Merge branch 'master' into 0.11
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 22 Aug 2011 11:14:49 +0000 (13:14 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 22 Aug 2011 11:14:49 +0000 (13:14 +0200)
Conflicts:
ext/pango/gsttextoverlay.c

514 files changed:
Android.mk
ChangeLog
Makefile.am
NEWS
RELEASE
android/alsa.mk
android/app.mk
android/app_plugin.mk
android/audio.mk
android/audioconvert.mk
android/decodebin.mk
android/decodebin2.mk
android/gdp.mk
android/interfaces.mk
android/netbuffer.mk
android/pbutils.mk
android/playbin.mk
android/queue2.mk
android/riff.mk
android/rtp.mk
android/rtsp.mk
android/sdp.mk
android/tag.mk
android/tcp.mk
android/typefindfunctions.mk
android/video.mk
android/videoconvert.mk [moved from android/ffmpegcolorspace.mk with 66% similarity]
configure.ac
docs/design/design-decodebin.txt
docs/design/draft-media-types.txt [new file with mode: 0644]
docs/libs/Makefile.am
docs/libs/gst-plugins-base-libs-docs.sgml
docs/libs/gst-plugins-base-libs-sections.txt
docs/libs/gst-plugins-base-libs.types
docs/plugins/Makefile.am
docs/plugins/gst-plugins-base-plugins-docs.sgml
docs/plugins/gst-plugins-base-plugins-sections.txt
docs/plugins/gst-plugins-base-plugins.hierarchy
docs/plugins/gst-plugins-base-plugins.interfaces
docs/plugins/gst-plugins-base-plugins.prerequisites
docs/plugins/inspect/plugin-ffmpegcolorspace.xml [deleted file]
docs/plugins/inspect/plugin-gnomevfs.xml [deleted file]
docs/plugins/inspect/plugin-video4linux.xml [deleted file]
ext/Makefile.am
ext/alsa/gstalsa.c
ext/alsa/gstalsadeviceprobe.c
ext/alsa/gstalsamixer.h
ext/alsa/gstalsamixerelement.c
ext/alsa/gstalsamixertrack.c
ext/alsa/gstalsasink.c
ext/alsa/gstalsasink.h
ext/alsa/gstalsasrc.c
ext/alsa/gstalsasrc.h
ext/cdparanoia/gstcdparanoiasrc.c
ext/gio/gstgio.c
ext/gio/gstgiobasesink.c
ext/gio/gstgiobasesrc.c
ext/gio/gstgiosink.c
ext/gio/gstgiosrc.c
ext/gio/gstgiostreamsink.c
ext/gio/gstgiostreamsrc.c
ext/gnomevfs/Makefile.am [deleted file]
ext/gnomevfs/gstgnomevfs.c [deleted file]
ext/gnomevfs/gstgnomevfs.h [deleted file]
ext/gnomevfs/gstgnomevfssink.c [deleted file]
ext/gnomevfs/gstgnomevfssink.h [deleted file]
ext/gnomevfs/gstgnomevfssrc.c [deleted file]
ext/gnomevfs/gstgnomevfssrc.h [deleted file]
ext/gnomevfs/gstgnomevfsuri.c [deleted file]
ext/gnomevfs/gstgnomevfsuri.h [deleted file]
ext/libvisual/Makefile.am
ext/libvisual/visual.c
ext/ogg/gstoggaviparse.c
ext/ogg/gstoggdemux.c
ext/ogg/gstoggdemux.h
ext/ogg/gstoggmux.c
ext/ogg/gstoggparse.c
ext/ogg/gstoggstream.c
ext/ogg/gstogmparse.c
ext/pango/Makefile.am
ext/pango/gstbasetextoverlay.c [new file with mode: 0644]
ext/pango/gstbasetextoverlay.h [new file with mode: 0644]
ext/pango/gstclockoverlay.c
ext/pango/gstclockoverlay.h
ext/pango/gsttextoverlay.c
ext/pango/gsttextoverlay.h
ext/pango/gsttextrender.c
ext/pango/gsttimeoverlay.c
ext/pango/gsttimeoverlay.h
ext/theora/gsttheoradec.c
ext/theora/gsttheoradec.h
ext/theora/gsttheoraenc.c
ext/theora/gsttheoraenc.h
ext/theora/gsttheoraparse.c
ext/vorbis/gstvorbisdec.c
ext/vorbis/gstvorbisdec.h
ext/vorbis/gstvorbisdeclib.c
ext/vorbis/gstvorbisdeclib.h
ext/vorbis/gstvorbisenc.c
ext/vorbis/gstvorbisenc.h
ext/vorbis/gstvorbisparse.c
ext/vorbis/gstvorbistag.c
gst-libs/gst/app/Makefile.am
gst-libs/gst/app/gstappbuffer.c [deleted file]
gst-libs/gst/app/gstappbuffer.h [deleted file]
gst-libs/gst/app/gstappsink.c
gst-libs/gst/app/gstappsrc.c
gst-libs/gst/audio/Makefile.am
gst-libs/gst/audio/audio.c
gst-libs/gst/audio/audio.h
gst-libs/gst/audio/gstaudioclock.c
gst-libs/gst/audio/gstaudioclock.h
gst-libs/gst/audio/gstaudiofilter.c
gst-libs/gst/audio/gstaudiofilter.h
gst-libs/gst/audio/gstaudioiec61937.c
gst-libs/gst/audio/gstaudiosink.c
gst-libs/gst/audio/gstaudiosink.h
gst-libs/gst/audio/gstaudiosrc.c
gst-libs/gst/audio/gstbaseaudiosink.c
gst-libs/gst/audio/gstbaseaudiosink.h
gst-libs/gst/audio/gstbaseaudiosrc.c
gst-libs/gst/audio/gstringbuffer.c
gst-libs/gst/audio/gstringbuffer.h
gst-libs/gst/audio/mixerutils.c
gst-libs/gst/audio/multichannel.c
gst-libs/gst/audio/multichannel.h
gst-libs/gst/cdda/Makefile.am
gst-libs/gst/cdda/gstcddabasesrc.c
gst-libs/gst/fft/Makefile.am
gst-libs/gst/interfaces/Makefile.am
gst-libs/gst/interfaces/colorbalance.c
gst-libs/gst/interfaces/colorbalance.h
gst-libs/gst/interfaces/mixer.c
gst-libs/gst/interfaces/mixer.h
gst-libs/gst/interfaces/navigation.c
gst-libs/gst/interfaces/tuner.c
gst-libs/gst/interfaces/tuner.h
gst-libs/gst/interfaces/videoorientation.c
gst-libs/gst/interfaces/videoorientation.h
gst-libs/gst/interfaces/videooverlay.c [moved from gst-libs/gst/interfaces/xoverlay.c with 64% similarity]
gst-libs/gst/interfaces/videooverlay.h [new file with mode: 0644]
gst-libs/gst/interfaces/xoverlay.h [deleted file]
gst-libs/gst/netbuffer/Makefile.am
gst-libs/gst/netbuffer/gstnetbuffer.c
gst-libs/gst/netbuffer/gstnetbuffer.h
gst-libs/gst/pbutils/Makefile.am
gst-libs/gst/pbutils/descriptions.c
gst-libs/gst/pbutils/encoding-profile.c
gst-libs/gst/pbutils/encoding-profile.h
gst-libs/gst/pbutils/encoding-target.c
gst-libs/gst/pbutils/encoding-target.h
gst-libs/gst/pbutils/gstdiscoverer-types.c
gst-libs/gst/pbutils/gstdiscoverer.c
gst-libs/gst/pbutils/gstdiscoverer.h
gst-libs/gst/pbutils/install-plugins.c
gst-libs/gst/pbutils/missing-plugins.c
gst-libs/gst/pbutils/pbutils-private.h
gst-libs/gst/riff/Makefile.am
gst-libs/gst/riff/riff-media.c
gst-libs/gst/riff/riff-read.c
gst-libs/gst/rtp/Makefile.am
gst-libs/gst/rtp/gstbasertpaudiopayload.c
gst-libs/gst/rtp/gstbasertpdepayload.c
gst-libs/gst/rtp/gstbasertpdepayload.h
gst-libs/gst/rtp/gstbasertppayload.c
gst-libs/gst/rtp/gstbasertppayload.h
gst-libs/gst/rtp/gstrtcpbuffer.c
gst-libs/gst/rtp/gstrtcpbuffer.h
gst-libs/gst/rtp/gstrtpbuffer.c
gst-libs/gst/rtp/gstrtpbuffer.h
gst-libs/gst/rtsp/Makefile.am
gst-libs/gst/sdp/Makefile.am
gst-libs/gst/tag/Makefile.am
gst-libs/gst/tag/gstexiftag.c
gst-libs/gst/tag/gsttagdemux.c
gst-libs/gst/tag/gsttagmux.c
gst-libs/gst/tag/gstvorbistag.c
gst-libs/gst/tag/gstxmptag.c
gst-libs/gst/tag/id3v2.c
gst-libs/gst/tag/tag.h
gst-libs/gst/tag/tags.c
gst-libs/gst/video/Makefile.am
gst-libs/gst/video/convertframe.c
gst-libs/gst/video/gstmetavideo.c [new file with mode: 0644]
gst-libs/gst/video/gstmetavideo.h [new file with mode: 0644]
gst-libs/gst/video/gstvideofilter.c
gst-libs/gst/video/gstvideopool.c [new file with mode: 0644]
gst-libs/gst/video/gstvideopool.h [new file with mode: 0644]
gst-libs/gst/video/video.c
gst-libs/gst/video/video.h
gst-plugins-base.doap
gst-plugins-base.spec.in
gst/adder/gstadder.c
gst/adder/gstadder.h
gst/audioconvert/audioconvert.c
gst/audioconvert/audioconvert.h
gst/audioconvert/channelmixtest.c
gst/audioconvert/gstaudioconvert.c
gst/audioconvert/gstaudioconvert.h
gst/audioconvert/gstaudioconvertorc-dist.c
gst/audioconvert/gstaudioconvertorc-dist.h
gst/audioconvert/gstaudioconvertorc.orc
gst/audioconvert/gstaudioquantize.c
gst/audioconvert/gstchannelmix.c
gst/audioconvert/plugin.c
gst/audiorate/Makefile.am
gst/audiorate/gstaudiorate.c
gst/audiorate/gstaudiorate.h
gst/audioresample/Makefile.am
gst/audioresample/gstaudioresample.c
gst/audioresample/gstaudioresample.h
gst/audioresample/resample.c
gst/audiotestsrc/Makefile.am
gst/audiotestsrc/gstaudiotestsrc.c
gst/audiotestsrc/gstaudiotestsrc.h
gst/encoding/gstencodebin.c
gst/encoding/gstsmartencoder.c
gst/encoding/gststreamcombiner.c
gst/encoding/gststreamsplitter.c
gst/ffmpegcolorspace/Makefile.am [deleted file]
gst/ffmpegcolorspace/avcodec.h [deleted file]
gst/ffmpegcolorspace/dsputil.c [deleted file]
gst/ffmpegcolorspace/dsputil.h [deleted file]
gst/ffmpegcolorspace/gstffmpegcodecmap.c [deleted file]
gst/ffmpegcolorspace/gstffmpegcodecmap.h [deleted file]
gst/ffmpegcolorspace/gstffmpegcolorspace.c [deleted file]
gst/ffmpegcolorspace/imgconvert.c [deleted file]
gst/ffmpegcolorspace/imgconvert_template.h [deleted file]
gst/ffmpegcolorspace/mem.c [deleted file]
gst/ffmpegcolorspace/utils.c [deleted file]
gst/gdp/gstgdpdepay.c
gst/gdp/gstgdppay.c
gst/playback/Makefile.am
gst/playback/README [deleted file]
gst/playback/gstdecodebin2.c
gst/playback/gstplay-enum.h
gst/playback/gstplay-marshal.list
gst/playback/gstplayback.c
gst/playback/gstplayback.h
gst/playback/gstplaybasebin.c [deleted file]
gst/playback/gstplaybasebin.h [deleted file]
gst/playback/gstplaybin.c [deleted file]
gst/playback/gstplaybin2.c
gst/playback/gstplaysink.c
gst/playback/gstplaysinkaudioconvert.c
gst/playback/gstplaysinkaudioconvert.h
gst/playback/gstplaysinkvideoconvert.c
gst/playback/gstplaysinkvideoconvert.h
gst/playback/gstrawcaps.h
gst/playback/gststreaminfo.c [deleted file]
gst/playback/gststreaminfo.h [deleted file]
gst/playback/gststreamselector.c
gst/playback/gststreamsynchronizer.c
gst/playback/gstsubtitleoverlay.c
gst/playback/gstsubtitleoverlay.h
gst/playback/gsturidecodebin.c
gst/subparse/gstssaparse.c
gst/subparse/gstsubparse.c
gst/subparse/gstsubparse.h
gst/tcp/gstmultifdsink.c
gst/tcp/gstmultifdsink.h
gst/tcp/gsttcp.c
gst/tcp/gsttcp.h
gst/tcp/gsttcpclientsink.c
gst/tcp/gsttcpclientsink.h
gst/tcp/gsttcpclientsrc.c
gst/tcp/gsttcpclientsrc.h
gst/tcp/gsttcpserversink.c
gst/tcp/gsttcpserversrc.c
gst/tcp/gsttcpserversrc.h
gst/typefind/gsttypefindfunctions.c
gst/videoconvert/Makefile.am [new file with mode: 0644]
gst/videoconvert/gstvideoconvert.c [new file with mode: 0644]
gst/videoconvert/gstvideoconvert.h [moved from gst/ffmpegcolorspace/gstffmpegcolorspace.h with 50% similarity]
gst/videoconvert/gstvideoconvertorc-dist.c [new file with mode: 0644]
gst/videoconvert/gstvideoconvertorc-dist.h [new file with mode: 0644]
gst/videoconvert/gstvideoconvertorc.orc [new file with mode: 0644]
gst/videoconvert/videoconvert.c [new file with mode: 0644]
gst/videoconvert/videoconvert.h [new file with mode: 0644]
gst/videoconvert/videoconvert.vcproj [moved from gst/ffmpegcolorspace/ffmpegcolorspace.vcproj with 79% similarity]
gst/videorate/gstvideorate.c
gst/videoscale/gstvideoscale.c
gst/videoscale/gstvideoscale.h
gst/videotestsrc/Makefile.am
gst/videotestsrc/gstvideotestsrc.c
gst/videotestsrc/gstvideotestsrc.h
gst/videotestsrc/videotestsrc.c
gst/videotestsrc/videotestsrc.h
gst/volume/gstvolume.c
po/LINGUAS
po/POTFILES.in
po/af.po
po/az.po
po/bg.po
po/ca.po
po/cs.po
po/da.po
po/de.po
po/el.po
po/en_GB.po
po/eo.po [new file with mode: 0644]
po/es.po
po/eu.po
po/fi.po
po/fr.po
po/gl.po
po/hu.po
po/id.po
po/it.po
po/ja.po
po/lt.po
po/lv.po
po/nb.po
po/nl.po
po/or.po
po/pl.po
po/pt_BR.po
po/ro.po
po/ru.po
po/sk.po
po/sl.po
po/sq.po
po/sr.po
po/sv.po
po/tr.po
po/uk.po
po/vi.po
po/zh_CN.po
sys/Makefile.am
sys/v4l/.gitignore [deleted file]
sys/v4l/Makefile.am [deleted file]
sys/v4l/README [deleted file]
sys/v4l/TODO [deleted file]
sys/v4l/gstv4l.c [deleted file]
sys/v4l/gstv4lcolorbalance.c [deleted file]
sys/v4l/gstv4lcolorbalance.h [deleted file]
sys/v4l/gstv4lelement.c [deleted file]
sys/v4l/gstv4lelement.h [deleted file]
sys/v4l/gstv4ljpegsrc.c [deleted file]
sys/v4l/gstv4ljpegsrc.h [deleted file]
sys/v4l/gstv4lmjpegsink.c [deleted file]
sys/v4l/gstv4lmjpegsink.h [deleted file]
sys/v4l/gstv4lmjpegsrc.c [deleted file]
sys/v4l/gstv4lmjpegsrc.h [deleted file]
sys/v4l/gstv4lsrc.c [deleted file]
sys/v4l/gstv4lsrc.h [deleted file]
sys/v4l/gstv4ltuner.c [deleted file]
sys/v4l/gstv4ltuner.h [deleted file]
sys/v4l/gstv4lxoverlay.c [deleted file]
sys/v4l/gstv4lxoverlay.h [deleted file]
sys/v4l/v4l_calls.c [deleted file]
sys/v4l/v4l_calls.h [deleted file]
sys/v4l/v4lmjpegsink_calls.c [deleted file]
sys/v4l/v4lmjpegsink_calls.h [deleted file]
sys/v4l/v4lmjpegsrc_calls.c [deleted file]
sys/v4l/v4lmjpegsrc_calls.h [deleted file]
sys/v4l/v4lsrc_calls.c [deleted file]
sys/v4l/v4lsrc_calls.h [deleted file]
sys/v4l/videodev_mjpeg.h [deleted file]
sys/ximage/Makefile.am
sys/ximage/ximage.c
sys/ximage/ximagepool.c [new file with mode: 0644]
sys/ximage/ximagepool.h [new file with mode: 0644]
sys/ximage/ximagesink.c
sys/ximage/ximagesink.h
sys/xvimage/Makefile.am
sys/xvimage/xvimage.c [new file with mode: 0644]
sys/xvimage/xvimagepool.c [new file with mode: 0644]
sys/xvimage/xvimagepool.h [new file with mode: 0644]
sys/xvimage/xvimagesink.c
sys/xvimage/xvimagesink.h
tests/check/Makefile.am
tests/check/elements/.gitignore
tests/check/elements/adder.c
tests/check/elements/appsink.c
tests/check/elements/audioconvert.c
tests/check/elements/audiorate.c
tests/check/elements/audioresample.c
tests/check/elements/decodebin.c
tests/check/elements/decodebin2.c [deleted file]
tests/check/elements/ffmpegcolorspace.c
tests/check/elements/gdpdepay.c
tests/check/elements/gdppay.c
tests/check/elements/gnomevfssink.c [deleted file]
tests/check/elements/libvisual.c
tests/check/elements/multifdsink.c
tests/check/elements/playbin-compressed.c [moved from tests/check/elements/playbin2-compressed.c with 99% similarity]
tests/check/elements/playbin.c
tests/check/elements/playbin2.c [deleted file]
tests/check/elements/subparse.c
tests/check/elements/textoverlay.c
tests/check/elements/videorate.c
tests/check/elements/videoscale.c
tests/check/elements/videotestsrc.c
tests/check/elements/volume.c
tests/check/elements/vorbisdec.c
tests/check/elements/vorbistag.c
tests/check/gst/typefindfunctions.c
tests/check/libs/audio.c
tests/check/libs/cddabasesrc.c
tests/check/libs/gstlibscpp.cc
tests/check/libs/libsabi.c
tests/check/libs/mixer.c
tests/check/libs/navigation.c
tests/check/libs/netbuffer.c
tests/check/libs/pbutils.c
tests/check/libs/profile.c
tests/check/libs/rtp.c
tests/check/libs/struct_i386.h
tests/check/libs/struct_x86_64.h
tests/check/libs/tag.c
tests/check/libs/video.c
tests/check/libs/xmpwriter.c
tests/check/pipelines/capsfilter-renegotiation.c
tests/check/pipelines/gio.c
tests/check/pipelines/oggmux.c
tests/check/pipelines/simple-launch-lines.c
tests/check/pipelines/streamheader.c
tests/check/pipelines/theoraenc.c
tests/check/pipelines/vorbisenc.c
tests/examples/Makefile.am
tests/examples/app/appsink-src.c
tests/examples/app/appsrc-ra.c
tests/examples/app/appsrc-seekable.c
tests/examples/app/appsrc-stream.c
tests/examples/app/appsrc-stream2.c
tests/examples/app/appsrc_ex.c
tests/examples/audio/Makefile.am
tests/examples/dynamic/addstream.c
tests/examples/encoding/encoding.c
tests/examples/gio/giosrc-mounting.c
tests/examples/overlay/.gitignore
tests/examples/overlay/Makefile.am
tests/examples/overlay/gtk-videooverlay.c [moved from tests/examples/overlay/gtk-xoverlay.c with 95% similarity]
tests/examples/overlay/qt-videooverlay.cpp [moved from tests/examples/overlay/qt-xoverlay.cpp with 96% similarity]
tests/examples/overlay/qtgv-videooverlay.cpp [moved from tests/examples/overlay/qtgv-xoverlay.cpp with 92% similarity]
tests/examples/overlay/qtgv-videooverlay.h [moved from tests/examples/overlay/qtgv-xoverlay.h with 100% similarity]
tests/examples/seek/jsseek.c
tests/examples/seek/scrubby.c
tests/examples/seek/seek.c
tests/examples/snapshot/snapshot.c
tests/examples/v4l/.gitignore [deleted file]
tests/examples/v4l/Makefile.am [deleted file]
tests/examples/v4l/probe.c [deleted file]
tests/icles/.gitignore
tests/icles/Makefile.am
tests/icles/audio-trickplay.c
tests/icles/output-selector-test.c
tests/icles/playback/decodetest.c
tests/icles/playback/test.c
tests/icles/playback/test3.c
tests/icles/playback/test5.c
tests/icles/playback/test6.c
tests/icles/playback/test7.c
tests/icles/playbin-text.c
tests/icles/position-formats.c
tests/icles/stress-videooverlay.c [moved from tests/icles/stress-xoverlay.c with 91% similarity]
tests/icles/test-box.c
tests/icles/test-colorkey.c
tests/icles/test-scale.c
tests/icles/test-textoverlay.c
tests/icles/test-videooverlay.c [moved from tests/icles/test-xoverlay.c with 92% similarity]
tests/old/Makefile.am [deleted file]
tests/old/examples/Makefile.am [deleted file]
tests/old/examples/capsfilter/Makefile.am [deleted file]
tests/old/examples/capsfilter/capsfilter1.c [deleted file]
tests/old/examples/gob/Makefile.am [deleted file]
tests/old/examples/gob/gst-identity2.gob [deleted file]
tests/old/examples/indexing/.gitignore [deleted file]
tests/old/examples/indexing/Makefile.am [deleted file]
tests/old/examples/indexing/indexmpeg.c [deleted file]
tests/old/examples/seek/.gitignore [deleted file]
tests/old/examples/seek/Makefile.am [deleted file]
tests/old/examples/seek/cdparanoia.c [deleted file]
tests/old/examples/seek/cdplayer.c [deleted file]
tests/old/examples/seek/chained.c [deleted file]
tests/old/examples/stats/Makefile.am [deleted file]
tests/old/examples/stats/mp2ogg.c [deleted file]
tests/old/examples/switch/.gitignore [deleted file]
tests/old/examples/switch/Makefile.am [deleted file]
tests/old/examples/switch/switcher.c [deleted file]
tests/old/testsuite/alsa/.gitignore [deleted file]
tests/old/testsuite/alsa/Makefile.am [deleted file]
tests/old/testsuite/alsa/formats.c [deleted file]
tests/old/testsuite/alsa/sinesrc.c [deleted file]
tests/old/testsuite/alsa/sinesrc.h [deleted file]
tests/old/testsuite/alsa/srcstate.c [deleted file]
tests/old/testsuite/alsa/state.c [deleted file]
tests/old/testsuite/embed/Makefile.am [deleted file]
tests/old/testsuite/embed/embed.c [deleted file]
tests/old/testsuite/gst-lint [deleted file]
tools/gst-discoverer.c
tools/gst-launch-ext.1.in
tools/gst-visualise-m.m
win32/MANIFEST
win32/common/_stdint.h
win32/common/audio-enumtypes.c
win32/common/config.h
win32/common/libgstapp.def
win32/common/libgstnetbuffer.def
win32/common/libgstrtp.def
win32/common/libgsttag.def
win32/common/libgstvideo.def
win32/common/multichannel-enumtypes.c
win32/common/multichannel-enumtypes.h
win32/common/video-enumtypes.c
win32/common/video-enumtypes.h
win32/vs6/gst_plugins_base.dsw
win32/vs6/libgstffmpegcolorspace.dsp [deleted file]
win32/vs6/libgsttag.dsp
win32/vs7/gst-plugins-base.sln
win32/vs7/libgstffmpegcolorspace.vcproj [deleted file]
win32/vs8/gst-plugins-base.sln
win32/vs8/libgstffmpegcolorspace.vcproj [deleted file]

index b3d345b..d6ca579 100644 (file)
@@ -56,7 +56,7 @@ GST_PLUGINS_BASE_BUILT_SOURCES :=                                             \
        gst/audiotestsrc/Android.mk                             \
        gst/videotestsrc/Android.mk                             \
        gst/videoscale/Android.mk                               \
-       gst/ffmpegcolorspace/Android.mk                         \
+       gst/videoconvert/Android.mk                             \
        gst/videorate/Android.mk                                \
        gst/encoding/Android.mk                                 \
        gst/adder/Android.mk                                    \
@@ -114,7 +114,7 @@ CONFIGURE_TARGETS += gst-plugins-base-configure
 -include $(GST_PLUGINS_BASE_TOP)/gst/audiotestsrc/Android.mk
 -include $(GST_PLUGINS_BASE_TOP)/gst/videotestsrc/Android.mk
 -include $(GST_PLUGINS_BASE_TOP)/gst/videoscale/Android.mk
--include $(GST_PLUGINS_BASE_TOP)/gst/ffmpegcolorspace/Android.mk
+-include $(GST_PLUGINS_BASE_TOP)/gst/videoconvert/Android.mk
 -include $(GST_PLUGINS_BASE_TOP)/gst/videorate/Android.mk
 -include $(GST_PLUGINS_BASE_TOP)/gst/encoding/Android.mk
 -include $(GST_PLUGINS_BASE_TOP)/gst/adder/Android.mk
index fe859b0..c35d8f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+=== release 0.11.0 ===
+
+2011-08-03  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * configure.ac:
+         releasing 0.11.0, "Just like a pacifier"
+
+2011-08-02 12:53:15 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * po/LINGUAS:
+       * po/af.po:
+       * po/az.po:
+       * po/bg.po:
+       * po/ca.po:
+       * po/cs.po:
+       * po/da.po:
+       * po/de.po:
+       * po/el.po:
+       * po/en_GB.po:
+       * po/eo.po:
+       * po/es.po:
+       * po/eu.po:
+       * po/fi.po:
+       * po/fr.po:
+       * po/gl.po:
+       * po/hu.po:
+       * po/id.po:
+       * po/it.po:
+       * po/ja.po:
+       * po/lt.po:
+       * po/lv.po:
+       * po/nb.po:
+       * po/nl.po:
+       * po/or.po:
+       * po/pl.po:
+       * po/pt_BR.po:
+       * po/ro.po:
+       * po/ru.po:
+       * po/sk.po:
+       * po/sl.po:
+       * po/sq.po:
+       * po/sr.po:
+       * po/sv.po:
+       * po/tr.po:
+       * po/uk.po:
+       * po/vi.po:
+       * po/zh_CN.po:
+         update po
+
+2011-08-02 12:24:37 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/volume/gstvolumeorc-dist.c:
+         update ORC dist files
+
+2011-08-02 12:24:19 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videoconvert/gstvideoconvertorc-dist.c:
+       * gst/videoconvert/gstvideoconvertorc-dist.h:
+         videoconvert: update ORC dist files
+
+2011-08-02 12:22:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * win32/common/libgstvideo.def:
+         def: add new symbols
+
+2011-08-01 19:04:47 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagepool.h:
+       * sys/ximage/ximagesink.c:
+         ximage: add support for alignment bufferpool option
+
+2011-08-01 18:36:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/xvimage/xvimagepool.c:
+       * sys/xvimage/xvimagepool.h:
+       * sys/xvimage/xvimagesink.c:
+         xv: apply cropping on padded images
+         Store the dimensions of the unpadded image in the metadata and use that info to
+         display the valid region of the image.
+
+2011-08-01 17:10:10 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/xvimage/xvimagepool.c:
+       * sys/xvimage/xvimagepool.h:
+         xvimage: add suport for video alignment
+         Add support for the VideoAlignment option in the bufferpool. The extra
+         configuration options can be used to request special padding and alignment
+         requirements for the video buffers.
+
+2011-08-01 16:50:28 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: ensure sign in scale function
+
+2011-08-01 16:48:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/Makefile.am:
+       * gst-libs/gst/video/gstvideopool.c:
+       * gst-libs/gst/video/gstvideopool.h:
+         videopool: add implementation
+         Rename very long structure name to GstVideoAlignment
+         Add the implementation of the video alignment config setter and getters.
+
+2011-07-29 17:15:39 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+       * gst/videoconvert/gstvideoconvert.c:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/videotestsrc/gstvideotestsrc.h:
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         base: update for new bufferpool API
+
+2011-07-29 17:14:07 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstvideopool.h:
+         videopool: add stuff related to bufferpools
+         Add bufferpool options and extra config parameters.
+
+2011-07-29 12:22:16 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: relax bufferpool checks
+         Check if the metadata belongs to us instead of checking the current bufferpool.
+         The bufferpool can change at any time when upstream wants to renegotiate.
+
+2011-07-27 16:55:45 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: add macro to access flags
+
+2011-07-28 15:28:41 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/videotestsrc/Makefile.am:
+         videotestsrc: use local libgstvideo here as well
+
+2011-07-28 14:18:34 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/videoconvert/Makefile.am:
+         videoconvert: link to local libgstvideo-0.11
+
+2011-07-28 13:39:14 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+       * tests/check/libs/video.c:
+         video: make GST_VIDEO_FORMATS_ALL define more readable
+         We don't need all those quotes, strings will be parsed as strings
+         regardless, and g-i doesn't seem to like all those escaped quotes.
+
+2011-07-27 01:18:19 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/pipelines/gio.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/scrubby.c:
+       * tests/examples/seek/seek.c:
+       * tests/examples/snapshot/snapshot.c:
+       * tests/icles/playback/test3.c:
+       * tests/icles/playback/test7.c:
+       * tests/icles/playbin-text.c:
+       * tests/icles/position-formats.c:
+         tests: update for query API changes
+
+2011-07-27 01:16:53 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * ext/ogg/gstoggdemux.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * gst/adder/gstadder.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gsturidecodebin.c:
+         ext,gst: update for query API changes
+
+2011-07-27 01:16:08 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+         gst-libs: update for query API changes
+
+2011-07-26 14:10:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: let old pool drain
+         Let the old pool drain without deactivating it, some elements might still be
+         using it.
+
+2011-07-26 13:17:20 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: use new setup_allocation vmethod
+
+2011-07-26 12:47:38 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgiobasesink.c:
+         giosink: use new query vmethod
+
+2011-07-26 12:42:22 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         baseaudiosink: chain up to parent_class correctly
+
+2011-07-26 12:37:04 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         baseaudiosink: use new basesink query vmethod
+
+2011-07-25 18:35:01 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: add pack and unpack functions
+         Add pack and unpack function to handle complex formats in the future.
+
+2011-07-25 18:08:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: add more info in the format structure
+         Add a field to describe how many bits are used to pack items.
+         Specify the shift for each component.
+         Add some more flags to better describe the format.
+
+2011-07-22 21:19:08 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/audioresample/gstaudioresample.c:
+         audioresample: fix for event handler change
+
+2011-07-19 18:31:23 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+         the
+
+2011-07-19 18:21:42 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+         theoradec: make sure our buffer is big enough
+         Make sure we allocate a buffer that is big enough.
+
+2011-07-18 18:46:01 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         x11: call parent set_config
+         Call the parent set_config method to make it aware of the current config so that
+         its default methods can do preallocation.
+
+2011-07-18 16:48:25 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: improve allocation parameters
+         Set the min-buffers to 2 because our base class will hold on to 1 buffer for the
+         last-buffer property.
+
+2011-07-15 16:34:02 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         X11: also check the bufferpool
+         Don't just check the availability of the metadata but also if the buffer is
+         really from our bufferpool.
+
+2011-07-15 12:32:25 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+         discoverer: decodebin2 is dead, long live decodebin
+
+2011-07-11 18:21:49 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstmetavideo.c:
+         metavideo: fix for API change
+
+2011-07-10 21:47:12 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+         video: init video info to some sensible defaults
+
+2011-07-10 13:49:14 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-07-10 13:39:31 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: add macros for par and fps
+
+2011-07-09 18:33:38 -0700  David Schleef <ds@schleef.org>
+
+       * ext/ogg/gstoggmux.c:
+         oggmux: check for EOS on both current and best pad
+         Oops, need both.  Fixes #654270.
+
+2011-07-09 18:24:26 -0700  David Schleef <ds@schleef.org>
+
+       * ext/ogg/gstoggmux.c:
+         oggmux: check for EOS on current pad, not best
+         Fixes #654270.
+
+2011-07-09 11:59:42 +0200  Piotr Fusik <fox@scene.pl>
+
+       * gst/typefind/gsttypefindfunctions.c:
+         typefind: fixed detection of audio/x-sap
+         Fixes: #654295.
+         Signed-off-by: David Schleef <ds@schleef.org>
+
+2011-07-06 17:03:08 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstrtcpbuffer.c:
+         rtcpbuffer: provide a WRITE map with maximum available size
+         ... which allows adding additional packets and may be needed to counteract
+         the shrink that implicitly occurred during a map/unmap cycle when adding
+         a previous packet.
+
+2011-07-08 20:02:25 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/gdp/gstgdppay.c:
+         gdppay: parse caps event and payload caps
+         Which makes it actually output stuff.
+
+2011-07-07 23:57:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/Makefile.am:
+       * tests/check/elements/adder.c:
+       * tests/check/libs/video.c:
+         tests: make adder test and libgstvideo test compile, disable some tests
+         Don't fully work yet though
+
+2011-07-07 21:24:38 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * Android.mk:
+       * android/ffmpegcolorspace.mk:
+       * android/videoconvert.mk:
+       * docs/plugins/inspect/plugin-ffmpegcolorspace.xml:
+       * ext/ogg/gstoggmux.c:
+       * ext/pango/gstclockoverlay.c:
+       * gst-libs/gst/pbutils/install-plugins.c:
+       * gst-libs/gst/video/convertframe.c:
+       * gst-plugins-base.spec.in:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/encoding/gstencodebin.c:
+       * sys/ximage/ximagesink.c:
+       * tests/check/Makefile.am:
+       * tests/check/elements/.gitignore:
+       * tests/check/elements/videoscale.c:
+       * tests/check/pipelines/oggmux.c:
+       * tests/examples/dynamic/addstream.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/snapshot/snapshot.c:
+       * tests/icles/output-selector-test.c:
+       * tests/icles/playback/test.c:
+       * tests/icles/test-box.c:
+       * tests/icles/test-scale.c:
+       * tests/icles/test-textoverlay.c:
+       * tools/gst-launch-ext.1.in:
+       * tools/gst-visualise-m.m:
+       * win32/MANIFEST:
+       * win32/vs6/gst_plugins_base.dsw:
+       * win32/vs6/libgstffmpegcolorspace.dsp:
+       * win32/vs6/libgsttag.dsp:
+       * win32/vs7/gst-plugins-base.sln:
+       * win32/vs7/libgstffmpegcolorspace.vcproj:
+       * win32/vs8/gst-plugins-base.sln:
+       * win32/vs8/libgstffmpegcolorspace.vcproj:
+         ffmpegcolorspace -> videoconvert
+
+2011-07-07 21:04:47 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/old/Makefile.am:
+       * tests/old/examples/Makefile.am:
+       * tests/old/examples/capsfilter/Makefile.am:
+       * tests/old/examples/capsfilter/capsfilter1.c:
+       * tests/old/examples/gob/Makefile.am:
+       * tests/old/examples/gob/gst-identity2.gob:
+       * tests/old/examples/indexing/.gitignore:
+       * tests/old/examples/indexing/Makefile.am:
+       * tests/old/examples/indexing/indexmpeg.c:
+       * tests/old/examples/seek/.gitignore:
+       * tests/old/examples/seek/Makefile.am:
+       * tests/old/examples/seek/cdparanoia.c:
+       * tests/old/examples/seek/cdplayer.c:
+       * tests/old/examples/seek/chained.c:
+       * tests/old/examples/stats/Makefile.am:
+       * tests/old/examples/stats/mp2ogg.c:
+       * tests/old/examples/switch/.gitignore:
+       * tests/old/examples/switch/Makefile.am:
+       * tests/old/examples/switch/switcher.c:
+       * tests/old/testsuite/alsa/.gitignore:
+       * tests/old/testsuite/alsa/Makefile.am:
+       * tests/old/testsuite/alsa/formats.c:
+       * tests/old/testsuite/alsa/sinesrc.c:
+       * tests/old/testsuite/alsa/sinesrc.h:
+       * tests/old/testsuite/alsa/srcstate.c:
+       * tests/old/testsuite/alsa/state.c:
+       * tests/old/testsuite/embed/Makefile.am:
+       * tests/old/testsuite/embed/embed.c:
+       * tests/old/testsuite/gst-lint:
+         tests: remove tests from ancient times
+         They're just noise.
+
+2011-07-07 11:10:39 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         gst-libs/gst/tag/gstxmptag.c
+         gst/encoding/gststreamsplitter.c
+
+2011-07-07 10:28:08 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/audioconvert/gstaudioconvertorc-dist.c:
+       * gst/audioconvert/gstaudioconvertorc-dist.h:
+         audioconvert: update orc dist files
+
+2011-07-07 10:20:19 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/audioconvert/gstaudioconvertorc.orc:
+       * gst/audioconvert/plugin.c:
+         audioconvert: don't use .init function
+         Don't use the .init function but compile all functions when needed instead of
+         when the plugin is registered.
+
+2011-07-06 12:54:40 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/libs/netbuffer.c:
+       * tests/check/libs/tag.c:
+         tests: update netbuffer and tag tests for gst_buffer_take_memory() API change
+
+2011-07-06 12:51:03 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/libs/pbutils.c:
+         tests: update libs/pbutils test for GstMessage API changes
+         Can't access msg->structure directly any more.
+
+2011-07-06 12:47:01 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/libs/mixer.c:
+         tests: fix libs/mixer test for GstImplementsInterface removal
+         Not sure if we want to keep the GstMixer API in its current form
+         though..
+
+2011-07-06 12:42:36 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/pipelines/theoraenc.c:
+         tests: update theoraenc test for new pad probe API
+         Compiles now, but fails.
+
+2011-07-06 12:38:10 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/gst/typefindfunctions.c:
+         tests: update typefindfunctions test for latest API changes
+
+2011-07-06 12:36:37 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/libs/audio.c:
+         tests: update libs/audio test for latest API changes
+
+2011-07-06 10:27:50 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * win32/common/libgstvideo.def:
+         win32: update exports for new libgstvideo API
+
+2011-07-06 10:27:02 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * docs/libs/Makefile.am:
+         docs: add -DGST_USE_UNSTABLE_API also to GTKDOC_CFLAGS
+         To avoid warnings
+
+2011-07-05 16:58:04 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: update docs
+
+2011-07-05 10:07:08 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * configure.ac:
+       * gst-libs/gst/app/Makefile.am:
+       * gst-libs/gst/audio/Makefile.am:
+       * gst-libs/gst/cdda/Makefile.am:
+       * gst-libs/gst/fft/Makefile.am:
+       * gst-libs/gst/interfaces/Makefile.am:
+       * gst-libs/gst/netbuffer/Makefile.am:
+       * gst-libs/gst/pbutils/Makefile.am:
+       * gst-libs/gst/riff/Makefile.am:
+       * gst-libs/gst/rtp/Makefile.am:
+       * gst-libs/gst/rtsp/Makefile.am:
+       * gst-libs/gst/sdp/Makefile.am:
+       * gst-libs/gst/tag/Makefile.am:
+       * gst-libs/gst/video/Makefile.am:
+         Add -DGST_USE_UNSTABLE_API to the compiler flags to avoid warnings
+
+2011-07-05 10:04:42 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * ext/theora/gsttheoraenc.c:
+         theoraenc: remove some unused code that caused a compiler warning
+         The video format is set up in the sink pad's setcaps() function.
+
+2011-07-04 18:08:25 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: add macro to get frame size
+
+2011-07-04 16:27:50 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: add some more macros
+         Add macros to get the plane and offset of a component.
+
+2011-07-04 10:19:13 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+       * gst/videoconvert/gstvideoconvert.c:
+       * gst/videoconvert/gstvideoconvert.h:
+       * gst/videoconvert/videoconvert.c:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videotestsrc/videotestsrc.c:
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         video: More video helper library improvements
+         Make a new GstVideoFormatinfo structure that contains the specific information
+         related to a format such as the number of planes, components, subsampling,
+         pixel stride etc. The result is that we are now able to introduce the concept of
+         components again in the API.
+         Use tables to specify the formats and its properties.
+         Use macros to get information about the video format description.
+         Move code to set strides, offsets and size into one function.
+         Remove methods that are not handled with the structures.
+         Add methods to retrieve pointers and strides to the components in the video.
+
+2011-06-30 20:33:36 +0200  Luis de Bethencourt <luis@debethencourt.com>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: fix compiler warning
+         cspace and cspace2 may run uninitialized.
+
+2011-06-29 13:12:49 +0200  Robert Swain <robert.swain@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: Add flags to disable conversion elements
+         Add a flags property and two flags to allow one to disable the
+         conversion elements within encodebin. Doing so insists that the
+         uncompressed input to encodebin for the appropriate stream type is
+         sufficient to meet the caps requirements of the encoders, muxers and
+         encodebin target.
+         This is mostly beneficial to bypass slow caps negotiations in the
+         conversion elements.
+
+2011-06-29 09:59:05 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+       * tests/check/libs/tag.c:
+         tag: xmp: Remove extra chars from end of xmp packet
+         Windows picture viewer is unhappy with extra trailing chars at the
+         end of the xmppacket footer. So remove them as they aren't needed.
+
+2011-06-29 11:30:51 +0200  Robert Swain <robert.swain@collabora.co.uk>
+
+       * gst/encoding/gststreamsplitter.c:
+         streamsplitter: Fix getcaps src pad caps merge
+         Caps returned from gst_pad_peer_get_caps_reffed () may not be writable.
+         If they are not is should cause an assertion in gst_caps_merge (),
+         however, sometimes assertions are disabled in binary builds of -base and
+         it's safer to just be sure the caps are writable. Also, check that the
+         reffed caps pointer is not NULL.
+
+2011-06-28 19:03:23 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst/playback/gstplaysink.c:
+         playsink: only unset initialized GValue
+
+2011-06-15 13:51:31 +0200  Philip Jägenstedt <philipj@opera.com>
+
+       * gst/typefind/gsttypefindfunctions.c:
+         typefind: NULL check in degas_type_find
+         The length check isn't sufficient, an source might
+         report the correct length, but then still fail to
+         read the requested number of bytes for some reason.
+         https://bugzilla.gnome.org/show_bug.cgi?id=652642
+
+2011-06-26 23:17:03 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/videoconvert/gstvideoconvert.c:
+         videoconvert: fix unused-but-set-variable compiler warning
+
+2011-06-26 23:16:08 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+       * gst/volume/gstvolume.c:
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         gst, sys: remove GstImplementsInterface usage
+
+2011-06-26 22:58:17 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * ext/alsa/gstalsamixer.h:
+       * ext/alsa/gstalsamixerelement.c:
+       * ext/alsa/gstalsasrc.c:
+         alsa: don't use GstImplementsInterface
+
+2011-06-26 21:46:08 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/interfaces/colorbalance.c:
+       * gst-libs/gst/interfaces/colorbalance.h:
+       * gst-libs/gst/interfaces/mixer.c:
+       * gst-libs/gst/interfaces/mixer.h:
+       * gst-libs/gst/interfaces/tuner.c:
+       * gst-libs/gst/interfaces/tuner.h:
+       * gst-libs/gst/interfaces/videoorientation.c:
+       * gst-libs/gst/interfaces/videoorientation.h:
+       * gst-libs/gst/interfaces/xoverlay.c:
+       * gst-libs/gst/interfaces/xoverlay.h:
+         gst-libs: remove GstImplementsInterface usage
+         Will need to add replacement API for some of these.
+
+2011-06-26 21:27:28 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+         Merge remote-tracking branch 'origin/master' into 0.11
+
+2011-06-26 01:06:58 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * docs/design/design-decodebin.txt:
+         docs: minor addition to decodebin2 design doc
+
+2011-06-26 01:06:19 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/libs/navigation.c:
+         tests: the navigation interface isn't GstImplementsInterface-wrapped
+
+2011-06-26 00:49:46 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/interfaces/streamvolume.h:
+         interfaces: GstStreamVolume isn't wrapped by GstImplementsInterface
+         This interface depends on properties and isn't per-instance.
+
+2011-06-26 00:40:20 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/rtsp/gstrtspextension.h:
+         rtsp: GstRTSPExtension isn't wrapped by GstImplementsInterface
+         Fix copy'n'paste error in headers, GstRTSPExtension isn't
+         something that's per-instance.
+
+2011-06-26 00:36:36 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/tag/xmpwriter.h:
+         tag: GstXmpWriter doesn't use the GstImplementsInterface
+         No need for per-instance checking of interface implementation here,
+         presumably just a copy'n'paste issue.
+
+2011-06-11 19:03:57 +1000  Jonathan Matthew <jonathan@d14n.org>
+
+       * gst-libs/gst/pbutils/encoding-target.c:
+         encoding-target: set names on audio and video profiles
+         https://bugzilla.gnome.org/show_bug.cgi?id=652342
+
+2011-06-23 11:28:04 -0700  David Schleef <ds@schleef.org>
+
+       * common:
+         Automatic update of common submodule
+         From 69b981f to 605cd9a
+
+2011-06-23 18:02:40 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoradec.h:
+         theoradec: use cropping metadata
+
+2011-06-23 16:31:21 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: let upstream know we support cropping
+
+2011-06-23 12:55:13 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         x11: add image cropping
+         Use the cropping metadata to crop the image.
+         Remove deprecated display-region property to set a clipping rectangle.
+
+2011-06-23 09:55:27 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+         meta: add some docs
+
+2011-06-23 09:30:19 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+         meta: add video crop metadata
+
+2011-06-22 19:35:16 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: handle unknown formats
+
+2011-06-22 16:38:48 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgio.c:
+       * gst-libs/gst/app/gstappsink.c:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+         fix for uri changes
+
+2011-06-22 15:38:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         x11: use frame copy functions
+
+2011-06-22 15:25:35 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: add video copy function
+         Add a function to copy a video frame, taking care of source and destination
+         strides.
+
+2011-06-22 12:57:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/examples/seek/seek.c:
+         seek: wait for the spinbutton widget
+         Wait for the spinbutton widget before trying to update it when the volume
+         changed callback is called.
+
+2011-06-22 11:45:58 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+         rtp: fix for allocator name change
+
+2011-06-21 18:17:59 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstaudioclock.c:
+       * gst-libs/gst/audio/gstaudioclock.h:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.h:
+         audio: clean up headers
+
+2011-06-21 18:13:48 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/alsa/gstalsasink.c:
+       * gst-libs/gst/audio/gstaudiosink.c:
+       * gst-libs/gst/audio/gstaudiosink.h:
+         audio: clean up audiosink headers
+
+2011-06-21 18:08:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstringbuffer.c:
+       * gst-libs/gst/audio/gstringbuffer.h:
+         audio: clean up ringbuffer header
+
+2011-06-21 17:57:56 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         configure.ac
+         docs/plugins/inspect/plugin-gnomevfs.xml
+
+2011-06-21 17:33:27 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videotestsrc/Makefile.am:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/videotestsrc/gstvideotestsrc.h:
+       * gst/videotestsrc/videotestsrc.c:
+       * gst/videotestsrc/videotestsrc.h:
+         videotestsrc: port to video helpers
+         Port videotestsrc to use the video helper functions to parse caps and handle
+         video frames.
+         Enable GstMetaVideo to make us handle strided video.
+
+2011-06-21 17:31:17 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: use gint to make parsing easier
+         Use gint for with/height etc to make it easier to pass the variables to various
+         caps and structure parsing functions.
+
+2011-06-21 12:52:23 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videotestsrc/videotestsrc.c:
+         videotestsrc: small cleanups
+
+2011-06-20 17:49:13 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videoscale/gstvideoscale.c:
+         videoscale: activate Video meta
+         Configure the allocator with GstMetaVideo because we can handle that using the
+         GstVideoFrame helpers.
+
+2011-06-20 17:36:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: delay pool activation
+         don't activate the pool we return in the ALLOCATION query because upstream might
+         still want to configure it
+
+2011-06-20 17:34:57 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videoconvert/gstvideoconvert.c:
+         videoconvert: use new allocation setup
+         Add setup_allocation to configure video metadata in the negotiated bufferpool.
+
+2011-06-20 15:43:57 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * configure.ac:
+         configure.ac: bump required GLib to 2.26
+
+2011-06-20 13:30:07 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+         theoradec: enable video metadata in the bufferpool
+         Enable the video metadata in the bufferpool.
+
+2011-06-20 13:28:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         x11: handle new bufferpool metadata api
+         Provide a method to list the supported metadata apis.
+         Activate the video metadata on buffers when a downstream element configured the
+         bufferpool to support that api.
+
+2011-06-20 11:25:58 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+       * gst/videoconvert/videoconvert.c:
+       * gst/videoscale/gstvideoscale.c:
+         video: remove intermediate Plane structure
+         Remove the GstVideoPlane structure and move the fields directly into the
+         GstVideoInfo structure. This makes things a little easier to read and also makes
+         it more likely that we can pass the stride array to external libraries.
+
+2011-06-18 13:32:17 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+         Bump git version after unplanned 0.10.35 release
+         Merge branch '0.10.35'
+         Conflicts:
+         configure.ac
+         docs/plugins/inspect/plugin-adder.xml
+         docs/plugins/inspect/plugin-alsa.xml
+         docs/plugins/inspect/plugin-app.xml
+         docs/plugins/inspect/plugin-audioconvert.xml
+         docs/plugins/inspect/plugin-audiorate.xml
+         docs/plugins/inspect/plugin-audioresample.xml
+         docs/plugins/inspect/plugin-audiotestsrc.xml
+         docs/plugins/inspect/plugin-cdparanoia.xml
+         docs/plugins/inspect/plugin-decodebin.xml
+         docs/plugins/inspect/plugin-encoding.xml
+         docs/plugins/inspect/plugin-ffmpegcolorspace.xml
+         docs/plugins/inspect/plugin-gdp.xml
+         docs/plugins/inspect/plugin-gio.xml
+         docs/plugins/inspect/plugin-gnomevfs.xml
+         docs/plugins/inspect/plugin-libvisual.xml
+         docs/plugins/inspect/plugin-ogg.xml
+         docs/plugins/inspect/plugin-pango.xml
+         docs/plugins/inspect/plugin-playback.xml
+         docs/plugins/inspect/plugin-subparse.xml
+         docs/plugins/inspect/plugin-tcp.xml
+         docs/plugins/inspect/plugin-theora.xml
+         docs/plugins/inspect/plugin-typefindfunctions.xml
+         docs/plugins/inspect/plugin-uridecodebin.xml
+         docs/plugins/inspect/plugin-videorate.xml
+         docs/plugins/inspect/plugin-videoscale.xml
+         docs/plugins/inspect/plugin-videotestsrc.xml
+         docs/plugins/inspect/plugin-volume.xml
+         docs/plugins/inspect/plugin-vorbis.xml
+         docs/plugins/inspect/plugin-ximagesink.xml
+         docs/plugins/inspect/plugin-xvimagesink.xml
+         gst-libs/gst/audio/Makefile.am
+         gst/subparse/gstsubparse.c
+         win32/common/_stdint.h
+         win32/common/config.h
+
+2011-06-18 11:16:19 +0200  Edward Hervey <bilboed@bilboed.com>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+         discoverer: Allow GError* argument to be NULL
+         This is how other methods taking GError* arguments behave.
+         Fixes #652838
+
+2011-06-17 17:54:52 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         x11: use GstVideoInfo to parse caps
+         Use GstVideoInfo to keep track of the configured format.
+         Add GstMetaVideo to buffers, disabled by default for now until we can have it
+         enabled with a property on the bufferpool configuration.
+
+2011-06-17 17:44:56 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstmetavideo.c:
+         metavideo: small fixes
+         Set the buffer as a field in the metadata so that we can use it to map the
+         buffer data.
+         Fix wrong assert.
+
+2011-06-17 17:27:22 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagepool.h:
+       * sys/xvimage/xvimagepool.c:
+       * sys/xvimage/xvimagepool.h:
+         x11: make function static
+         Don't export buffer creation function, we need to use the bufferpool
+         now.
+
+2011-06-17 16:47:25 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+         video: use metadata to set up strides
+         Use the GstMetaVideo when we can to map the buffers and set up the strides.
+
+2011-06-17 15:48:19 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         tests/examples/Makefile.am
+
+2011-06-17 15:31:59 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gstbasetextoverlay.h:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoradec.h:
+       * ext/theora/gsttheoraenc.c:
+       * ext/theora/gsttheoraenc.h:
+       * gst/videoconvert/gstvideoconvert.c:
+       * gst/videoconvert/gstvideoconvert.h:
+       * gst/videoconvert/videoconvert.c:
+       * gst/videoconvert/videoconvert.h:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videoscale/gstvideoscale.h:
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         -base: port to GstVideoFrame API
+
+2011-06-17 15:29:50 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: Add GstVideoFrame helper structure
+         The videoframe structure can be used to easily parse the contents of video
+         buffers.
+
+2011-06-17 09:21:27 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+       * gst-libs/gst/video/gstvideofilter.c:
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+       * gst/videoconvert/gstvideoconvert.c:
+       * gst/videoconvert/gstvideoconvert.h:
+       * gst/videoconvert/videoconvert.c:
+         video: port to new API
+         Add support for palette again.
+         Rewrite setup code for videoconvert using the new video methods.
+
+2011-06-16 19:35:27 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: rework part 2
+         Update docs.
+         Add method to get number of components.
+         Implement method to calculate defaults from format and dimensions.
+         Improve caps parsing.
+         Implement GstVideoInfo to caps conversion.
+
+2011-06-16 16:27:31 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstmetavideo.h:
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: rework part 1
+         Add GstVideoFlags similar to the flags on the metadata. The idea is to replace
+         the metadata flags with the GstVideoFlags.
+         Move VideoPlane to video.h, it contains the information for a plane.
+         Add GstVideoInfo structure that holds the current configuration of a video
+         format.
+         Add methods to parse caps into GstVideoInfo.
+
+2011-06-16 13:41:25 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/elements/ffmpegcolorspace.c:
+       * tests/check/elements/libvisual.c:
+       * tests/check/elements/playbin-compressed.c:
+       * tests/check/elements/playbin.c:
+       * tests/check/elements/textoverlay.c:
+       * tests/check/elements/videorate.c:
+       * tests/check/elements/videoscale.c:
+       * tests/check/elements/videotestsrc.c:
+       * tests/check/libs/pbutils.c:
+       * tests/check/libs/profile.c:
+       * tests/check/libs/video.c:
+       * tests/check/pipelines/capsfilter-renegotiation.c:
+       * tests/check/pipelines/simple-launch-lines.c:
+       * tests/check/pipelines/theoraenc.c:
+         test: port some more tests
+
+2011-06-16 12:48:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * gst/encoding/gstencodebin.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstrawcaps.h:
+       * gst/videoconvert/gstvideoconvert.c:
+       * gst/videorate/gstvideorate.c:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/videotestsrc/gstvideotestsrc.h:
+       * gst/videotestsrc/videotestsrc.c:
+       * gst/videotestsrc/videotestsrc.h:
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/xvimagesink.c:
+         -base: port elements to new video caps
+
+2011-06-16 12:43:54 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: add methods to parse X11 visuals
+         Add method to convert X11 visual description to GstVideoFormat
+
+2011-06-15 16:16:02 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+         video: update video caps
+
+2011-06-16 14:23:25 +1000  Jan Schmidt <thaytan@noraisin.net>
+
+       * po/POTFILES.in:
+       * po/af.po:
+       * po/az.po:
+       * po/bg.po:
+       * po/ca.po:
+       * po/cs.po:
+       * po/da.po:
+       * po/de.po:
+       * po/el.po:
+       * po/en_GB.po:
+       * po/es.po:
+       * po/eu.po:
+       * po/fi.po:
+       * po/fr.po:
+       * po/gl.po:
+       * po/hu.po:
+       * po/id.po:
+       * po/it.po:
+       * po/ja.po:
+       * po/lt.po:
+       * po/lv.po:
+       * po/nb.po:
+       * po/nl.po:
+       * po/or.po:
+       * po/pl.po:
+       * po/pt_BR.po:
+       * po/ro.po:
+       * po/ru.po:
+       * po/sk.po:
+       * po/sl.po:
+       * po/sq.po:
+       * po/sr.po:
+       * po/sv.po:
+       * po/tr.po:
+       * po/uk.po:
+       * po/vi.po:
+       * po/zh_CN.po:
+         Remove deleted playbin/decodebin files from POTFILES.in
+
 === release 0.10.35 ===
 
-2011-06-15  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2011-06-15 19:29:48 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+         Release 0.10.35
+         This is an ad-hoc release that is almost identical to 0.10.34:
+         * work around GLib atomic ops API change
+         * don't use G_CONST_RETURN in public headers
+         * subparse: typefinding fixes for subtitles in non-UTF8 charsets
+
+2011-06-15 18:08:32 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * docs/plugins/gst-plugins-base-plugins-docs.sgml:
+       * docs/plugins/gst-plugins-base-plugins-sections.txt:
+       * gst/playback/gstplay-enum.h:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstsubtitleoverlay.c:
+         some more ffmpegcolorspace to videoconvert changes
+
+2011-06-15 18:01:04 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * configure.ac:
+       * docs/plugins/Makefile.am:
+       * gst/ffmpegcolorspace/Makefile.am:
+       * gst/ffmpegcolorspace/avcodec.h:
+       * gst/ffmpegcolorspace/dsputil.c:
+       * gst/ffmpegcolorspace/dsputil.h:
+       * gst/ffmpegcolorspace/ffmpegcolorspace.vcproj:
+       * gst/ffmpegcolorspace/gstffmpegcodecmap.c:
+       * gst/ffmpegcolorspace/gstffmpegcodecmap.h:
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.h:
+       * gst/ffmpegcolorspace/imgconvert.c:
+       * gst/ffmpegcolorspace/imgconvert_template.h:
+       * gst/ffmpegcolorspace/mem.c:
+       * gst/ffmpegcolorspace/utils.c:
+       * gst/playback/gstplaysink.c:
+         ffmpegcolorspace: remove plugin
+
+2011-06-15 17:49:21 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * configure.ac:
+       * gst/colorspace/Makefile.am:
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+       * gst/colorspace/colorspace.vcproj:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+       * gst/colorspace/gstcolorspaceorc-dist.h:
+       * gst/colorspace/gstcolorspaceorc.orc:
+       * gst/videoconvert/Makefile.am:
+       * gst/videoconvert/gstvideoconvert.c:
+       * gst/videoconvert/gstvideoconvert.h:
+       * gst/videoconvert/gstvideoconvertorc-dist.c:
+       * gst/videoconvert/gstvideoconvertorc-dist.h:
+       * gst/videoconvert/gstvideoconvertorc.orc:
+       * gst/videoconvert/videoconvert.c:
+       * gst/videoconvert/videoconvert.h:
+       * gst/videoconvert/videoconvert.vcproj:
+         videoconvert: renamed from colorspace
+
+2011-06-15 16:52:52 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspace.c:
+         colorspace: fix caps negotiation
+
+2011-06-15 16:28:44 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspace.c:
+         colorspace: port to 0.11
+
+2011-06-15 16:28:30 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * configure.ac:
+         colorspace: add to build
+
+2011-04-30 19:46:40 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+         [MOVED FROM BAD 68/68] Update orc-generated disted C backup code to orc 0.4.14
+
+2011-04-28 00:00:09 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+         [MOVED FROM BAD 67/68] 0.10.21.3 pre-release
+
+2011-04-17 01:09:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+       * gst/colorspace/gstcolorspaceorc-dist.h:
+         [MOVED FROM BAD 66/68] ext, gst: update disted orc backup files
+
+2011-04-15 00:09:14 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 65/68] Fix some unused-but-set-variable warnings with gcc 4.6
+
+2011-04-11 00:36:35 -0400  Thibault Saunier <thibault.saunier@collabora.co.uk>
+
+       * gst/colorspace/Makefile.am:
+         [MOVED FROM BAD 64/68] android: make it ready for androgenizer
+         Remove the android/ top dir
+         Fixe the Makefile.am to be androgenized
+         To build gstreamer for android we are now using androgenizer which generates the needed Android.mk files.
+         Androgenizer can be found here: http://git.collabora.co.uk/?p=user/derek/androgenizer.git
+
+2011-02-25 19:59:05 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 63/68] colorspace: set dithering enum directly
+
+2011-02-25 19:57:47 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 62/68] colorspace: Add support for r210
+
+2011-02-20 23:01:30 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 61/68] colorspace: Fix YUV->RGB matrixing
+
+2011-02-20 22:43:56 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+         [MOVED FROM BAD 60/68] colorspace: Add dithering
+         Dithering only happens when a 16-bit-per-channel format is
+         involved.
+
+2011-02-20 14:14:27 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspaceorc.orc:
+         [MOVED FROM BAD 59/68] colorspace: fix a few formats
+
+2011-02-19 13:12:41 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 58/68] colorspace: Add 16-bit-per-channel handling
+
+2011-02-19 13:13:13 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 57/68] colorspace: Fix memleak
+
+2011-02-15 18:12:02 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 56/68] colorspace: Fix memory leak
+
+2011-01-02 16:13:56 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 55/68] colorspace: Disable matrixing on big-endian
+         It's broken until someone writes better Orc code.  Fixes #631232.
+
+2010-11-21 23:11:19 -0800  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 54/68] colorspace: remove incorrect check
+
+2010-11-05 10:56:51 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+       * gst/colorspace/gstcolorspaceorc-dist.h:
+         [MOVED FROM BAD 53/68] colorspace: Update generated ORC sources
+
+2010-11-04 14:18:29 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 52/68] colorspace: Inverse -base version check logic to actually make sense
+
+2010-11-03 15:37:48 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 51/68] colorspace: Add support for IYU1
+
+2010-11-03 15:12:42 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspaceorc.orc:
+         [MOVED FROM BAD 50/68] colorspace: First version of YUV9 and YVU9 implementation
+
+2010-11-03 09:20:15 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 49/68] colorspace: Use GST_CHECK_PLUGINS_BASE_VERSION() instead of other hacks
+
+2010-11-02 16:54:59 +0000  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 48/68] colorspace: fix build with current git of gst-plugins-base
+         ifdef tests don't work so well if we define them in the code
+         above in case they aren't defined.
+
+2010-11-02 16:05:37 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+         [MOVED FROM BAD 47/68] colorspace: Add support for 8 bit paletted RGB
+         This needs the 8 bit paletted support from -base
+         which will be committed after release. Without this
+         the 8 bit parts are disabled.
+
+2010-11-01 15:53:52 +0000  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+       * gst/colorspace/gstcolorspaceorc-dist.h:
+         [MOVED FROM BAD 46/68] cog, colorspace: update orc backup functions for latest changes
+         Should fix build on systems without the latest orc.
+
+2010-10-31 23:46:27 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 45/68] colorspace: Add support for RGB15 and BGR15
+
+2010-10-31 23:44:20 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 44/68] colorspace: Add support for RGB16 and BGR16
+
+2010-10-31 23:25:57 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspaceorc.orc:
+         [MOVED FROM BAD 43/68] colorspace: Add support for Y16
+
+2010-10-31 23:25:40 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc.orc:
+         [MOVED FROM BAD 42/68] colorspace: Fix Y800 ORC getline implementation
+
+2010-10-31 23:07:43 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspaceorc.orc:
+         [MOVED FROM BAD 41/68] colorspace: Add support for A420
+
+2010-10-31 23:00:07 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 40/68] colorspace: Add support for Y41B
+
+2010-10-31 22:39:38 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+         [MOVED FROM BAD 39/68] colorspace: Add support for SDTV/HDTV YUV conversions
+
+2010-10-31 22:21:35 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 38/68] colorspace: Add comment for the A420 getline/putline table row
+
+2010-10-31 20:40:09 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+         [MOVED FROM BAD 37/68] colorspace: Add const to the source arrays and the getline/putline table
+
+2010-10-31 19:42:30 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 36/68] colorspace: Make fast-path transform table const
+
+2010-10-31 19:39:33 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 35/68] colorspace: Only do the I420->YUY2 conversion once per scanline in the fast path
+
+2010-09-21 18:13:37 -0700  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/colorspace.c:
+         [MOVED FROM BAD 34/68] colorspace: quiet a GST_ERROR
+
+2010-09-15 21:47:09 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/colorspace/gstcolorspaceorc-dist.c:
+       * gst/colorspace/gstcolorspaceorc-dist.h:
+         [MOVED FROM BAD 33/68] colorspace: add orc-dist files
+         Should fix build without orc or too old orc.
+
+2010-09-13 18:49:43 -0700  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/Makefile.am:
+       * gst/colorspace/colorspace.c:
+       * gst/colorspace/colorspace.h:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+       * gst/colorspace/gstcolorspaceorc.orc:
+         [MOVED FROM BAD 32/68] colorspace: Add conversion code
+         Work in progress.  Colorspace handles most format conversion using
+         3-stage getline/matrix/putline process using an AYUV or ARGB
+         intermediate, with most functions handled by Orc.  There is also
+         a table of single-pass conversions, all handled by Orc.  The plan
+         is to add optional stages for various chroma upsampling/downsampling
+         algorithms, dithering, and float/int16 intermediates, and then have
+         Orc create multi-stage functions at runtime.
+
+2010-09-13 12:48:50 -0700  David Schleef <ds@schleef.org>
+
+       * gst/colorspace/Makefile.am:
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+       * gst/colorspace/gstcolorspaceorc.orc:
+       * gst/colorspace/yuv2rgb.c:
+       * gst/colorspace/yuv2rgb.h:
+         [MOVED FROM BAD 31/68] colorspace: Revive element
+         Now based on Orc.
+
+2010-03-18 17:30:26 +0100  Benjamin Otte <otte@redhat.com>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 30/68] gst_element_class_set_details => gst_element_class_set_details_simple
+
+2008-11-04 12:42:30 +0000  Stefan Kost <ensonic@users.sourceforge.net>
+
+         [MOVED FROM BAD 29/68] Don't install static libs for plugins. Fixes #550851 for -bad.
+         Original commit message from CVS:
+         * ext/alsaspdif/Makefile.am:
+         * ext/amrwb/Makefile.am:
+         * ext/apexsink/Makefile.am:
+         * ext/arts/Makefile.am:
+         * ext/artsd/Makefile.am:
+         * ext/audiofile/Makefile.am:
+         * ext/audioresample/Makefile.am:
+         * ext/bz2/Makefile.am:
+         * ext/cdaudio/Makefile.am:
+         * ext/celt/Makefile.am:
+         * ext/dc1394/Makefile.am:
+         * ext/dirac/Makefile.am:
+         * ext/directfb/Makefile.am:
+         * ext/divx/Makefile.am:
+         * ext/dts/Makefile.am:
+         * ext/faac/Makefile.am:
+         * ext/faad/Makefile.am:
+         * ext/gsm/Makefile.am:
+         * ext/hermes/Makefile.am:
+         * ext/ivorbis/Makefile.am:
+         * ext/jack/Makefile.am:
+         * ext/jp2k/Makefile.am:
+         * ext/ladspa/Makefile.am:
+         * ext/lcs/Makefile.am:
+         * ext/libfame/Makefile.am:
+         * ext/libmms/Makefile.am:
+         * ext/metadata/Makefile.am:
+         * ext/mpeg2enc/Makefile.am:
+         * ext/mplex/Makefile.am:
+         * ext/musepack/Makefile.am:
+         * ext/musicbrainz/Makefile.am:
+         * ext/mythtv/Makefile.am:
+         * ext/nas/Makefile.am:
+         * ext/neon/Makefile.am:
+         * ext/ofa/Makefile.am:
+         * ext/polyp/Makefile.am:
+         * ext/resindvd/Makefile.am:
+         * ext/sdl/Makefile.am:
+         * ext/shout/Makefile.am:
+         * ext/snapshot/Makefile.am:
+         * ext/sndfile/Makefile.am:
+         * ext/soundtouch/Makefile.am:
+         * ext/spc/Makefile.am:
+         * ext/swfdec/Makefile.am:
+         * ext/tarkin/Makefile.am:
+         * ext/theora/Makefile.am:
+         * ext/timidity/Makefile.am:
+         * ext/twolame/Makefile.am:
+         * ext/x264/Makefile.am:
+         * ext/xine/Makefile.am:
+         * ext/xvid/Makefile.am:
+         * gst-libs/gst/app/Makefile.am:
+         * gst-libs/gst/dshow/Makefile.am:
+         * gst/aiffparse/Makefile.am:
+         * gst/app/Makefile.am:
+         * gst/audiobuffer/Makefile.am:
+         * gst/bayer/Makefile.am:
+         * gst/cdxaparse/Makefile.am:
+         * gst/chart/Makefile.am:
+         * gst/colorspace/Makefile.am:
+         * gst/dccp/Makefile.am:
+         * gst/deinterlace/Makefile.am:
+         * gst/deinterlace2/Makefile.am:
+         * gst/dvdspu/Makefile.am:
+         * gst/festival/Makefile.am:
+         * gst/filter/Makefile.am:
+         * gst/flacparse/Makefile.am:
+         * gst/flv/Makefile.am:
+         * gst/games/Makefile.am:
+         * gst/h264parse/Makefile.am:
+         * gst/librfb/Makefile.am:
+         * gst/mixmatrix/Makefile.am:
+         * gst/modplug/Makefile.am:
+         * gst/mpeg1sys/Makefile.am:
+         * gst/mpeg4videoparse/Makefile.am:
+         * gst/mpegdemux/Makefile.am:
+         * gst/mpegtsmux/Makefile.am:
+         * gst/mpegvideoparse/Makefile.am:
+         * gst/mve/Makefile.am:
+         * gst/nsf/Makefile.am:
+         * gst/nuvdemux/Makefile.am:
+         * gst/overlay/Makefile.am:
+         * gst/passthrough/Makefile.am:
+         * gst/pcapparse/Makefile.am:
+         * gst/playondemand/Makefile.am:
+         * gst/rawparse/Makefile.am:
+         * gst/real/Makefile.am:
+         * gst/rtjpeg/Makefile.am:
+         * gst/rtpmanager/Makefile.am:
+         * gst/scaletempo/Makefile.am:
+         * gst/sdp/Makefile.am:
+         * gst/selector/Makefile.am:
+         * gst/smooth/Makefile.am:
+         * gst/smoothwave/Makefile.am:
+         * gst/speed/Makefile.am:
+         * gst/speexresample/Makefile.am:
+         * gst/stereo/Makefile.am:
+         * gst/subenc/Makefile.am:
+         * gst/tta/Makefile.am:
+         * gst/vbidec/Makefile.am:
+         * gst/videodrop/Makefile.am:
+         * gst/videosignal/Makefile.am:
+         * gst/virtualdub/Makefile.am:
+         * gst/vmnc/Makefile.am:
+         * gst/y4m/Makefile.am:
+         * sys/acmenc/Makefile.am:
+         * sys/cdrom/Makefile.am:
+         * sys/dshowdecwrapper/Makefile.am:
+         * sys/dshowsrcwrapper/Makefile.am:
+         * sys/dvb/Makefile.am:
+         * sys/dxr3/Makefile.am:
+         * sys/fbdev/Makefile.am:
+         * sys/oss4/Makefile.am:
+         * sys/qcam/Makefile.am:
+         * sys/qtwrapper/Makefile.am:
+         * sys/vcd/Makefile.am:
+         * sys/wininet/Makefile.am:
+         * win32/common/config.h:
+         Don't install static libs for plugins. Fixes #550851 for -bad.
+
+2007-06-22 10:46:33 +0000  Edward Hervey <bilboed@bilboed.com>
+
+         [MOVED FROM BAD 28/68] Fix leaks.
+         Original commit message from CVS:
+         * ext/amrwb/gstamrwbdec.c: (gst_amrwbdec_init):
+         * ext/amrwb/gstamrwbenc.c: (gst_amrwbenc_init):
+         * ext/amrwb/gstamrwbparse.c: (gst_amrwbparse_init):
+         * ext/audioresample/gstaudioresample.c:
+         * ext/bz2/gstbz2dec.c: (gst_bz2dec_init):
+         * ext/bz2/gstbz2enc.c: (gst_bz2enc_init):
+         * ext/divx/gstdivxdec.c: (gst_divxdec_init):
+         * ext/divx/gstdivxenc.c: (gst_divxenc_init):
+         * ext/faac/gstfaac.c: (gst_faac_init):
+         * ext/gsm/gstgsmdec.c: (gst_gsmdec_init):
+         * ext/gsm/gstgsmenc.c: (gst_gsmenc_init):
+         * ext/hermes/gsthermescolorspace.c: (gst_hermes_colorspace_init):
+         * ext/lcs/gstcolorspace.c: (gst_colorspace_init):
+         * ext/libfame/gstlibfame.c: (gst_fameenc_init):
+         * ext/snapshot/gstsnapshot.c: (gst_snapshot_init):
+         * ext/spc/gstspc.c: (gst_spc_dec_init):
+         * ext/swfdec/gstswfdec.c: (gst_swfdec_init):
+         * ext/xvid/gstxvidenc.c: (gst_xvidenc_init):
+         * gst/cdxaparse/gstcdxaparse.c: (gst_cdxa_parse_init):
+         * gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
+         * gst/chart/gstchart.c: (gst_chart_init):
+         * gst/colorspace/gstcolorspace.c: (gst_colorspace_init):
+         * gst/festival/gstfestival.c: (gst_festival_init):
+         * gst/freeze/gstfreeze.c: (gst_freeze_init):
+         * gst/mixmatrix/mixmatrix.c: (gst_mixmatrix_request_new_pad):
+         * gst/mpeg1sys/gstmpeg1systemencode.c: (gst_system_encode_init):
+         * gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
+         * gst/nsf/gstnsf.c: (gst_nsfdec_init):
+         * gst/overlay/gstoverlay.c: (gst_overlay_init):
+         * gst/passthrough/gstpassthrough.c: (passthrough_init):
+         * gst/playondemand/gstplayondemand.c: (play_on_demand_init):
+         * gst/smooth/gstsmooth.c: (gst_smooth_init):
+         * gst/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
+         * gst/speed/gstspeed.c: (speed_init):
+         * gst/vbidec/gstvbidec.c: (gst_vbidec_init):
+         * gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
+         * sys/dxr3/dxr3spusink.c: (dxr3spusink_init):
+         * sys/dxr3/dxr3videosink.c: (dxr3videosink_init):
+         * sys/qcam/gstqcamsrc.c: (gst_qcamsrc_init):
+         Fix leaks.
+
+2006-06-01 22:00:26 +0000  Stefan Kost <ensonic@users.sourceforge.net>
+
+         [MOVED FROM BAD 27/68] Fix more gobject macros: obj<->klass, GstXXX<->GstXXXClass
+         Original commit message from CVS:
+         * ext/alsaspdif/alsaspdifsink.h:
+         * ext/amrwb/gstamrwbdec.h:
+         * ext/amrwb/gstamrwbenc.h:
+         * ext/amrwb/gstamrwbparse.h:
+         * ext/arts/gst_arts.h:
+         * ext/artsd/gstartsdsink.h:
+         * ext/audiofile/gstafparse.h:
+         * ext/audiofile/gstafsink.h:
+         * ext/audiofile/gstafsrc.h:
+         * ext/audioresample/gstaudioresample.h:
+         * ext/bz2/gstbz2dec.h:
+         * ext/bz2/gstbz2enc.h:
+         * ext/dirac/gstdiracdec.h:
+         * ext/directfb/dfbvideosink.h:
+         * ext/divx/gstdivxdec.h:
+         * ext/divx/gstdivxenc.h:
+         * ext/dts/gstdtsdec.h:
+         * ext/faac/gstfaac.h:
+         * ext/gsm/gstgsmdec.h:
+         * ext/gsm/gstgsmenc.h:
+         * ext/ivorbis/vorbisenc.h:
+         * ext/libfame/gstlibfame.h:
+         * ext/nas/nassink.h:
+         * ext/neon/gstneonhttpsrc.h:
+         * ext/polyp/polypsink.h:
+         * ext/sdl/sdlaudiosink.h:
+         * ext/sdl/sdlvideosink.h:
+         * ext/shout/gstshout.h:
+         * ext/snapshot/gstsnapshot.h:
+         * ext/sndfile/gstsf.h:
+         * ext/swfdec/gstswfdec.h:
+         * ext/tarkin/gsttarkindec.h:
+         * ext/tarkin/gsttarkinenc.h:
+         * ext/theora/theoradec.h:
+         * ext/wavpack/gstwavpackdec.h:
+         * ext/wavpack/gstwavpackparse.h:
+         * ext/xine/gstxine.h:
+         * ext/xvid/gstxviddec.h:
+         * ext/xvid/gstxvidenc.h:
+         * gst/cdxaparse/gstcdxaparse.h:
+         * gst/cdxaparse/gstcdxastrip.h:
+         * gst/colorspace/gstcolorspace.h:
+         * gst/festival/gstfestival.h:
+         * gst/freeze/gstfreeze.h:
+         * gst/gdp/gstgdpdepay.h:
+         * gst/gdp/gstgdppay.h:
+         * gst/modplug/gstmodplug.h:
+         * gst/mpeg1sys/gstmpeg1systemencode.h:
+         * gst/mpeg1videoparse/gstmp1videoparse.h:
+         * gst/mpeg2sub/gstmpeg2subt.h:
+         * gst/mpegaudioparse/gstmpegaudioparse.h:
+         * gst/multifilesink/gstmultifilesink.h:
+         * gst/overlay/gstoverlay.h:
+         * gst/playondemand/gstplayondemand.h:
+         * gst/qtdemux/qtdemux.h:
+         * gst/rtjpeg/gstrtjpegdec.h:
+         * gst/rtjpeg/gstrtjpegenc.h:
+         * gst/smooth/gstsmooth.h:
+         * gst/smoothwave/gstsmoothwave.h:
+         * gst/spectrum/gstspectrum.h:
+         * gst/speed/gstspeed.h:
+         * gst/stereo/gststereo.h:
+         * gst/switch/gstswitch.h:
+         * gst/tta/gstttadec.h:
+         * gst/tta/gstttaparse.h:
+         * gst/videodrop/gstvideodrop.h:
+         * gst/xingheader/gstxingmux.h:
+         * sys/directdraw/gstdirectdrawsink.h:
+         * sys/directsound/gstdirectsoundsink.h:
+         * sys/dxr3/dxr3audiosink.h:
+         * sys/dxr3/dxr3spusink.h:
+         * sys/dxr3/dxr3videosink.h:
+         * sys/qcam/gstqcamsrc.h:
+         * sys/vcd/vcdsrc.h:
+         Fix more gobject macros: obj<->klass, GstXXX<->GstXXXClass
+
+2006-04-25 21:56:38 +0000  Stefan Kost <ensonic@users.sourceforge.net>
+
+         [MOVED FROM BAD 26/68] Define GstElementDetails as const and also static (when defined as global)
+         Original commit message from CVS:
+         * ext/amrwb/gstamrwbdec.c:
+         * ext/amrwb/gstamrwbenc.c:
+         * ext/amrwb/gstamrwbparse.c:
+         * ext/arts/gst_arts.c:
+         * ext/artsd/gstartsdsink.c:
+         * ext/audiofile/gstafparse.c:
+         * ext/audiofile/gstafsink.c:
+         * ext/audiofile/gstafsrc.c:
+         * ext/audioresample/gstaudioresample.c:
+         * ext/bz2/gstbz2dec.c:
+         * ext/bz2/gstbz2enc.c:
+         * ext/cdaudio/gstcdaudio.c:
+         * ext/directfb/dfbvideosink.c:
+         * ext/divx/gstdivxdec.c:
+         * ext/divx/gstdivxenc.c:
+         * ext/dts/gstdtsdec.c: (gst_dtsdec_base_init):
+         * ext/faac/gstfaac.c: (gst_faac_base_init):
+         * ext/faad/gstfaad.c:
+         * ext/gsm/gstgsmdec.c:
+         * ext/gsm/gstgsmenc.c:
+         * ext/hermes/gsthermescolorspace.c:
+         * ext/ivorbis/vorbisfile.c:
+         * ext/lcs/gstcolorspace.c:
+         * ext/libfame/gstlibfame.c:
+         * ext/libmms/gstmms.c: (gst_mms_base_init):
+         * ext/musepack/gstmusepackdec.c: (gst_musepackdec_base_init):
+         * ext/musicbrainz/gsttrm.c: (gst_musicbrainz_base_init):
+         * ext/nas/nassink.c: (gst_nassink_base_init):
+         * ext/neon/gstneonhttpsrc.c:
+         * ext/sdl/sdlaudiosink.c:
+         * ext/sdl/sdlvideosink.c:
+         * ext/shout/gstshout.c:
+         * ext/snapshot/gstsnapshot.c:
+         * ext/sndfile/gstsf.c:
+         * ext/swfdec/gstswfdec.c:
+         * ext/tarkin/gsttarkindec.c:
+         * ext/tarkin/gsttarkinenc.c:
+         * ext/theora/theoradec.c:
+         * ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_base_init):
+         * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_base_init):
+         * ext/xvid/gstxviddec.c:
+         * ext/xvid/gstxvidenc.c:
+         * gst/cdxaparse/gstcdxaparse.c: (gst_cdxa_parse_base_init):
+         * gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_base_init):
+         * gst/chart/gstchart.c:
+         * gst/colorspace/gstcolorspace.c:
+         * gst/deinterlace/gstdeinterlace.c:
+         * gst/equalizer/gstiirequalizer.c: (gst_iir_equalizer_base_init):
+         * gst/festival/gstfestival.c:
+         * gst/filter/gstbpwsinc.c:
+         * gst/filter/gstiir.c:
+         * gst/filter/gstlpwsinc.c:
+         * gst/freeze/gstfreeze.c:
+         * gst/games/gstpuzzle.c: (gst_puzzle_base_init):
+         * gst/librfb/gstrfbsrc.c:
+         * gst/mixmatrix/mixmatrix.c:
+         * gst/mpeg1sys/gstmpeg1systemencode.c:
+         * gst/mpeg1videoparse/gstmp1videoparse.c:
+         * gst/mpeg2sub/gstmpeg2subt.c:
+         * gst/mpegaudioparse/gstmpegaudioparse.c:
+         * gst/multifilesink/gstmultifilesink.c:
+         * gst/overlay/gstoverlay.c:
+         * gst/passthrough/gstpassthrough.c:
+         * gst/playondemand/gstplayondemand.c:
+         * gst/qtdemux/qtdemux.c:
+         * gst/rtjpeg/gstrtjpegdec.c:
+         * gst/rtjpeg/gstrtjpegenc.c:
+         * gst/smooth/gstsmooth.c:
+         * gst/smoothwave/gstsmoothwave.c:
+         * gst/spectrum/gstspectrum.c:
+         * gst/speed/gstspeed.c:
+         * gst/stereo/gststereo.c:
+         * gst/switch/gstswitch.c:
+         * gst/tta/gstttadec.c: (gst_tta_dec_base_init):
+         * gst/tta/gstttaparse.c: (gst_tta_parse_base_init):
+         * gst/vbidec/gstvbidec.c:
+         * gst/videocrop/gstvideocrop.c:
+         * gst/videodrop/gstvideodrop.c:
+         * gst/virtualdub/gstxsharpen.c:
+         * gst/xingheader/gstxingmux.c: (gst_xing_mux_base_init):
+         * gst/y4m/gsty4mencode.c:
+         * sys/cdrom/gstcdplayer.c:
+         * sys/directdraw/gstdirectdrawsink.c:
+         * sys/directsound/gstdirectsoundsink.c:
+         * sys/glsink/glimagesink.c:
+         * sys/qcam/gstqcamsrc.c:
+         * sys/v4l2/gstv4l2src.c:
+         * sys/vcd/vcdsrc.c: (gst_vcdsrc_base_init):
+         * sys/ximagesrc/ximagesrc.c:
+         Define GstElementDetails as const and also static (when defined as
+         global)
+
+2006-04-08 21:48:01 +0000  Stefan Kost <ensonic@users.sourceforge.net>
+
+         [MOVED FROM BAD 25/68] Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
+         Original commit message from CVS:
+         * ext/amrwb/gstamrwbdec.c: (gst_amrwbdec_class_init):
+         * ext/amrwb/gstamrwbenc.c: (gst_amrwbenc_class_init):
+         * ext/amrwb/gstamrwbparse.c: (gst_amrwbparse_class_init):
+         * ext/arts/gst_arts.c: (gst_arts_class_init):
+         * ext/artsd/gstartsdsink.c: (gst_artsdsink_class_init):
+         * ext/audiofile/gstafsink.c: (gst_afsink_class_init):
+         * ext/audiofile/gstafsrc.c: (gst_afsrc_class_init):
+         * ext/audioresample/gstaudioresample.c:
+         * ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init):
+         * ext/directfb/dfbvideosink.c: (gst_dfbvideosink_class_init):
+         * ext/divx/gstdivxdec.c: (gst_divxdec_class_init):
+         * ext/hermes/gsthermescolorspace.c:
+         (gst_hermes_colorspace_class_init):
+         * ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_class_init):
+         * ext/jack/gstjack.c: (gst_jack_class_init):
+         * ext/jack/gstjackbin.c: (gst_jack_bin_class_init):
+         * ext/lcs/gstcolorspace.c: (gst_colorspace_class_init):
+         * ext/libfame/gstlibfame.c: (gst_fameenc_class_init):
+         * ext/musicbrainz/gsttrm.c: (gst_musicbrainz_class_init):
+         * ext/nas/nassink.c: (gst_nassink_class_init):
+         * ext/shout/gstshout.c: (gst_icecastsend_class_init):
+         * ext/snapshot/gstsnapshot.c: (gst_snapshot_class_init):
+         * ext/sndfile/gstsf.c: (gst_sf_class_init):
+         * ext/swfdec/gstswfdec.c: (gst_swfdecbuffer_class_init),
+         (gst_swfdec_class_init):
+         * ext/tarkin/gsttarkindec.c: (gst_tarkindec_class_init):
+         * ext/tarkin/gsttarkinenc.c: (gst_tarkinenc_class_init):
+         * gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_class_init):
+         * gst/chart/gstchart.c: (gst_chart_class_init):
+         * gst/colorspace/gstcolorspace.c: (gst_colorspace_class_init):
+         * gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_class_init):
+         * gst/festival/gstfestival.c: (gst_festival_class_init):
+         * gst/filter/gstbpwsinc.c: (gst_bpwsinc_class_init):
+         * gst/filter/gstiir.c: (gst_iir_class_init):
+         * gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init):
+         * gst/librfb/gstrfbsrc.c: (gst_rfbsrc_class_init):
+         * gst/mixmatrix/mixmatrix.c: (gst_mixmatrix_class_init):
+         * gst/mpeg1sys/gstmpeg1systemencode.c:
+         (gst_system_encode_class_init):
+         * gst/mpeg1videoparse/gstmp1videoparse.c:
+         (gst_mp1videoparse_class_init):
+         * gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_class_init):
+         * gst/mpegaudioparse/gstmpegaudioparse.c:
+         (gst_mp3parse_class_init):
+         * gst/overlay/gstoverlay.c: (gst_overlay_class_init):
+         * gst/passthrough/gstpassthrough.c: (passthrough_class_init):
+         * gst/playondemand/gstplayondemand.c: (play_on_demand_class_init):
+         * gst/rtjpeg/gstrtjpegdec.c: (gst_rtjpegdec_class_init):
+         * gst/rtjpeg/gstrtjpegenc.c: (gst_rtjpegenc_class_init):
+         * gst/smooth/gstsmooth.c: (gst_smooth_class_init):
+         * gst/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init):
+         * gst/spectrum/gstspectrum.c: (gst_spectrum_class_init):
+         * gst/stereo/gststereo.c: (gst_stereo_class_init):
+         * gst/switch/gstswitch.c: (gst_switch_class_init):
+         * gst/tta/gstttadec.c: (gst_tta_dec_class_init):
+         * gst/tta/gstttaparse.c: (gst_tta_parse_class_init):
+         * gst/vbidec/gstvbidec.c: (gst_vbidec_class_init):
+         * gst/videocrop/gstvideocrop.c: (gst_video_crop_class_init):
+         * gst/virtualdub/gstxsharpen.c: (gst_xsharpen_class_init):
+         * gst/y4m/gsty4mencode.c: (gst_y4mencode_class_init):
+         * sys/cdrom/gstcdplayer.c: (cdplayer_class_init):
+         * sys/directsound/gstdirectsoundsink.c:
+         (gst_directsoundsink_class_init):
+         * sys/dxr3/dxr3audiosink.c: (dxr3audiosink_class_init):
+         * sys/dxr3/dxr3spusink.c: (dxr3spusink_class_init):
+         * sys/dxr3/dxr3videosink.c: (dxr3videosink_class_init):
+         * sys/qcam/gstqcamsrc.c: (gst_qcamsrc_class_init):
+         * sys/v4l2/gstv4l2colorbalance.c:
+         (gst_v4l2_color_balance_channel_class_init):
+         * sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_channel_class_init),
+         (gst_v4l2_tuner_norm_class_init):
+         * sys/ximagesrc/ximagesrc.c: (gst_ximagesrc_class_init):
+         Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
+
+2006-04-08 19:04:01 +0000  Stefan Kost <ensonic@users.sourceforge.net>
+
+         [MOVED FROM BAD 24/68] gst/: Fix more broken GObject macros
+         Original commit message from CVS:
+         * gst/colorspace/gstcolorspace.h:
+         * gst/deinterlace/gstdeinterlace.h:
+         * gst/passthrough/gstpassthrough.h:
+         * gst/y4m/gsty4mencode.h:
+         Fix more broken GObject macros
+
+2006-04-01 10:09:11 +0000  Thomas Vander Stichele <thomas@apestaart.org>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 23/68] rework build; add translations for v4l2
+         Original commit message from CVS:
+         rework build; add translations for v4l2
+
+2005-12-06 19:55:58 +0000  Thomas Vander Stichele <thomas@apestaart.org>
+
+       * gst/colorspace/yuv2rgb.c:
+       * gst/colorspace/yuv2rgb.h:
+         [MOVED FROM BAD 22/68] expand tabs
+         Original commit message from CVS:
+         expand tabs
+
+2005-12-05 13:04:22 +0000  Andy Wingo <wingo@pobox.com>
+
+         [MOVED FROM BAD 21/68] Update for alloc_buffer changes.
+         Original commit message from CVS:
+         2005-12-05  Andy Wingo  <wingo@pobox.com>
+         * ext/faac/gstfaac.c: (gst_faac_sink_event), (gst_faac_chain):
+         * ext/faad/gstfaad.c: (gst_faad_chain):
+         * ext/hermes/gsthermescolorspace.c: (gst_hermes_colorspace_chain):
+         * ext/lcs/gstcolorspace.c: (gst_colorspace_chain):
+         * ext/xine/xineinput.c: (gst_xine_input_get):
+         * gst/colorspace/gstcolorspace.c: (gst_colorspace_chain):
+         * gst/speed/gstspeed.c: (speed_chain):
+         * gst/videocrop/gstvideocrop.c: (gst_video_crop_chain): Update for
+         alloc_buffer changes.
+
+2005-09-05 17:20:29 +0000  Jan Schmidt <thaytan@mad.scientist.com>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 20/68] Fix up all the state change functions.
+         Original commit message from CVS:
+         Fix up all the state change functions.
+
+2005-08-14 16:21:00 +0000  Thomas Vander Stichele <thomas@apestaart.org>
+
+       * gst/colorspace/Makefile.am:
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 19/68] pound some sense in the colorspace elements
+         Original commit message from CVS:
+         pound some sense in the colorspace elements
+
+2005-07-05 10:51:49 +0000  Andy Wingo <wingo@pobox.com>
+
+         [MOVED FROM BAD 18/68] Way, way, way too many files: Remove crack comment from the 2000 era.
+         Original commit message from CVS:
+         2005-07-05  Andy Wingo  <wingo@pobox.com>
+         * Way, way, way too many files:
+         Remove crack comment from the 2000 era.
+
+2004-07-27 21:41:30 +0000  Steve Lhomme <steve.lhomme@free.fr>
+
+       * gst/colorspace/colorspace.vcproj:
+         [MOVED FROM BAD 17/68] more working plugins
+         Original commit message from CVS:
+         more working plugins
+
+2004-07-27 09:57:33 +0000  Steve Lhomme <steve.lhomme@free.fr>
+
+       * gst/colorspace/colorspace.vcproj:
+         [MOVED FROM BAD 16/68] rename GStreamer-0.8.lib to libgstreamer.lib
+         Original commit message from CVS:
+         rename GStreamer-0.8.lib to libgstreamer.lib
+
+2004-07-27 09:48:51 +0000  Steve Lhomme <steve.lhomme@free.fr>
+
+       * gst/colorspace/colorspace.vcproj:
+         [MOVED FROM BAD 15/68] avoid problems with math.h, fix release dependancy
+         Original commit message from CVS:
+         avoid problems with math.h, fix release dependancy
+
+2004-07-26 22:11:21 +0000  Steve Lhomme <steve.lhomme@free.fr>
+
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/yuv2rgb.h:
+         [MOVED FROM BAD 14/68] local include fixes
+         Original commit message from CVS:
+         local include fixes
+         Fix some 64 bits constants to be glib friendly
+         issue for a vararg macro with MSVC
+
+2004-07-26 13:20:11 +0000  Steve Lhomme <steve.lhomme@free.fr>
+
+       * gst/colorspace/colorspace.vcproj:
+         [MOVED FROM BAD 13/68] more plugins supported under windows
+         Original commit message from CVS:
+         more plugins supported under windows
+
+2004-05-21 22:39:30 +0000  Stéphane Loeuillet <gstreamer@leroutier.net>
+
+       * gst/colorspace/gstcolorspace.c:
+         [MOVED FROM BAD 12/68] first batch : remove ',' at end of enums as they could confuse older gcc, foreign compilers (forte) and gtk-doc
+         Original commit message from CVS:
+         first batch :
+         remove ',' at end of enums as they could confuse older gcc, foreign compilers (forte) and gtk-doc
+
+2004-04-22 03:52:52 +0000  Benjamin Otte <otte@gnome.org>
+
+         [MOVED FROM BAD 11/68] s/gst_caps_simplify/gst_caps_do_simplify/
+         Original commit message from CVS:
+         * ext/hermes/gsthermescolorspace.c:
+         (gst_hermes_colorspace_caps_remove_format_info):
+         * gst/colorspace/gstcolorspace.c:
+         (gst_colorspace_caps_remove_format_info):
+         * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+         (gst_ffmpegcolorspace_caps_remove_format_info):
+         s/gst_caps_simplify/gst_caps_do_simplify/
+
+2004-04-09 00:01:44 +0000  David Schleef <ds@schleef.org>
+
+         [MOVED FROM BAD 10/68] gst/colorspace/gstcolorspace.c: Don't advertise a conversion we don't support (bug #139532)
+         Original commit message from CVS:
+         * gst/colorspace/gstcolorspace.c: Don't advertise a conversion
+         we don't support (bug #139532)
+
+2004-03-30 07:07:46 +0000  David Schleef <ds@schleef.org>
+
+         [MOVED FROM BAD 09/68] ext/hermes/gsthermescolorspace.c: decrease rank by 2 to not interfere with other colorspaces.
+         Original commit message from CVS:
+         * ext/hermes/gsthermescolorspace.c: (plugin_init): decrease rank
+         by 2 to not interfere with other colorspaces.
+         * ext/pango/gsttextoverlay.c: (plugin_init): change rank to NONE
+         * gst/colorspace/gstcolorspace.c: (plugin_init): decrease rank by
+         one to not interfere with ffmpeg_colorspace.
+
+2004-03-15 19:32:27 +0000  Thomas Vander Stichele <thomas@apestaart.org>
+
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/yuv2rgb.c:
+         [MOVED FROM BAD 08/68] don't mix tabs and spaces
+         Original commit message from CVS:
+         don't mix tabs and spaces
+
+2004-03-15 16:32:54 +0000  Johan Dahlin <johan@gnome.org>
+
+         [MOVED FROM BAD 07/68] *.h: Revert indenting
+         Original commit message from CVS:
+         * *.h: Revert indenting
+
+2004-03-14 22:34:33 +0000  Thomas Vander Stichele <thomas@apestaart.org>
+
+       * gst/colorspace/gstcolorspace.c:
+       * gst/colorspace/gstcolorspace.h:
+       * gst/colorspace/yuv2rgb.c:
+       * gst/colorspace/yuv2rgb.h:
+         [MOVED FROM BAD 06/68] gst-indent
+         Original commit message from CVS:
+         gst-indent
+
+2004-03-13 00:19:26 +0000  David Schleef <ds@schleef.org>
+
+         [MOVED FROM BAD 05/68] configure.ac: the Hermes library controls hermescolorspace, not colorspace.
+         Original commit message from CVS:
+         * configure.ac: the Hermes library controls hermescolorspace, not
+         colorspace.
+         * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
+         (gst_mpeg2dec_init): minor pet peeve: disable code with #ifdef,
+         not /* */
+         * ext/sdl/sdlvideosink.c: Change XID to unsigned long.
+         * ext/sdl/sdlvideosink.h: ditto.
+         * gst/colorspace/gstcolorspace.c: Fix old comments about Hermes
+
+2004-01-18 19:02:33 +0000  Christian Schaller <uraeus@gnome.org>
+
+       * gst/colorspace/Makefile.am:
+         [MOVED FROM BAD 04/68] fix to make it possible to build from disted tarball
+         Original commit message from CVS:
+         fix to make it possible to build from disted tarball
+
+2004-01-16 00:55:29 +0000  David Schleef <ds@schleef.org>
+
+         [MOVED FROM BAD 03/68] gst-libs/gst/audio/Makefile.am: Add gstaudiofiltertemplate.c and building of gstaudiofilterexample.c from the template.
+         Original commit message from CVS:
+         * gst-libs/gst/audio/Makefile.am:
+         Add gstaudiofiltertemplate.c and building of gstaudiofilterexample.c
+         from the template.
+         * gst-libs/gst/audio/gstaudiofilter.c:
+         * gst-libs/gst/audio/gstaudiofilter.h:
+         Add bytes_per_sample and size and n_samples calculation.
+         * gst-libs/gst/audio/gstaudiofilterexample.c:
+         Remove, now autogenerated.
+         * gst-libs/gst/audio/gstaudiofiltertemplate.c:
+         Moved from gstaudiofilterexample, object name changed, code added
+         so that it actually works.
+         * gst-libs/gst/audio/make_filter:
+         Script to build an audiofilter subclass from the template.
+         * gst/colorspace/Makefile.am:
+         * gst/colorspace/yuv2yuv.c:
+         Remove file, since it's GPL, and we don't use it.
+
+2004-01-15 10:45:55 +0000  Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+         [MOVED FROM BAD 02/68] gst/colorspace/: Fix compiling... Didn't test if it actually works.
+         Original commit message from CVS:
+         2004-01-15  Ronald Bultje  <rbultje@ronald.bitfreak.net>
+         * gst/colorspace/gstcolorspace.c:
+         * gst/colorspace/yuv2yuv.c: (gst_colorspace_yuy2_to_i420),
+         (gst_colorspace_i420_to_yv12):
+         Fix compiling... Didn't test if it actually works.
+
+2004-01-15 08:58:22 +0000  David Schleef <ds@schleef.org>
+
+         [MOVED FROM BAD 01/68] Duplicate the ext/hermes colorspace plugin, and remove Hermes code and GPL code.  Fix for new caps negotiation.  Rewr...
+         Original commit message from CVS:
+         * configure.ac:
+         * gst/colorspace/Makefile.am:
+         * gst/colorspace/gstcolorspace.c:
+         * gst/colorspace/gstcolorspace.h:
+         * gst/colorspace/yuv2rgb.c:
+         * gst/colorspace/yuv2rgb.h:
+         Duplicate the ext/hermes colorspace plugin, and remove Hermes
+         code and GPL code.  Fix for new caps negotiation.  Rewrite
+         much of the format handling code, and some of the conversion
+         code.  Basically, rewrote almost everything.  This element
+         handles I420, YV12 to RGB conversions.
+         * ext/hermes/Makefile.am:
+         * ext/hermes/gsthermescolorspace.c:
+         Rename colorspace to hermescolorspace.  Fix negotiation issues.
+         Remove non-Hermes related code.  This element handles lots of
+         RGB to RGB conversions, but no YUV.
+         * ext/hermes/gstcolorspace.c:
+         * ext/hermes/gstcolorspace.h:
+         * ext/hermes/rgb2yuv.c:
+         * ext/hermes/yuv2rgb.c:
+         * ext/hermes/yuv2rgb.h:
+         * ext/hermes/yuv2rgb_mmx16.s:
+         * ext/hermes/yuv2yuv.c:
+         * ext/hermes/yuv2yuv.h:
+         Remove old code.
+
+2011-06-15 15:08:32 +0100  Christian Fredrik Kalager Schaller <christian.schaller@collabora.co.uk>
+
+       * gst-plugins-base.spec.in:
+         Add gobject introspection files to spec
+
+2011-06-15 14:53:56 +0100  Christian Fredrik Kalager Schaller <christian.schaller@collabora.co.uk>
+
+       * gst-plugins-base.spec.in:
+         remove old v4l plugin from spec file
+
+2011-06-15 14:49:41 +0100  Christian Fredrik Kalager Schaller <christian.schaller@collabora.co.uk>
+
+       * tests/examples/Makefile.am:
+         Add missing dist subdir
+
+2011-06-15 14:21:30 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/audio/Makefile.am:
+         audio: link test program against libgstaudio
+
+2011-06-15 13:01:34 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/examples/seek/seek.c:
+         seek: cleanup and use playbin after rename
+         Remove the static pipelines and other unused things
+         Use playbin
+
+2011-06-15 12:48:04 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * docs/design/draft-media-types.txt:
+         docs: add more media type
+
+2011-06-15 00:52:47 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * configure.ac:
+       * docs/plugins/Makefile.am:
+       * docs/plugins/gst-plugins-base-plugins-docs.sgml:
+       * docs/plugins/gst-plugins-base-plugins-sections.txt:
+       * docs/plugins/inspect/plugin-gnomevfs.xml:
+       * ext/Makefile.am:
+       * ext/gnomevfs/Makefile.am:
+       * ext/gnomevfs/gstgnomevfs.c:
+       * ext/gnomevfs/gstgnomevfs.h:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/gnomevfs/gstgnomevfssink.h:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/gnomevfs/gstgnomevfssrc.h:
+       * ext/gnomevfs/gstgnomevfsuri.c:
+       * ext/gnomevfs/gstgnomevfsuri.h:
+       * gst-libs/gst/pbutils/descriptions.c:
+       * gst-plugins-base.spec.in:
+       * po/POTFILES.in:
+       * tests/check/Makefile.am:
+       * tests/check/elements/.gitignore:
+       * tests/check/elements/gnomevfssink.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/scrubby.c:
+       * tests/icles/playback/decodetest.c:
+         gnomevfs: remove GnomeVFS plugin
+         The gio plugin replaces it.
+
+2011-06-15 00:35:58 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/Makefile.am:
+       * tests/check/elements/.gitignore:
+       * tests/check/elements/decodebin.c:
+       * tests/check/elements/decodebin2.c:
+       * tests/check/elements/playbin-compressed.c:
+       * tests/check/elements/playbin.c:
+       * tests/check/elements/playbin2-compressed.c:
+       * tests/check/elements/playbin2.c:
+         tests: fix up unit tests for playbin2/decodebin2 renames and updates
+         Even if they don't work yet.
+
+2011-06-15 00:32:23 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * docs/design/design-decodebin.txt:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplay-marshal.list:
+       * gst/playback/gsturidecodebin.c:
+         uridecodebin, decodebin: remove new-decoded-pad and removed-decoded-pad signals
+         They were deprecated, use "pad-added" and "pad-removed" instead.
+
+2011-06-15 00:06:09 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gststreamsynchronizer.c:
+         playback: rename playbin2 to playbin
+         But keep source file name as-is for now.
+
+2011-06-15 00:02:13 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/playback/Makefile.am:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplayback.c:
+       * gst/playback/gstplayback.h:
+       * gst/playback/gsturidecodebin.c:
+         playback: merge playbin and decodebin plugins into one single playback plugin again
+
+2011-06-14 23:51:29 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/playback/gsturidecodebin.c:
+         decodebin2: rename decodebin2 to decodebin
+         But don't rename source file for now, which hopefully
+         makes merging from master easier.
+
+2011-06-14 23:42:27 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/playback/Makefile.am:
+       * gst/playback/README:
+       * gst/playback/gstdecodebin.c:
+       * gst/playback/gstplayback.c:
+       * gst/playback/gstplaybasebin.c:
+       * gst/playback/gstplaybasebin.h:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gststreaminfo.c:
+       * gst/playback/gststreaminfo.h:
+         playback: remove old playbin and decodebin elements
+
+2011-06-15 01:55:31 +0530  Debarshi Ray <rishi@gnu.org>
+
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+       * gst/tcp/gsttcpclientsink.c:
+         Remove unused but set variables
+         This is needed to satisfy the new -Wunused-but-set-variable added in
+         GCC 4.6: http://gcc.gnu.org/gcc-4.6/changes.html
+
+2011-06-14 18:25:47 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * docs/design/draft-media-types.txt:
+         docs: add beginnings of new media types design doc
+         Start with new video media types and properties
+
+2011-06-14 15:20:37 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-06-14 10:31:18 +0530  Debarshi Ray <rishi@gnu.org>
+
+       * gst-libs/gst/pbutils/codec-utils.c:
+         codec-utils: restore 7350 as a valid sampling frequency for AAC
+         This was lost during c77f88cac675a1dbb89e40da8e3c28320523bfca.
+
+2011-06-09 18:30:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstid3tag.c:
+       * gst-libs/gst/tag/gstvorbistag.c:
+       * gst-libs/gst/tag/tag.h:
+         libs: replace G_CONST_RETURN with 'const'
+         G_CONST_RETURN will be deprecated soon.
+         https://bugzilla.gnome.org/show_bug.cgi?id=652211
+
+2011-05-31 22:14:09 -0700  David Schleef <ds@schleef.org>
+
+       * gst/audioresample/resample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/videoscale/vs_4tap.c:
+       * gst/videotestsrc/generate_sine_table.c:
+       * gst/videotestsrc/videotestsrc.c:
+       * tests/icles/test-xoverlay.c:
+         convert M_PI to G_PI, for msvc
+
+2011-06-06 14:41:41 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst-libs/gst/tag/gsttagdemux.c:
+         tagdemux: no input data implies no type can be found
+         ... and posting a proper error message to this effect is appropriately
+         informative and prevents auto-plugging otherwise stalling.
+
+2011-06-04 13:36:55 -0700  David Schleef <ds@schleef.org>
+
+       * gst/adder/gstadder.c:
+         adder: Work around changes in g_atomic API
+         See #651514 for details.
+
+2011-05-31 20:38:56 -0700  David Schleef <ds@schleef.org>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+         discoverer: fix c99-ism
+
+2011-05-23 16:02:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/subparse/gstsubparse.c:
+         subparse: Try to typefind even if conversion to UTF8 failed
+         Fixes bug #600043.
+
+2011-05-23 15:51:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/subparse/gstsubparse.c:
+         subparse: Interprete typefind strings passed to GRegex as raw bytes instead of valid UTF8
+
+2011-05-20 10:48:39 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/lang.c:
+         lang: fix possible array overrun
+         We where checking for i<G_N_ELEMENTS, but where accessing i+1.
+
+2011-06-14 10:31:18 +0530  Debarshi Ray <rishi@gnu.org>
+
+       * gst-libs/gst/pbutils/codec-utils.c:
+         codec-utils: restore 7350 as a valid sampling frequency for AAC
+         This was lost during c77f88cac675a1dbb89e40da8e3c28320523bfca.
+
+2011-06-13 19:09:05 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-06-13 16:32:56 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstrtcpbuffer.c:
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+       * gst-libs/gst/tag/gstexiftag.c:
+       * gst-libs/gst/tag/gstxmptag.c:
+       * gst/gdp/gstgdppay.c:
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+       * tests/examples/app/appsrc-ra.c:
+       * tests/examples/app/appsrc-seekable.c:
+       * tests/examples/app/appsrc-stream.c:
+       * tests/examples/app/appsrc-stream2.c:
+         -base: update for buffer API change
+
+2011-06-13 16:28:58 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstbasertppayload.h:
+         basertppayload: cleanup header
+
+2011-06-13 12:15:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+         theoradec: use _check_reconfigure method
+
+2011-06-13 12:09:34 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/videotestsrc/gstvideotestsrc.h:
+         videotestsrc: use baseclass allocator negotiation logic
+         Let the baseclass implement the negotiation of the allocators.
+         Influence the allocator buffersize.
+         Use the fill vmethod to fill the buffer with data.
+
+2011-06-11 20:47:01 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         ximage: fix alignment and size
+         Set the right alignment and size in the bufferpool.
+
+2011-06-11 18:54:44 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * ext/theora/gsttheoradec.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagepool.c:
+       * sys/xvimage/xvimagesink.c:
+         update for bufferpool api change
+
+2011-05-31 22:14:09 -0700  David Schleef <ds@schleef.org>
+
+       * gst/audioresample/resample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/videoscale/vs_4tap.c:
+       * gst/videotestsrc/generate_sine_table.c:
+       * gst/videotestsrc/videotestsrc.c:
+       * tests/icles/test-xoverlay.c:
+         convert M_PI to G_PI, for msvc
+
+2011-06-07 21:30:18 -0700  David Schleef <ds@schleef.org>
+
+       * ext/ogg/gstoggmux.c:
+       * ext/ogg/gstoggmux.h:
+         oggmux: refactor how EOS is determined
+         This decreases the number of buffers held on each pad by one,
+         eliminating next_buffer.  Simplifies the logic by relying solely
+         on CollectPads to let us know when a pad is in EOS.  As a side
+         benefit, the collect pads related code is structured more like
+         other CollectPad users.
+         The previous code would occasionally mark the wrong pad as EOS,
+         causing the code to get in a state where all the streams were
+         finished, but EOS hadn't been sent to the source pad.
+
+2011-06-10 18:04:29 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * ext/theora/gsttheoradec.c:
+         update for alignment change
+
+2011-06-10 17:58:48 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggdemux.c:
+         oggdemux: small cleanups
+
+2011-06-10 17:58:26 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videotestsrc/gstvideotestsrc.c:
+         videotestsrc: fix for alignment value change
+
+2011-06-10 12:14:57 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         tests/examples/audio/Makefile.am
+         tests/examples/v4l/Makefile.am
+
+2011-06-10 11:59:53 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggdemux.c:
+       * gst/adder/gstadder.c:
+       * gst/encoding/gstsmartencoder.c:
+         -base: fix for flush_stop event API change
+
+2011-06-09 18:30:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstid3tag.c:
+       * gst-libs/gst/tag/gstvorbistag.c:
+       * gst-libs/gst/tag/tag.h:
+         libs: replace G_CONST_RETURN with 'const'
+         G_CONST_RETURN will be deprecated soon.
+         https://bugzilla.gnome.org/show_bug.cgi?id=652211
+
+2011-06-09 00:02:07 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Fix LocationShown syntax
+         According to the specification, the LocationShown requires its
+         struct fields to be inside a Bag type.
+
+2011-06-09 11:52:32 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+         visual: small improvements
+
+2011-06-08 14:21:40 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Add room for extra namespace definitions
+         Adds an extra field to the namespace definitions of the schemas
+         so they can add the namespace of any array/struct fields they
+         might use internally.
+
+2011-06-08 13:43:28 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/playback/gsturidecodebin.c:
+         playback: changes for message API changes
+
+2011-06-08 12:21:43 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * ext/pango/Makefile.am:
+       * gst/audioresample/Makefile.am:
+       * tests/check/Makefile.am:
+       * tests/examples/v4l/Makefile.am:
+         GST_PLUGINS_BASE_LIBS is not defined in -base.
+
+2011-06-08 11:33:07 +0200  Christophe Fergeau <cfergeau@redhat.com>
+
+       * tests/examples/audio/Makefile.am:
+         examples: don't link testchannels example with system libgstaudio
+         The testchannels audio test program is using -lgstaudio-0.10 to link
+         with libgstaudio which won't use the gstaudio library that was just
+         built but the one from the system. This is an issue since it means
+         we won't be testing the code from the current source tree, and it
+         also breaks the build when building on a system which don't have
+         a libgstaudio yet.
+         https://bugzilla.gnome.org/show_bug.cgi?id=652100
+
+2011-06-08 11:11:05 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * docs/design/design-decodebin.txt:
+         docs: add some text about parser/decoder autoplugging issues
+
+2011-06-07 20:43:24 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * Makefile.am:
+       * configure.ac:
+       * docs/plugins/gst-plugins-base-plugins-docs.sgml:
+       * docs/plugins/inspect/plugin-video4linux.xml:
+       * gst-plugins-base.spec.in:
+       * gst/videorate/gstvideorate.c:
+       * po/POTFILES.in:
+       * sys/Makefile.am:
+       * sys/v4l/.gitignore:
+       * sys/v4l/Makefile.am:
+       * sys/v4l/README:
+       * sys/v4l/TODO:
+       * sys/v4l/gstv4l.c:
+       * sys/v4l/gstv4lcolorbalance.c:
+       * sys/v4l/gstv4lcolorbalance.h:
+       * sys/v4l/gstv4lelement.c:
+       * sys/v4l/gstv4lelement.h:
+       * sys/v4l/gstv4ljpegsrc.c:
+       * sys/v4l/gstv4ljpegsrc.h:
+       * sys/v4l/gstv4lmjpegsink.c:
+       * sys/v4l/gstv4lmjpegsink.h:
+       * sys/v4l/gstv4lmjpegsrc.c:
+       * sys/v4l/gstv4lmjpegsrc.h:
+       * sys/v4l/gstv4lsrc.c:
+       * sys/v4l/gstv4lsrc.h:
+       * sys/v4l/gstv4ltuner.c:
+       * sys/v4l/gstv4ltuner.h:
+       * sys/v4l/gstv4lxoverlay.c:
+       * sys/v4l/gstv4lxoverlay.h:
+       * sys/v4l/v4l_calls.c:
+       * sys/v4l/v4l_calls.h:
+       * sys/v4l/v4lmjpegsink_calls.c:
+       * sys/v4l/v4lmjpegsink_calls.h:
+       * sys/v4l/v4lmjpegsrc_calls.c:
+       * sys/v4l/v4lmjpegsrc_calls.h:
+       * sys/v4l/v4lsrc_calls.c:
+       * sys/v4l/v4lsrc_calls.h:
+       * sys/v4l/videodev_mjpeg.h:
+       * tests/examples/Makefile.am:
+       * tests/examples/v4l/.gitignore:
+       * tests/examples/v4l/Makefile.am:
+       * tests/examples/v4l/probe.c:
+         Remove v4l plugin
+         The old v4l interface has been deprecated for years and even
+         been removed from the kernel headers. If anyone still needs
+         this plugin, they can resurrect it in gst-plugins-bad, there's
+         no reason for it to be in -base.
+
+2011-06-07 16:18:40 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+         rtp: use new memory alloc API
+
+2011-06-07 12:06:22 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+         event: fix some event leaks
+
+2011-06-07 11:55:36 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggaviparse.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * gst/videorate/gstvideorate.c:
+         -base: use caps event
+         Remove uses of setcaps function and use the caps event.
+
+2011-06-07 10:58:27 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/adder/gstadder.c:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/encoding/gststreamcombiner.c:
+       * gst/encoding/gststreamsplitter.c:
+       * gst/subparse/gstssaparse.c:
+         -base: use caps event instead of setcapsfunction
+
+2011-06-06 16:27:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         ext/theora/gsttheoraenc.c
+
+2011-06-06 12:03:50 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/videotestsrc/gstvideotestsrc.h:
+         videotestsrc: remove deprecated peer-alloc property
+         Remove the peer-alloc property, it's not used anymore because pad-alloc is gone.
+
+2011-06-06 14:30:03 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * configure.ac:
+         configure: also define GST_DISABLE_XML for now to fix subparse build
+
+2011-06-06 14:41:41 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst-libs/gst/tag/gsttagdemux.c:
+         tagdemux: no input data implies no type can be found
+         ... and posting a proper error message to this effect is appropriately
+         informative and prevents auto-plugging otherwise stalling.
+
+2011-06-06 12:48:23 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * ext/ogg/gstoggmux.c:
+       * ext/ogg/gstoggmux.h:
+         oggmux: determine granulepos metadata using stream mapper whenever possible
+         ... which unfortunately is not the case for all types, but at least so for
+         most common ones.
+
+2011-06-06 12:46:05 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * ext/ogg/gstoggmux.c:
+         oggmux: convert incoming buffer timestamp to running time
+         ... so all subsequent manipulation can take place in the proper timeline
+         without further ado.
+
+2011-06-01 20:48:44 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * ext/ogg/gstoggmux.c:
+         oggmux: remove superfluous code
+         ... since there is nothing in oggstream that cares (or even should)
+         about granulepos for what is being asked from it.
+
+2011-06-05 23:47:37 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * po/af.po:
+       * po/az.po:
+       * po/bg.po:
+       * po/ca.po:
+       * po/cs.po:
+       * po/da.po:
+       * po/de.po:
+       * po/el.po:
+       * po/en_GB.po:
+       * po/es.po:
+       * po/eu.po:
+       * po/fi.po:
+       * po/fr.po:
+       * po/gl.po:
+       * po/hu.po:
+       * po/id.po:
+       * po/it.po:
+       * po/ja.po:
+       * po/lt.po:
+       * po/lv.po:
+       * po/nb.po:
+       * po/nl.po:
+       * po/or.po:
+       * po/pl.po:
+       * po/pt_BR.po:
+       * po/ro.po:
+       * po/ru.po:
+       * po/sk.po:
+       * po/sl.po:
+       * po/sq.po:
+       * po/sr.po:
+       * po/sv.po:
+       * po/tr.po:
+       * po/uk.po:
+       * po/vi.po:
+       * po/zh_CN.po:
+         po: update for removed translatable strings
+
+2011-06-05 23:47:58 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/subparse/gstsubparse.c:
+         subparse: fix indentation
+
+2011-06-05 23:44:47 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * configure.ac:
+         configure: define USE_XML conditional used by subparse as FALSE for now
+         The subparse plugin needs to be split and/or moved to ext/ for the
+         libxml2 dependency. The media type needs to be format-specific instead
+         of a catch-all format. Maybe add a base class or line-based adapter.
+
+2011-06-04 13:36:55 -0700  David Schleef <ds@schleef.org>
+
+       * gst/adder/gstadder.c:
+         adder: Work around changes in g_atomic API
+         See #651514 for details.
+
+2011-05-31 20:38:56 -0700  David Schleef <ds@schleef.org>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+         discoverer: fix c99-ism
+
+2011-06-03 16:29:00 +0200  Luis de Bethencourt <luis.debethencourt@collabora.como>
+
+       * ext/theora/gsttheoraenc.c:
+         theora: separate encode and push block in chain, into own function.
+
+2011-06-03 19:10:33 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/elements/vorbistag.c:
+         check/vorbistag: Convert to new probe API
+
+2011-06-03 19:07:44 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/pipelines/vorbisenc.c:
+         check/vorbisenc: Convert to new probe API
+
+2011-06-03 19:00:23 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/pipelines/oggmux.c:
+         check/oggmux: Convert to new probe API
+
+2011-06-03 15:51:08 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/elements/playbin2.c:
+         check/playbin2: Update for caps and structure API changes
+
+2011-06-03 12:19:49 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/elements/gnomevfssink.c:
+         check: Use new gst_event_new_segment() API
+
+2011-06-03 11:48:43 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/examples/audio/Makefile.am:
+         examples: Link against proper libgstaudio
+         It was previously attempting to link against the non-local one.
+
+2011-06-03 19:00:39 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * ext/ogg/gstoggmux.c:
+         oggmux: Use the GstPad (and not the GstOggPadData for GstPad functions
+         For those willing, renaming that 'pad' variable to something more obvious
+         would be nice to avoid such bugs...
+
+2011-06-03 13:35:49 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoraenc.c:
+         thoeraenc: port to 0.11
+
+2011-06-03 13:31:42 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         ext/theora/gsttheoraenc.c
+
+2011-06-03 13:16:09 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/typefind/gsttypefindfunctions.c:
+         typefind: fix after merge
+
+2011-06-03 13:12:31 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstsubtitleoverlay.c:
+         playback: fix compilation after ghostpad setcaps removal
+
+2011-06-02 19:08:41 +0200  Luis de Bethencourt <luis.debethencourt@collabora.como>
+
+       * ext/theora/gsttheoraenc.c:
+         theora: use fixed src cap pads
+
+2011-06-02 18:57:05 +0200  Luis de Bethencourt <luis.debethencourt@collabora.como>
+
+       * ext/theora/gsttheoraenc.c:
+       * ext/theora/gsttheoraenc.h:
+         theora: set the width/height/par on the srcpad caps
+
+2011-06-02 17:29:53 +0200  Luis de Bethencourt <luis.debethencourt@collabora.como>
+
+       * ext/theora/gsttheoraenc.c:
+         theora: get sink caps info from downstream element pad
+         https://bugzilla.gnome.org/show_bug.cgi?id=651564
+
+2011-06-02 19:26:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-06-02 19:21:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstbasertpaudiopayload.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.h:
+         basertp: use caps event instead of setcaps function
+         Use the caps event instead of the setcaps function to configure caps.
+         Use a default event handler for the base rtp payloader instead of the awkward
+         way of handling the return value.
+
+2011-05-27 14:41:39 -0700  Patrick McCarty <patrick.mccarty@intel.com>
+
+       * gst-libs/gst/pbutils/descriptions.c:
+         pbutils: add description for wbmp images.
+         https://bugzilla.gnome.org/show_bug.cgi?id=651294
+
+2011-06-02 00:55:41 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst/typefind/gsttypefindfunctions.c:
+         typefinding: add typefinder for WAP WBMP bitmaps
+         https://bugzilla.gnome.org/show_bug.cgi?id=651294
+
+2011-06-02 12:21:28 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: fix header after merge
+
+2011-06-02 12:18:13 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         gst-libs/gst/video/video.h
+         gst/playback/gstplaysinkaudioconvert.c
+         gst/playback/gstplaysinkvideoconvert.c
+         tests/check/libs/rtp.c
+
+2011-06-02 12:12:04 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+         playsinconvert: clear the probe id when removing
+
+2011-06-02 12:08:22 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/playback/gstplaysink.c:
+         playsink: refactor block/unblock code a little
+
+2011-06-02 11:53:10 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+         playsink: Fix deadlock in the audio/video converter bins when linking fails
+
+2011-06-01 19:34:54 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst/playback/gstdecodebin.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybasebin.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkaudioconvert.h:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.h:
+       * gst/playback/gststreaminfo.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/playback/gstsubtitleoverlay.h:
+       * gst/playback/gsturidecodebin.c:
+       * tests/icles/audio-trickplay.c:
+         probes: port to new API for blocking and probes
+
+2011-06-01 17:31:35 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/Makefile.am:
+         check: ... and don't forget to add the new arm header
+         Forgot it in my previous commit
+
+2011-06-01 17:24:30 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * tests/check/libs/libsabi.c:
+       * tests/check/libs/struct_arm.h:
+         libsabi: Add structure sizes for arm
+
+2011-05-31 19:57:57 -0700  David Schleef <ds@schleef.org>
+
+       * gst-libs/gst/fft/gstfftf32.c:
+       * gst-libs/gst/fft/gstfftf64.c:
+       * gst-libs/gst/fft/gstffts16.c:
+       * gst-libs/gst/fft/gstffts32.c:
+         fft: s/M_PI/G_PI/ for MSVC
+
+2011-05-31 11:05:03 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/volume/gstvolume.c:
+       * gst/volume/gstvolumeorc.orc:
+       * tests/check/elements/volume.c:
+         volume: Fix handling of volume>=4.0 for 8 and 16 bit integer formats
+         Also add a unit test for this. Previously volumes bigger than 4.0
+         would have resulted in overflows in the fixed point processing.
+         Fixes bug #649642.
+
+2011-05-30 18:36:14 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstsubtitleoverlay.c:
+         playbin: fixed for new pad block API
+
+2011-05-30 17:14:48 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggdemux.c:
+         oggdemux: activate pad before pushing things
+         Activate the pad before pushing things on it or else we get errors.
+
+2011-05-29 13:32:04 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/elements/adder.c:
+       * tests/check/elements/ffmpegcolorspace.c:
+       * tests/check/elements/vorbistag.c:
+       * tests/check/libs/rtp.c:
+       * tests/check/pipelines/theoraenc.c:
+         tests: fix some more unused-but-set-variable warnings with gcc 4.6
+
+2011-05-28 16:14:23 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * win32/common/libgstvideo.def:
+         win32: update .def file for new API
+
+2011-05-28 12:39:06 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * Makefile.am:
+       * tests/check/elements/.gitignore:
+         Ignore new playbin2-compress test binary
+         And add old testchannels binary to CRUFT_FILES.
+
+2011-05-27 23:31:27 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: sprinkle some G_GNUC_CONST
+         Mark functions that have no effect besides their return value and
+         only inspect their input arguments with G_GNUC_CONST. (We just
+         ignore the g_return_val_if_fail() guards for this)
+
+2011-05-27 23:25:00 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/video/video.h:
+         video: clean up header file
+         Sprinkle some spaces and newlines here and there.
+
+2011-05-27 14:30:19 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/videoscale/gstvideoscale.c:
+         videoscale: Optimize transform_caps()
+         If the second and next caps structures are a subset of the already existing
+         transformed caps we can safely skip them because we would transform them to
+         the same caps again.
+
+2011-05-27 14:28:46 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+         ffmpegcolorspace: Optimize transform_caps()
+         If the second and next caps structures are a subset of the already existing
+         transformed caps we can safely skip them because we would transform them to
+         the same caps again.
+
+2011-05-27 14:20:08 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioresample/gstaudioresample.c:
+         audioresample: Optimize transform_caps()
+         If the second and next caps structures are a subset of the already existing
+         transformed caps we can safely skip them because we would transform them to
+         the same caps again.
+
+2011-05-27 14:10:50 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioconvert/gstaudioconvert.c:
+         audioconvert: Use new gst_caps_is_subset_structure() API
+         This prevents one copy of every structure and creating a new caps
+         instance.
+
+2011-05-27 15:03:19 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * configure.ac:
+       * gst-libs/gst/audio/.gitignore:
+       * gst-libs/gst/audio/Makefile.am:
+       * gst-libs/gst/audio/testchannels.c:
+       * tests/examples/Makefile.am:
+       * tests/examples/audio/.gitignore:
+       * tests/examples/audio/Makefile.am:
+       * tests/examples/audio/testchannels.c:
+         audio: move testchannels example to 'tests/examples' dir
+         Also fix it up a little to not include 'c' file but link to the libs instead.
+
+2011-05-27 13:58:41 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-05-27 13:13:42 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioconvert/gstaudioconvert.c:
+         audioconvert: Optimize transform_caps()
+         If the second and next caps structures are a subset of the already existing
+         transformed caps we can safely skip them because we would transform them to
+         the same caps again.
+         This makes gst_pad_get_caps() on an audiotestsrc ! audioconvert !
+         audioconvert ! audioconvert ! fakesink pipeline about 1.7 times faster.
+
+2011-05-27 12:13:32 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/elements/audioconvert.c:
+         audioconvert: Fix audioconvert unit test to work again
+
+2011-05-27 12:13:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioconvert/gstaudioconvert.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+       * gst/videoscale/gstvideoscale.c:
+         gst: Update for the GstBaseTransform::transform_caps() changes
+
+2011-05-27 11:39:21 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/pbutils/codec-utils.c:
+         code-utile: fix level descriptions for fgs
+         fgs levels range from 8-13 and are mapped to 0-5.
+
+2011-05-25 14:38:21 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/pbutils/codec-utils.c:
+         codec-utils: fix mpeg4 level verification
+         The current condition would never be true. As levels<6 are asp and levels>7 and
+         <14 are fgs, we should return NULL for cases 6,7,14,15.
+
+2011-05-26 16:08:44 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstsubtitleoverlay.c:
+         -base: change for changed set_blocked API
+
+2011-05-26 13:47:24 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-05-26 12:33:08 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: Fallback to non-XShm mode if allocating the XShm image failed
+         Fixes bug #630442.
+
+2011-05-26 12:30:31 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: Fallback to non-XShm mode if allocating the XShm image failed
+         Fixes bug #630442.
+
+2011-05-26 11:41:50 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaybin2.c:
+         playbin2: Let the input-selectors sync all streams to the running time
+         This is especially needed when switching between a non-sparse and sparse
+         video stream, see bug #537382. It also lowers the time needed for switching
+         between streams a bit.
+
+2011-01-20 00:52:50 -0700  Lane Brooks <dirjud@gmail.com>
+
+       * ext/pango/gsttextoverlay.c:
+       * ext/pango/gsttextoverlay.h:
+         textoverlay: added 'outline-color' parameter to control whether text gets a shadow
+
+2011-01-20 00:42:39 -0700  Lane Brooks <dirjud@gmail.com>
+
+       * ext/pango/gsttextoverlay.c:
+       * ext/pango/gsttextoverlay.h:
+         textoverlay: added 'shadow' option to control whether text gets a shadow
+
+2011-05-26 10:48:05 +0200  Jindrich Makovicka <makovick@gmail.com>
+
+       * ext/pango/gsttextrender.c:
+         textrender: Correctly negotiate with downstream instead of just using random caps
+         Fixes bug #638897.
+
+2011-05-26 10:43:51 +0200  Jindrich Makovicka <makovick@gmail.com>
+
+       * ext/pango/gsttextrender.c:
+         textrender: Add bound checks to not write outside the image area
+
+2011-05-26 10:42:46 +0200  Jindrich Makovicka <makovick@gmail.com>
+
+       * ext/pango/gsttextrender.c:
+         textrender: Prevent double unref of caps if the caps can't be set on the srcpad
+
+2011-05-26 10:31:11 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/gnomevfs/gstgnomevfssrc.c:
+         gnomevfssrc: Keep track of interruptions during read with a flag
+
+2010-09-03 09:11:30 -0400  American Dynamics <GStreamer-Bugs@tycosp.com>
+
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/gnomevfs/gstgnomevfssrc.h:
+         gnomevfssrc: Add support for cancelling the read operations
+         This allows the state change from PAUSED to READY to be faster.
+         Fixes bug #628337.
+
+2011-05-25 14:14:46 +0300  Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: Remove g_assert from interface query
+
+2011-05-25 14:08:43 +0300  Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: Remove the g_assert from interface query
+
+2011-05-26 00:17:40 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/audiotestsrc/gstaudiotestsrc.h:
+         audiotestsrc: add blue and violet noise by using spectral inversion
+         Add blue and violet noise by spectral inversion of pink and red noise.
+         Fixes #649969
+
+2011-05-25 23:40:26 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/audiotestsrc/gstaudiotestsrc.h:
+         audiotestsrc: add red (brownian) noise generator
+         Add another noise generator which produces a quite dark noise color.
+         Fixes parts of #649969.
+
+2010-09-27 13:32:31 +0400  Vladimir Eremeev <eremeev@atlantis.ru>
+
+       * tests/examples/seek/seek.c:
+         seek: set selected/default audio/video sinks on playbin and playbin2
+         https://bugzilla.gnome.org/show_bug.cgi?id=630322
+
+2011-05-25 19:03:44 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/examples/seek/seek.c:
+         seek: add --audiosink and --videosink command line options
+
+2011-05-25 18:50:34 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/examples/seek/seek.c:
+         seek: use the right GDK defines to differentiate between the backends
+
+2011-05-25 18:45:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/examples/seek/seek.c:
+         seek: use gst_filename_to_uri() to convert a filename to a uri
+
+2010-09-27 12:46:54 +0400  Vladimir Eremeev <eremeev@atlantis.ru>
+
+       * tests/examples/seek/seek.c:
+         seek: make seek example work in win32
+         https://bugzilla.gnome.org/show_bug.cgi?id=630322
+
+2011-05-25 16:08:54 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * configure.ac:
+         configure: update GLib requirement to >= 2.24
+         Same as core (make implicit requirement explicit).
+         http://gstreamer.freedesktop.org/wiki/ReleasePlanning/GLibRequirement
+
+2011-05-25 15:24:33 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * ext/theora/gsttheoraenc.c:
+         theoraenc: remove bogus <0 check for unsigned var
+         bytes_written is a gsize which is unsigned and thus never < 0.
+
+2011-05-25 15:23:13 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * ext/theora/gsttheoraenc.c:
+         theoraenc: fix variable type for bytes_consumed
+         th_encode_ctl() returns an int. Using a gsize result in bogus <0 checks.
+
+2011-05-25 15:04:20 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/riff/riff-read.c:
+         riff: remove the g_return_if_fail as we test it below
+         We don't want to return without setting taglist=NULL if asserts are on and with
+         setting taglist=NULL otherwise.
+
+2011-05-25 14:28:18 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst/volume/gstvolume.c:
+         volume: use a flag for 'mute' using the controller
+         Previously we checked mute_csource to determine wheter we need to premultiply
+         volumes and mute values. That fails as we unrefs mute_csource and set it to
+         NULL after. Use an extra flag instead.
+
+2011-05-25 14:12:50 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/gstexiftag.c:
+         exiftag: reflow the code
+         Move the warning on unsupported units to the swicth-case. Move fetching the
+         pending tags down to where we use them.
+
+2011-05-25 13:59:57 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/gstexiftag.c:
+         exiftag: set value=1 if we found the token
+         Otherwise we never write the tag. This would also be consistent with the code in
+         deserialize_scene_type().
+
+2011-05-25 12:30:51 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: run gst-indent
+
+2011-05-25 12:29:21 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: remove unneded !=NULL checks
+         We check for matching_attr!=NULL right before already.
+
+2011-05-24 18:21:06 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/mixerutils.c:
+       * gst/encoding/gstencodebin.c:
+       * gst/playback/gstplaybin2.c:
+       * tests/check/elements/libvisual.c:
+         feature: use object name instaed of feature name
+
+2011-05-24 17:37:45 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgiobasesrc.c:
+       * ext/gio/gstgiosrc.c:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/ogg/gstoggdemux.c:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/audio/gstbaseaudiosrc.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+         scheduling: port to new scheduling query
+
+2011-05-24 10:46:48 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+         theoradec: handle reconfigure events
+         Handle the caps with the caps event.
+         Handle the reconfigure event and renegotiate the bufferpool when needed.
+
+2011-05-24 09:55:47 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/convertframe.c:
+         convertframe: fix for merge conflict
+
+2011-05-24 09:47:15 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         gst-libs/gst/video/convertframe.c
+
+2011-05-24 09:45:18 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         x11: free bufferpool whe activation fails
+
+2011-05-24 00:13:04 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+         docs: massage the section file more
+         Add more symbols (from unused.txt). Move the whole bunch of riff-fourcc defines
+         to std section too (no one is hoing to document them, right).
+
+2011-05-24 00:12:26 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/video/video.c:
+         docs: add missing parameter docs
+
+2011-05-23 23:53:38 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+         docs: move the riff structure to std-section
+         If someone intents to document them and the fields we can move them back.
+
+2011-05-23 23:53:06 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/libs/gst-plugins-base-libs-docs.sgml:
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+       * gst-libs/gst/pbutils/gstpluginsbaseversion.c:
+         docs: move pluginbaseversion to separate section as we have section docs
+
+2011-05-23 23:51:15 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+       * gst-libs/gst/rtsp/gstrtspdefs.h:
+         docs: add minimal docblobs for status code and headers
+         Use a trick to avoid documenting all 100 enums.
+
+2011-05-23 23:41:56 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/interfaces/xoverlay.c:
+       * gst-libs/gst/interfaces/xoverlay.h:
+         docs: update xoverlay docs for api addition and deprecation
+
+2011-05-23 23:12:50 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/rtp/gstbasertpaudiopayload.c:
+       * gst-libs/gst/rtp/gstbasertpaudiopayload.h:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.h:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.h:
+         docs: rtp library docs update
+
+2011-05-23 22:58:22 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/audio/gstringbuffer.h:
+       * gst-libs/gst/cdda/gstcddabasesrc.h:
+       * gst-libs/gst/interfaces/colorbalance.h:
+       * gst-libs/gst/interfaces/colorbalancechannel.h:
+       * gst-libs/gst/interfaces/mixer.h:
+       * gst-libs/gst/interfaces/mixeroptions.h:
+       * gst-libs/gst/interfaces/navigation.h:
+       * gst-libs/gst/interfaces/tuner.h:
+       * gst-libs/gst/video/gstvideofilter.h:
+       * gst-libs/gst/video/gstvideosink.h:
+         docs: add missing documentation for various pieces
+
+2010-02-19 12:54:18 +0100  Thijs Vermeir <thijsvermeir@gmail.com>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         baseaudiosink: recalibrate clock on setcaps
+         Because the spec for the ringbuffer can change when changing
+         the caps, we must recalibrate the clock.
+         https://bugzilla.gnome.org/show_bug.cgi?id=610443
+
+2011-05-23 16:02:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/subparse/gstsubparse.c:
+         subparse: Try to typefind even if conversion to UTF8 failed
+         Fixes bug #600043.
+
+2011-05-23 16:02:20 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/subparse/gstsubparse.c:
+         subparse: Compile the typefind regex with optimization to speed up matching
+
+2011-05-23 15:51:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/subparse/gstsubparse.c:
+         subparse: Interprete typefind strings passed to GRegex as raw bytes instead of valid UTF8
+
+2011-05-23 15:21:59 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/video/convertframe.c:
+         convertframe: fix docs
+         Fixup paramter mismatch between func and prototype. Add missing parameter docs.
+
+2011-05-23 15:08:24 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/audio/gstaudioclock.h:
+       * gst-libs/gst/audio/gstaudiofilter.h:
+       * gst-libs/gst/audio/gstaudiosrc.h:
+       * gst-libs/gst/audio/multichannel.h:
+         docs: fixup audio-library docs
+
+2011-05-23 15:02:27 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+       * gst-libs/gst/app/gstappsink.c:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst/app/gstapp.c:
+         docs: fixup appsrc/sink api docs
+
+2011-05-23 14:53:26 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/audio/gstaudioiec61937.c:
+       * gst-libs/gst/audio/gstaudioiec61937.h:
+         docs: fix docs for new api
+         Some parameters where wrong, first line missed the ':' and return docs where
+         broken.
+
+2011-05-23 14:45:23 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/libs/gst-plugins-base-libs-docs.sgml:
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+         docs: update xmp api docs
+         Add missing section. Add new section to main-sgml. Add missing function.
+
+2011-05-23 14:07:38 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         xmptag: remove late check
+         We deref the pointer two lines before already and besides this internal function
+         should not be called with this parameter=NULL.
+
+2011-05-23 14:01:29 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         xmptag: have the default branch as the last one
+
+2011-05-23 14:00:04 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         xmptag: an uint value can't be <0
+
+2011-05-23 13:53:06 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/video/video.c:
+         whitespace: trim trailing whitespace
+
+2011-05-23 13:50:59 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/video/video.c:
+         video.c: use a break and a final warning instead of early returns
+         Use breaks for case branches instead of return 0. We don't expect these to
+         happen anyway. Thus have a warning before the final return to make it easier to
+         see when things go out of sync.
+
+2011-05-23 13:49:01 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/video/video.c:
+         video.c: use g_assert_not_reached() for logical error here.
+         This will help to detect them closer to the source if they ever happen.
+
+2011-05-20 12:50:39 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: use new method
+         Use the new element class method to get the metadata from an element. Not all
+         elements might have an elementfactory.
+
+2011-05-20 12:32:35 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: Fix compilation after the removal of GstElementDetails
+
+2011-05-20 12:26:57 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         docs/plugins/gst-plugins-base-plugins.hierarchy
+         docs/plugins/gst-plugins-base-plugins.interfaces
+         docs/plugins/gst-plugins-base-plugins.prerequisites
+
+2011-05-20 10:48:39 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst-libs/gst/tag/lang.c:
+         lang: fix possible array overrun
+         We where checking for i<G_N_ELEMENTS, but where accessing i+1.
+
+2011-05-19 23:41:08 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * gst/audioconvert/gstaudioconvert.c:
+         audioconvert: cleanup helper code
+         make_lossless_changes() returns the same structure that we're passing (probably
+         to enable chaining). Instead of reusing s and making it point to s2 as well,
+         keep using s2. Drop the assignment which in the 2nd case is a dead one anyway.
+
+2011-05-19 23:25:24 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * docs/plugins/gst-plugins-base-plugins.args:
+       * docs/plugins/gst-plugins-base-plugins.hierarchy:
+       * docs/plugins/gst-plugins-base-plugins.interfaces:
+       * docs/plugins/gst-plugins-base-plugins.prerequisites:
+         docs: update plugin introspection data
+         Now more files are merged and produced in a canonical fashion, which hopefully
+         creates less or no delta in the future.
+
+2011-05-19 22:56:53 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * common:
+         Automatic update of common submodule
+         From 9e5bbd5 to 69b981f
+
+2011-05-19 15:56:57 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: implement ALLOCATION query
+
+2011-05-19 15:55:53 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: improve allocation query
+         If the allocation query contains the same caps as the current allocator, we can
+         return that one instead of making a new one.
+
+2011-05-19 13:40:29 +0100  Christian Fredrik Kalager Schaller <christian.schaller@collabora.co.uk>
+
+       * gst-plugins-base.spec.in:
+         Add new header file
+
+2011-05-19 13:38:55 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+         visual: fix upstream renegotiation
+         Fix a refcount problem.
+         Handle reconfiguration requests.
+
+2011-05-19 08:30:14 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: Autoplug formatters
+         Autoplug formatters for streams if a formatter with secondary or
+         higher rank is found. Formatters are autoplugged when there is no
+         muxer or when the muxer doesn't implement the tagsetter interface.
+         Currently only the first formatter found is plugged, this might
+         help in lots of cases, but it doesn't solve the
+         'lamemp3 ! xingmux ! id3mux'
+         case.
+         https://bugzilla.gnome.org/show_bug.cgi?id=649841
+
+2011-05-19 08:27:29 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: fix typos
+
+2011-05-19 12:42:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+         visual: improve negotiation
+         Remove the setcaps function on the srcpad, we know exactly when we negotiate a
+         new format now.
+         Use a caps event to configure new caps.
+
+2011-05-19 12:29:57 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/vorbis/gstvorbisdec.c:
+         vorbis: fix for new API
+
+2011-05-19 11:31:53 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-05-18 22:07:58 +0200  Aleix Conchillo Flaque <aleix@oblong.com>
+
+       * ext/vorbis/gstvorbisdec.c:
+         vorbisdec: Handle headers in caps
+
+2011-05-18 17:23:18 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/gio/gstgiobasesink.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/encoding/gstsmartencoder.c:
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/videorate/gstvideorate.c:
+         base: Update for SEGMENT event parse API changes
+
+2011-05-18 16:09:47 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * common:
+         Automatic update of common submodule
+         From fd35073 to 9e5bbd5
+
+2011-05-18 13:18:15 +0200  Robert Swain <robert.swain@collabora.co.uk>
+
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+       * tests/check/libs/video.c:
+         gstvideo: Add gst_video_get_size_from_caps function
+         gst_video_get_size_from_caps () allows easy calculation of the raw video
+         buffer size from some fixed video caps.
+         API: gst_video_get_size_from_caps()
+
+2011-05-18 12:24:02 +0300  Stefan Kost <ensonic@users.sf.net>
+
+       * common:
+         Automatic update of common submodule
+         From 46dfcea to fd35073
+
+2011-05-18 09:34:52 +0200  Robert Swain <robert.swain@collabora.co.uk>
+
+       * ext/alsa/gstalsasrc.c:
+         alsa: Remove unused but set variable
+         Unused but set variables cause warnings in GCC 4.6.x and newer.
+
+2011-05-17 13:04:27 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/adder/gstadder.c:
+       * gst/videorate/gstvideorate.c:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+         gst: Update for caps/pad template related API changes
+
+2011-05-17 13:03:57 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/elements/ffmpegcolorspace.c:
+       * tests/check/elements/videoscale.c:
+       * tests/check/elements/videotestsrc.c:
+         tests: Update for caps/pad template related API changes
+
+2011-05-17 13:01:39 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/alsa/gstalsasink.c:
+       * ext/alsa/gstalsasrc.c:
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstogmparse.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/vorbis/gstvorbisdec.c:
+         ext: Update for caps/pad template related API changes
+
+2011-05-17 12:54:41 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/v4l/gstv4lmjpegsrc.c:
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         sys: Update for caps/pad template related API changes
+
+2011-05-17 12:51:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: Update for caps/pad template related API changes
+
+2011-05-17 12:47:32 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/encoding-profile.c:
+       * gst-libs/gst/pbutils/encoding-profile.h:
+         encoding-profile: Returns a new reference of caps everywhere instead of const caps
+
+2011-05-17 12:29:24 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstaudiofilter.c:
+       * gst-libs/gst/audio/gstaudiofilter.h:
+         audiofilter: gst_pad_template_new() does not take ownership of the caps anymore
+         There's no need to copy the caps before passing them to that function.
+
+2011-05-17 11:27:12 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-05-17 11:25:31 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/gio/gstgiobasesink.c:
+       * ext/gio/gstgiobasesrc.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstogmparse.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraparse.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisparse.c:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/audio/gstbaseaudiosrc.c:
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/adder/gstadder.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/encoding/gststreamcombiner.c:
+       * gst/encoding/gststreamsplitter.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gsturidecodebin.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/videorate/gstvideorate.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * sys/v4l/gstv4lsrc.c:
+       * sys/xvimage/xvimagesink.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/seek.c:
+       * tests/icles/audio-trickplay.c:
+       * tests/icles/playback/test5.c:
+       * tests/icles/playback/test6.c:
+         Revert "-base_port to new query API"
+         This reverts commit c9f4e0676ba8c8074a50aa6d1d058f6da9a76b32.
+
+2011-05-17 11:24:18 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstdecodebin2.c:
+         Revert "decodebin2: Update for GstQuery related API changes"
+         This reverts commit 549128c2a3702a878c62f5603e097c8df7075f36.
+
+2011-05-17 10:20:36 +0200  Edward Hervey <edward.hervey@collabora.co.uk>
+
+       * gst-libs/gst/rtsp/gstrtspconnection.c:
+         rtsp: Fix typo which broke the build
+
+2011-05-17 09:31:01 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-05-16 15:35:50 +0200  Miguel Angel Cabrera Moya <madmac2501@gmail.com>
+
+       * gst-libs/gst/rtsp/gstrtspconnection.c:
+         rtspconnection: not enter in not controllable state unless it is necessary
+         When closing rtspsrc the state change blocks until the polling in the
+         connection timeouts. This is because the second time we loop to read a
+         full message controllable is set to FALSE in the poll group, even though no
+         message is half read.
+         This can be avoided by not setting controllable to FALSE the poll group
+         unless we had begin to read a message.
+         Fixes #610916
+
+2011-05-16 15:35:50 +0200  Miguel Angel Cabrera Moya <madmac2501@gmail.com>
+
+       * gst-libs/gst/rtsp/gstrtspconnection.c:
+         rtspconnection: not enter in not controllable state unless it is necessary
+         When closing rtspsrc the state change blocks until the polling in the
+         connection timeouts. This is because the second time we loop to read a
+         full message controllable is set to FALSE in the poll group, even though no
+         message is half read.
+         This can be avoided by not setting controllable to FALSE the poll group
+         unless we had begin to read a message.
+         Fixes #610916
+
+2010-05-30 13:21:00 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * ext/cdparanoia/gstcdparanoiasrc.c:
+       * ext/cdparanoia/gstcdparanoiasrc.h:
+         cdparanoiasrc: fix build on OSX by #undef-ing VERSION before including system headers
+         On OSX the cdparanoia headers include IOKit framework headers (in particular
+         SCSICmds_INQUIRY_Definitions.h) which define a structure that has a member
+         named VERSION, so we must #undef VERSION before including those for things
+         to compile on OSX.
+         Fixes #609918.
+
+2011-05-16 17:44:44 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/v4l/gstv4lsrc.c:
+         v4l: Make sure to return a subset of the filter caps in getcaps
+
+2011-05-16 17:30:13 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/v4l/gstv4lsrc.c:
+         v4lsrc: fix for new getcaps function
+
+2011-05-16 17:14:08 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/videorate/gstvideorate.c:
+         videorate: Update for segment API changes
+
+2011-05-16 17:13:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstdecodebin2.c:
+         decodebin2: Update for GstQuery related API changes
+
+2011-05-16 17:13:04 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.c:
+         playsink: Update for other 0.11 API changes
+
+2011-05-16 17:08:45 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaysink.c:
+         playsink: Use correct number of parameters to gst_pad_get_caps()
+
+2011-05-16 17:06:22 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         configure.ac
+         ext/alsa/gstalsasrc.c
+         gst-libs/gst/audio/gstbaseaudiosink.c
+         gst-libs/gst/tag/gstxmptag.c
+         gst/playback/gstsubtitleoverlay.c
+         gst/videorate/gstvideorate.c
+         sys/xvimage/xvimagesink.c
+
+2011-05-16 15:31:58 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/examples/encoding/encoding.c:
+       * tests/icles/playback/test.c:
+       * tests/icles/playback/test5.c:
+       * tests/icles/playback/test6.c:
+         tests: Update for negotiation related API changes
+
+2011-05-16 15:25:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisparse.c:
+         vorbis: Update for negotiation related API changes
+
+2011-05-16 15:19:35 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/theora/gsttheoraenc.c:
+       * ext/theora/gsttheoraparse.c:
+         theora: Update for negotiation related API changes
+
+2011-05-16 12:23:17 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/pango/gstbasetextoverlay.c:
+         textoverlay: Update for negotiation related API changes
+
+2011-05-16 12:20:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/ogg/gstoggparse.c:
+         ogg: Update for negotiation related API changes
+
+2011-05-16 12:18:03 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+         visual: Update for negotiation related API changes
+
+2011-05-16 12:17:49 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/alsa/gstalsasink.c:
+       * ext/alsa/gstalsasrc.c:
+         alsa: Update for negotiation related API changes
+
+2011-05-16 12:04:39 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: Update for negotiation related API changes
+
+2011-05-16 12:01:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/videorate/gstvideorate.c:
+         videorate: Update for negotiation related API changes
+
+2011-05-16 11:37:39 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/tcp/gsttcpclientsrc.c:
+         tcpclientsrc: Update for negotation related API changes
+
+2011-05-16 11:37:25 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioresample/gstaudioresample.c:
+         audioresample: Update for negotiation related API changes
+
+2011-05-16 11:33:12 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstdecodebin.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybasebin.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/playback/gsturidecodebin.c:
+         playback: Update for negotiation related API changes
+
+2011-05-16 11:26:17 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+         ffmpegcolorspace: Update for negotiation related API changes
+
+2011-05-16 11:04:30 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+       * gst/encoding/gstsmartencoder.c:
+       * gst/encoding/gststreamcombiner.c:
+       * gst/encoding/gststreamsplitter.c:
+         encodebin: Update for negotiation related API changes
+
+2011-05-16 10:56:11 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioconvert/gstaudioconvert.c:
+         audioconvert: Update for negotiation related API changes
+
+2011-05-16 10:52:59 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/adder/gstadder.c:
+         adder: Update for negotiation related API changes
+
+2011-05-16 10:48:35 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+         discoverer: Update for the new gst_pad_get_caps() signature
+
+2011-05-16 10:47:02 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/app/gstappsink.c:
+         appsink: Update for the negotiation related API changes
+
+2011-05-16 10:44:18 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.h:
+         basertppayload: Change ::get_caps to include the filter caps
+         And improve downstream negotiation a bit by passing our proposed
+         caps to the peer as a filter.
+
+2011-05-11 17:39:52 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: Update for negotiation related API changes
+
+2011-05-11 17:39:06 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/videotestsrc/gstvideotestsrc.c:
+         videotestsrc: Update for negotiation related API changes
+
+2011-05-16 12:02:48 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/videoscale/gstvideoscale.c:
+         videoscale: Update for negotiation related API changes
+
+2011-05-11 17:35:36 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/videoscale/gstvideoscale.c:
+         videoscale: basetransform is now better at trying passthrough, remove workaround
+
+2011-05-16 13:48:11 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgiobasesink.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstoggdemux.h:
+       * ext/ogg/gstoggmux.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisenc.h:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/audio/audio.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.h:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/adder/gstadder.c:
+       * gst/adder/gstadder.h:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/encoding/gstsmartencoder.c:
+       * gst/gdp/gstgdpdepay.c:
+       * gst/gdp/gstgdppay.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/subparse/gstssaparse.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/subparse/gstsubparse.h:
+       * gst/videorate/gstvideorate.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+         -base: port to new SEGMENT API
+
+2011-05-02 11:43:38 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst/videorate/gstvideorate.c:
+       * gst/videorate/gstvideorate.h:
+         videorate: optionally ensure maximum average output frame rate
+         See #628764.
+
+2011-04-29 14:58:02 +0200  Alexey Fisher <bug-track@fisher-privat.net>
+
+       * gst/videorate/gstvideorate.c:
+       * gst/videorate/gstvideorate.h:
+         videorate: optionally only drop frames to ensure maximum frame rate
+         This adds option to arrange for maximal allowed variable frame rate.
+         Fixes #628764.
+
+2011-04-26 13:37:51 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst/playback/gsturidecodebin.c:
+         uridecodebin: use bitrate to configure streaming buffer-duration default case
+         In particular, in audio only cases whose (estimated) metadata provides bitrate
+         information, the buffer-size based on such bitrate (and buffer-duration)
+         will be much more reasonable than queue2 default buffer-size.
+
+2011-04-26 11:27:40 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+
+       * gst/playback/gsturidecodebin.c:
+         uridecodebin: remove some dead code
+         ... which was dead as pads were never added to the list, and need not be added,
+         since removing them is handled by a pad callback.
+
+2011-04-29 11:48:02 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * tests/examples/encoding/Makefile.am:
+         encodebin: examples: Add missing base libs to makefile
+
+2011-04-28 10:58:15 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+         encodebin: Check for missing converters
+         Adds checks for missing video and audio converter elements
+
+2011-04-27 22:05:55 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/xmpwriter.c:
+         tag: xmpwriter: Rename documentation headers
+         Fix some wrong documentation headers from the first name
+         given to this interface.
+
+2011-04-19 08:41:53 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * tests/check/libs/tag.c:
+         tests: xmp: New tests for the Iptc4xmpExt tags
+
+2011-04-18 23:28:13 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Add Iptc4xmpExt schema support
+         Adds Iptc4xmpExt schema with country, city and sublocation
+         tags mapped
+
+2011-04-19 11:00:24 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Add support for reading struct tags
+         Adds a context variable that controls if the parsing is on
+         'top level' tags or inside a struct tag.
+
+2011-04-18 16:54:54 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Add struct xmp tag type support
+         Adds support for writing the xmp struct tag type, it is a compound tag
+         that has inner tags.
+
+2011-04-18 23:16:59 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Fixing schema maps
+         Do not forget to create a new schema for every supported schema
+         instead of reusing the same object
+
+2011-04-18 10:20:00 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         tag: xmp: Write the same tag to all schemas
+         Instead of writing only the xmp tag for the first found entry
+         that matches the gstreamer tag, look for all mappings to write
+         the tag to different schemas.
+         The rationale here is that some reader application might only
+         be interested on a particular schema tags, so we should try
+         to write as many tags for all schemas.
+
+2011-05-15 13:39:18 +0200  Edward Hervey <bilboed@bilboed.com>
+
+       * win32/common/libgstaudio.def:
+         win32: Update libgstaudio.def for new symbols
+
+2011-05-14 17:27:30 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstringbuffer.c:
+         baseaudiosink: Use g_str_equal() instead of strncmp()
+         The strncmp is unnecessary anyway since one of the strings is a const
+         string.
+
+2011-05-14 16:49:53 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         baseaudiosink: Fix trivial indentation problems
+
+2011-03-07 20:49:16 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * docs/libs/gst-plugins-base-libs-docs.sgml:
+       * docs/libs/gst-plugins-base-libs-sections.txt:
+       * gst-libs/gst/audio/Makefile.am:
+       * gst-libs/gst/audio/gstaudioiec61937.c:
+       * gst-libs/gst/audio/gstaudioiec61937.h:
+         audio: Add an IEC 61937 payloading library
+         This can be used by sinks to take compressed formats, correctly payload
+         these in IEC 61937 frames and feed these to sinks that support
+         passthrough output over IEC 60958 (S/PDIF) or, in the case of MP3, over
+         Bluetooth.
+         Initial implementation includes AC3, E-AC3, MPEG-1, MPEG-2 (non-AAC),
+         and DTS (type-I/II/II) payloading. More formats can be added as needed.
+         API: gst_audio_iec61937_frame_size()
+         API: gst_audio_iec61937_payload()
+         https://bugzilla.gnome.org/show_bug.cgi?id=642730
+
+2011-03-09 11:12:39 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.h:
+         baseaudiosink: Allow subclasses to provide payloaders
+         This allows subclasses to provide a "payload" function to prepare
+         buffers for consumption. The immediate use for this is for sinks that
+         can handle compressed formats - parsers are directly connected to the
+         sink, and for formats such as AC3, DTS, and MPEG, IEC 61937 patyloading
+         might be used.
+         API: GstBaseAudioSinkClass:payload()
+         https://bugzilla.gnome.org/show_bug.cgi?id=642730
+
+2011-04-09 09:49:10 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstringbuffer.c:
+         ringbuffer: Add support for E-AC3
+         Adds support for pushing E-AC3 buffers and doing bytes-to-ms conversion
+         correctly. The assumption (as with other formats) is that something like
+         IEC 61937 payloading will be used. Correspondingly the ringbuffer spec
+         is populated so that the data rate is 4x normal AC3.
+         https://bugzilla.gnome.org/show_bug.cgi?id=642730
+
+2011-03-14 15:51:40 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstringbuffer.c:
+         ringbuffer: Add support for MPEG audio buffers
+
+2011-03-14 15:49:57 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstringbuffer.h:
+         ringbuffer: Add AAC format types
+         These are meant to be used for buffers containing AAC data. Nothing uses
+         this yet, but for now it serves to distinguish from GST_BUFTYPE_MPEG
+         which represents non-AAC MPEG audio.
+         API: GST_BUFTYPE_MPEG2_AAC
+         API: GST_BUFTYPE_MPEG4_AAC
+
+2011-03-09 22:57:00 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstringbuffer.c:
+         ringbuffer: Add support for DTS buffers
+
+2011-05-14 11:42:50 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * configure.ac:
+         configure: Require core 0.10.34.1 for the new ghostpad API
+
+2011-05-09 22:20:23 +0200  Andoni Morales Alastruey <ylatuya@gmail.com>
+
+       * gst/playback/gstdecodebin2.c:
+         decodebin2: fix preroll for streams at low bitrates
+         For streams at low bitrates we need to set a limit in time because the limit
+         in bytes might not reached too late, sometimes more than 30 seconds.
+         This limit can only be set if upstream is seekable (see #584104)
+         Closes #647769
+
+2011-05-09 13:11:00 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaysink.c:
+         playsink: Use new ghostpad/proxypad API to get the internal pad
+
+2011-05-09 12:59:22 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkaudioconvert.h:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.h:
+         playsink: Use new ghostpad/proxypad API
+
+2011-05-09 12:50:06 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/elements/playbin2-compressed.c:
+         playbin2: Disable some compressed stream tests that are racy without a stream-activate event
+
+2011-03-29 19:15:27 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/elements/playbin2-compressed.c:
+         playbin2: Reset buffer counter in playbin2-compressed tests every time when going to READY
+
+2011-03-25 08:26:00 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/Makefile.am:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstplaysinkaudioconvert.c:
+       * gst/playback/gstplaysinkaudioconvert.h:
+       * gst/playback/gstplaysinkvideoconvert.c:
+       * gst/playback/gstplaysinkvideoconvert.h:
+         playsink: Add audio and video converter convenience bins
+         These reconfigure based on the caps and plugin in converters if
+         necessary. This also makes switching between compressed and raw
+         streams work flawlessly without loosing the states of any element
+         somewhere or having running time problems.
+
+2011-03-15 12:51:04 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gstplaysink.h:
+         playbin2/playsink: Decide if A/V caps are raw only inside playsink
+         Before playbin2 would use different selectors for raw audio and
+         compressed audio (and the same for video) and used different
+         pads from playsink. This made the involved logic much more
+         complex and was not implemented completely in playsink, which
+         made it impossible to support files with a compressed and
+         uncompressed stream that is support by the sink.
+         playbin2 handles raw/non-raw streams the same now and the
+         decision is left to playsink, which now can also handle
+         caps changes from raw to non-raw and the other way around.
+         Fixes bug #632788.
+
+2011-03-15 11:41:14 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/Makefile.am:
+       * tests/check/elements/playbin2-compressed.c:
+         playbin2: Add unit test for compressed stream support in playbin2/playsink
+
+2011-05-09 12:56:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/alsa/gstalsasrc.c:
+         alsasrc: Fix some compilation errors
+
+2011-05-09 11:50:05 +0200  Pontus Oldberg <pontus.oldberg@invector.se>
+
+       * ext/alsa/gstalsasrc.c:
+       * ext/alsa/gstalsasrc.h:
+         alsasrc: Improve timestamp accuracy
+         Fixes bug #635256.
+
+2011-05-06 17:01:53 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/playback/gstsubtitleoverlay.h:
+         subtitleoverlay: Use new, public ghostpad functions
+
+2011-05-03 11:26:32 +0300  Sreerenj Balachandran <sreerenj.balachandran@nokia.com>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: Use GST_BOILERPLATE
+
+2011-05-14 09:41:58 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * configure.ac:
+       * docs/plugins/gst-plugins-base-plugins.hierarchy:
+       * docs/plugins/inspect/plugin-adder.xml:
+       * docs/plugins/inspect/plugin-alsa.xml:
+       * docs/plugins/inspect/plugin-app.xml:
+       * docs/plugins/inspect/plugin-audioconvert.xml:
+       * docs/plugins/inspect/plugin-audiorate.xml:
+       * docs/plugins/inspect/plugin-audioresample.xml:
+       * docs/plugins/inspect/plugin-audiotestsrc.xml:
+       * docs/plugins/inspect/plugin-cdparanoia.xml:
+       * docs/plugins/inspect/plugin-decodebin.xml:
+       * docs/plugins/inspect/plugin-encoding.xml:
+       * docs/plugins/inspect/plugin-ffmpegcolorspace.xml:
+       * docs/plugins/inspect/plugin-gdp.xml:
+       * docs/plugins/inspect/plugin-gio.xml:
+       * docs/plugins/inspect/plugin-gnomevfs.xml:
+       * docs/plugins/inspect/plugin-libvisual.xml:
+       * docs/plugins/inspect/plugin-ogg.xml:
+       * docs/plugins/inspect/plugin-pango.xml:
+       * docs/plugins/inspect/plugin-playback.xml:
+       * docs/plugins/inspect/plugin-subparse.xml:
+       * docs/plugins/inspect/plugin-tcp.xml:
+       * docs/plugins/inspect/plugin-theora.xml:
+       * docs/plugins/inspect/plugin-typefindfunctions.xml:
+       * docs/plugins/inspect/plugin-uridecodebin.xml:
+       * docs/plugins/inspect/plugin-videorate.xml:
+       * docs/plugins/inspect/plugin-videoscale.xml:
+       * docs/plugins/inspect/plugin-videotestsrc.xml:
+       * docs/plugins/inspect/plugin-volume.xml:
+       * docs/plugins/inspect/plugin-vorbis.xml:
+       * docs/plugins/inspect/plugin-ximagesink.xml:
+       * docs/plugins/inspect/plugin-xvimagesink.xml:
+       * win32/common/_stdint.h:
+       * win32/common/config.h:
+         Back to development
+
+=== release 0.10.34 ===
+
+2011-05-14 01:00:38 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * ChangeLog:
+       * NEWS:
+       * RELEASE:
+       * configure.ac:
+       * docs/plugins/inspect/plugin-adder.xml:
+       * docs/plugins/inspect/plugin-alsa.xml:
+       * docs/plugins/inspect/plugin-app.xml:
+       * docs/plugins/inspect/plugin-audioconvert.xml:
+       * docs/plugins/inspect/plugin-audiorate.xml:
+       * docs/plugins/inspect/plugin-audioresample.xml:
+       * docs/plugins/inspect/plugin-audiotestsrc.xml:
+       * docs/plugins/inspect/plugin-cdparanoia.xml:
+       * docs/plugins/inspect/plugin-decodebin.xml:
+       * docs/plugins/inspect/plugin-encoding.xml:
+       * docs/plugins/inspect/plugin-ffmpegcolorspace.xml:
+       * docs/plugins/inspect/plugin-gdp.xml:
+       * docs/plugins/inspect/plugin-gio.xml:
+       * docs/plugins/inspect/plugin-gnomevfs.xml:
+       * docs/plugins/inspect/plugin-libvisual.xml:
+       * docs/plugins/inspect/plugin-ogg.xml:
+       * docs/plugins/inspect/plugin-pango.xml:
+       * docs/plugins/inspect/plugin-playback.xml:
+       * docs/plugins/inspect/plugin-subparse.xml:
+       * docs/plugins/inspect/plugin-tcp.xml:
+       * docs/plugins/inspect/plugin-theora.xml:
+       * docs/plugins/inspect/plugin-typefindfunctions.xml:
+       * docs/plugins/inspect/plugin-uridecodebin.xml:
+       * docs/plugins/inspect/plugin-videorate.xml:
+       * docs/plugins/inspect/plugin-videoscale.xml:
+       * docs/plugins/inspect/plugin-videotestsrc.xml:
+       * docs/plugins/inspect/plugin-volume.xml:
+       * docs/plugins/inspect/plugin-vorbis.xml:
+       * docs/plugins/inspect/plugin-ximagesink.xml:
+       * docs/plugins/inspect/plugin-xvimagesink.xml:
+       * gst-plugins-base.doap:
+       * win32/common/_stdint.h:
+       * win32/common/config.h:
+         Release 0.10.34
+
+2011-05-11 19:12:42 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/netbuffer/gstnetbuffer.c:
+       * gst-libs/gst/video/gstmetavideo.c:
+       * sys/v4l/v4lsrc_calls.c:
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         -base: remove metadata (des)serialize functions
+
+2011-05-10 18:39:07 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgiobasesink.c:
+       * ext/gio/gstgiobasesrc.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstogmparse.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraparse.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisparse.c:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/audio/gstbaseaudiosrc.c:
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/adder/gstadder.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/encoding/gststreamcombiner.c:
+       * gst/encoding/gststreamsplitter.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gsturidecodebin.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/videorate/gstvideorate.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * sys/v4l/gstv4lsrc.c:
+       * sys/xvimage/xvimagesink.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/seek.c:
+       * tests/icles/audio-trickplay.c:
+       * tests/icles/playback/test5.c:
+       * tests/icles/playback/test6.c:
+         -base_port to new query API
+
+2011-05-10 16:44:37 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggmux.c:
+       * gst/adder/gstadder.c:
+       * gst/encoding/gstencodebin.c:
+       * gst/encoding/gststreamcombiner.c:
+       * gst/encoding/gststreamsplitter.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+         -base: fix for now request pad API
+
+2011-05-10 15:43:08 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/interfaces/navigation.c:
+         navigation: use new query method names
+
+2011-05-10 13:35:49 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst-libs/gst/pbutils/missing-plugins.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gsturidecodebin.c:
+       * tests/examples/gio/giosrc-mounting.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/seek.c:
+         message: don't acces the structure directly
+
+=== release 0.10.33 ===
+
+2011-05-10 09:32:11 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
+       * ChangeLog:
+       * NEWS:
+       * RELEASE:
        * configure.ac:
-         releasing 0.10.35, "Short Notice"
+       * docs/plugins/inspect/plugin-adder.xml:
+       * docs/plugins/inspect/plugin-alsa.xml:
+       * docs/plugins/inspect/plugin-app.xml:
+       * docs/plugins/inspect/plugin-audioconvert.xml:
+       * docs/plugins/inspect/plugin-audiorate.xml:
+       * docs/plugins/inspect/plugin-audioresample.xml:
+       * docs/plugins/inspect/plugin-audiotestsrc.xml:
+       * docs/plugins/inspect/plugin-cdparanoia.xml:
+       * docs/plugins/inspect/plugin-decodebin.xml:
+       * docs/plugins/inspect/plugin-encoding.xml:
+       * docs/plugins/inspect/plugin-ffmpegcolorspace.xml:
+       * docs/plugins/inspect/plugin-gdp.xml:
+       * docs/plugins/inspect/plugin-gio.xml:
+       * docs/plugins/inspect/plugin-gnomevfs.xml:
+       * docs/plugins/inspect/plugin-libvisual.xml:
+       * docs/plugins/inspect/plugin-ogg.xml:
+       * docs/plugins/inspect/plugin-pango.xml:
+       * docs/plugins/inspect/plugin-playback.xml:
+       * docs/plugins/inspect/plugin-subparse.xml:
+       * docs/plugins/inspect/plugin-tcp.xml:
+       * docs/plugins/inspect/plugin-theora.xml:
+       * docs/plugins/inspect/plugin-typefindfunctions.xml:
+       * docs/plugins/inspect/plugin-uridecodebin.xml:
+       * docs/plugins/inspect/plugin-videorate.xml:
+       * docs/plugins/inspect/plugin-videoscale.xml:
+       * docs/plugins/inspect/plugin-videotestsrc.xml:
+       * docs/plugins/inspect/plugin-volume.xml:
+       * docs/plugins/inspect/plugin-vorbis.xml:
+       * docs/plugins/inspect/plugin-ximagesink.xml:
+       * docs/plugins/inspect/plugin-xvimagesink.xml:
+       * gst-plugins-base.doap:
+       * win32/common/_stdint.h:
+       * win32/common/config.h:
+         Release 0.10.33
+         Highlights:
+         - support for 16-bit-per-component video formats
+         - playbin2 fixes and improvements for custom and non-raw sinks
+         - oggmux muxes based on running time now
+         - many other fixes and improvements
 
-2011-06-15 14:21:30 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2011-05-10 11:54:30 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst-libs/gst/audio/Makefile.am:
-         audio: link test program against libgstaudio
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+         event: don't access the event structure
+         the event structure is now hidden, so don't access it directly.
 
-2011-06-14 10:31:18 +0530  Debarshi Ray <rishi@gnu.org>
+2011-05-09 18:53:03 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst-libs/gst/pbutils/codec-utils.c:
-         codec-utils: restore 7350 as a valid sampling frequency for AAC
-         This was lost during c77f88cac675a1dbb89e40da8e3c28320523bfca.
+       * ext/libvisual/visual.c:
+       * ext/theora/gsttheoradec.c:
+       * gst/playback/gststreamsynchronizer.c:
+         qos: _qos_full -> _qos
 
-2011-06-09 18:30:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2011-05-09 18:16:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst-libs/gst/tag/gstid3tag.c:
-       * gst-libs/gst/tag/gstvorbistag.c:
-       * gst-libs/gst/tag/tag.h:
-         libs: replace G_CONST_RETURN with 'const'
-         G_CONST_RETURN will be deprecated soon.
-         https://bugzilla.gnome.org/show_bug.cgi?id=652211
+       * ext/gio/gstgiobasesink.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/adder/gstadder.c:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/encoding/gstsmartencoder.c:
+       * gst/gdp/gstgdppay.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/subparse/gstssaparse.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/videorate/gstvideorate.c:
+         segment: fix for new core API
+         Fix for gst_*_segment_full rename.
 
-2011-05-31 22:14:09 -0700  David Schleef <ds@schleef.org>
+2011-05-09 16:42:34 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst/audioresample/resample.c:
-       * gst/audiotestsrc/gstaudiotestsrc.c:
-       * gst/videoscale/vs_4tap.c:
-       * gst/videotestsrc/generate_sine_table.c:
-       * gst/videotestsrc/videotestsrc.c:
-       * tests/icles/test-xoverlay.c:
-         convert M_PI to G_PI, for msvc
+       * gst/audiorate/gstaudiorate.c:
+         audiorate: abs_rate is removed from segment structure
 
-2011-06-06 14:41:41 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+2011-05-09 15:41:19 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
+       * ext/libvisual/visual.c:
+         visual: use the right pad
+
+2011-05-09 15:37:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * docs/plugins/gst-plugins-base-plugins.hierarchy:
+       * docs/plugins/gst-plugins-base-plugins.interfaces:
+       * docs/plugins/gst-plugins-base-plugins.prerequisites:
+       * ext/libvisual/visual.c:
+         visual: use CAPS event to configure caps
+
+2011-05-09 15:37:09 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+       * ext/vorbis/gstvorbisdec.c:
+         theora/vorbis: use default pad handler
+         Use the default pad event handler because we are not supposed to pass on CAPS
+         events.
+
+2011-05-09 13:05:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggaviparse.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/ogg/gstoggparse.c:
+       * ext/ogg/gstogmparse.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/theora/gsttheoraparse.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisparse.c:
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/audio/audio.c:
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
        * gst-libs/gst/tag/gsttagdemux.c:
-         tagdemux: no input data implies no type can be found
-         ... and posting a proper error message to this effect is appropriately
-         informative and prevents auto-plugging otherwise stalling.
+       * gst-libs/gst/tag/gstvorbistag.c:
+       * gst-libs/gst/tag/tags.c:
+       * gst-libs/gst/video/convertframe.c:
+       * gst-libs/gst/video/video.c:
+       * gst-libs/gst/video/video.h:
+       * gst/adder/gstadder.c:
+       * gst/audioconvert/gstaudioconvert.c:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/encoding/gstsmartencoder.c:
+       * gst/gdp/gstgdpdepay.c:
+       * gst/gdp/gstgdppay.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gstplaysink.c:
+       * gst/subparse/gstssaparse.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/tcp/gstmultifdsink.c:
+       * gst/tcp/gsttcpclientsrc.c:
+       * gst/videorate/gstvideorate.c:
+       * tests/examples/app/appsink-src.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/seek.c:
+       * tests/examples/snapshot/snapshot.c:
+         -base: don't use buffer caps
+         Port to newest 0.11 core API, remove GST_PAD_CAPS and GST_BUFFER_CAPS.
 
-2011-06-04 13:36:55 -0700  David Schleef <ds@schleef.org>
+2011-05-08 13:24:30 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
        * gst/adder/gstadder.c:
-         adder: Work around changes in g_atomic API
-         See #651514 for details.
+         adder: fix getcaps function
+         Explicitely get the possible caps in the sinkpad instead of using an old removed
+         function.
 
-2011-05-31 20:38:56 -0700  David Schleef <ds@schleef.org>
+2011-05-08 13:09:35 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst-libs/gst/pbutils/gstdiscoverer.c:
-         discoverer: fix c99-ism
+       * gst/videotestsrc/gstvideotestsrc.c:
+         videotestsrc: avoid setting caps on buffers
+         We don't need to set caps on buffers anymore, this is now done with a caps
+         event.
 
-2011-05-23 16:02:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2011-05-06 11:31:43 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst/subparse/gstsubparse.c:
-         subparse: Try to typefind even if conversion to UTF8 failed
-         Fixes bug #600043.
+       * ext/libvisual/visual.c:
+         visual: avoid unreffing a NULL object
 
-2011-05-23 15:51:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2011-05-05 18:47:58 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
-       * gst/subparse/gstsubparse.c:
-         subparse: Interprete typefind strings passed to GRegex as raw bytes instead of valid UTF8
+       * gst/playback/gstsubtitleoverlay.c:
+         subtitleoverlay: Update for new GstIterator API
+
+2011-05-05 18:47:50 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaybin2.c:
+         playbin2: Update for new GstIterator API
+
+2011-05-05 18:38:53 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gststreamselector.c:
+         streamselector: Return a NULL iterator instead of an empty iterator that returns NULL if there's no otherpad
+
+2011-05-05 18:35:46 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gstplaybasebin.c:
+         playbasebin: Update for new GstIterator API
+
+2011-05-05 18:29:13 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/playback/gsturidecodebin.c:
+         uridecodebin: Fix usage of gst_iterator_fold()
+
+2011-05-05 16:05:13 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * win32/common/libgstvideo.def:
+         win32: Update exports
+
+2011-05-05 16:04:11 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/icles/playback/test5.c:
+       * tests/icles/playback/test6.c:
+         icles: Update for new GstIterator API
+
+2011-05-05 16:03:52 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/adder/gstadder.c:
+       * gst/encoding/gstencodebin.c:
+       * gst/playback/gstdecodebin.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+         gst: Update for new GstIterator API
+
+2011-05-05 15:30:53 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/pipelines/capsfilter-renegotiation.c:
+         capsfilter-renegotiation: Fix for the removal of the bufferalloc function
+
+2011-05-03 12:57:28 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: Send reconfigure event upstream if the window geometry changes
+
+2011-04-28 10:55:21 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: Add caps with the current window geometry to the top in getcaps
 
-2011-05-20 10:48:39 +0300  Stefan Kost <ensonic@users.sf.net>
+2011-01-17 14:12:06 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
 
-       * gst-libs/gst/tag/lang.c:
-         lang: fix possible array overrun
-         We where checking for i<G_N_ELEMENTS, but where accessing i+1.
+       * tests/check/pipelines/capsfilter-renegotiation.c:
+         tests: capsfilter-renegotiation: New renegotiation use cases
+         Adds some new tests for renegotiation use cases that would
+         use the new renegotiate event
 
-=== release 0.10.34 ===
+2011-04-29 14:14:53 +0200  Philippe Normand <pnormand@igalia.com>
 
-2011-05-14 01:00:38 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+       * gst-libs/gst/pbutils/encoding-target.c:
+       * tests/check/libs/profile.c:
+         base: presets moved from $HOME/.gstreamer-0.11 to $HOME/.local/share/gstreamer-0.11
 
-       * ChangeLog:
-       * NEWS:
-       * RELEASE:
-       * configure.ac:
-       * docs/plugins/inspect/plugin-adder.xml:
-       * docs/plugins/inspect/plugin-alsa.xml:
-       * docs/plugins/inspect/plugin-app.xml:
-       * docs/plugins/inspect/plugin-audioconvert.xml:
-       * docs/plugins/inspect/plugin-audiorate.xml:
-       * docs/plugins/inspect/plugin-audioresample.xml:
-       * docs/plugins/inspect/plugin-audiotestsrc.xml:
-       * docs/plugins/inspect/plugin-cdparanoia.xml:
-       * docs/plugins/inspect/plugin-decodebin.xml:
-       * docs/plugins/inspect/plugin-encoding.xml:
-       * docs/plugins/inspect/plugin-ffmpegcolorspace.xml:
-       * docs/plugins/inspect/plugin-gdp.xml:
-       * docs/plugins/inspect/plugin-gio.xml:
-       * docs/plugins/inspect/plugin-gnomevfs.xml:
-       * docs/plugins/inspect/plugin-libvisual.xml:
-       * docs/plugins/inspect/plugin-ogg.xml:
-       * docs/plugins/inspect/plugin-pango.xml:
-       * docs/plugins/inspect/plugin-playback.xml:
-       * docs/plugins/inspect/plugin-subparse.xml:
-       * docs/plugins/inspect/plugin-tcp.xml:
-       * docs/plugins/inspect/plugin-theora.xml:
-       * docs/plugins/inspect/plugin-typefindfunctions.xml:
-       * docs/plugins/inspect/plugin-uridecodebin.xml:
-       * docs/plugins/inspect/plugin-videorate.xml:
-       * docs/plugins/inspect/plugin-videoscale.xml:
-       * docs/plugins/inspect/plugin-videotestsrc.xml:
-       * docs/plugins/inspect/plugin-volume.xml:
-       * docs/plugins/inspect/plugin-vorbis.xml:
-       * docs/plugins/inspect/plugin-ximagesink.xml:
-       * docs/plugins/inspect/plugin-xvimagesink.xml:
-       * gst-plugins-base.doap:
-       * win32/common/_stdint.h:
-       * win32/common/config.h:
-         Release 0.10.34
+2011-05-03 09:49:26 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
-=== release 0.10.33 ===
+         Merge branch 'master' into 0.11
+         Conflicts:
+         configure.ac
 
-2011-05-10 09:32:11 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2011-05-02 11:11:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * ChangeLog:
-       * NEWS:
-       * RELEASE:
-       * configure.ac:
-       * docs/plugins/inspect/plugin-adder.xml:
-       * docs/plugins/inspect/plugin-alsa.xml:
-       * docs/plugins/inspect/plugin-app.xml:
-       * docs/plugins/inspect/plugin-audioconvert.xml:
-       * docs/plugins/inspect/plugin-audiorate.xml:
-       * docs/plugins/inspect/plugin-audioresample.xml:
-       * docs/plugins/inspect/plugin-audiotestsrc.xml:
-       * docs/plugins/inspect/plugin-cdparanoia.xml:
-       * docs/plugins/inspect/plugin-decodebin.xml:
-       * docs/plugins/inspect/plugin-encoding.xml:
-       * docs/plugins/inspect/plugin-ffmpegcolorspace.xml:
-       * docs/plugins/inspect/plugin-gdp.xml:
-       * docs/plugins/inspect/plugin-gio.xml:
-       * docs/plugins/inspect/plugin-gnomevfs.xml:
-       * docs/plugins/inspect/plugin-libvisual.xml:
-       * docs/plugins/inspect/plugin-ogg.xml:
-       * docs/plugins/inspect/plugin-pango.xml:
-       * docs/plugins/inspect/plugin-playback.xml:
-       * docs/plugins/inspect/plugin-subparse.xml:
-       * docs/plugins/inspect/plugin-tcp.xml:
-       * docs/plugins/inspect/plugin-theora.xml:
-       * docs/plugins/inspect/plugin-typefindfunctions.xml:
-       * docs/plugins/inspect/plugin-uridecodebin.xml:
-       * docs/plugins/inspect/plugin-videorate.xml:
-       * docs/plugins/inspect/plugin-videoscale.xml:
-       * docs/plugins/inspect/plugin-videotestsrc.xml:
-       * docs/plugins/inspect/plugin-volume.xml:
-       * docs/plugins/inspect/plugin-vorbis.xml:
-       * docs/plugins/inspect/plugin-ximagesink.xml:
-       * docs/plugins/inspect/plugin-xvimagesink.xml:
-       * gst-plugins-base.doap:
-       * win32/common/_stdint.h:
-       * win32/common/config.h:
-         Release 0.10.33
-         Highlights:
-         - support for 16-bit-per-component video formats
-         - playbin2 fixes and improvements for custom and non-raw sinks
-         - oggmux muxes based on running time now
-         - many other fixes and improvements
+       * ext/libvisual/visual.c:
+       * ext/theora/gsttheoradec.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * sys/xvimage/xvimagesink.c:
+         plugins: fix for allocation query API change
 
 2011-04-30 17:35:54 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
        * gst/volume/gstvolumeorc-dist.c:
          gst: update orc-generated disted C backup code to orc 0.4.14
 
+2011-04-29 18:23:25 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+         visual: add bufferpool support to libvisual
+
+2011-04-29 16:52:23 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoradec.h:
+         theoradec: use bufferpool
+
+2011-04-29 13:48:39 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/elements/audioresample.c:
+       * tests/check/elements/videoscale.c:
+         tests: make unit tests compile
+
+2011-04-29 13:28:17 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/playback/gststreamselector.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/subparse/gstsubparse.c:
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         remove buffer_alloc
+
+2011-04-29 12:10:14 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/videotestsrc/gstvideotestsrc.h:
+         videotestsrc: use ALLOCATION query
+         Use the allocation query to get the buffer parameters and potentially a
+         bufferpool from downstream. Use the bufferpool to create buffers.
+
+2011-04-29 12:09:38 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: implement ALLOCATION query
+
+2011-04-29 11:27:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+         metavideo: add flags and a define for the API
+
+2011-04-28 19:28:16 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         configure.ac
+
+2011-04-28 19:20:58 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/video/Makefile.am:
+       * gst-libs/gst/video/gstmetavideo.c:
+       * gst-libs/gst/video/gstmetavideo.h:
+         metavideo: first attempt at video metadata
+         Add a first version of video metadata for buffers that can contain more info
+         about the video such as strides and flags etc.
+
 2011-04-27 12:09:33 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
        * configure.ac:
        * win32/common/config.h:
          0.10.32.3 pre-release
 
+2011-04-25 11:32:27 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/elements/videoscale.c:
+         tests: fix test
+
+2011-04-25 11:20:45 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         gst/videoscale/gstvideoscale.c
+
 2011-04-24 18:45:40 -0700  David Schleef <ds@schleef.org>
 
        * gst/videoscale/vs_image.c:
          videoscale: use simpler scaling method for small images
          https://bugzilla.gnome.org/show_bug.cgi?id=633837
 
-2011-04-14 09:32:19 +0200  Marc Plano-Lesay <marc.planolesay@gmail.com>
+2011-04-14 09:32:19 +0200  Marc Plano-Lesay <marc.planolesay@gmail.com>
+
+       * gst/audioresample/gstaudioresample.c:
+         audioresample: fix unused-but-set-variable warnings with gcc 4.6
+         https://bugzilla.gnome.org/show_bug.cgi?id=647294
+
+2011-04-22 13:55:20 +0200  Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
+
+       * gst-libs/gst/tag/gstexiftag.c:
+       * gst-libs/gst/tag/gsttageditingprivate.h:
+         tag: exif: register common tags from tag library
+         Exif uses tags like  image-vertical-ppi or image-horizontal-ppi which are
+         registered in gst_tag_register_musicbrainz_tags(), but neither GstExifReader
+         nor GstExifWriter register them.
+         https://bugzilla.gnome.org/show_bug.cgi?id=648459
+
+2011-04-24 12:16:47 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/tag/tag.h:
+       * gst-libs/gst/tag/tags.c:
+         tag: update some FIXMEs for 0.11
+
+2011-04-21 14:11:49 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * tests/check/elements/videoscale.c:
+         tests: add unit test for basetransform/videoscale negotiation regression
+         Turn Rene's test pipeline into a unit test.
+         https://bugzilla.gnome.org/show_bug.cgi?id=648220
+
+2011-04-19 16:40:02 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/v4l/gstv4lelement.c:
+       * sys/v4l/gstv4lsrc.c:
+         v4l: use G_DEFINE_TYPE
+
+2011-04-19 14:31:20 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstaudiofilter.c:
+         audiofilter: GstElement takes ownership of pad templates and it should be called from class_init now, not base_init
+
+2011-04-19 14:21:34 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/elements/audiorate.c:
+       * tests/check/elements/playbin.c:
+       * tests/check/elements/playbin2.c:
+       * tests/check/elements/videoscale.c:
+       * tests/check/libs/cddabasesrc.c:
+       * tests/check/libs/mixer.c:
+       * tests/check/libs/navigation.c:
+       * tests/check/libs/xmpwriter.c:
+         tests: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
+
+2011-04-19 14:11:32 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/alsa/gstalsamixerelement.c:
+       * ext/alsa/gstalsamixertrack.c:
+       * ext/alsa/gstalsasink.c:
+       * ext/alsa/gstalsasrc.c:
+       * ext/cdparanoia/gstcdparanoiasrc.c:
+       * ext/gio/gstgiobasesink.c:
+       * ext/gio/gstgiobasesrc.c:
+       * ext/gio/gstgiosink.c:
+       * ext/gio/gstgiosrc.c:
+       * ext/gio/gstgiostreamsink.c:
+       * ext/gio/gstgiostreamsrc.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gstclockoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/pango/gsttimeoverlay.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/theora/gsttheoraparse.c:
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisparse.c:
+       * ext/vorbis/gstvorbistag.c:
+         ext: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
+
+2011-04-19 11:44:14 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         sys: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
+
+2011-04-19 11:36:35 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/audioresample/gstaudioresample.c:
+         audioresample: Remove filter-length property, it only existed for backward compatibility
+
+2011-04-19 11:35:53 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst/adder/gstadder.c:
+       * gst/audioconvert/gstaudioconvert.c:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/audiorate/gstaudiorate.h:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+       * gst/gdp/gstgdpdepay.c:
+       * gst/gdp/gstgdppay.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/playback/gstsubtitleoverlay.c:
+       * gst/playback/gsturidecodebin.c:
+       * gst/subparse/gstssaparse.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/tcp/gstmultifdsink.c:
+       * gst/tcp/gsttcpclientsink.c:
+       * gst/tcp/gsttcpclientsrc.c:
+       * gst/tcp/gsttcpserversink.c:
+       * gst/tcp/gsttcpserversrc.c:
+       * gst/videorate/gstvideorate.c:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/volume/gstvolume.c:
+         gst: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
+
+2011-04-19 10:54:50 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+         cddabasesrc: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
+
+2011-04-19 10:52:00 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstaudiosink.c:
+       * gst-libs/gst/audio/gstaudiosrc.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/audio/gstbaseaudiosrc.c:
+         audio: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
+
+2011-04-19 10:47:15 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
-       * gst/audioresample/gstaudioresample.c:
-         audioresample: fix unused-but-set-variable warnings with gcc 4.6
-         https://bugzilla.gnome.org/show_bug.cgi?id=647294
+       * gst-libs/gst/app/gstappsink.c:
+       * gst-libs/gst/app/gstappsrc.c:
+         app: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
 
-2011-04-22 13:55:20 +0200  Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
+2011-04-18 18:30:41 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
-       * gst-libs/gst/tag/gstexiftag.c:
-       * gst-libs/gst/tag/gsttageditingprivate.h:
-         tag: exif: register common tags from tag library
-         Exif uses tags like  image-vertical-ppi or image-horizontal-ppi which are
-         registered in gst_tag_register_musicbrainz_tags(), but neither GstExifReader
-         nor GstExifWriter register them.
-         https://bugzilla.gnome.org/show_bug.cgi?id=648459
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+         gstbasertppayload: Use g_once_init_{enter,leave}() in the _get_type() function
 
-2011-04-24 12:16:47 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2011-04-18 18:29:35 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
-       * gst-libs/gst/tag/tag.h:
-       * gst-libs/gst/tag/tags.c:
-         tag: update some FIXMEs for 0.11
+       * gst-libs/gst/rtp/gstbasertpaudiopayload.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+         rtp: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
 
-2011-04-21 14:11:49 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2011-04-18 13:23:32 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
-       * tests/check/elements/videoscale.c:
-         tests: add unit test for basetransform/videoscale negotiation regression
-         Turn Rene's test pipeline into a unit test.
-         https://bugzilla.gnome.org/show_bug.cgi?id=648220
+         Merge branch 'master' into 0.11
 
 2010-11-25 17:01:53 +0100  Håvard Graff <havard.graff@.eu.tandberg.int>
 
          vorbis: add support for using tremolo on android
          Tremolo is an ARM-optimised version of xiph's tremor library.
 
+2011-04-16 16:14:26 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/ogg/gstoggstream.c:
+         ogg: Update new code for 0.11 buffer API
+
+2011-04-16 16:06:26 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-04-16 15:56:55 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * ext/pango/Makefile.am:
+       * ext/pango/gstbasetextoverlay.c:
+       * ext/pango/gstbasetextoverlay.h:
+       * ext/pango/gstclockoverlay.c:
+       * ext/pango/gstclockoverlay.h:
+       * ext/pango/gsttextoverlay.c:
+       * ext/pango/gsttextoverlay.h:
+       * ext/pango/gsttimeoverlay.c:
+       * ext/pango/gsttimeoverlay.h:
+         pango: Create a new base class for all the elements
+         This prevents the ugly hack where the text_sink pad template
+         was only added for textoverlay but not for the subclasses.
+         Also makes this work with the core change that made
+         subclasses inherit the templates of their parent class.
+
 2011-04-15 13:36:39 +0100  Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
 
        * ext/ogg/gstoggmux.c:
          Make sure the scanner doesn't load or introspect or check any plugins,
          (especially not outside the build directory).
 
+2011-04-16 09:33:44 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-04-16 09:12:31 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
 2011-04-15 21:09:00 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
        * tests/check/Makefile.am:
        * gst/videorate/gstvideorate.c:
          videorate: empty caps have no structure to pick
 
+2011-04-11 11:37:51 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         android/alsa.mk
+         android/app.mk
+         android/app_plugin.mk
+         android/audio.mk
+         android/audioconvert.mk
+         android/decodebin.mk
+         android/decodebin2.mk
+         android/gdp.mk
+         android/interfaces.mk
+         android/netbuffer.mk
+         android/pbutils.mk
+         android/playbin.mk
+         android/queue2.mk
+         android/riff.mk
+         android/rtp.mk
+         android/rtsp.mk
+         android/sdp.mk
+         android/tag.mk
+         android/tcp.mk
+         android/typefindfunctions.mk
+         android/video.mk
+
 2011-04-11 10:06:53 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
        * gst-libs/gst/tag/gstid3tag.c:
        * ext/vorbis/gstvorbisdec.c:
          vorbisdec: make upstream queries and events MT-safe
 
+2011-04-07 16:19:08 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         gst-libs/gst/rtp/gstbasertpdepayload.c
+
+2011-04-07 16:07:57 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+         ximage: don't share the memory
+         We can't share the memory on the buffer with other buffers because the metadata
+         X(v)Image points to it and we don't want it to go away.
+
 2011-04-06 16:25:37 +0100  Bastien Nocera <hadess@hadess.net>
 
        * gst-libs/gst/rtp/gstbasertpdepayload.c:
          The endianness was not set correctly before.
          Fixes bug #646923.
 
+2011-04-06 19:21:02 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/xvimage/xvimagesink.c:
+         xvimagesink: make the show_frame function prettier
+
+2011-04-06 17:54:28 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagepool.c:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         ximage: more fixes
+
+2011-04-06 16:33:56 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         ext/theora/gsttheoraenc.c
+
+2011-04-06 16:26:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         ximage: more fixes
+
 2011-04-06 16:11:02 +0200  Robert Swain <robert.swain@collabora.co.uk>
 
        * docs/design/part-interlaced-video.txt:
          indicate that the buffer contains only unneeded repeated fields that are
          present in other buffers and as such this buffer can be dropped.
 
+2011-04-06 12:26:47 +0200  benjamin gaignard <benjamin.gaignard@linaro.org>
+
+       * sys/ximage/ximage.c:
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagepool.h:
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/Makefile.am:
+       * sys/xvimage/xvimage.c:
+       * sys/xvimage/xvimagepool.c:
+       * sys/xvimage/xvimagepool.h:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         xvimagesink: use bufferpool
+         Improve bufferpool handling in ximagesink.
+         Implement bufferpool handling on xvimagesink.
+         Based on patches from benjamin gaignard <benjamin.gaignard@linaro.org>
+
 2011-03-25 16:59:51 +0100  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
 
        * ext/theora/gsttheoraenc.c:
          Automatic update of common submodule
          From 1ccbe09 to c3cafe1
 
+2011-04-04 11:44:15 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/pango/gsttextoverlay.c:
+       * gst-libs/gst/tag/gstvorbistag.c:
+       * tests/check/libs/video.c:
+         fix compilation after merge
+
+2011-04-04 11:31:33 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         gst-libs/gst/tag/gstvorbistag.c
+
 2011-03-11 10:41:11 +0100  Trond Andersen <trondand@cisco.com>
 
        * gst-libs/gst/rtp/gstrtcpbuffer.c:
          thus is visible regardless of the alpha of the background image. The
          overlay in the above pipeline works after applying this patch.
 
+2011-03-31 18:40:48 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/libs/libsabi.c:
+       * tests/check/libs/struct_x86_64.h:
+       * tests/check/libs/xmpwriter.c:
+         fixes for new API
+
+2011-03-31 17:53:12 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
+2011-03-31 17:47:43 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/app/gstappsink.c:
+       * gst-libs/gst/rtp/gstbasertpaudiopayload.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst/gdp/gstgdppay.c:
+       * tests/check/elements/appsink.c:
+         bufferlist: fixes for new API
+
 2011-03-28 22:00:25 +0200  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
 
        * gst-libs/gst/audio/gstbaseaudiosink.c:
          libs: replace 0.10 with @GST_MAJORMINOR@ in Makefile.am
          For easier cherry-picking/merging later.
 
+2011-03-30 20:35:51 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+         xmp: fix after merge conflict
+
+2011-03-30 20:23:54 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11-fdo
+         Conflicts:
+         gst-libs/gst/tag/gstxmptag.c
+
+2011-03-30 16:50:45 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgiobasesrc.c:
+       * ext/ogg/gstoggaviparse.c:
+       * ext/ogg/gstogmparse.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/vorbis/gstvorbisenc.c:
+       * gst-libs/gst/audio/audio.c:
+       * gst-libs/gst/riff/riff-read.c:
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst/audiorate/gstaudiorate.c:
+         Fix for latest API changes
+
 2011-03-30 15:47:38 +0100  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
        * tests/check/gst/typefindfunctions.c:
          API: GstTagXmpWriter
          https://bugzilla.gnome.org/show_bug.cgi?id=645167
 
-2011-03-18 09:28:23 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+2011-03-18 09:28:23 -0300  Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+
+       * gst-libs/gst/tag/gstxmptag.c:
+       * gst-libs/gst/tag/tag.h:
+       * win32/common/libgsttag.def:
+         tag: xmp: Add function to list the available schemas
+         Adds a function to list the available schemas in our xmp lib
+         https://bugzilla.gnome.org/show_bug.cgi?id=645167
+
+2011-03-29 15:41:33 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+       * tests/check/elements/encodebin.c:
+         encodebin: Requesting a pad again now gives a g_return_val_if_fail()
+         Before the behaviour was undefined and implemented differently by elements,
+         now core checks for this (and other problems) and returns NULL and an assertion.
+
+2011-03-29 11:08:19 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/gio/gstgiobasesrc.c:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+         remove deprecated buffer methods
+
+2011-03-28 20:19:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggparse.c:
+         oggparse: fix for _make_writable
+
+2011-03-28 20:13:59 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11-fdo
+
+2011-03-28 19:23:38 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/vorbis/gstvorbisenc.c:
+       * gst-libs/gst/audio/audio.c:
+       * tests/check/pipelines/vorbisenc.c:
+       * win32/common/libgstapp.def:
+       * win32/common/libgstnetbuffer.def:
+       * win32/common/libgstrtp.def:
+       * win32/common/libgsttag.def:
+         tests: fix more checks
+
+2011-03-28 18:42:09 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/rtp/gstrtcpbuffer.c:
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+       * gst-libs/gst/rtp/gstrtpbuffer.h:
+       * tests/check/libs/rtp.c:
+         tests: fix RTP and RTCP unit tests
+
+2011-03-28 18:22:50 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/libs/tag.c:
+         test: fic tag check
+
+2011-03-28 18:17:45 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/libs/profile.c:
+         tests: fix patch names and g_object_unref
+
+2011-03-28 18:01:03 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/libs/pbutils.c:
+         tests: fix version number checks
+
+2011-03-28 17:58:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/netbuffer/gstnetbuffer.h:
+         netbuffer: fix netbuffer add function
+
+2011-03-28 17:53:39 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/elements/videorate.c:
+         tests: fix more tests
+         refcounts are always 1 because subbuffers don't ref the original buffer anymore,
+         just the memory.
+
+2011-03-28 17:46:52 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/elements/gdppay.c:
+       * tests/check/elements/subparse.c:
+         tests: fix more unit tests
+
+2011-03-28 17:02:26 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/encoding-profile.c:
+       * gst-libs/gst/pbutils/encoding-target.c:
+         encodebin: fix new profile unref
+
+2011-03-28 16:54:30 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/audio.c:
+       * tests/check/elements/decodebin.c:
+       * tests/check/elements/decodebin2.c:
+       * tests/check/elements/textoverlay.c:
+       * tests/check/elements/vorbistag.c:
+       * tests/check/pipelines/vorbisenc.c:
+         tests: fix some unit tests
+
+2011-03-28 15:51:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/libs/gstlibscpp.cc:
+       * tests/check/libs/video.c:
+       * tests/check/pipelines/streamheader.c:
+         tests: fix remaining unit tests
+
+2011-03-28 14:12:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/check/elements/appsink.c:
+       * tests/check/elements/audioconvert.c:
+       * tests/check/elements/audiorate.c:
+       * tests/check/elements/audioresample.c:
+       * tests/check/elements/decodebin.c:
+       * tests/check/elements/decodebin2.c:
+       * tests/check/elements/ffmpegcolorspace.c:
+       * tests/check/elements/gdpdepay.c:
+       * tests/check/elements/gdppay.c:
+       * tests/check/elements/gnomevfssink.c:
+       * tests/check/elements/multifdsink.c:
+       * tests/check/elements/playbin.c:
+       * tests/check/elements/playbin2.c:
+       * tests/check/elements/subparse.c:
+       * tests/check/elements/textoverlay.c:
+       * tests/check/elements/videorate.c:
+       * tests/check/elements/videoscale.c:
+       * tests/check/elements/videotestsrc.c:
+       * tests/check/elements/volume.c:
+       * tests/check/elements/vorbisdec.c:
+       * tests/check/elements/vorbistag.c:
+       * tests/check/gst/typefindfunctions.c:
+       * tests/check/libs/audio.c:
+       * tests/check/libs/cddabasesrc.c:
+       * tests/check/libs/libsabi.c:
+       * tests/check/libs/netbuffer.c:
+       * tests/check/libs/profile.c:
+       * tests/check/libs/rtp.c:
+       * tests/check/libs/struct_i386.h:
+       * tests/check/libs/tag.c:
+       * tests/check/pipelines/oggmux.c:
+       * tests/examples/app/appsink-src.c:
+       * tests/examples/app/appsrc-ra.c:
+       * tests/examples/app/appsrc-seekable.c:
+       * tests/examples/app/appsrc-stream.c:
+       * tests/examples/app/appsrc-stream2.c:
+       * tests/examples/app/appsrc_ex.c:
+       * tests/examples/seek/jsseek.c:
+       * tests/examples/seek/seek.c:
+       * tests/examples/snapshot/snapshot.c:
+       * tests/icles/playbin-text.c:
+         tests: work on porting the unit tests
+
+2011-03-28 10:25:38 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         audiosink: improve comment
+
+2011-03-28 10:20:06 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/vorbis/gstvorbisdec.c:
+       * ext/vorbis/gstvorbisdeclib.h:
+       * ext/vorbis/gstvorbisenc.c:
+       * ext/vorbis/gstvorbisparse.c:
+       * ext/vorbis/gstvorbistag.c:
+       * tools/gst-discoverer.c:
+         plugins: more porting
+
+2011-03-27 20:15:46 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/theora/gsttheoraparse.c:
+         theora: port to new memory API
+
+2011-03-27 18:30:24 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/libvisual/visual.c:
+       * ext/ogg/gstoggaviparse.c:
+       * ext/ogg/gstoggdemux.c:
+       * ext/ogg/gstoggmux.c:
+       * ext/ogg/gstoggparse.c:
+       * ext/ogg/gstoggstream.c:
+       * ext/ogg/gstogmparse.c:
+       * ext/pango/gsttextoverlay.c:
+       * ext/pango/gsttextrender.c:
+       * ext/theora/gsttheoradec.c:
+       * ext/theora/gsttheoraenc.c:
+       * ext/theora/gsttheoraparse.c:
+       * gst-libs/gst/tag/gstvorbistag.c:
+       * gst-libs/gst/tag/tag.h:
+         plugins: more porting to new memory API
+
+2011-03-27 17:16:10 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/cdparanoia/gstcdparanoiasrc.c:
+       * ext/gio/gstgiobasesink.c:
+       * ext/gio/gstgiobasesrc.c:
+       * ext/gnomevfs/gstgnomevfssink.c:
+       * ext/gnomevfs/gstgnomevfssrc.c:
+       * ext/libvisual/visual.c:
+       * sys/v4l/v4lsrc_calls.c:
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         plugins: fix for new memory API
+
+2011-03-27 16:35:28 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * gst-libs/gst/tag/gstxmptag.c:
-       * gst-libs/gst/tag/tag.h:
-       * win32/common/libgsttag.def:
-         tag: xmp: Add function to list the available schemas
-         Adds a function to list the available schemas in our xmp lib
-         https://bugzilla.gnome.org/show_bug.cgi?id=645167
+       * gst/adder/gstadder.c:
+       * gst/audioconvert/gstaudioconvert.c:
+       * gst/audiorate/gstaudiorate.c:
+       * gst/audioresample/gstaudioresample.c:
+       * gst/audiotestsrc/gstaudiotestsrc.c:
+       * gst/ffmpegcolorspace/gstffmpegcodecmap.c:
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+       * gst/gdp/gstgdpdepay.c:
+       * gst/gdp/gstgdppay.c:
+       * gst/playback/gststreamsynchronizer.c:
+       * gst/subparse/gstssaparse.c:
+       * gst/subparse/gstsubparse.c:
+       * gst/tcp/gstmultifdsink.c:
+       * gst/tcp/gsttcp.c:
+       * gst/tcp/gsttcpclientsink.c:
+       * gst/tcp/gsttcpclientsrc.c:
+       * gst/tcp/gsttcpserversrc.c:
+       * gst/typefind/gsttypefindfunctions.c:
+       * gst/videorate/gstvideorate.c:
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videotestsrc/gstvideotestsrc.c:
+       * gst/volume/gstvolume.c:
+         plugins: port some plugins to the new memory API
 
-2011-03-29 15:41:33 +0200  Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2011-03-27 13:55:15 +0200  Wim Taymans <wim.taymans@collabora.co.uk>
 
-       * tests/check/elements/encodebin.c:
-         encodebin: Requesting a pad again now gives a g_return_val_if_fail()
-         Before the behaviour was undefined and implemented differently by elements,
-         now core checks for this (and other problems) and returns NULL and an assertion.
+       * gst-libs/gst/app/gstappsrc.c:
+       * gst-libs/gst/audio/audio.c:
+       * gst-libs/gst/audio/gstaudiofilter.c:
+       * gst-libs/gst/audio/gstaudiosink.c:
+       * gst-libs/gst/audio/gstaudiosrc.c:
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       * gst-libs/gst/audio/gstbaseaudiosrc.c:
+       * gst-libs/gst/audio/gstringbuffer.c:
+       * gst-libs/gst/audio/gstringbuffer.h:
+       * gst-libs/gst/cdda/gstcddabasesrc.c:
+       * gst-libs/gst/riff/riff-media.c:
+       * gst-libs/gst/riff/riff-read.c:
+       * gst-libs/gst/rtp/gstbasertpaudiopayload.c:
+       * gst-libs/gst/rtp/gstbasertpdepayload.c:
+       * gst-libs/gst/rtp/gstbasertppayload.c:
+       * gst-libs/gst/rtp/gstrtcpbuffer.c:
+       * gst-libs/gst/rtp/gstrtcpbuffer.h:
+       * gst-libs/gst/rtp/gstrtpbuffer.c:
+       * gst-libs/gst/rtp/gstrtpbuffer.h:
+       * gst-libs/gst/video/convertframe.c:
+       * gst-libs/gst/video/gstvideofilter.c:
+         libs: port to new data API
 
 2011-03-26 19:36:50 +0000  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
          Automatic update of common submodule
          From 193b717 to 1ccbe09
 
+2011-03-25 19:52:30 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/netbuffer/gstnetbuffer.c:
+       * gst-libs/gst/tag/gstexiftag.c:
+       * gst-libs/gst/tag/gsttagdemux.c:
+       * gst-libs/gst/tag/gstvorbistag.c:
+       * gst-libs/gst/tag/gstxmptag.c:
+       * gst-libs/gst/tag/tag.h:
+       * gst-libs/gst/tag/tags.c:
+         tags: port to new metadata and memory API
+
 2011-03-25 14:55:52 +0200  Stefan Kost <ensonic@users.sf.net>
 
        * common:
          detect the errors.
          Fixes bug #644845.
 
+2011-03-15 11:11:56 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11-fdo
+
 2011-03-14 19:42:49 +0100  Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
        * ext/ogg/gstoggmux.c:
          these clients will never be disconnected and for that reason it should be
          handled in the select() loop too.
 
+2010-10-22 14:01:26 +0200  Andoni Morales Alastruey <amorales@flumotion.com>
+
+       * gst/tcp/gstmultifdsink.c:
+         multifdsink: disconnect inactive clients in the select loop too
+         Clients are usually disconnected in the streaming thread if their inactivity
+         is bigger than the timeout. If no new buffers are to be rendered in the sink,
+         these clients will never be disconnected and for that reason it should be
+         handled in the select() loop too.
+
+2011-03-09 11:51:14 +0000  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/app/Makefile.am:
+       * gst-libs/gst/audio/Makefile.am:
+       * gst-libs/gst/cdda/Makefile.am:
+       * gst-libs/gst/fft/Makefile.am:
+       * gst-libs/gst/interfaces/Makefile.am:
+       * gst-libs/gst/netbuffer/Makefile.am:
+       * gst-libs/gst/riff/Makefile.am:
+       * gst-libs/gst/rtp/Makefile.am:
+       * gst-libs/gst/rtsp/Makefile.am:
+       * gst-libs/gst/sdp/Makefile.am:
+       * gst-libs/gst/tag/Makefile.am:
+       * gst-libs/gst/video/Makefile.am:
+         libs: make sure gobject-introspection scanner calls gst_init()
+         Fixes introspection failures caused by type assertions/warnings.
+         Since we now moved from _get_type() functions to external GType
+         variables in a couple of places, we actually have to call gst_init()
+         to make sure these are set when we use GST_TYPE_FOO.
+
+2011-03-09 11:45:03 +0000  Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+       * gst-libs/gst/app/Makefile.am:
+         libgstapp: fix backticks in gobject-introspection section of Makefile.am
+
 2010-11-03 14:37:07 +0530  Arun Raghavan <arun.raghavan@collabora.co.uk>
 
        * gst-libs/gst/pbutils/gstdiscoverer.c:
          container.
          https://bugzilla.gnome.org/show_bug.cgi?id=632291
 
+2011-03-08 17:01:41 +0000  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/netbuffer/gstnetbuffer.c:
+       * sys/v4l/v4lsrc_calls.c:
+       * sys/ximage/ximagepool.c:
+       * sys/xvimage/xvimagesink.c:
+         meta: update for new API
+
+2011-03-04 18:32:53 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagepool.h:
+       * sys/ximage/ximagesink.c:
+         ximagesink: make metadata methods more like core
+
+2011-03-04 17:25:46 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         baseaudiosink: use sink preroll lock
+
+2011-03-04 10:21:52 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+         ximagesink: reset the pool
+
+2011-03-03 18:39:38 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagepool.c:
+         ximagesink: implement buffer_alloc from the pool
+         Use the bufferpool for pad_alloc when we are asked for the same caps as the
+         bufferpool.
+
+2011-03-03 16:48:23 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/Makefile.am:
+       * sys/ximage/ximage.c:
+       * sys/ximage/ximagepool.c:
+       * sys/ximage/ximagepool.h:
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+         ximage: rewrite the buffer pool in ximagesink
+         Rewrite the pooling in ximagesink to extend from the bufferpool base class in
+         core. Move some code to a comon place and refactor.
+
+2011-03-04 16:21:13 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+
 2011-03-03 19:14:38 +0100  Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
 
        * gst-libs/gst/audio/gstbaseaudiosink.c:
          Automatic update of common submodule
          From 1de7f6a to 6aec6b9
 
+2011-02-28 12:59:40 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/netbuffer/gstnetbuffer.c:
+       * gst-libs/gst/netbuffer/gstnetbuffer.h:
+         netbuffer: Implement NetAddress with metadata
+         Make a NetAddress metadata.
+
+2011-02-27 19:42:31 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/v4l/v4lsrc_calls.c:
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         meta: fix for new API
+
+2011-02-26 18:19:01 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+         ximagesink: experiment with convenience macros
+
+2011-02-25 16:28:55 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/xvimagesink.h:
+         ximage: fix macros
+
+2011-02-25 16:01:47 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/xvimage/xvimagesink.c:
+         ximage: reimplement buffer pooling with metadata
+         Use the buffer metadata to get back to the extra info we can use to optimize the
+         video rendering.
+
+2011-02-25 15:49:33 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/v4l/v4lsrc_calls.c:
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         metadata: implement extra buffer data with metadata
+         Use buffer metadata to attach arbitrary extra data to buffers.
+
+2011-02-24 12:19:27 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * tests/examples/app/appsink-src.c:
+       * tests/examples/app/appsrc_ex.c:
+         tests: fix some tests now that appbuffer is gone
+
+2011-02-24 12:18:43 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/v4l/v4lsrc_calls.c:
+         v4l: use buffer private data for extra buffer info
+         Since we can't subclass anymore, use the owber_priv pointer for storing extra
+         info for the buffer.
+
+2011-02-24 11:57:53 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * sys/ximage/ximagesink.c:
+       * sys/ximage/ximagesink.h:
+       * sys/xvimage/xvimagesink.c:
+       * sys/xvimage/xvimagesink.h:
+         X11: port imagesinks to new miniobjects
+         Remove the subbuffer from X11 sinks and use the private pointer to store a
+         single buffer metadata with the extra info.
+
+2011-02-23 15:46:56 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/encoding/gstencodebin.c:
+       * gst/playback/gstplaybin.c:
+       * gst/playback/gstplaybin2.c:
+       * gst/playback/gstplaysink.c:
+       * gst/subparse/gstssaparse.c:
+         miniobject: fix for changed miniobject
+
+2011-02-23 14:12:22 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/pbutils/encoding-profile.c:
+       * gst-libs/gst/pbutils/encoding-profile.h:
+       * gst-libs/gst/pbutils/encoding-target.c:
+       * gst-libs/gst/pbutils/encoding-target.h:
+       * gst-libs/gst/pbutils/gstdiscoverer-types.c:
+       * gst-libs/gst/pbutils/gstdiscoverer.c:
+       * gst-libs/gst/pbutils/gstdiscoverer.h:
+       * gst-libs/gst/pbutils/pbutils-private.h:
+         pbutils: use GObject as the base class
+         We can't subclass miniobject so use GObject as the base class,
+
+2011-02-23 13:42:16 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+         baseaudiosink: remove deprecated method
+
+2011-02-23 13:14:21 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/netbuffer/gstnetbuffer.c:
+       * gst-libs/gst/netbuffer/gstnetbuffer.h:
+         netbuffer: disable GstNetBuffer object
+         There are no more buffer subclasses and this should be implemented with
+         buffermetadata later.
+
+2011-02-23 13:13:32 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst-libs/gst/app/Makefile.am:
+       * gst-libs/gst/app/gstappbuffer.c:
+       * gst-libs/gst/app/gstappbuffer.h:
+         app: remove appbuffer
+         There are no more buffer subclasses and the application can use the regular API
+         to make buffers.
+
+2011-02-28 11:47:44 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+         Merge branch 'master' into 0.11
+         Conflicts:
+         configure.ac
+         gst-libs/gst/pbutils/Makefile.am
+
 2011-02-28 10:10:22 +0200  Stefan Kost <ensonic@users.sf.net>
 
        * tests/check/Makefile.am:
          Otherwise it will generate they symbols as _GstRTSP* (with the leading
          underscore).
 
+2010-12-07 11:31:30 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/ogg/gstoggdemux.c:
+       * gst/playback/gstdecodebin2.c:
+       * gst/playback/gstplaybin.c:
+         use _object_ref_sink() when we can
+
+2010-12-07 11:30:28 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * ext/alsa/gstalsadeviceprobe.c:
+         alsaprobe: don't abuse the object class lock
+         don't abuse the class lock but use a new static lock for protecting the probed
+         list of devices.
+
+2010-12-06 20:01:35 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * gst/tcp/gstmultifdsink.c:
+       * gst/tcp/gstmultifdsink.h:
+       * gst/tcp/gsttcp.c:
+       * gst/tcp/gsttcp.h:
+       * gst/tcp/gsttcpclientsink.c:
+       * gst/tcp/gsttcpclientsink.h:
+       * gst/tcp/gsttcpclientsrc.c:
+       * gst/tcp/gsttcpclientsrc.h:
+       * gst/tcp/gsttcpserversrc.c:
+       * gst/tcp/gsttcpserversrc.h:
+         tcp: remove deprecated GDP protocol
+
+2010-12-06 17:09:10 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * configure.ac:
+       * gst-libs/gst/app/Makefile.am:
+       * gst-libs/gst/audio/Makefile.am:
+       * gst-libs/gst/cdda/Makefile.am:
+       * gst-libs/gst/fft/Makefile.am:
+       * gst-libs/gst/interfaces/Makefile.am:
+       * gst-libs/gst/netbuffer/Makefile.am:
+       * gst-libs/gst/pbutils/Makefile.am:
+       * gst-libs/gst/riff/Makefile.am:
+       * gst-libs/gst/rtp/Makefile.am:
+       * gst-libs/gst/rtsp/Makefile.am:
+       * gst-libs/gst/sdp/Makefile.am:
+       * gst-libs/gst/tag/Makefile.am:
+       * gst-libs/gst/video/Makefile.am:
+         more 0.10 -> 0.11 changes
+
+2010-12-06 16:50:39 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * android/alsa.mk:
+       * android/app.mk:
+       * android/app_plugin.mk:
+       * android/audio.mk:
+       * android/audioconvert.mk:
+       * android/decodebin.mk:
+       * android/decodebin2.mk:
+       * android/gdp.mk:
+       * android/interfaces.mk:
+       * android/netbuffer.mk:
+       * android/pbutils.mk:
+       * android/playbin.mk:
+       * android/queue2.mk:
+       * android/riff.mk:
+       * android/rtp.mk:
+       * android/rtsp.mk:
+       * android/sdp.mk:
+       * android/tag.mk:
+       * android/tcp.mk:
+       * android/typefindfunctions.mk:
+       * android/video.mk:
+         android: update for 0.11
+
+2010-12-06 12:11:03 +0100  Wim Taymans <wim.taymans@collabora.co.uk>
+
+       * configure.ac:
+         configure: start 0.11 branch
+
 2010-12-04 14:48:46 +0000  Tim-Philipp Müller <tim.muller@collabora.co.uk>
 
        * tests/examples/app/appsrc-ra.c:
index 00201ec..126379f 100644 (file)
@@ -79,6 +79,9 @@ CRUFT_FILES = \
        $(top_builddir)/gst-libs/gst/audio/testchannels \
        $(top_builddir)/tools/gst-discoverer
 
+CRUFT_DIRS = \
+       $(top_srcdir)/sys/v4l \
+       $(top_srcdir)/tests/examples/v4l
 
 include $(top_srcdir)/common/cruft.mak
 
diff --git a/NEWS b/NEWS
index 6ee1d4f..f45032c 100644 (file)
--- a/NEWS
+++ b/NEWS
-This is GStreamer Base Plug-ins 0.10.35, "Short Notice"
+This is GStreamer Base Plug-ins 0.11.0, "Just like a pacifier"
 
-Changes since 0.10.34:
+New in 0.11.0:
 
-      * work around GLib atomic ops API change
-      * don't use G_CONST_RETURN in public headers 
-      * subparse: typefinding fixes for subtitles in non-UTF8 charsets
-
-Bugs fixed since 0.10.34:
-
-      * 600043 : subparse: fails to recognise Cyrillic subtitles in windows-1251 encoding
-
-Changes since 0.10.33:
-
-      * None: this release is identical to 0.10.33 and just done to keep core/base
-       versions in sync
-
-Changes since 0.10.32:
-
-      * audioringbuffer: make sure to not start if the may_start flag is FALSE
-      * baseaudiosink: arrange for running clock when rendering eos
-      * baseaudiosink: don't allow aligning behind the read-segment
-      * baseaudiosink: start ringbuffer upon going to PLAYING and already EOS
-      * riff: Add support for video/x-camstudio
-      * rtcpbuffer: fix invalid read in validation of padding in rtcp packet
-      * rtcpbuffer: Round to next 32bit word, not current 32bit word at end of SDES chunk
-      * rtpbuffer: Off-by-one error when creating RTP header extensions with a two-byte header
-      * rtsptransport: ensure valid int result when parsing ranges
-      * tag: map the ID3v2 TENC frame to GST_TAG_ENCODED_BY
-      * tag: add GST_TAG_CAPTURING_EXPOSURE_COMPENSATION incl. EXIF/XMP mappings
-      * tag: add a new GstTagXmpWriter interface to select XMP schemas to be used
-      * tagdemux: also push cached events downstream when operating in pull mode
-      * video: add GST_VIDEO_BUFFER_PROGRESSIVE flag
-      * video: add ARGB64 and AYUV64 (16 bits per channel) formats
-      * video: add r210 (10 bits per channel) format
-      * video: add gst_video_format_get_component_depth() and _new_template_caps()
-      * video: fix creation of grayscale caps and height calculation for YUV9/YVU9
-      * appsink: emit "new-buffer-list" signal for buffer lists if handled by app
-      * audiorate: add "skip-to-first" property
-      * decodebin2: don't use the same parser element multiple times in the same chain
-      * decodebin2: improve detection of raw caps in expose-all-streams=false mode
-      * discoverer: don't wait for subtitle streams to preroll; leak fixes
-      * discoverer: use nominal bitrate if bitrate tag is unavailable
-      * encodebin: add an audioconvert after the audio resampler
-      * encodebin: fix refcounting issues and leaks related to request pads
-      * encodebin: return a new reference of the pad for the "request-pad" signal
-      * encodebin: set all elements to NULL and remove them from the bin when removing a source group
-      * encodebin: tear down old profiles when setting new ones
-      * multifdsink: disconnect inactive clients in the select loop too
-      * oggmux: prefer headers from caps to determine stream type (for VP8)
-      * oggmux: fix issue with ogg page numbering and discont flag handling
-      * oggmux: ensure stream serial numbers are unique
-      * oggmux: use running time for muxing instead of timestamps
-      * oggparse: better detection of delta unit flag
-      * playbin2, uridecodebin: add "source-setup" signal
-      * playbin2: always prefer the custom set sink and also set it back to NULL in all cases
-      * playbin2: check if an already existing sink supports the non-raw format too
-      * playbin2: fix handling of non-raw custom sinks
-      * playbin2: if a sink claims to support ANY caps assume that it only supports the usual raw formats
-      * playbin2: only consider the audio/video sinks in autoplug_continue for the normal uridecodebin
-      * playbin2: use gst_pad_accept_caps() instead of intersecting with the getcaps caps
-      * playbin2: set sinks to READY before checking if it accept caps
-      * textoverlay: add support for ARGB and other RGB alpha variants, and xBGR and RGBx
-      * textoverlay: add support for vertical center alignment
-      * textoverlay: converted AYUV to use 'A OVER B' alpha compositing
-      * textoverlay: use a class wide mutex to work around pango reentrance issues
-      * theoraenc: don't reset the video quality when setting the bitrate
-      * theoraenc: allow adjustment of the speed level while running
-      * theoraenc: set speed-level property defaults from libtheora's defaults
-      * typefinding: MPEG-TS detection fixes
-      * typefinding: detect HTTP live streaming m3u8 playlists
-      * typefinding: detect windows icon files and DEGAS images (to avoid false positives)
-      * typefinding: detect raw h.263
-      * typefinding: add depth and endianness fields to DTS caps
-      * uridecodebin: Add default handler for autoplug-select
-      * uridecodebin: add https:// to protocols for which to enable buffering
-      * uridecodebin: expose "autoplug-sort" signal
-      * uridecodebin: post proper error message if decodebin2/typefind elements are missing
-      * uridecodebin: Return NULL from the default autoplug-sort handler
-      * videorate: fix "skip-to-first" timestamp setup
-      * videoscale: add 16-bit-channel support (ARGB64, AYUV64), fix ARGB bilinear scaling
-      * videotestsrc: add 16-bit-per-channel support (ARGB64, AYUV64)
-      * vorbis: add support for using tremolo on android
-      * vorbistag: Add support for METADATA_BLOCK_PICTURE tags
-      * vorbistag: Write GST_TAG_IMAGE and GST_TAG_PREVIEW_IMAGE as METADATA_BLOCK_PICTURE
-      * win32: fix DEFAULT_AUDIOSINK, should be direct*sound*sink
-      * xvimagesink: don't paint the window black when going to NULL
-
-Bugs fixed since 0.10.32:
-
-      * 618516 : [typefinding] need raw H.263 typefinder
-      * 619778 : oggdemux: fails on zero-length pages with Patent_Absurdity_HD_3540kbit.ogv
-      * 633837 : videoscale: invalid reads after conversion to orc linear scaling
-      * 412678 : random segfaults or memory corruptions with multiple textoverlays (pango not reentrant)
-      * 620364 : [typefinding] .ico file detected as AAC
-      * 625129 : typefinding: file incorrectly detected as audio/x-dts
-      * 626152 : [playbin2] add " source-setup " signal
-      * 627268 : [tag] add GST_TAG_ENCODED_BY and map id3v2 TENC frame
-      * 629196 : oggmux: re-tagging an Ogg Vorbis file may corrupt audio data
-      * 632291 : discoverer: sparse tracks cause prerolling to hang till timeout
-      * 632889 : [multifdsink] [PATCH] Disconnect inactive clients in the select loop too
-      * 635669 : [vorbistag] Support METADATA_BLOCK_PICTURE for Vorbis cover art
-      * 635784 : ringbuffer: make sure to not start if the may_start flag is FALSE
-      * 635800 : xvimagesink flashes black when going from READY_TO_NULL
-      * 636886 : baseaudiosink: no running clock when eos leads to hang in PLAYING
-      * 639136 : [oggparse]code is not safe when using libogg fuctions
-      * 639159 : [textoverloay] Add vertical center alignment option
-      * 639237 : textoverlay: patch to use " A OVER B " alpha compositing
-      * 639744 : [oggdemux] Removing dead code:
-      * 640189 : oggmux: cleanup
-      * 640211 : oggmux: ensure serialnos are unique
-      * 640607 : appsink never sends " new-buffer-list " signal
-      * 640709 : [typefindfunctions] h264 typefinder registered with MPEG_VIDEO_CAPS
-      * 640804 : checks: encodebin test fails if theora or vorbis plugins are not available
-      * 641706 : discoverer: Keep references on discoverer objects for callbacks
-      * 641860 : discoverer: Use nominal bitrate if bitrate tag is unavailable
-      * 641917 : [gdppay] Ensure buffer's medata is writeable before setting it
-      * 641927 : [encodebin] refcount issue with the " request-pad " signal
-      * 641952 : [videoscale] assertion on fixate_caps
-      * 642174 : Playbin2 cannot work with non-raw custom sinks
-      * 642232 : theoraenc sets Video quality to zero when explicitely setting the bitrate to 0
-      * 642274 : [playbin2] arbitrary audio-sink is chosen even though explicitely having set a custom audio-sink bin
-      * 642381 : potential memleak in decodebin2
-      * 642466 : playbin2: after replacing a video sink with the pipeline in NULL state I still get the old one
-      * 642720 : audiotestsrc: pipelines with multiple instances with wave=gaussian-noise, white-noise, or pink-noise are very slow
-      * 642942 : adder: offset_end field of outgoing buffers is set to GST_BUFFER_OFFSET_NONE
-      * 642949 : pbutils: encoding-target: chaining error object in loading target from file may cause crash if there is no error
-      * 643775 : [oggmux] use running time instead of timestamps
-      * 644416 : [encodebin] Cannot be reused
-      * 644745 : [oggmux] Fails to mux Speex content, doesn't preroll
-      * 644845 : [alsa] Comparison of unsigned int < 0 always false in gstalsamixer.c
-      * 644996 : libsABI check doesn't depend only on architecture
-      * 645167 : [xmp] Add a new XmpConfig interface
-      * 645437 : encoding-profile: Fix syntax in Example: Creating a profile
-      * 646570 : baseaudiosink: don't allow aligning behind the read-segment
-      * 646572 : baseaudiosrc: protect against ringbuffer disappearing while in a query
-      * 646573 : baseaudiosrc: Add src object lock around call to ringbuffer parse caps
-      * 646575 : rtcpbuffer: Round to next 32bit word, not current 32bit word at end of SDES chunk
-      * 646576 : rtcpbuffer: fix invalid read in validation of padding in rtcp packet
-      * 646923 : video: Remove unused variable
-      * 646924 : rtp: Remove unused variables
-      * 646925 : encoding-profile: Remove unused variables
-      * 646952 : Fix the strlol return type mismatch :
-      * 647399 : Bad typo in ID3 tags: psychadelic - > psychedelic
-      * 647721 : Remove excessive checking for video.c
-      * 647781 : [playbin2] missing shutdown steps and inconsistent error behaviour
-      * 647856 : [oggmux] Assumes that the first buffer can be used to detect the stream type
-      * 647857 : [xvimagesink/ximagesink] Handle NULL caps in buffer_alloc()
-      * 647942 : [pango] Use different Pango contexts for the different subclasses
-      * 647943 : [pango] Class global pango mutex not always used
-      * 648459 : tag: exif: register common tags from tag library
-      * 648466 : Ogg to LPCM transcoding fails
-      * 648548 : videoscale broken with orc 0.4.13
-      * 642667 : [playbin2] autoplug-factories code does not do what it claims to do
-      * 642732 : [playbin2] sinks set to READY after activating groups causes bad autoplug-continue decisions
-      * 646744 : libgsttag: Minor issues building gst-plugins-base with MS compiler
-      * 647294 : gst-plugins-base doesn't compile with GCC 4.6
-
-API additions since 0.10.32:
-
-      * gst_tag_list_to_xmp_buffer_full()
-      * gst_tag_xmp_list_schemas()
-      * gst_tag_xmp_writer_add_all_schemas()
-      * gst_tag_xmp_writer_add_schema()
-      * gst_tag_xmp_writer_get_type()
-      * gst_tag_xmp_writer_has_schema()
-      * gst_tag_xmp_writer_remove_all_schemas()
-      * gst_tag_xmp_writer_remove_schema()
-      * gst_tag_xmp_writer_tag_list_to_xmp_buffer()
-      * GST_TAG_CAPTURING_EXPOSURE_COMPENSATION
-      * gst_video_format_get_component_depth()
-      * gst_video_format_new_template_caps()
-
-Changes since 0.10.31:
-
-      * GLib requirement is now >= 2.22, gobject-introspection >= 0.9.12
-      * New encodebin element
-      * New encoding profile and encoding targets API in pbutils
-      * audioresample: corrected buffer duration calculation to account for nonzero initial timestamp
-      * audioresample: provide as much valid output ts and offset as valid input
-      * audioresample: push half a history length, instead of a full history length, at end-of-stream
-        so that output segment and input segment have same duration
-      * decodebin2: deprecate new-decoded-pad and removed-decoded-pad signals (use "pad-added" and "pad-removed" instead)
-      * multifdsink: add first and last buffer's timestamp to the stats; only keep last valid timestamp
-      * oggdemux: extract more tags (vorbis comment headers, Kate)
-      * oggdemux: ignore header pages when looking for keyframe; set headers on caps
-      * oggdemux: fix interpretation of Theora granule position and parsing of Theora size
-      * oggparse: Set DELTA_UNIT on buffers
-      * playbin2: delay stream-changed messages, fixing KATE subtitle recognition
-      * textoverlay: make text, xpos, ypos, color, and silent properties controllable
-      * typefinding: (E)AC-3 and ISO typefinder improvements; add yuv4mpeg typefinder
-      * typefinding: add "stream-format" to h264 caps, and framed=false to DTS caps
-      * typefinding: assume EBML files without doctype are matroska
-      * videorate: fix behaviour for frame rate cap changes
-      * vorbisdec: avoid using invalid timestamps; keep timestamps when no decoded output
-      * ximagesink, xvimagesink: add read-only window-width and window-height properties
-      * baseaudiopay: fix timestamps on buffer lists
-      * baseaudiosink: protect against ringbuffer disappearing while in a query
-      * basedepay: add support for buffer lists in the depayloader
-      * basertppay: use RTP base time when invalid timestamps
-      * rtpbuffer: relax arrangement for RTP bufferlists
-      * rtpdepayloader: add support for getting events
-      * rtppayload: copy applied rate to segment
-      * sdp: add method to check for multicast addresses
-      * sdp: only parse TTL for IP4 addresses
-      * video: add 8-bit paletted RGB, YUV9, YVU9 and IYU1 video formats
-      * video: return correct component width/height for A420
-
-Bugs fixed since 0.10.31:
-
-      * 619778 : oggdemux: fails on zero-length pages with Patent_Absurdity_HD_3540kbit.ogv
-      * 586570 : Add GAP Flag support to audioresample
-      * 623413 : pbutils: Add/Fix some media descriptions
-      * 627476 : New profile library and encoding plugin
-      * 629349 : [oggdemux] extract stream tags for tagreadbin and transcoding
-      * 632667 : [ximagesink] added read-only properties window-width and window-height
-      * 634397 : [multifdsink] [PATCH] Add the timestamp of the first and last buffer to the stats
-      * 634522 : gst-visualize-m.m imports but doesn't use File::Basename
-      * 635231 : baseaudiosink: protect against ringbuffer disappearing while in a query
-      * 636198 : decodebin2: " removed-decoded-pad " signal never fired
-      * 636769 : [appsink] Flushing property is never reset
-      * 636827 : Usage of gst_caps_interset where gst_caps_can_intersect was intended?
-      * 637324 : oggdemux: unable to demux Ogg files with Skeleton in push mode
-      * 637377 : timeoverlay: add missing break
-      * 637519 : ogg: implement packet duration query for kate streams
-      * 637586 : playbin2 fails to recognize subtitle caps from katedec
-      * 637735 : [encoding-profile] automatic load/save support and registry
-      * 637758 : [exiftag] Generates buffers with uninitialized data during taglist- > exif buffer serialization
-      * 637822 : oggdemux: allocate buffers using gst_buffer_new_and_alloc
-      * 637927 : oggdemux: set headers on caps
-      * 638200 : [oggdemux] fails to playback video file
-      * 638276 : oggstream: when the last keyframe position is not known, do not use -1
-      * 638859 : textoverlay: make misc. properties controllable
-      * 638901 : [encodebin] proper element documentation
-      * 638903 : [encodebin] missing-plugin support
-      * 638961 : Small configure bashism 0.10.31.2
-      * 639039 : gobject-introspection: GstPbutils gir scanner fails to link with gold linker
-      * 639121 : oggdemux: outdated comment for gst_ogg_demux_submit_buffer()
-      * 639215 : examples: Allow building with newer GTK+
-      * 639730 : discoverer: Validate timeouts before processing them
-      * 639755 : discoverer: Clean up callbacks in dispose()
-      * 639778 : discoverer: Drop new stream tags once preroll is done
-      * 639790 : [gdp] Fix metadata g_warning
-      * 639747 : Please export GST_TYPE_APP_STREAM_TYPE
-      * 553244 : theoraparse doesn't work at all (throws criticals and asserts)
-
-
-API added since 0.10.31:
-
-      * gst_app_stream_type_get_type()
-      * gst_discoverer_info_get_seekable()
-      * gst_encoding_audio_profile_get_type()
-      * gst_encoding_audio_profile_new()
-      * gst_encoding_container_profile_add_profile()
-      * gst_encoding_container_profile_contains_profile()
-      * gst_encoding_container_profile_get_profiles()
-      * gst_encoding_container_profile_get_type()
-      * gst_encoding_container_profile_new()
-      * gst_encoding_list_all_targets()
-      * gst_encoding_list_available_categories()
-      * gst_encoding_profile_find()
-      * gst_encoding_profile_get_description()
-      * gst_encoding_profile_get_format()
-      * gst_encoding_profile_get_input_caps()
-      * gst_encoding_profile_get_name()
-      * gst_encoding_profile_get_presence()
-      * gst_encoding_profile_get_preset()
-      * gst_encoding_profile_get_restriction()
-      * gst_encoding_profile_get_type()
-      * gst_encoding_profile_get_type_nick()
-      * gst_encoding_profile_is_equal()
-      * gst_encoding_profile_set_description()
-      * gst_encoding_profile_set_format()
-      * gst_encoding_profile_set_name()
-      * gst_encoding_profile_set_presence()
-      * gst_encoding_profile_set_preset()
-      * gst_encoding_profile_set_restriction()
-      * gst_encoding_target_add_profile()
-      * gst_encoding_target_get_category()
-      * gst_encoding_target_get_description()
-      * gst_encoding_target_get_name()
-      * gst_encoding_target_get_profile()
-      * gst_encoding_target_get_profiles()
-      * gst_encoding_target_get_type()
-      * gst_encoding_target_load()
-      * gst_encoding_target_load_from_file()
-      * gst_encoding_target_new()
-      * gst_encoding_target_save()
-      * gst_encoding_target_save_to_file()
-      * gst_encoding_video_profile_get_pass()
-      * gst_encoding_video_profile_get_type()
-      * gst_encoding_video_profile_get_variableframerate()
-      * gst_encoding_video_profile_new()
-      * gst_encoding_video_profile_set_pass()
-      * gst_encoding_video_profile_set_variableframerate()
-      * gst_base_rtp_depayload_push_list()
-      * gst_rtsp_url_decode_path_components()
-      * gst_sdp_address_is_multicast()
-      * gst_video_parse_caps_palette()
-
-Changes since 0.10.30:
-
-      * adder: Make sure FLUSH_STOP is always sent after a flushing seek
-      * alsasrc, alsasink: add "card-name" property to get the card name in addition to the device name
-      * appsrc: don't override buffer caps if appsrc caps are NULL; fix element classification
-      * audioclock: add a function to invalidate the clock
-      * audioconvert: optimise remaining conversion code paths with Orc as well
-      * baseaudiosink,baseaudiosrc: post clock-provide and clock-lost messages when going from/to READY to/from PAUSED
-      * baseaudiosink: subtract the render_delay from our latency
-      * decodebin2: don't add non prerolled stream to topology
-      * ffmpegcolorspace: add support for A420 and fix support for 8 bit paletted RGB and IYU1
-      * gnomevfsrc: set GST_PARAM_MUTABLE_READY flag on the "handle" property
-      * libvisual: add latency query; only drop frames that are really too old
-      * multifdsink: gdp protocol is deprecated. People should use gdppay instead
-      * oggdemux: fix seeking with negative rate with skeleton; fix wrong flowreturn handling
-      * pbutils: AAC profile and level detection utility functions
-      * pbutils: H.264 and MPEG-4 profile and level extraction utility functions
-      * pbutils: new GstDiscoverer utility API for extracting metadata and tags
-      * playbin2, decodebin2: declare stable, deprecate the old playbin/decodebin
-      * playbin2, uridecodebin: add property to configure ring buffer size
-      * rtcpbuffer: add function to manipulation the data in RTCP feedback packets
-      * rtpbuffer: add functions to add RFC 5285 header extensions to GstBufferLists
-      * rtpbuffer: add function to add RTP header extensions with a two bytes header
-      * rtpbuffer: add function to append RFC 5285 one byte header extensions
-      * rtpbuffer: add function to parse RFC 5285 header extensions
-      * rtpbuffer: add function to read RFC 5285 header extensions from GstBufferLists
-      * rtpbuffer: add function to transform a GstBuffer into a GstBufferList
-      * rtsp: improve rtsp timeout calculation and handling
-      * sdp: add methods to convert between uri and message
-      * tags: try ISO-8859-1 as second fallback in case WINDOWS-1252 is not supported
-      * tags: add many more photography/capture tags
-      * tags: EXIF and XMP tag handling improvements
-      * textoverlay: add support for NV12, NV21 and AYUV; configurable text color and position
-      * theoradec: expose telemetry properties only if libtheora was compiled with --enable-telemetry
-      * theoraenc: add support for two-pass encoding; allow change of bitrate and quality on-the-fly
-      * tools: standalone gst-discoverer-0.10 tool for discovering media file properties
-      * typefinding: detect avc1 ftyp as video/quicktime
-      * typefinding: export 3gp profile in caps
-      * typefinding: detect enhanced AC-3
-      * typefinding: extend AAC typefinder to detect LOAS streams
-      * typefinding: fix ADTS caps stream-format detail
-      * typefinding: more reliable mpeg-ts typefinding
-      * uridecodebin: Only enable progressive downloading if the upstream duration in bytes is known
-      * video: add  gst_video_convert_frame*() utility functions
-      * videorate: fixate the pixel-aspect-ratio if necessary
-      * videorate: mark duplicated frames with the GAP flag
-      * videoscale: add support for adding black borders to keep the DAR if necessary ("add-borders" property)
-      * videoscale: Fix caps fixating if the height is fixed but the width isn't
-      * videoscale: only set the PAR if the caps already had a PAR
-      * videoscale: refactor using more Orc code
-      * videotestsrc: new patterns: solid-color, ball, bar and smpte100
-      * videotestsrc: add "foreground-color" and "background-color" properties, deprecate "colorspec" property
-      * videotestsrc: add support for UYVP format, fix NV21 rendering
-      * volume: use Orc to optimise many code paths
-      * vorbisdec: decode pending buffers upon EOS when doing reverse playback
-      * xoverlay: add set_window_handle() with guintptr argument, deprecate set_xwindow_id() which doesn't work on some platforms
-      * xoverlay: allow render rectangle coordinates to be negative
-
-Bugs fixed since 0.10.30:
-
-      * 628028 : [uridecodebin] Don't enable progressive downloading for live streams
-      * 623846 : typefinding: add support for " enhanced ac3 " (eac3)
-      * 602437 : [playbin2] [gapless] Completely broken when switching between files with audio/video only
-      * 612264 : Notification needed when the first buffer is pushed by the basertppayloader
-      * 615471 : [videoscale] Interlaced handling makes output worse than no interlaced handling at all
-      * 616392 : videotestsrc colorspec=0/1 does not affect color-matrix in caps
-      * 617314 : pbutils: Add codec-specific utility functions for AAC, H.264, MPEG-4 video
-      * 617506 : [videoscale] Add support for adding black borders if necessary to keep the DAR
-      * 620291 : typefindfunctions: Export 3gp profile in caps
-      * 623663 : [typefinding] mpeg-ts file detected as audio/mpeg
-      * 623807 : [audioclock] Add gst_audio_clock_new_full() with GDestroyNotify for the user_data
-      * 623837 : typefind: only associate .webm with WebM
-      * 623918 : [typefind] Extend AAC typefinder to detect LOAS stream
-      * 624598 : [adder] crash in orc_sse_set_mxcsr()
-      * 624656 : [videoscale] UYVY scaling broken, introduces green lines
-      * 624919 : [videotestsrc] add solid color pattern
-      * 624920 : [textoverlay] configurable text color and position
-      * 624949 : [playbin2] declare playbin2 stable
-      * 625001 : [examples] Don't use GdkDraw/GdkGC
-      * 625118 : [playbin2] Race condition with EOS events in gapless mode
-      * 625944 : [pbutils] GstDiscoverer - API to discover metadata and stream information
-      * 626125 : [alsa] Conditional jump or move depends on uninitialised value(s)
-      * 626570 : [tag] Add resolution tags
-      * 626581 : [playbin2] regression: occasional deadlocks in streamsynchronizer
-      * 626621 : [playbin2] streamsynchronizer regressions
-      * 626629 : [ffmpegcolorspace] doesn't handle palettes any longer
-      * 626718 : playback: Delay usage of GstFactoryList
-      * 627203 : [alsa] alsasrc and alsasink should expose card name via property
-      * 627297 : [regression] build-failure
-      * 627565 : [xoverlay][win64] gulong can't hold a HANDLE
-      * 627768 : add NV12 support to textoverlay
-      * 627780 : GstClockOverlay re-renders string even if it hasn't changed, resulting in very high CPU usage.
-      * 627924 : riff: add support for 2vuy
-      * 628009 : [volume] Float processing with orc broken
-      * 628400 : [videorate] does not generate buffers to fill the duration of the last frame
-      * 628500 : videotestsrc: add moving color bars pattern
-      * 628747 : gst-plugins-base: unable to build because of compiler warning in libggsttag
-      * 629157 : Move video frame conversion from playback plugin to libgstvideo
-      * 629672 : gnomevfsrsrc: " handle " property should also have the GST_PARAM_MUTABLE_READY flag
-      * 629848 : build problem with current gtk+: implicit declaration of function 'gdk_draw_rectangle', GtkStyle' has no member named 'black_gc'
-      * 630303 : theoraenc: Make the bitrate/quality dynamically modifiable
-      * 630353 : [appsrc] Avoid losing buffers' caps
-      * 630440 : ringbuffer: use g_once for type-init
-      * 630443 : baseaudiosink: Add getter and setter for drift tolerance
-      * 630471 : [tag] ligatures " Œ " and " œ " are not supported in freeform strings
-      * 630496 : seek example: add new #define to set seek bar graininess
-      * 630802 : videotestsrc.c doesn't compile in Visual Studio 2008
-      * 631128 : Add methods to manipulate RFC 5285 header extensions
-      * 631312 : [streamsynchronizer] Advancing segments too much
-      * 631633 : [oggdemux] fix seeking with negative rate with skeleton
-      * 631703 : [oggdemux] sintel ogv delay when playing
-      * 631756 : Fix build with glib 2.21.3
-      * 631773 : [tags] Add new exif tags: sharpness, metering mode, file/capturing source
-      * 631774 : [xvimagesink] sets non-simple caps on pad_alloced buffer
-      * 632167 : [oggdemux] doesn't parse/push all headers in pull mode
-      * 632653 : [seek] Don't use deprecated combo box API
-      * 632656 : [uridecodebin] internal decodebin2 might fail to reach PLAYING in streaming case
-      * 632789 : [PATCH] tests/icles/: adapted test-colorkey.c and test-xoverlay.c to deprecation of gtk_widget_hide_all
-      * 632809 : [regression] build failure in 0.10.30.2 in tools/
-      * 632988 : [discoverer] gst_caps_ref() critical for substreams of unknown streams
-      * 633023 : [discoverer] Add versionized gst-discoverer tool
-      * 633203 : Regression: streamsynchroniser + disabled deinterlacing = no DVD menu highlights/subtitles
-      * 633311 : discoverer: use specific types in getters, rename some boolean getters
-      * 633336 : [discoverer] Move documentation into the correct section
-      * 633455 : [rtsp] don't let the rtsp connection timeout
-      * 634014 : GTK+3 is a moving target, lets not compile against it by default.
-      * 634584 : decodebin2 docs should mention that " new-decoded-pad " signal may be emitted after " no-more-pads "
-      * 635067 : [*decodebin*] pad template leaked
-      * 635392 : Missing information on exported packages from GIRs
-      * 621349 : [theoraenc] Implement two-pass encoding
-      * 628488 : [theoradec] add properties to enable telemetry overlay
-      * 629746 : Enumerations have incorrect names of enum values (GEnumValue.value_name)
-      * 626869 : The RTP depayloader is sometimes sending partial frames down the pipeline without the DISCONT bit set
-
-API added since 0.10.30:
-
-      * gst_audio_clock_invalidate()
-      * gst_audio_clock_new_full()
-      * gst_base_audio_sink_get_drift_tolerance()
-      * gst_base_audio_sink_set_drift_tolerance()
-      * gst_x_overlay_got_window_handle()
-      * gst_x_overlay_set_window_handle()
-      * GstXOverlay::set_window_handle()
-      * gst_codec_utils_aac_caps_set_level_and_profile()
-      * gst_codec_utils_aac_get_level()
-      * gst_codec_utils_aac_get_profile()
-      * gst_codec_utils_aac_get_sample_rate_from_index()
-      * gst_codec_utils_h264_caps_set_level_and_profile()
-      * gst_codec_utils_h264_get_level()
-      * gst_codec_utils_h264_get_profile()
-      * gst_codec_utils_mpeg4video_caps_set_level_and_profile()
-      * gst_codec_utils_mpeg4video_get_level()
-      * gst_codec_utils_mpeg4video_get_profile()
-      * gst_discoverer_audio_info_get_bitrate()
-      * gst_discoverer_audio_info_get_channels()
-      * gst_discoverer_audio_info_get_depth()
-      * gst_discoverer_audio_info_get_max_bitrate()
-      * gst_discoverer_audio_info_get_sample_rate()
-      * gst_discoverer_audio_info_get_type()
-      * gst_discoverer_container_info_get_streams()
-      * gst_discoverer_container_info_get_type()
-      * gst_discoverer_discover_uri()
-      * gst_discoverer_discover_uri_async()
-      * gst_discoverer_get_type()
-      * gst_discoverer_info_copy()
-      * gst_discoverer_info_get_audio_streams()
-      * gst_discoverer_info_get_container_streams()
-      * gst_discoverer_info_get_duration()
-      * gst_discoverer_info_get_misc()
-      * gst_discoverer_info_get_result()
-      * gst_discoverer_info_get_stream_info()
-      * gst_discoverer_info_get_stream_list()
-      * gst_discoverer_info_get_streams()
-      * gst_discoverer_info_get_tags()
-      * gst_discoverer_info_get_type()
-      * gst_discoverer_info_get_uri()
-      * gst_discoverer_info_get_video_streams()
-      * gst_discoverer_new()
-      * gst_discoverer_result_get_type()
-      * gst_discoverer_start()
-      * gst_discoverer_stop()
-      * gst_discoverer_stream_info_get_caps()
-      * gst_discoverer_stream_info_get_misc()
-      * gst_discoverer_stream_info_get_next()
-      * gst_discoverer_stream_info_get_previous()
-      * gst_discoverer_stream_info_get_stream_type_nick()
-      * gst_discoverer_stream_info_get_tags()
-      * gst_discoverer_stream_info_get_type()
-      * gst_discoverer_stream_info_list_free()
-      * gst_discoverer_video_info_get_bitrate()
-      * gst_discoverer_video_info_get_depth()
-      * gst_discoverer_video_info_get_framerate_denom()
-      * gst_discoverer_video_info_get_framerate_num()
-      * gst_discoverer_video_info_get_height()
-      * gst_discoverer_video_info_get_max_bitrate()
-      * gst_discoverer_video_info_get_par_denom()
-      * gst_discoverer_video_info_get_par_num()
-      * gst_discoverer_video_info_get_type()
-      * gst_discoverer_video_info_get_width()
-      * gst_discoverer_video_info_is_image()
-      * gst_discoverer_video_info_is_interlaced()
-      * GST_PLUGINS_BASE_VERSION_MAJOR
-      * GST_PLUGINS_BASE_VERSION_MINOR
-      * GST_PLUGINS_BASE_VERSION_MICRO
-      * GST_PLUGINS_BASE_VERSION_NANO
-      * GST_CHECK_PLUGINS_BASE_VERSION
-      * gst_plugins_base_version()
-      * gst_plugins_base_version_string()
-      * gst_rtcp_packet_fb_get_fci()
-      * gst_rtcp_packet_fb_get_fci_length()
-      * gst_rtcp_packet_fb_set_fci_length()
-      * gst_rtp_buffer_add_extension_onebyte_header()
-      * gst_rtp_buffer_add_extension_twobytes_header()
-      * gst_rtp_buffer_get_extension_onebyte_header()
-      * gst_rtp_buffer_get_extension_twobytes_header()
-      * gst_rtp_buffer_list_add_extension_onebyte_header()
-      * gst_rtp_buffer_list_add_extension_twobytes_header()
-      * gst_rtp_buffer_list_from_buffer()
-      * gst_rtp_buffer_list_get_extension_onebyte_header()
-      * gst_rtp_buffer_list_get_extension_twobytes_header()
-      * gst_sdp_message_as_uri()
-      * gst_sdp_message_parse_uri()
-      * GST_TAG_CAPTURING_SOURCE
-      * GST_TAG_CAPTURING_METERING_MODE
-      * GST_TAG_CAPTURING_SHARPNESS
-      * GST_TAG_IMAGE_HORIZONTAL_PPI
-      * GST_TAG_IMAGE_VERTICAL_PPI
-      * GST_TAG_CAPTURING_FLASH_FIRED
-      * GST_TAG_CAPTURING_FLASH_MODE
-      * GST_TAG_CAPTURING_EXPOSURE_PROGRAM
-      * GST_TAG_CAPTURING_EXPOSURE_MODE
-      * GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE
-      * GST_TAG_CAPTURING_GAIN_ADJUSTMENT
-      * GST_TAG_CAPTURING_WHITE_BALANCE
-      * GST_TAG_CAPTURING_CONTRAST
-      * GST_TAG_CAPTURING_SATURATION
-      * GST_TAG_CAPTURING_SHUTTER_SPEED
-      * GST_TAG_CAPTURING_FOCAL_RATIO
-      * GST_TAG_CAPTURING_FOCAL_LENGTH
-      * GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO
-      * GST_TAG_CAPTURING_ISO_SPEED
-      * GST_VIDEO_FORMAT_UYVP
-      * GST_VIDEO_FORMAT_A420
-      * gst_video_convert_frame()
-      * gst_video_convert_frame_async()
-      * GstTextOverlay:xpos
-      * GstTextOverlay:ypos
-      * GstTextOverlay:color
-      * GstVideoTestSrc:solid-color
-      * GstVideoTestSrc::foreground-color
-      * GstVideoTestSrc::background-color
-
-API deprecated since 0.10.30:
-
-      * gst_x_overlay_set_xwindow_id()
-      * gst_x_overlay_got_xwindow_id()
-      * GstXOverlay::set_xwindow_id()
-
-Changes since 0.10.29:
-
-      * Use Orc (Optimized Inner Loops Runtime Compiler) for SIMD and
-        other optimisations, and remove liboil dependency. The main goal
-        for this release was to make the transition from liboil to liborc.
-        Performance improvements should not be expected and will be the
-        focus of future versions. liborc is an optional dependency for
-        the time being, to make it possible to test and develop the very
-        latest GStreamer versions on systems that don't have orc yet.
-        However, without orc slow unoptimised backup code will be used
-        for many performance critical code paths. Distributors are urged
-        to package and ship the latest version of liborc and compile
-        GStreamer modules with --enable-orc. Please do not distribute
-        GStreamer packages that are not orc enabled. More information on
-        the orc integration can be found in the docs/design/ directory.
-      * basertpaudiopayload: Set duration on buffers; add extra frame for non-complete frame lengths
-      * riff: add mappings for On2 VP8 and VP6F (On2 VP6 Flash variant)
-      * video: Add support for RGB/BGR with 15 and 16 bits, and Y800 and Y16
-      * xmp/exif tags: add mappings for new tags (device, geo location, image orientation)
-      * adder, audioconvert, audioresample, volume: convert from liboil to orc
-      * adder: rework timestamping; only accept seek-types SEEK_NONE and SEEK_SET
-      * decodebin2: add "expose-all-streams" property to not expose/decode all streams
-      * decodebin2: use accumulator for autoplug-sort
-      * ffmpegcolorspace: add YUY2/YVYU to all RGB formats conversions
-      * ffmpegcolorspace: fix conversion of packed 4:2:2 YUV to RGB and 8 bit grayscale
-      * ffmpegcolorspace: fix Y16 from/to GRAY8 conversion
-      * ffmpegcolorspace: fix Y42B from/to YUY2/YVYU/UYVY conversion for odd widths
-      * ffmpegcolorspace: Map "Y8  " and "GREY" to "Y800" and add it to the template caps
-      * ffmpegcolorspace: negotiation speed-ups
-      * oggdemux: implement seeking and duration estimates when operating in push mode (http etc.)
-      * oggdemux: parse Skeleton index packets for better seeking in push mode
-      * oggdemux: fix granulepos->key granule calculation for Dirac video
-      * oggdemux: fix EOS flow aggregation: only EOS when all streams are EOS
-      * oggmux: Start a new page for every CMML buffer
-      * ogg: Implement Ogg VP8 mapping
-      * playbin2: add "av-offset" property to adjust audio/video sync
-      * playbin2: add flag for enabling/disabling automatic deinterlacing
-      * playbin2: fix race when querying duration right after preroll, by forwarding duration
-        query duration during group switch if no cached duration exists
-      * playbin2: if a text sink is provided, let subtitle parsing be done by decodebin2 if required
-      * playbin2: set the subtitle encoding on the decodebins again
-      * playsink: also expose "convert-frame" action signal and "frame" property in playsink
-      * playsink: reconfigure the video chain correctly when switching from a subtitle to a non-subtitle file
-      * playsink: Don't fail if subtitles are used but only audio is available and no visualizations
-      * typefinding: add WebM typefinder (was in -good before)
-      * typefinding: add IVF and dts typefinders, improve AC-3 and jpeg typefinding
-      * typefinding: detect ISO 14496-14 files as video/quicktime not audio/x-m4a
-      * uridecodebin: add all qtdemux types to downloadable types
-      * uridecodebin: add the 'expose-all-streams' property from decodebin2
-      * uridecodebin: Allow video/webm for progressive downloading
-      * videorate, videotestsrc: fixate color-matrix, chroma-site and interlaced fields if necessary
-      * videoscale: Try to keep DAR when scaling
-      * videoscale: Add support for Y444, Y42B and Y41B and more gray formats
-      * videoscale: Fix resampling of ARGB scanlines
-      * videoscale: Try harder to keep the DAR if possible
-      * videoscale: Use passthrough mode if width and height are not changed
-
-Bugs fixed since 0.10.29:
-
-      * 621428 : [playbin2] ghostpad with arbitrary getcaps func leads to not working srt subtitles
-      * 371108 : videoscale sucks at basic mathematics when it comes to PAR
-      * 512740 : unit test failures if compiling against installed core with installed plugins-base also present
-      * 605100 : GNOME Goal: Remove deprecated glib symbols
-      * 610866 : [playbin2] Don't fail if there are subtitles and audio but no video
-      * 614872 : [tag] Add basic exif support
-      * 614942 : playbin2: " text-sink " is supposed to handle raw subtitle data?
-      * 615783 : reworked timestamping in adder
-      * 616396 : [playbin2] might fail a duration query immediately following PAUSED state
-      * 616422 : playsink might not handle reconfiguring after a text enabled file correctly
-      * 616557 : [videorate] Add support for video/x-raw-gray
-      * 617636 : [rtsp] uses unicode characters in date string
-      * 617855 : [oggdemux] Fails to play LAC2010 videos
-      * 617868 : [decodebin2] Option to not expose/decode all streams
-      * 618324 : rtp payloader don't put the duration on their output buffers
-      * 618392 : [avi-demux] Gstreamer does not support 1x1 or 1xN avi files
-      * 618625 : lock priv mutex in appsrc when setting caps
-      * 619090 : [uridecodebin] caps negociation fail
-      * 619102 : [PATCH] WebM typefinder
-      * 619310 : [videorate] negotiation issue, tries to set unfixed caps on pad
-      * 619396 : gstreamer does not seek http streams of Ogg Vorbis and Flac audio files.
-      * 620136 : Orc integration
-      * 620140 : [gio] report out-of-space errors
-      * 620211 : gst-plugins-base gets confused by dual-QT system
-      * 620279 : [playsink] expose 'frame' property and move 'convert-frame' action from playbin2
-      * 620342 : [baseaudiosink] Allocate and free the clock in state changes
-      * 620412 : [video] Incomplete support for 15 and 16 bit RGB and BGR formats
-      * 620441 : [video] Add support for Y800 and Y16 formats
-      * 620500 : totem won't do progressive download for flv videos
-      * 620720 : typefinding: Mark ISO 14496-14 files as video/quicktime
-      * 620939 : [oggdemux] No support for Skeleton 4.0 streams
-      * 621071 : [playbin2] no playback with fakesink instead of appsink as text-sink
-      * 621161 : autoplug-sort default callback is run last - overwrite user supplied callback result
-      * 621190 : video sink drops buffers if it's preceded by ffmpegcolorspace, videoscale and a capsfilter
-      * 621509 : [xmptag] Uses uninitialized variable
-      * 621572 : [videoscale] Adds horizontal green lines in bilinear mode
-      * 622696 : ffmpegcolorspace: Speed up caps nego by using simpler caps
-      * 622807 : [decodebin2] Doesn't recover properly after an error
-      * 622944 : Require automake 1.9 or newer for $(builddir)
-      * 623003 : Major problems with calls to gst_util_uint64_scale()
-      * 623176 : riff: matroska file with FLV4 FOURCC fails to play
-      * 623218 : oggdemux: Handle errors from _get_next_page in _do_seek.
-      * 623233 : GstNetBuffer initialization isn't thread safe.
-      * 623318 : [playbin2] If source setup fails the old uridecodebin is kept and breaks future playback
-      * 623375 : [ffmpegcolorspace] Invalid memory accesses with odd widths/height during subsampling
-      * 623384 : [ffmpegcolorspace] Doesn't write last pixel for odd widths in packed 4:2:2 YUV- > RGB conversion
-      * 623418 : [ffmpegcolorspace] Fix packed 4:2:2 YUV to 8 bit grayscale conversion for odd widths
-      * 623530 : [ffmpegcolorspace] Stripy pattern with videotestsrc ! ffmpegcolorspace ! ximagesink
-      * 623583 : [playbin2] regression: DVD playback broken
-      * 624266 : [playbin2] Internal uridecodebin are not properly removed in READY= > NULL
-      * 547603 : [playbin2] add deinterlacing support
-
-API added since 0.10.29:
-
-      * GST_VIDEO_FORMAT_v308
-      * GST_VIDEO_FORMAT_Y800
-      * GST_VIDEO_FORMAT_Y16
-      * GST_VIDEO_FORMAT_RGB16
-      * GST_VIDEO_FORMAT_BGR16
-      * GST_VIDEO_FORMAT_RGB15
-      * GST_VIDEO_FORMAT_BGR15
-      * gst_tag_image_orientation_to_exif_value ()
-      * gst_tag_image_orientation_from_exif_value ()
-      * gst_tag_list_to_exif_buffer ()
-      * gst_tag_list_to_exif_buffer_with_tiff_header ()
-      * gst_tag_list_from_exif_buffer ()
-      * gst_tag_list_from_exif_buffer_with_tiff_header ()
-
-Changes since 0.10.28:
-
-      * video: add support for color-matrix and chroma-site fields in video caps and selected elements
-      * video: Add support for 8-bit and 16-bit grayscale formats
-      * typefinding: add AAC profile, level, channels and rate to ADTS caps
-      * tags: add basic xmp metadata support
-      * gio, gnomevfs: invert ranks of gio and gnomevfs elements: gio is prefered now, gnomevfs has been deprecated
-      * riff: add mapping for On2 VP62 and VP7 and add some more MPEG4 fourccs
-      * playsink: Don't fail if there are subtitles and audio but no video
-      * oggdemux: map old FLAC mapping correctly
-      * alsa: handle disappearing of sound device whilst in use more gracefully
-      * playbin: Only unref the volume element on dispose and when a new audio sink is set
-      * build: build plugin, example and libs directories in parallel if make -jN is used
-      * uridecodebin/playbin2: we can handle avi in download mode too
-      * rtsp: handle closed POST socket in tunneling, ignore unparsable ranges, allow for more ipv6 addresses
-      * audiopayload: add property to control packet duration
-
-Bugs fixed since 0.10.28:
-
-      * 615647 : xvimagesink could miss initial expose
-      * 423086 : vorbisdec introduces timestamp discontinuity at the end
-      * 601315 : [uridecodebin] No download buffering for AVI files
-      * 609539 : xmp metadata support in tag library
-      * 609801 : [volume] Use sample accurate property values if a controller is used
-      * 610248 : don't poll geometry for every frame
-      * 610249 : [xoverlay] add set_render_rectangle() methods
-      * 610866 : [playbin2] Don't fail if there are subtitles and audio but no video
-      * 611702 : playbin2: Warning: g_object_set: assertion `G_IS_OBJECT (object)' failed with custom text sink
-      * 612223 : [base(audio)sink] hangs in _wait_eos
-      * 612312 : typefind: Post AAC profile in caps
-      * 612552 : Examples and tests don't compile with -DGSEAL_ENABLE
-      * 612783 : Warning when compiling gstsubparse.c with MSVC
-      * 612845 : [typefindfunctions] crash in strncasecmp() on windows
-      * 612968 : Add On2 VP62 and VP7 support in riff-media
-      * 613093 : Improper boundary condition handling in videoscale.
-      * 613198 : ximagesink memory leak
-      * 613248 : [audiopayload] add property to control packet duration
-      * 613281 : [PATCH] autogen.sh: Don't call configure with --enable-plugin-docs
-      * 613387 : [gio] compiler warning with GLib 2.18, breaks build with -Werror
-      * 613403 : docs: gst_x_overlay_handle_events() lacks Since: tag
-      * 613589 : typefind: Export AAC level in caps
-      * 613591 : rtspsrc doesn't parse negative port numbers
-      * 613690 : [xmp] refactoring to 1-n tag mappings
-      * 613809 : [oggdemux] flac: file does not play locally
-      * 614288 : Setting playbin volume has no effect the second time around
-      * 614545 : gstalsasrc mixer task spins 100% CPU when USB sound card is removed
-      * 614622 : Trying to compile and it blows up at seek
-      * 614764 : Compile breaks on Mac OS 10.5.8 on new jsseek example
-      * 615572 : Buffer Leak in audiorate during fill process
-      * 615697 : Problems with Makefile
-      * 615789 : [ximagesink] gst_ximagesink_xwindow_update_geometry: assertion `xwindow != NULL' failed
-      * 616545 : [ffmpegcolorspace] Crashes when converting Y41B with some width/height combinations
-
-API added since 0.10.28:
-
-      * gst_x_overlay_set_render_rectangle()
-      * gst_tag_list_from_xmp_buffer()
-      * gst_tag_list_to_xmp_buffer()
-      * gst_video_format_is_gray()
-      * gst_video_parse_caps_chroma_site()
-      * gst_video_parse_caps_color_matrix()
-      * GST_VIDEO_CAPS_GRAY8
-      * GST_VIDEO_CAPS_GRAY16
-      * GST_TYPE_RTSP_LOWER_TRANS
-      * gst_rtsp_lower_trans_get_type()
-
-Changes since 0.10.27:
-
-      * Ogg/Dirac fixes
-      * build: really dist qtgv-xoverlay.h header file needed by overlay examples this time
-      * rtspconnection: fix handling of x-server-ip-address
-      * alsasrc fixes
-
-Bugs fixed since 0.10.27:
-
-      * 610832 : qtgv-xoverlay.h header file missing in the tarball
-      * 611900 : [oggdemux] Incorrect parsing of Dirac headers
-
-Changes since 0.10.26:
-
-      * playbin2,decodebin2: lots of fixes for missing plugin installation
-      * playbin2, playsink, subtitleoverlay: Set subtitle encoding properly
-      * videorate: Improve upstream negotiation
-      * oggdemux: use the chain begin_time instead of our counter
-      * oggdemux: mark skeleton streams correctly
-      * oggdemux: theora PAR of 0:N, N:0 or 0:0 is allowed and maps to 1:1
-      * typefinding: detect stm module format
-      * ffmpegcolorspace: add conversions from all ARGB formats to AYUV and back
-      * theoradec: Fix chroma copying for 4:2:2
-      * tcpclientsrc,tcpserversrc: Fix handling of closed sockets
-      * examples,build: dist header file for the Qt graphics view example
-      * playsink: Reset the sink's state to NULL before unreffing it unless it's the same instance again
-      * rtspconnection: make sure not to dereference NULL username or password
-      * appsrc: Update segment duration and post a duration message if the duration changes
-      * vorbisdec: also support ivorbis tremor decoder
-      * rtsp: fail gracefully on bad Content-Length headers
-      * rtsp: ignore \n and \r as the first line
-
-Bugs fixed since 0.10.26:
-
-      * 610449 : codec autodetection does not always work
-      * 608025 : [videorate] fails at upstream negotiation
-      * 608309 : [appsrc] Should request new data before the queue is empty
-      * 608417 : rtspsrc problem with \n and \r as first line
-      * 609063 : [vorbisdec] also support integer vorbis decoder (tremor) library implementation
-      * 609314 : typefind: Typefind does not handle .stm module format
-      * 609423 : [appsrc] gst_app_src_set_size() should update duration and post a duration message
-      * 610005 : [oggdemux] regression: bad seek granularity
-      * 610268 : [rtsp] NULL pointer reference in gstrtspconnection
-      * 610310 : [playbin2] Subtitle encoding property has no effect
-      * 610329 : [theoradec] doesn't copy all chroma lines for 4:2:2
-      * 610379 : [playbin2] doesn't play if text flag is unset and media has text subtitles
-      * 610386 : [tcpserversrc] Doesn't send EOS when socket is closed
-      * 610672 : overlay examples are now inconsistent and broken
-      * 610832 : missing header file in the tarball
-      * 611225 : [oggdemux] doesn't preroll big_buck_bunny_427x240.indexed.ogg in push mode
-      * 611227 : [oggdemux] no duration or seeking in local big_buck_bunny_427x240.indexed.ogg in pull mode
-      * 604131 : Totem can no longer open Matroska files that hold ASS subtitles
-
-API added since 0.10.26:
-
-      * appsrc::min-percent property
-      * GST_RIFF_TAG_JUNQ
-
-Changes since 0.10.25:
-
-      * playbin2: make about-to-finish signal work for raw sources (e.g. audio CDs)
-      * playbin2: fix handling of the native audio/video flags
-      * playbin2: add flag to enable decodebin buffering
-      * playbin2: make subtitle error handling more robust and ignore late errors
-      * playbin2: improve subtitle passthrough in uridecodebin
-      * playbin2: new subtitleoverlay element for generic subtitle overlaying
-      * playbin2: proxy notify::volume and notify::mute from the volume/mute
-                elements (or audio sink)
-      * playbin2: don't stop completely on initialization errors from subtitle
-                elements; instead disable the subtitles and play the other
-                parts of the stream
-      * decodebin2: rewrite autoplugging and how groups of pads are exposed
-      * uridecodebin: add use-buffering property that will perform buffering on
-                parsed or demuxed media.
-      * GstXOverlay: flesh out docs and add example for use with Gtk+ >= 2.18
-      * libgsttag: add utility functions for ISO-639 language codes and tags
-      * oggdemux: use internal granulepos<->timestamp mapper and make oggdemux
-                more like a 'normal' demuxer that outputs timestamps
-      * oggdemux: seeking improvements
-      * subparse: add qttext support
-      * ffmpegcolorspace: prefer transforming alpha formats to alpha formats
-                and the other way around
-      * libgstvideo: add functions to create/parse still frame events.
-      * theoraenc: make the default quality property 48.
-      * videotestsrc: add pattern with out-of-gamut colors
-      * theora: port to 'new' theora 1.0 API; make misc. existing properties
-                have no effect (quick, keyframe-mindistance, noise-sensitivity,
-                sharpness, keyframe_threshold); those either never worked or
-                aren't needed/provided/useful any longer with the newer API
-      * typefinding: misc. performance improvements and fixes
-      * baseaudiosink: make drift tolerance configurable
-
-Bugs fixed since 0.10.25:
-
-      * 507131 : GStreamer does not play short ogg sounds
-      * 583376 : [typefind] Detects MP3 as h264
-      * 344013 : [oggdemux] use parsers to suck less
-      * 598114 : build overwrites interfaces/interfaces-enumtypes.h with wrong enumtypes
-      * 344706 : [playbin] problem changing subtitles and language
-      * 350748 : [ffmpegcolorspace] ffmpeg colorspace should prefer RGBA over RGB
-      * 499181 : audiorate inserting samples (due to rounding errors ?)
-      * 524771 : Can't seek in YouTube videos
-      * 537050 : [playbin2] QOS event problems
-      * 542758 : [playbin2] Hangs in PLAYING forever if caps are not a subset of pad template caps
-      * 549254 : [playbin/decodebin] Doesn't handle pads that are added much later than the other(s) correctly
-      * 563828 : [decodebin2] Complains about loops in the graph when demuxer output requires another demuxer
-      * 568014 : oggdemux/theoradec doesn't play last video frame
-      * 570753 : [playbin] Support subtitle renderers additional to subtitle parsers
-      * 574289 : [decodebin2] race in state change to PAUSED
-      * 577326 : tcpclientsrc stops working if set to PLAYING, PAUSED and PLAYING again
-      * 579394 : [playbin2] deadlock with wavpack files: type_found - > analyze_new_pad - > no_more_pads
-      * 584441 : [playbin2] if suburi preroll fails with error, playback should continue
-      * 584987 : [playbin2] [gapless] Fire a track-changed message on track change.
-      * 585681 : Subtitle selector doesn't work
-      * 585969 : [playbin2] [gapless] Position/Duration information mismatch on track change
-      * 587704 :  " GstDecodeBin2: This appears to be a text file " error when playing files from a samba share
-      * 591625 : [alsasrc] odd timestamping on start
-      * 591662 : [playbin2] can't handle both text subtitles and subpictures
-      * 591677 : Easy codec installation is not working
-      * 591706 : [playbin2] Support of files with subtitle subpicture streams
-      * 594729 : theora: Convert to libtheora 1.0 API
-      * 595123 : [playbin2] Should hide the difference between subtitles and subpictures
-      * 595401 : gobject assertion and null access to volume instance in playbin
-      * 595427 : avoid x event thread if not needed
-      * 595849 : Fix Y41B strides in videotestsrc and gstvideo
-      * 596159 : rtspsrc hangs when connecting over http tunneled rtsp
-      * 596694 : [typefind] Detects quicktime as mp3
-      * 596774 : Speed up subtitle display after seek/switch
-      * 596981 : [audioresample] Compilation failure due to warning about use of %lu for guint64 variable
-      * 597537 : [streamvolume.c]The cube root function is not defined in Microsoft's CRT
-      * 597539 : [gststrpconnection.c] 'close' is not defined in Microsoft's CRT
-      * 597786 : [tag] enhance gst_tag_freeform_string_to_utf8 to handle 16-bit Unicode
-      * 598288 : [decodebin2] Plays a wav file but issues an error
-      * 598533 : [decodebin2] Post element message with the stream topology on the bus
-      * 598936 : DKS subtitle format
-      * 599105 : [baseaudiosink] Remove pulsesink < 0.10.17 hack after gst-plugins-good release
-      * 599154 : RtpAudioPayload can send out buffers that are not exact multiple of the frame size
-      * 599266 : Requires restart after installing codecs
-      * 599471 : uridecodebin: Store unused decodebin2 instances for further usage.
-      * 599649 : Support for frame-based subtitles using playbin2 and subparse
-      * 600027 : [playbin2,playsink] Should notify about volume/mute changes
-      * 600370 : [subtitleoverlay] New element to overlay video with subtitles in every supported format
-      * 600469 : gdpdepay: Clear adapter on flush and state change
-      * 600479 : Deadlock when playing movie with subtitles
-      * 600726 : [queue2] implement buffering-left argument to buffer messages
-      * 600787 : playbin2 has a problem with Ogg stream with " info "
-      * 600945 : silence buffers at start reusing pulsesrc
-      * 600948 : [uridecodebin] Improve all raw caps detection on pads
-      * 601104 : [cddabasesrc] always plays first track if device is specified
-      * 601627 : theoradec breaks timestamps
-      * 601772 : gst-rtsp-server crashing : bug fixed
-      * 601809 : seek example doesn't work with csw
-      * 601942 : Add a still-frame event to libgstvideo
-      * 602000 : [playbin2] [gapless] Does state change PLAYING- > PAUSED- > PLAYING while it should stay in PLAYING
-      * 602225 : Can't play another movie after using subtitles
-      * 602790 : New oggdemux parsers break theora/vorbis playback
-      * 602834 : [ffmpegcolorspace] does un-necessary conversion from RGB to ARGB
-      * 602924 : Text subtitle rendering regression
-      * 602954 : [oggdemux] can't get first chain on ogg/theora stream
-      * 603345 : [playbin2] textoverlay refcount issues in git
-      * 603357 : [subparse] support for QTtext
-      * 605100 : GNOME Goal: Remove deprecated glib symbols
-      * 605219 : Freezes nearly always when switching Audio CDs
-      * 605960 : new examples require GTK 2.18
-      * 606050 : Implement ptime support
-      * 606163 : textoverlay: Ignore zero framerate
-      * 606687 : playbin2: can't see video after setting native flags
-      * 606744 : Totem fails to play video file: " Can't display both text subtitles and subpictures. "
-      * 606926 : Vorbis: Implement Proper Channel Orderings for 6.1 and 7.1 Configurations
-      * 607116 : [playbin2] no 'about-to-finish' signal with audio CDs
-      * 607226 : Disallow setting the playbin uri property in state > = PAUSED
-      * 607381 : GST_FRAMES_TO_CLOCK_TIME() GST_CLOCK_TIME_TO_FRAMES() should round result
-      * 607403 : rtpaudiopayload: ptime is in milli-seconds, convert to nanosecs
-      * 607569 : Playing a chained ogg stream from HTTP pauses or freezes between songs
-      * 607652 : segfault with an ogg annodex file
-      * 607848 : typefind wrong classifies mp4 file as mp3
-      * 607870 : [oggdemux] OGM parsing broken
-      * 607926 : [oggdemux] regression with certain chained ogg stream
-      * 607929 : [oggdemux] regression: headers pushed twice at the beginnign of each stream
-      * 608167 : [decodebin2] Doesn't push out full topology
-      * 608179 : caps filter appearing after adder results in deadlock
-      * 608446 : [playbin2] post an error message if no URI is set
-      * 608484 : [playbin2] problem with redirect and reset to READY
-      * 608699 : [oggdemux] memory leak while demuxing
-      * 609252 : [theoradec] Doesn't handle unknown pixel aspect ratio properly
-      * 596078 : Playbin2 takes ref of audio-/video-sink parameter
-      * 596183 : decodebin2: Rewrite autoplugging and how groups of pads are handled
-      * 601480 : [playback] Update factory lists not only after going back to NULL
-      * 596313 : gstv4lelement.c:168: error: ‘client’ may be used uninitialized in this function
-      * 606949 : [playbin2] verify type of volume property before using it
-
-API added since 0.10.25:
-
-      * gst_rtcp_sdes_name_to_type()
-      * gst_rtcp_sdes_type_to_name()
-      * gst_tag_get_language_name()
-      * gst_tag_get_language_codes()
-      * gst_tag_get_language_code_iso_639_1()
-      * gst_tag_get_language_code_iso_639_2B()
-      * gst_tag_get_language_code_iso_639_2T()
-      * gst_video_event_new_still_frame()
-      * gst_video_event_parse_still_frame()
-
-Changes since 0.10.24:
-    
-      * Add per-stream volume controls
-      * Theora 1.0 and Y444 and Y42B format support
-      * Improve audio capture timing
-      * GObject introspection support
-      * Improve audio output startup
-      * RTSP improvements
-      * Use pango-cairo instead of pangoft2
-      * Allow cdda://(device#)?track URI scheme in cddabasesrc
-      * Support interlaced content in videoscale and ffmpegcolorspacee
-      * Many other bug fixes and improvements
-
-Bugs fixed since 0.10.24:
-     
-      * 595401 : gobject assertion and null access to volume instance in playbin
-      * 563828 : [decodebin2] Complains about loops in the graph when demuxer output requires another demuxer
-      * 591677 : Easy codec installation is not working
-      * 588523 : smarter sink selection in playbin2
-      * 590146 : adder regressions
-      * 321532 : [cddabasesrc] Support device setting in cdda:// URI
-      * 340887 : add pangocairo textoverlay plugin.
-      * 397419 : [oggdemux] ogm video with subtitles stuck on first frame
-      * 556537 : [PATCH] typefind: more flexible MPEG4 start code recognition
-      * 559049 : gstcheck.c:76:F:general:test_state_changes_* failure: GST_IS_CLOCK(clock) assertion fails
-      * 567660 : [API] need a stream volume interface for sinks that do volume control
-      * 567928 : Make videorate work with a live source
-      * 571610 : [playbin] Scale of volume property is not documented
-      * 583255 : [playbin2] deadlock when disabling visualisations
-      * 586180 : RTSP improvements
-      * 588717 : [oggmux] gst_caps_unref() warning if not linked downstream
-      * 588761 : [videoscale] Needs special support for interlaced content
-      * 588915 : audioresample's output offset counter's initialization could maybe be improved
-      * 589095 : [appsrc] clarify documentation on caps and linkage
-      * 589574 : [typefind] incorrect sdp file detection
-      * 590243 : [videoscale] Claims to support MAX width/height
-      * 590425 : Slaved alsasrc clock with slave-method=re-timestamp not usable for RTP audio
-      * 590856 : [decodebin2] triggers assertion failure on NULL caps
-      * 591207 : totem does display the following subtitle srt file.
-      * 591357 : gst-plugins-base git won't build due to warning in gstrtspconnection.c
-      * 591577 : [playbin2] Incorrect error message string
-      * 591664 : [playbin2] after seeking, srt subtitles don't resync correctly
-      * 591934 : timestamp drift in audioresample
-      * 592544 : Remove regex.h check
-      * 592657 : [appsink] Blocks after entering on pause state
-      * 592864 : deadlocks from recent inputselector/streamselector change
-      * 592884 : [playbin2] g_object_get increases refcount by 2 and therefore leaves memleak
-      * 593035 : gdp doesn't preserve fields of the buffers put into the caps' streamheader
-      * 593284 : basertppayloader takes time in instance init
-      * 594020 : Totem don't play videos from ssh remote host
-      * 594094 : Playback Error playing Midi file
-      * 594136 : [alsasink] Regression from 0.10.23 -- element reuse doesn't work
-      * 594165 : [theoraenc] Implement support for new formats
-      * 594256 : improved slave-skew resynch mechanism
-      * 594258 : missing break in rtcpbuffer
-      * 594275 : Add cast to navigation to fix compiler warning
-      * 594623 : Expose playsink as a fully-fledged element
-      * 594732 : parse error
-      * 594757 : build fails due to warning in gstbasertppayload.c
-      * 594993 : [introspection] pkg-config file madness
-      * 594994 : [streamvolume] Add get_type function to the documentation
-      * 595454 : [cddabasesrc] uri format change breaks rhythmbox
-      * 545807 : [baseaudiosink] audible crack when starting the pipeline
-
-API added since 0.10.24:
-    
-      * gst_rtsp_connection_create_from_fd()
-      * gst_rtsp_connection_set_http_mode()
-      * gst_rtsp_watch_write_data()
-      * gst_rtsp_watch_send_message()
-      * GstBaseRTPPayload::perfect-rtptime
-      * GstBaseRTPAudioPayload::gst_base_rtp_audio_payload_flush()
-      * GstVideoSinkClass::show_frame()
-      * GstVideoSink:show-preroll-frame
-      * GST_MIXER_TRACK_READONLY
-      * GST_MIXER_TRACK_WRITEONLY
-      * GstStreamVolume interface
-
-Changes since 0.10.23:
-
-      * Recognise Kate subpicture subtitles
-      * Support progressive download in playbin2
-      * GIO improvements
-      * Add buffer-list support in appsink
-      * Add gaussian-noise mode to audiotestsrc
-      * bump cdparanoia req to 0.10.2 and improve caching
-      * Improve audio source base class
-      * Add frame-by-frame stepping and examples
-      * Extend stream-probing in decodebin2
-      * Many RTSP improvements
-      * support for PGS subpictures
-      * adder improvements
-      * Add Y444, v210, v216 formats
-      * implement preset interface in vorbisenc, theoraenc, oggmux
-      * Improve libvisual visualisation timestamp tracking
-      * playbin2 enhancements: custom audiosink, subpictures, cdda
-      * Improvements in textrender
-      * Support raw YUV 4:2:2 and SIREN in RIFF
-      * Add 4:2:2 and 4:4:4 support to theoradec
-      * Many other bug-fixes and improvements
-
-Bugs fixed since 0.10.23:
-     
-      * 510417 : [gio] make non-experimental
-      * 513373 : [PATCH] [gstvorbistag] Preserve cover art in Ogg/Vorbis tags
-      * 529300 : [giosink] [PATCH] Allow overwrite
-      * 531035 : [cdparanoia] Should depend on LGPL'd version of the libra...
-      * 567997 : [patch] add allow-pull-scheduling property to audio sinks
-      * 576552 : [subparse] post GST_TAG_SUBTITLE_CODEC tags
-      * 577637 : [playbin2] expose temp-location property
-      * 579692 : mp3_type_find is over-optimistic
-      * 580318 : [tagdemux] drops tag events from upstream
-      * 581460 : [baseaudiosrc] Reusing audio source leads to null timesta...
-      * 581571 : ARGB and alignment added to textrender
-      * 582021 : autogen: libtoolize must be called before aclocal
-      * 582749 : uridecodebin caps property not implemented yet
-      * 582819 : multifdsink: add num-fds property
-      * 583867 : gdpdepay + identity cause failed assertions
-      * 584020 : [playbin2] inadvertently resets configured audio/video sinks
-      * 584686 : [playbin2] Need {audio,video,text}-tags-changed signals
-      * 585197 : [subparse] fails to detect subrip subtitles with fewer th...
-      * 585758 : Remove deprecated GTK+ symbols
-      * 585970 : gst_audioringbuffer_get_type is not thread safe
-      * 585994 : gst-rtsp-message doesn't support " Timestamp " filed
-      * 586331 : [cdparanoia] expose cd cache size parameter
-      * 586356 : [playbin2] use private copy of input-selector as long as ...
-      * 586519 : white Gaussian noise would be useful in audiotestsrc
-      * 587080 : rtsp fails to compile - doesn't see some ws2tcpip functions
-      * 587278 : Support for GstBufferList in appsink
-      * 587676 : Call tzset() before localtime_r(), in e.g. gst-plugins-ba...
-      * 587695 : Patches to add stream-status messages audio elements
-      * 587896 :  " No stream given yet " error from giostreamsrc
-      * 587980 : gstchannelmix.c: protect debug code with GST_DISABLE_GST_...
-      * 588078 : [playbin2] Fails to go to READY again after an error
-      * 588205 : Pipeline with giostreamsrc will not enter playing state
-      * 588550 : build failure in git, missing gstinterfaces-0.10
-      * 588551 : queue2: download buffering fixes
-      * 588724 : [vorbisdec] empty encoder string causes GStreamer
-      * 588746 : [audiotestsrc] Make sure tags are properly serialized in ...
-      * 588747 : [adder] Serialize incoming in-band events (tags) in the d...
-      * 588748 : [adder] Check dataflow consistency in unit tests
-      * 589075 : [playbin2] changing volume doesn't work after stream rest...
-      * 589581 : typefinder: recognise more Kate subtitle categories
-      * 589622 : Cannot use both playbin and input-selector
-      * 589663 : gstreamer asserts in gstaudiofilter
-      * 589797 : alsasrc does not set GstAlsaSrc- > handle to NULL after snd...
-      * 590470 : [typefinding] certain flac-in-ogg files not detected any ...
-      * 536313 : [cdda] Remove sha1 copy once we depend on glib-2.16
-      * 579642 : [oggdemux] handle broken ogg/vorbis files better
-      * 582528 : playbin2 Audio CD playback broken since
-      * 583318 : Assertion from within playbin2
-      * 585079 : undefined references to gst_adapter_* functions in schro
-      * 585708 : [adder] Wrong handling of flushing seeks
-      * 588218 : Siren in .wav support
-      * 586920 : rtsp: needs < netinet/in.h > on FreeBSD
-
-API added since 0.10.23:
-     
-      * GstNetAddress::gst_netaddress_to_string()
-      * Add gst_rtsp_watch_queue_data()
-      * playbin2: Add {audio,video,text}-tags-changed signals
-      * Add gst_color_balance_get_balance_type()
-      * Add gst_mixer_get_mixer_type()
-
-Changes since 0.10.22:
-    
-      * New navigation API to support DVD playback
-      * playbin2 improvements
-      * RTSP extensions to allow extra headers and options
-      * Replace audioresampler with speexresample based code
-      * Support interlacing flags in the gstvideo library
-      * Support new RIFF formats
-      * Improve typefinding
-      * Support more frame formats in videoscale
-      * Many other bug-fixes and improvements
-
-Bugs fixed since 0.10.22:
-     
-      * 577637 : [playbin2] expose temp-location property
-      * 580120 : [playbin2] unit test fails
-      * 478512 : [alsamixer] volume control slider not working
-      * 574962 : rhythmbox crash in flac_type_find
-      * 564139 : Documentation of TCP plugins
-      * 577436 : xvimagesink should use xcontext- > depth and not count bits...
-      * 350311 : [playbin2] support for subpicture subtitles
-      * 378094 : Enable pango elements to handle UYVY
-      * 543591 : Gnonlin can not play theora streams
-      * 553295 : [riff] fuzzed AVI file causes segfault
-      * 565105 : Gstreamer does not change from READY back to PAUSED in sa...
-      * 565777 : [riff] unrecognised video fourcc 0x10000002 for mpeg2 in avi
-      * 566661 : [typefind] Fall back to file extension using uri query
-      * 567255 : [riff] doesn't detect codec_id 0x706d as AAC (amongst other)
-      * 567636 : [pbutils] Missing plugins code shouldn't ask for the same...
-      * 567740 : bogus warning in decodebin2?
-      * 568482 : linking problems in gst-plugins-base
-      * 569655 : [ffmpegcolorspace] Add UYVY422 to GRAY8 conversion function
-      * 570142 : Documentation is broken for uridecodebin
-      * 570356 : aac typefinder failure
-      * 570768 : [ximagesink] wrong mouse pointer position if output windo...
-      * 570832 : Add flags to enhance mixer interfaces
-      * 571009 : [tagdemux] WMA file with id3v2 tag causes assertion to fail
-      * 571147 : [ffmpegcolorspace/videotestsrc] Add support for packed/pl...
-      * 572577 : [playbin2] deadlock on shutdown
-      * 572872 : [ffmpegcolorspace] Add YVYU colorspace
-      * 572993 : [subparse] broken libregex dependency on Windows
-      * 573165 : Generate additional export files for gstreamer app plugin
-      * 573528 : Wrong format modifier in gstgiobasesink.c
-      * 573529 : In gstrtspconnection.c some functions are called with wro...
-      * 574293 : [decodebin2] deadlock on shutdown
-      * 574319 : Missing HAVE_PROCESS_H in win32/common/config.h
-      * 574447 : gstadder.c: line 904: error C2036: 'gpointer' : unknown size
-      * 574939 : [typefinding] flac typefinder mis-typefinds PDFs as flac ...
-      * 575550 : srt subtitle file keeps playbin2 from playing
-      * 575638 : kissfft copyright
-      * 575649 : [oggdemux] duration query in time format returns true wit...
-      * 576019 : On Windows queue2 can't write files longer than 2-4 GiB, ...
-      * 576142 : [vorbisenc] Non-header output buffers have NULL caps
-      * 576180 : [playbin2] Uses unref'd audiosink volume if using gconfau...
-      * 576586 : [alsamixer] gnome-sound-properties freeze
-      * 577054 : [videoscale] Not valgrind clean
-      * 577709 : Review new navigation API
-      * 577827 : [appsink] Have appsink new_buffer-callback return GstFlow...
-      * 578583 : [PATCH] multifdsink doesn't handle sync-method=latest-key...
-      * 578656 : Implement upstream GstForceKeyUnit events in theoraenc
-      * 579129 : pkgconfig: appsrc/appsink can not be linked to uninstalled
-      * 579130 : app: expose trivial type macros
-      * 579192 : gst_rtcp_packet_get_type should not assert on packet content
-      * 579203 : baseaudiosink: unparenting the ringbuffer in NULL causes ...
-      * 579267 : [rtspconnection] g_async_queue_new_full() is GLib-2.16 AP...
-      * 579463 : [cddabasesrc] [cdparanoiasrc] no longer emits discid
-      * 579668 : audioresample fails to build with --disable-gst-debug
-      * 579734 : [playbin] raw_decoding_mode seems to be set unconditionally
-      * 579912 : [decodebin2] multiqueue is too small in time (interleave ...
-      * 580470 : [audioresample] causes pipelines to go out of sync and be...
-      * 580952 : [audioresample] bad quality/pops compared to plughw
-      * 581727 : [playbin2] make playsink go to PAUSED async
-      * 569682 : playbin2 leaks request pad from input selector
-      * 580020 : [vorbisenc] causes buffers to be out of segment if new se...
-      * 562794 : rtspsrc fails to create a socket on Win32 sometimes.
-      * 567396 : playbin2: DECODE_BIN_LOCK occasionally called twice withi...
-      * 567982 :  " queued_bytes " field isn't updated while flushing the que...
-      * 571299 : [appsink] Handoff callback API
-      * 574443 : rtsp win32 - forgotten variable
-      * 574516 : [typefind] add typefinder for photoshop .psd files
-      * 574964 : gst_app_src_end_of_stream(), mutex on error return
-      * 575256 : rtspsrc fails to resolve hostnames
-      * 575588 : decodebin2 deadlock
-      * 576187 : [playbin2] Stalls video sink when disabling subtitles in ...
-      * 576188 : [playbin2] Reusing a playbin2 instance with visualization...
-      * 576190 : [playbin2] Deadlock when reusing playbin2 after an error
-      * 577288 :  " Internal playbin error " when seeking to the end of files
-      * 577610 : RTCP feedback messages support in GstRTCPPacket
-      * 577794 : [playbin2] leaks elements set through properties
-      * 578118 : [multifdsink] add option to not resend the streamheader w...
-      * 578506 : Pipeline with alsasrc and alsasink cannot change state ba...
-      * 578942 : Missing RTSP headers related to Windows Media extension.
-      * 580271 : videorate: fails to clear discont flag on duplicated buffers
-      * 580649 : uridecodebin: bug on documentation published in website
-
-API added since 0.10.22:
-    
-      * GstRTSP::gst_rtsp_options_as_text()
-      * GstRTSPMessage::gst_rtsp_message_take_header()
-      * GstRTSPRange::gst_rtsp_range_to_string()
-      * New Navigation interface commands, queries and messages
-      * gst_rtsp_channel_new()
-      * gst_rtsp_channel_unref()
-      * gst_rtsp_channel_attach()
-      * gst_rtsp_channel_queue_message()
-      * gst_rtsp_connection_accept()
-      * GstAppSink::gst_app_sink_set_callbacks()
-      * GST_VIDEO_FORMAT_YVYU,GST_VIDEO_BUFFER_TFF,GST_VIDEO_BUFFER_RFF,GST_VIDEO_BUFFER_ONEFIELD
-      * GST_MIXER_FLAG_HAS_WHITELIST,GST_MIXER_FLAG_GROUPING,GST_MIXER_TRACK_NO_RECORD,GST_MIXER_TRACK_NO_MUTE,GST_MIXER_TRACK_WHITELIST
-      * GstAppSrc::emit-signals
-      * GstAppSrc::gst_app_src_set_emit_signals()
-      * GstAppSrc::gst_app_src_get_emit_signals()
-      * GstAppSrc::gst_app_src_set_callbacks()
-      * RTSP::gst_rtsp_connection_get_url()
-      * GstRTSPLowerTrans::GST_RTSP_LOWER_TRANS_HTTP
-      * RTSP:gst_rtsp_connection_set_tunneled()
-      * RTSP:gst_rtsp_connection_is_tunneled()
-      * RTSP::gst_rtsp_connection_set_ip()
-      * RTSP::gst_rtsp_connection_get_tunnelid()
-      * RTSP::gst_rtsp_connection_do_tunnel()
-      * RTSP::gst_rtsp_watch_reset()
-
-IMPORTANT NOTES
-
-1) Please note that decodebin2 and playbin2 API included in this release is
-still considered unstable and WILL change in future releases. At this stage,
-only developers or early adopters should consider using decodebin2 or playbin2
-API embodied in their signals and properties.
-
-Changes since 0.10.21:
-
-      * Require gettext 0.17
-      * Replace audioresample with speexresample from -bad
-      * Support new formats in RIFF: uncompressed RGB, WMA lossless, VP6
-      * Move libgstapp and elements from -bad
-      * Support color-key setting and probing for Xv properties
-      * Improve typefinding for various formats
-      * Extend audio sinks for pull-mode operation
-      * Support for more subtitle formats
-      * More development on decode2bin and playbin2
-      * RTP and SDP fixes
-      * Many bug fixes and improvements
-
-Bugs fixed since 0.10.21:
-
-      * 562163 : theoraenc likely ignoring segments
-      * 562258 : rtspsrc element takes long time to error out if the addre...
-      * 561789 : [volume] deadlocks with a controller attached
-      * 554533 : [xvimagesink] allow setting colorkey if possible
-      * 567511 : colorkey in xvimagesink gets reset when element is reused
-      * 116051 : libresample doesn't handle > factor of 2 rate conversion
-      * 346218 : [audioresample] doesn't do anti aliasing
-      * 385061 : [audioresample?] investigate high CPU usage
-      * 456788 : [subparse] can't handle UTF-16 charset encoded subtitle.
-      * 525807 : [vorbisenc] vorbisenc has problems with a gnlsource that ...
-      * 546955 : gstoggmux EOS handling issue
-      * 549417 : [audioresample] unit test fails on 64bit linux
-      * 549510 : audioresample doesn't negotiate ideal caps
-      * 552237 : UTF-16 srt confuses gstreamer, misdetected as mp3
-      * 552559 : Implementation of SLAVE_SKEW in baseaudiosrc
-      * 552569 : audioresample producing strange sized buffers
-      * 552801 : audioconvert can overflow with big audio buffers
-      * 554879 : Add ability to specify format for date/time display in Gs...
-      * 555257 : Doesn't display srt subtitles saved with BOM
-      * 555319 : add FFV1 fourcc to riff-media
-      * 555607 : subrip subtitles typefind too strict
-      * 555699 : [PATCH] theoradec: prefer container's pixel aspect ratio ...
-      * 556025 : build failure in tests/icles
-      * 556066 : Last byte of FLAC image buffer chopped off
-      * 557365 : subparse check fails
-      * 558124 : [PLUGIN-MOVE] Move speexresample as audioresample2 to -base
-      * 559111 : ALSA sink hangs on USB audio device unplug while playing
-      * 559478 : does not play windows media streams correctly
-      * 559567 : `gst_base_audio_sink_sync_latency' should call `gst_base_...
-      * 561436 : videorate element add image/jpeg to caps template
-      * 561734 : playbin2 additions
-      * 561780 : Playbin2 should work without volume too
-      * 561924 : oggdemux hangs when given corrupt input via non-seekable ...
-      * 562270 : build without gdk fails
-      * 563143 : ximagesink/xvimagesink : _alloc_buffer returns non-clean ...
-      * 563174 : Implement gst_rtcp_packet_remove
-      * 563508 : [rgvolume] Unit test fails with passthrough assertions
-      * 563718 : Theora check out of date
-      * 563904 : GNOME Goal: Clean up GLib and GTK+ includes
-
-API added since 0.10.21:
-
-      * clockoverlay::time-format
-      * GstRingBuffer:gst_ring_buffer_activate()
-      * GstRingBuffer:gst_ring_buffer_is_active()
-      * GstRingBuffer:gst_ring_buffer_convert()
-      * Add GST_TYPE_BASE_AUDIO_(SRC|SINK)_SLAVE_METHOD to the public API
-      * gst_netaddress_get_address_bytes()
-      * gst_netaddress_set_address_bytes()
-
-Changes since 0.10.20:
-
-      * Continue playbin2 development
-      * Ogg improvements - CELT support, skeleton fixes
-      * DVD subpicture support
-      * Improved audio dithering random number generator
-      * xvimagesink/ximagesink fixes
-      * Vorbis encoding and decoding fixes
-      * Recognise Kate subtitle streams
-      * Many bug-fixes and enhancements
-
-Bugs fixed since 0.10.20:
-
-      * 537380 : [gnomevfssrc] Doesn't handle short reads properly
-      * 538656 : xvimagesink support for autofill/colorkey property
-      * 540334 : Build fails without X in tests/examples/seek
-      * 528299 : Multiple GstMixerTracks with the same label cause problem...
-      * 530068 : Ogg Streams with Skeleton and Granulepos > 0 do not work(...
-      * 537009 : playbin2 silly typo breaks signals
-      * 537045 : decodebin2 sometimes emits 'drained' multiple times
-      * 537599 : [oggdemux] skeleton streams not skipped in ogg
-      * 537889 : [xvimagesink] colorbalance is bad
-      * 538232 : vorbisenc/vorbisdec don't work with a live source
-      * 538663 : gdppay memleak in gst_gdp_pay_reset
-      * 540215 : decodebin does not insert a queue for raw data type
-      * 540351 : [avidemux] Doesn't know about Duck DK4 ADPCM
-      * 540497 : ffmpegcolorspace is returning wrong size
-      * 541358 : cross mingw32 gcc: getaddrinfo is not in ws2_32.dll befor...
-      * 544306 : rtspsrc debug=1 segfaults with some libc
-      * 548898 : GStreamer-CRITICAL errors on seeking beyond stream borders
-      * 548913 : vorbisenc being picky about rounding errors in timestamps
-      * 549062 : Video devices aren't updated on subsequent probing.
-      * 549814 : [typefind] add application/pdf typefinder
-      * 550582 : [oggdemux] KATE streams not recognised
-      * 550638 : [typefind] Recognize some jpeg2k file types
-      * 550656 : recognize TrueSpeech in wavparse
-      * 550729 : gst-plugins-base won't compile with " -pedantic " option
-      * 552960 : tagdemux asserts and aborts on truncated files
-      * 553244 : theoraparse doesn't work at all (throws criticals and ass...
-
-API added since 0.10.20:
-
-      * Add "index" property to GstMixerTrack to differantiate between
-        multiple mixer tracks with the same label.
-
-Changes since 0.10.19:
-
-      * RTP improvements
-      * Support digest auth for RTSP
-      * Additional documentation
-      * Support DSCP QoS in multifdsink
-      * Add NV12/NV21 video buffer layouts
-      * Video scaling now bilinear by default
-      * Support more than 8 channels in audio conversions
-      * Channel mapping fixes for audioconvert
-      * Improve tmplayer and sami subtitle support
-      * Support 1x1 pixel buffers for videoscale
-      * Typefinding improvements for MPEG2, musepack
-      * Ogg/Dirac mapping updated in oggmux
-      * Fixes in ogg demuxing
-      * audiosink synchronisation and slaving fixes
-      * Support muting of the audio in playbin by selecting -1 as the audio stream
-      * Work done on playbin2 and uridecodebin
-      * Improvements in the experimental GIO plugin
-      * decodebin fixes
-      * Handle GAP buffers in some places
-      * Various other leak and bug-fixes
-
-Bugs fixed since 0.10.20:
-
-      * 526794 : [giosrc] totem doesn't work with some gvfs backends
-      * 510417 : [PLUGIN-MOVE] Move gio to gst-plugins-base
-      * 509125 : crash in CD Player: - playing CD - lowering/...
-      * 517813 : [audioconvert] make gap aware
-      * 302798 : [playbin] add mute property
-      * 342294 : Setting playbin property current-audio=-1 also stops the ...
-      * 398033 : [audioconvert] support more than 8 channels
-      * 419351 : [avi/a52dec] AV synchronization problems
-      * 467911 : [subparse] sami parser update
-      * 469933 : multifdsink IPv6 and diffserv TOS/TC markup
-      * 506659 : [textoverlay] rendering error when using non-standard widths
-      * 512333 : [gstvorbistag] Retrieve Ogg/Vorbis cover art as image met...
-      * 512382 : [playbin] race condition when pausing/playing multiple in...
-      * 518037 : pbutils-enumtypes.c is not included in win32/vs6/libgstpb...
-      * 521761 : gstaudioclock frozen the clock value until reaches latest...
-      * 522401 : gdpdepay doesn't validate payload CRCs
-      * 523993 : playbin2 blocks after a while when listening to a radio s...
-      * 524724 : [PATCH] [baseaudiosrc] buffer-time and latency-time do no...
-      * 525665 : Crash on Ogg/Vorbis with chain=NULL
-      * 525915 : [streamheader] Unit test fails with " gst_adapter_peek: as...
-      * 526173 : [typefinding] fails to detect mpeg video stream whereas m...
-      * 529018 : gst_ogm_parse_stream_header creates fraction value with w...
-      * 529500 : [videotestsrc] support for NV12 and NV21
-      * 529546 : [Playbin] Memory leak in streaminfo handling
-      * 530068 : Ogg Streams with Skeleton and Granulepos > 0 do not work(...
-      * 530531 : [typefinding] bad read in mpeg_video_stream_type_find
-      * 530719 : gst_video_calculate_display_ratio fails when playing Ogg ...
-      * 530962 : [subparse] parses only every second line of TMPlayer subt...
-      * 532454 : [NV12/NV21] videotestsrc and ffmpegcolorspace don't play ...
-      * 533087 : GstRTSPTransport kept opaque in docs
-      * 533817 : [audioconvert] Can't use default 7 channel layout / only ...
-      * 534071 : Gdppay memleak
-      * 534331 : race in decodebin when changing states while the internal...
-      * 535356 : vorbisdec doesn't support 8 channels
-      * 536475 : gdppay memleak and possible crash
-      * 536521 : Refcounting errors in playbin
-      * 536874 : Build failure on windows
-      * 532166 : [ffmpegcolorspace] support NV12 format
-      * 533617 : [audioconvert] Produces silence when converting 1/2 chann...
-      * 536848 : [giosrc] Doesn't handle short reads properly
-      * 536849 : [giosrc] Very slow doing any playback
-      * 518082 : [alsamixer] playback volumes overwritten by capture volum...
-      * 435633 : [PATCH] videorate not (fully) segment aware; causes frame...
-      * 532364 : tcpclientsrc broken in 0.10.19
-      * 533075 : gst_rtp_buffer_compare_seqnum doesn't do what it says
-      * 533265 : [cddabasesrc] Sound Juicer cut a sector when ripping a track
-
-API additions since 0.10.20:
-
-      * decodebin2::sink-caps property
-      * giosrc::file property
-      * giosink::file property
-      * gst_base_audio_src_set_slave_method()
-      * gst_base_audio_src_get_slave_method()
-      * GstAudioClock::gst_audio_clock_reset()
-      * GstBaseAudioSrc:actual-buffer-time property
-      * GstBaseAudioSrc:actual-latency-time property
-      * gst_audio_check_channel_positions()
-      * add gst_tag_image_data_to_image_buffer()
-      * add gst_tag_list_add_id3_image()
-      * add GST_TAG_IMAGE_TYPE_NONE enum value
-
-Changes since 0.10.18:
-
-      * Handle EAGAIN when polling sockets in rtspconnection
-
-Changes since 0.10.17:
-
-      * Experimental GIO plugin
-      * Continued playbin2 development
-      * RTP fixes
-      * Better network element support on Windows
-      * Various other bug-fixes and improvements
-
-Bugs fixed since 0.10.17:
-
-      * 509637 : [API] [basertpaudiopayload] add _set_samplebits_options()
-      * 510229 : [gnomevfssrc] HTTPS support
-      * 511478 : [rtpbuffer] add gst_rtp_buffer_set_extension_data function
-      * 511810 : [RTSP] Uses MT-unsafe gmtime() function
-      * 512899 : [alsa] gstalsasink.c:527: warning: 'snd_pcm_sw_params_set...
-      * 513167 : Fix compiler warning due to disabled signals in mixertrac...
-      * 514307 : [playbin] warning in nautilus, volume element can't be cr...
-      * 514623 : Ogg Theora video slow
-      * 514937 : Correct initialization of hints in is_multicast_address()
-      * 515654 : xvimagesink doesn't build with --disable-xshm
-      * 516246 : [alsasink] handle negative delay from snd_pcm_delay
-      * 517420 : typefind: add h264 elementary stream discovery
-      * 517991 : problems with configure file depending on GCC compiler
-      * 518039 : libgstrtsp MSVC 6.0 compile error
-      * 518162 : [subparse] handle italic text starting with " / " with Micr...
-      * 518940 : [playbin2] make _get_*_tags() match vfuncs prototype in c...
-      * 519906 : [API] add GstMixerOptions::get_values vfunc
-      * 519916 : [API] add mixer-changed and options-list-changed messages
-      * 520523 : [API] Unreviewed changes to ringbuffer API
-      * 521743 : libgstnetbuffer.def exports not up to date
-      * 522625 : [video] gst_video_format_parse_caps() broken for RGBA for...
-      * 523054 : gstbasesrc crashes when called from typefind helpers
-      * 511825 : [RTSP] compiler warning on FreeBSD
-      * 520300 : [alsasrc] provide-clock=false messes up buffer durations
-
-API added since 0.10.17:
-
-      * GstRTPBuffer:gst_rtp_buffer_set_extension_data()
-      * add GST_VIDEO_FORMAT_Y41B and GST_VIDEO_FORMAT_Y42B.
-      * add GstMixerOptions::get_values vfunc (#519906)
-      * add gst_mixer_options_list_changed(), gst_mixer_mixer_changed() and
-        gst_mixer_message_parse_options_list_changed(). Fixes #519916.
-      * gst_base_rtp_audio_payload_set_samplebits_options()
-      * GstNetBuffer::gst_netaddress_equal
-
-Changes since 0.10.16:
-        
-      * Work-around ABI breakage due to unfortunate use of the
-        GST_DISABLE_DEPRECATED macro
-      * Export 2 missing functions needed for bindings in the win32 build
-      * Initialise the GstRingBuffer GType from a thread-safe context
-
-Bugs fixed since 0.10.16:
-        
-      * 511825 : [RTSP] compiler warning on FreeBSD
-      * 513018 : crash in Volume Control: I typed my password at t...
-      * 512334 : g_critical() when using GstAudioFilter & GST_DEBUG
-
-Changes since 0.10.15:
-    
-      * Handle newer Theora granule-pos semantics
-      * Introducing first alpha version playbin2 - the upcoming successor to
-       playbin
-      * Fixes in playbin handling of stream-switching
-      * New API for uniform handling of raw-video format buffers.
-      * Improvements for RTSP/RTP handling
-      * RIFF lib additions for VC-1 and AVC1 fourccs
-      * Many other bug-fixes and improvements
-
-Bugs fixed since 0.10.15:
-     
-      * 506132 : Review of changes in video/video.h
-      * 320984 : [oggdemux] cannot handle multiple chains
-      * 373011 : [playbin] throws error when switching off subtitles
-      * 436756 : Intermittent crashes in Pidgin in audioclock g_type_class...
-      * 462740 : [streamselector] patch to improve default stream selection
-      * 486840 : [alsamixer] use _all variants when setting the mixer
-      * 497964 : theoraenc test fails
-      * 498228 : gst-plugins-base-0.10.15 does not compile on FreeBSD (Gen...
-      * 499697 : Provide better pkg-config files 
-      * 502497 : [subparse] SubRip subtitles starting from 0 not recognised
-      * 503440 : The control sockets used by gstrtspconnection.c are never...
-      * 503930 : [cdda] warning: 'eos' may be used uninitialized in this f...
-      * 506928 : [alsamixer] add " PCM " as master fall back for cards that ...
-      * 508138 : [decodebin] does not error out if pad activation fails
-      * 509762 : missing file in win32/MANIFEST
-      * 511274 : gst_rtp_buffer_get_extension_data is returning FALSE when...
-      * 496731 : [PATCH] xvimagesink leaks memory if initialization fails
-      * 496761 : [PATCH] RTSP message leaks memory when uninitialized
-      * 500763 : SIGSEGV while playing ogg audio file
-      
-API additions since 0.10.15:
-      
-      * New GstVideoFormat API and helper functions in libgstvideo
-      * gst_base_audio_sink_set_provide_clock()
-      * gst_base_audio_sink_get_provide_clock()
-      * gst_base_audio_sink_set_slave_method()
-      * gst_base_audio_sink_get_slave_method()
-      * gst_base_audio_src_set_provide_clock()
-      * gst_base_audio_src_get_provide_clock()
-
-Changes since 0.10.14:
-
-      * RTP/RTSP/RTCP/SDP support improved
-      * New FFT support library libgstfft, based on Kiss FFT
-      * New formats supported in volume and audiotestsrc
-      * Fixes in audiorate and videorate
-      * Audio capture fixes
-      * Playbin and decodebin fixes
-      * New tagdemux base class for ID3/APE style tag readers
-      * Fix a nasty crash in the X sinks on shutdown
-      * New tags supported
-      * Add support for multichannel WAV files.
-      * Preserve channel layout information when up/down-mixing.
-      * Many bug-fixes and improvements
-
-Bugs fixed since 0.10.14:
-
-      * 475395 : decodebin2 leaks request-pads
-      * 475451 : [decodebin2] leaks ghostpad
-      * 378770 : [xvimagesink] race condition in event thread?
-      * 407282 : [decodebin2] autoplug-sort signal has GList ** parameter
-      * 430677 : [audioconvert] does not preserve channel positions when f...
-      * 442654 : [volume] controller bypassed by default
-      * 445529 : [volume] support for 24/32-bit audio/x-raw-int
-      * 446766 : return code for gst_base_rtp_payload_audio_handle_event()
-      * 451970 : Subparse requires HTML parser
-      * 453650 : [audiobasesrc] two alsasrcs do not work in one pipeline
-      * 459334 : [textoverlay] expose pango line alignment property
-      * 459585 : [basertpdepayload] api without namespace
-      * 460422 : [audiotestsrc] Add support for float and double output
-      * 462805 : [alsa] compilation fails with gcc 4.2
-      * 462979 : Add 'silent' property to GstTimeOverlay
-      * 463215 : [audioconvert] compile errors
-      * 464320 : [PATCH] gst-plugins-base-0.14 does not build for win32
-      * 464666 : [playbin] QT trailer hangs in preroll with decodebin2
-      * 464690 : Add connection-speed property to uridecodebin element
-      * 465015 : [playbin] Not removed probes causes deadlocks in streamin...
-      * 465028 : some warnings with mingw
-      * 467667 : GST_FRAMES_TO_CLOCK_TIME() and GST_CLOCK_TIME_TO_FRAMES()...
-      * 468129 : [basertpaudiopayload] event handler returns the wrong value
-      * 468619 : New library gstfft: FFT library for integer and float typ...
-      * 470456 : [API] add gst_missing_*_installer_detail_new()
-      * 470766 : [ssaparse] line breaks in SSA subtitle parser
-      * 471067 : Make the SDP code useable for generating SDP descriptions
-      * 471194 : [rtpbuffer] RTP headers are wrong for win32
-      * 473097 : [baseaudiosink] gstreamer-properties hangs when testing s...
-      * 474384 : gstrtsp-enumtypes.c and .h needed for win32
-      * 474880 : [xvimagesink] [ximagesink] leaking buffer caps reference
-      * 475731 : rtspconnection is able to read incomplete messages
-      * 483620 : All Rtp buffers are discarded --  gst_rtp_buffer_get_payl...
-      * 484989 : memleak, not unrefed caps for gstbasertppayload.c
-      * 489010 : Please change default channel order for WAVE_EXT-less .wa...
-      * 491722 : [playbin] regression: crash with external subtitles
-      * 492098 : [GstFFT] Broken scaling
-      * 492114 : Build issues on Windows/MSVC
-      * 492306 : compilation errors with MinGW
-      * 492813 : Missing symbols in libgstrtp.def
-      * 493986 : Build issues on Windows (missing symbols)
-      * 494346 : pre-release vs6 patch
-      * 496548 : Including malloc.h breaks macos build
-      * 496724 : DSW file references non-existent DSP files
-      * 464079 : audiotestsrc doesn't respond to conversion queries properly
-      * 442065 : floatcast.h includes config.h and might break other apps
-      * 466717 : gst_event_new_new_segment_full:assertion `start < = stop' ...
-      * 485753 : Decodebin2 deadlocks when nulling pipeline during typefind
-      * 464028 : Move connection-speed from playbin to playbasebin
-
-API added since 0.10.14:
-
-      * GstTagDemux base class for simple tag demuxers
-      * GstBaseAudioSrc::provide-clock property
-      * gst_rtcp_ntp_to_unix()
-      * gst_rtcp_unix_to_ntp()
-      * gst_rtp_buffer_get_header_len()
-      * gst_rtp_buffer_get_extension_data()
-      * gst_rtp_buffer_compare_seqnum()
-      * gst_rtp_buffer_ext_timestamp()
-      * gst_rtcp_packet_sdes_copy_entry()
-      * gst_install_plugins_supported()
-      * gst_missing_*_installer_detail_new() convenience API
-      * gst_rtsp_connection_poll()
-      * GstTextOverlay::line-alignment property
-
-Changes since 0.10.13:
-
-      * Audio dither and noise-shaping when reducing bit-depth
-      * RTSP and SDP helper libraries added
-      * Experimental buffering element "queue2" now supports pull-mode
-        and file-based buffering.
-      * Support for more 32-bit video pixel layouts
-      * Various fixes and improvements
-
-Bugs fixed since 0.10.13:
-
-      * 380625 : [x*imagesink] add 'handle-expose' property
-      * 385527 : oggmux sometimes gets DELTA flag on output wrong near start
-      * 402076 : videoscale 4-tap method broken for downscaling
-      * 437169 : [xvimagesink] add property to disable Xv double-buffering
-      * 441264 : queue2 support to do buffering on a file
-      * 442553 : [v4lsrc] doesn't output segments in GST_FORMAT_TIME
-      * 442557 : [videorate] doesn't handle latency queries
-      * 442944 : Audiotestsrc can overflow on seeks
-      * 444523 : [queue2] Pull mode support
-      * 444630 : Compilation error with fsseko (from gstqueue2.c) -- unabl...
-      * 445505 : [queue2] It does not work in pull mode with oggdemux
-      * 446551 : [queue2] Buffering is not working properly if it is set t...
-      * 446572 : [queue2] Division by zero
-      * 446972 : warning when compiling  gstoggdemux.c
-      * 449156 : Regression in CVS for decodebin2
-      * 450875 : Missing files in po/POTFILES.in
-      * 451707 : [tag] UTF-8 in ID3v1 tag not correctly decoded
-      * 451908 : [ffmpegcolorspace] regression: doesn't accept GST_VIDEO_C...
-      * 454264 : Playbin fails to " play " image url after a movie url
-      * 456656 : [API] Addition of audio buffer clipping function to gstaudio
-      * 460978 : gst_audio_buffer_clip outputs warnings
-      * 152864 : [PATCH] GstAlsaMixer doesn't support signals
-      * 360246 : [audioconvert] Optionally apply dithering
-      * 394061 : Add support for Subviewer subtitles
-      * 420326 : Base payloader class has wrong property types and ranges
-      * 451145 : [vorbisdec] errors out on 0-sized packets
-      * 459204 : [PATCH] [playbin] gst_play_base_bin_get_streaminfo_value_...
-
-API added since 0.10.13:
-
-      * RTSP and SDP libraries added
-      * gst_rtsp_base64_decode_ip
-      * Add buffer clipping function gst_audio_buffer_clip for raw audio 
-        buffers. Fixes #456656.
-      * gst_mixer_get_mixer_flags
-      * gst_mixer_message_parse_mute_toggled
-      * gst_mixer_message_parse_record_toggled
-      * gst_mixer_message_parse_volume_changed
-      * gst_mixer_message_parse_option_changed
-      * GstMixerMessageType
-      * GstMixerFlags
-
-Changes since 0.10.12:
-      * Many fixes and improvements
-      * RTP and RTCP support improved
-
-Bugs fixed since 0.10.12:
-
-      * 339838 : [audioconvert] support floats with non-native endianness
-      * 393975 : closing x/xvimagesink window crashes gst-launch
-      * 405072 : [API] add gst_tag_freeform_string_to_utf8()
-      * 413799 : [subparse] add support for MPL2 format
-      * 414645 : GstMixerTrack should make untranslated label available
-      * 420079 : [audioconvert] Uses biased rounding which results in dist...
-      * 420578 : [subparse] add more colour map in sami parser
-      * 421834 : videorate breaks on dimension changes
-      * 423051 : Vorbis tags of type double use locale-dependent formatting
-      * 423055 : Verify ReplayGain vorbistag processing in libs/tag testsuite
-      * 425455 : Decodebin2 leaks pads
-      * 426250 : GstPlayBaseBin leaks streaminfo objects
-      * 428187 : Rtp base depayloader class doesn't send new_segment after...
-      * 431672 : gst_base_rtp_audio_payload_push() should take object of i...
-      * 432362 : [ximagesink] doesn't build if XShm is not available
-      * 432755 : [videorate] leaks buffer if flow != OK
-      * 432984 : [baseaudiosrc] misleading warning message when dropping s...
-      * 433888 : [theoradec] does not generate a perfect stream
-      * 436562 : Theoradec doesn't work well with gnonlin
-      * 438840 : [theoradec] does not compile with old version of libtheora
-      * 440997 : [gstriff] Doesn't handle width!=depth files with audio/x-...
-      * 441295 : audioconvert doesn't build on VS6
-      * 442024 : regression in playbin buffering
-      * 350299 : [playbin] " Internal data flow error " opening movie with s...
-      * 410039 : totem crashed with SIGSEGV in new_decoded_pad_full()
-      * 340842 : do latency calculation for live sources
-      * 341078 : RB does not play beyond initially downloaded podcast file
-      * 414496 : [id3demux, id3v2mux] Add support for GST_TAG_MUSICBRAINZ_...
-
-API additions since 0.10.12:
-
-      * add gst_tag_freeform_string_to_utf8()
-      * GstRTPBuffer::gst_rtp_buffer_default_clock_rate()
-      * GstBaseAudioSink::slave-method property
-      * add "min-ptime" property to RTP base audio payloader
-      * gst_base_rtp_audio_payload_push()
-      * gst_base_rtp_audio_payload_get_adapter()
-      * GstMixerTrack::untranslated-label property
-
-Changes since 0.10.11:
-
-      * New API for on-demand plugin installation
-      * Xv thread-safety and configuration enhancements
-      * decodebin2 improvements
-      * Support more raw audio format conversions
-      * Improvements in Ogg support
-      * AudioFilter base class ported to 0.10
-      * Fixes for subtitles
-      * Latency/live-playback support for Alsa
-      * Lots of bug fixes and improvements
-
-Bugs fixed since 0.10.11:
-
-      * 398721 : No video in .ogm files with decodebin2
-      * 339837 : [audioconvert] support for 64-bit float audio 
-      * 341524 : [decodebin] can't handle decoders with always src pads wi...
-      * 352069 : Add de.po German translation
-      * 363379 : [oggmux] doesn't detect EOS on all sinkpads 
-      * 378436 : [oggdemux] rhythmbox crash on fast clicking on rating in ...
-      * 380342 : Totem does not play mp3 files when lyrics are present 
-      * 383195 : [cddabasesrc,basertpaudiopayload] compile errors with gcc...
-      * 383198 : totem crashed to gst_xvimagesink_update_colorbalance
-      * 384008 : [xvimagesink] accesses - > xwindow outside locks
-      * 384060 : gst_xoverlay_set_xwindow_id() causing lockups with x(v)im...
-      * 387138 : x input events processing in sinks with xoverlay interfac...
-      * 390063 : Documentation typo 
-      * 390076 : add xv adaptor and port properties in xvimagesink element.
-      * 391365 : [oggdemux] internal stream error on OggFlac
-      * 392070 : [vorbis] GST_TAG_LOCATION not mapped
-      * 392393 : [API] add libgstbaseutils library for missing plugins mes...
-      * 396042 : mpeg4 video typefinder loops endlessly on quicktime redirect
-      * 396835 : audioconvert/audioresample combination causing buffer of ...
-      * 397673 : [patch] XIOError caught in x[v]imagesink.c
-      * 397810 : [typefinding] .vob file: could not determine type of stream
-      * 398110 : [theoraenc] GLib failed to allocate 3080991032 bytes on g...
-      * 399340 : Crash in the oggdemux plugin when trying to play a specia...
-      * 401029 : [playbin] rapidly changing visualisation freezes
-      * 401072 : Move libgimme-codec helper functions to GStreamer
-      * 402505 : visualisations don't work for some samplerates
-      * 407811 : decodebin2 hang on HD clip
-      * 409683 : Crash with Decodebin2
-      * 410396 : not reading " DATE " tags from Flac files
-      * 410963 : Fails to build with -z defs 
-      * 357503 : [suparse] wrong timing with microdvd subtitles
-      * 393310 : [pango] localtime_r does not exist in MinGW
-      * 397207 : Test failure w/ HP-UX 11.11 & native compiler
-      * 399948 : [textoverlay] leaks upstream events if textpad unlinked
-      * 403963 : GstAudioFilter base class broken
-      * 404512 : [videoscale] floating point exception on 1x1 video
-      * 405020 : [alsa] probing the device-name doesn't seem to work corre...
-      * 408278 : [videorate] memory leak
-      * 410772 : Crash copying a GstNetBuffer
-      * 401118 : [visual] error if width not a multiple of 4 
-      * 405451 : [alsasink] deadlocks when disconnecting USB Sounddevice
-
-API additions since 0.10.11:
-
-      * GstAudioFilter
-      * GST_VIDEO_SINK_CAST()
-      * gst_pb_utils_add_codec_description_to_tag_list()
-      * gst_pb_utils_get_codec_description()
-      * gst_pb_utils_get_source_description()
-      * gst_pb_utils_get_sink_description()
-      * gst_pb_utils_get_decoder_description()
-      * gst_pb_utils_get_encoder_description()
-      * gst_pb_utils_get_element_description()
-      * gst_pb_utils_init()
-      * gst_install_plugins_context_new()
-      * gst_install_plugins_context_set_xid()
-      * gst_install_plugins_context_free()
-      * gst_install_plugins_async()
-      * gst_install_plugins_sync()
-      * gst_install_plugins_return_get_name()
-      * gst_install_plugins_installation_in_progress()
-      * gst_missing_uri_source_message_new()
-      * gst_missing_uri_sink_message_new
-      * gst_missing_element_message_new
-      * gst_missing_decoder_message_new
-      * gst_missing_encoder_message_new
-      * gst_missing_plugin_message_get_installer_detail
-      * gst_missing_plugin_message_get_description
-      * gst_is_missing_plugin_message
-
-Bugs fixed since 0.10.10:
-     
-      * 360552 : [riff] [avi] extracts non-UTF8 metadata
-      * 365501 : [x/xvimagesink] race condition when creating first image ...
-      * 339366 : [playbin] hangs if suburi file type cannot be determined
-      * 355914 : libvisual causes xvimagesink:  assertion `GST_CAPS_REFCOU...
-      * 363118 : gst_riff_create_video_caps() should also store variant in...
-      * 363607 : xvimagesink xwindow_draw_border() slowness
-      * 336301 : [playbin] can't handle RTSP source
-      * 337026 : oggmux doesn't set EOS properly
-      * 337031 : vorbisdec outputs too much data 
-      * 340049 : New BaseRTPAudioPayloader class to -base 
-      * 348264 : Theora encoding, Ogg muxing don't handle discontinuities
-      * 354773 : xvimage assumes that XV_COLORKEY can be set in RGB888 format
-      * 355917 : libvisual plugin is broken
-      * 355935 : multifdsink doesn't allow setting maximums (soft, hard) i...
-      * 357038 : [ffmpegcolorspace] RGBA handling broken
-      * 357215 : [playbin] buffering notification not quite right yet
-      * 357289 : [riff] riff parser can't detect aac audio stream
-      * 357404 : [playbin] Linking can fail silently 
-      * 357531 : [subparse] problem if markup is not closed
-      * 357577 : [playbin] regression: buffering still images broken
-      * 357591 : Avoid compiler warning with uclibc and -Werror
-      * 357613 : XvStopVideo in xvimagesink
-      * 357800 : [libvisual] doesn't pass audio data to libvisual 0.4.0 co...
-      * 359580 : tcpserversink and dataprotocol assert for multipart streams
-      * 361095 : Fixes compiling with forte: warning clean up (part 3)
-      * 361456 : [basertppayload] Memory leak
-      * 361634 : sink- > ringbuffer NULL in BaseAudioSink's setcaps()
-      * 361984 : [subparse] doesn't accept .srt file that doesn't start wi...
-      * 366334 : [PATCH] Windows vs8 fixes
-      * 368273 : Using the remove signal on multifdsink is not threadsafe
-      * 368310 : include file  gstbasertpaudiopayload.h not included for r...
-      * 369482 : [typefind] MPEG system streams get recognized as mp3 files
-      * 370092 : [PATCH] Decodebin v2 : Implementation
-      * 377183 : regression: no eos when playing ogg vorbis files
-      * 381219 : bad debugging code left in audiorate
-      * 382223 : [decodebin] more delayed linking
-      * 382269 : Typefind detects mpeg video clip as audio/mpeg
-      * 335635 : Add an Ogg/Vorbis retagging element
-      * 341681 : [textoverlay] flickering with continuously timestamped text
-      * 342228 : [alsa] Recognize " Front " as a Master channel 
-      * 357330 : [subparse] some sami parser minor but enhanced patch 
-      * 357532 : [gsttag] vorbistag doesn't handle dates that include time...
-      * 359237 : [typefinding] doesn't recognize XML files shorter than 25...
-      * 362845 : [subparse] add support for tmplayer format
-      * 357977 : [videorate] new segment start is not respected
-      * 364812 : [PATCH] oggmux release pad does not remove pad
-      * 364856 : pngenc stride problems
-      * 372507 : Mac build fixes
-
-API added since 0.10.10:
-
-      * playbin::queue-min-threshold property.
-      * GstVideoOrientation interface
-      * gst_base_rtp_depayload_push_ts
-      * gst_base_rtp_depayload_push
-      * Add dropped_buffers to multifdsink's get-stats GValueArray
-      * gst_ring_buffer_commit_full
-
-Changes since 0.10.9:
-
-      * New elements: gdppay, gdpdepay
-
-Bugs fixed since 0.10.9:
-     
-      * 343787 : The adder cannot handle when multiple elements tries to l...
-      * 336075 : ALSA emu10k1 mixer tracks are wrongly classified as playb...
-      * 349105 : crash with playbin and resizing screen
-      * 342494 : [v4l] Query " device-name " even if device is not open
-      * 342680 : [adder] seeking with multiple ogg files fails to work
-      * 345188 : [alsa] can't handle more than 8 channels
-      * 347091 : converting vorbis comments to GstTagLists is lossy
-      * 348157 : Changed " Change Device " menu behaviour in gnome-volume-co...
-      * 348916 : [typefind] add multipart/x-mixed-replace typefinder
-      * 350157 : [riff] riff parser can't detect dts audio stream
-      * 350655 : [oggdemux] should process seeking queries
-      * 350900 : [adder] should not clamp floating point values
-      * 351426 : API: add gst_tag_parse_extended_comment
-      * 351502 : g_value_set_string leaks
-      * 351742 : [vorbisenc] discontinuity detection too sensitive, might ...
-      * 353658 : [videotestsrc] doesn't round strides correctly for YVYU
-      * 354594 : multifdsink doesn't work reliably with sync-method = 'nex...
-      * 351790 : [ogmparse] crash parsing video stream on x86-64
-      * 140139 : [avidemux] can't play broken avi with ogg (not vorbis) au...
-      * 347783 : [PLUGIN-MOVE] GDP elements should be moved
-      * 347918 : Internal data flow error in udpsrc
-      * 349656 : jitterbuffer in GstBaseRtp fails to handle rtp seqnum rol...
-      * 350784 : element alsamixer doesn't respect asoundrc
-      * 351308 : [netbuffer] build fails with gkt-doc critical warnings
-      * 353234 : audiorate preserves DISCONT on buffers
-      * 353912 : Add cmml caps to oggmux
-
-API added since 0.10.9:
-     
-      * gst_rtp_buffer_get_payload_subbuffer()
-      * gst_tag_parse_extended_comment()
-      * GstPlayBin::connection-speed
-      * GstTheoraParse::synchronization-points
-      * GST_AUDIO_CHANNEL_POSITION_NONE
-
-Changes since 0.10.8:
-
-      * Parallel installability with 0.8.x series
-      * Threadsafe design and API
-      * Subtitle fixes
-      * Support for images in tags
-      * Playback improvements
-      * Gnomevfssrc now supports burn:// uris
-      * Videoscale now supports more RGBA formats
-      * Multifdsink improvements
-      * Testsuite can now generate coverage information
-
-Bugs fixed since 0.10.8:
-
-      * 347296 : Problems with clocks on alsasrc hangs the application
-      * 347295 : [vorbisdec] Pushes before being initialized
-      * 329798 : [playbin] doesn't always give correct error message for m...
-      * 342085 : [alsasink] doesn't set buffer-time correctly
-      * 342789 : [audioresample] doesn't clear state when stopped, causing...
-      * 343303 : [subparse] workaround for bad entities in sami parser
-      * 343385 : [gnomevfs] add support for burn:// URIs
-      * 343500 : [riff] gst_riff_parse_strf_vids() can't parse extra data.
-      * 343699 : oggmux leaks
-      * 344503 : [subparse] parse font face property in sami parser.
-      * 345131 : [PATCH] videoscale support for 32-bit RGB-formats
-      * 345206 : [textoverlay] crash with non-UTF8 input
-      * 345225 : [theoradec] Clipping for exact seeking
-      * 345641 : [API] [libgsttag] add enums for image tag type
-      * 345879 : [riff] won't play a .wmv file with WMVA video stream
-      * 346581 : [typefinding] recognise text/html
-      * 347221 : [audioconvert] channel remapping does not work right
-      * 347304 : Massive leaks with xvimagesink
-      * 346527 : alsasrc get_range does not respect requested size
-
-Changes since 0.10.7:
-    
-      * alsasink probing fixes
-      * xvimagesink error reporting fixes
-      * subtitle fixes
-      * adder fixes
-      * vorbis multichannel fixes
-      * multifdsink streamheader fixes
-
-Bugs fixed since 0.10.7:
-    
-      * 169936 : [subparse] support for SAMI subtitles
-      * 315312 : Gstreamer Xv uses RGB instead of YUV.
-      * 334002 : video4linux shouldn't depend on X in configure script
-      * 336881 : [libvisual] additional support for libvisual-0.4
-      * 337544 : [xvimagesink] Internal Error when image is too large
-      * 339520 : [subparse] add " encoding " property
-      * 340909 : [alsasink] can't enable spdif output
-      * 341542 : some users have an assertion failed: (GST_VIDEO_SINK_WIDT...
-      * 341562 : audioconvert doesn't list formats in order of preference
-      * 341696 : audioconvert crashes if converting from a format with no ...
-      * 341719 : bisection algorithm in ogg doesn't bisect in some cases
-      * 341732 : [alsasink] doesn't query supported sample rates
-      * 341873 : [alsasink] minor memory leak, uses unprotected static var...
-      * 342143 : [subparse] sami parser needs to escape characters
-      * 342181 : [alsa] add property probe interface to alsasink and alsasrc
-      * 342268 : [playbin] add 'subtitle-encoding' property
-      * 342345 : [riff] Elephant's Dream AVI does not play, JUNK chunk bef...
-      * 342566 : Building without GTK+ fails
-      * 343397 : H.264/AAC movie deadlocks with totem in gstreamer code, p...
-      * 339935 : [adder] dead-locks when adding sink pads in PAUSED state
-
-Changes since 0.10.6:
-
-      * typefind improvements
-      * bug-fixes in textoverlay, audioconvert, videotestsrc, 
-        multifdsink and audio source/sink base classes
-      * Ice-cast metadata support has moved from gnomevfssrc to the 
-        icydemux element in gst-plugins-good
-      * audioresample now supports floating point samples
-      * Adder element fixes.
-      * Fixes for network playback and audio resampling in playbin
-
-Bugs fixed since 0.10.6:
-    
-      * 340060 : [adder] handle newsegment events properly
-      * 340375 : [API 0.11] [patch] typefind to differentiate between mp4 ...
-      * 339405 : [textoverlay] can't display '\n' character
-      * 338657 : [patch] adder should send events from src-pad to all sink...
-      * 338919 : [patch] alsasink should also query witdh capabilities fro...
-      * 301759 : [audioresample] float audio support (for OSX audio sinks)
-      * 331901 : [videotestsrc] framerate=0/1 gives assertion error
-      * 333657 : Replacing icy demuxing in gnomevfssrc
-      * 336339 : [audioresample] should support width != 16
-      * 338718 : [patch] [audioconvert] correctly clip float samples > 1.0
-      * 338778 : [patch] Bad audio with ASX files
-      * 338991 : [patch] Videoscale doesn't pass on pixel-aspect ratio
-      * 339574 : [patch] Race condition in multifdsink can lead to spuriou...
-      * 339786 : [typefinding] wavpack typefinding doesn't always work
-      * 340369 : [volume element] " volume " property range insufficient
-      * 340379 : [playbin] doesn't insert audioresample, causes problems w...
-      * 340392 : Problem with internal-decodebin
-      * 341160 : [multifdsink] client_status enum has an uninitialized nick
-      * 341182 : Accessing playbin's streaminfo property from high languag...
-      * 341432 : [playbin] automatically get icecast metadata requiring ic...
-      * 341542 : some users have an assertion failed: (GST_VIDEO_SINK_WIDT...
-      * 341557 : Map GST_TAG_IMAGE < = > ID3v2 APIC tag
-
-API added since 0.10.6:
-    
-      * client-fd-removed signal added to multifdsink
-      * stream-info-value-array property added to playbin
-      * gst_video_calculate_display_ratio() in libgstvideo
-
-Changes since 0.10.5:
-
-      * QoS in sinks and transform elements
-      * Needs GStreamer 0.10.5 for new GstBaseSink::async_playback() vmethod
-      * added theoraparse element
-
-Bugs fixed since 0.10.5:
-    
-      * 313136 : [playbin] hang while playing truncated ogg file
-      * 172848 : [subparse] subtitles with special chars are displayed as ...
-      * 305279 : [riff] uncompressed AVIs with 24bpp don't work
-      * 320765 : [ffmpegcolorspace] make win32+msvc compliant, don't use _...
-      * 323852 : Disable tests/icles on platforms that do not have X
-      * 325653 : build errors compiling audioresample on win32(vs7)
-      * 327357 : gst-plugins-base fails to compile with GCC 4.1
-      * 334620 : [gnomevfssrc] fails to connect to icecast streaming servers
-      * 334822 : [ffmpegcolorspace] YVU9 support
-      * 335028 : [typefinding] ID3 v1 tag is not recognized with mp3-in-wa...
-      * 335365 : inefficient use of GList in gst-plugins-base
-      * 336190 : [gnomevfssink] should accept non-URI filenames as " location " 
-      * 336194 : [gnomevfssrc] some minor memory leaks
-      * 336477 : plugins need better/univied descriptions
-      * 336617 : Unable to recognise MPEG TS stream
-      * 337548 : Memory leaks in basertpdepayload
-      * 337945 : [oggdemux] segment stop position ignored
-      * 338419 : Regression in the handling of files with multiple audio/s...
-      * 338897 : Videoscale crashes as part of DVD to Ogg transcoding
-      * 339013 : [videorate] Goes into an infinite loop
-      * 339047 : [riff] handle H264 fourcc in addition to h264
-      * 339212 : ISO file typefinding regression
-      * 330748 : deadlock in base audio sink on playing- > paused state change
-
-Bugs fixed since 0.10.4:
-    
-      * 334216 : [gnomevfssrc] won't open some media on NFS mounts any longer
-      * 334226 : typefindfunctions plugin crashes on PPC on registration
-
-Changes since 0.10.3:
-    
-      * (Experimental) QoS support
-      * oggmuxer now creates 100% valid streams for Theora, Vorbis and Speex
-      * documentation updates
-      * better support for subtitles (seeking)
-
-Bugs fixed since 0.10.3:
-    
-      * 310202 : [subtitles] < i >  < /i > tags and others should be supported i...
-      * 312439 : XVideo output doesn't work on remote displays (probably r...
-      * 321271 : audio output is truncated at EOS
-      * 321650 : Can't decode this ogm file
-      * 325732 : [oggdemux] problem when seeking to time less than 4s with...
-      * 325972 : [typefinding] doesn't recognise this mp3
-      * 326720 : [alsasink] doesn't support more than 2 channels anymore
-      * 330711 : [ffmpegcolorspace] problems with palettized RGB (fencount...
-      * 330789 : gstbaseaudiosink causes noise on seeking
-      * 330888 : Fix build with gcc 2.95 (again)
-      * 331295 : gnomevfssink doesn't respect umask when creating files
-      * 331526 : 3GP type detection is too simple
-      * 331678 : Decodebin is not reusable within a single pipeline (as in...
-      * 331690 : playbin won't play my last.fm stream
-      * 331763 : [alsamixer] unmute sets the volume to 100%
-      * 331765 : [alsamixer] mixer applet slider doesn't want to move from...
-      * 331903 : [videorate] doesnt handle input caps of framerate=0/1 sanely
-      * 332778 : [ogmparse] " Already an existing pad " WARNING
-      * 332964 : random crashes in mp3_type_find
-      * 333254 : theora encoder does not set IN_CAPS flag properly
-      * 333352 : [gnomevfssink] reports disk full as generic error
-      * 333488 : Allow for palette < 256 colours in AVI files
-      * 333510 : [PATCH] Fix gst_pad_new_from_template (gst_static_pad_tem...
-      * 333545 : [riff] set depth on wma caps to make asfdemux and pitfdll...
-      * 333663 : [patch] unref the result of gst_pad_get_parent
-      * 333900 : [typefind] cannot play a particular mp3 file
-      * 334112 : variable not initialized
-      * 334129 : Disable frame dropping for now
-      * 317038 : use default channel layout if none is specified in multic...
-      * 319340 : [cdparanoia] uncorrected-error signal never fired
-
-API added since 0.10.3:
-    
-      * GstTextOverlay::halignment
-      * GstTextOverlay::valignment
-
-Changes since 0.10.2:
-
-      * typefind improvements
-      * Ogg decoding and encoding fixes
-      * Improved audio and video sink classes
-      * Bug and leak fixes
-      * Improved video scaling
-      * On-the-fly visualisation switching
-      * Subtitle support
-
-Bugs fixed since 0.10.2:
-
-      * 330244 : gsttextoverlay.c:895: 'struct _GstCollectData' has no mem...
-      * 324000 : [playbin] post error or message on unknown input
-      * 153004 : [typefind] can't identify mp3 file with one single mpeg f...
-      * 323874 : [playbin] leaks sinks and threads when using gconfaudiosink
-      * 324626 : ffmpegcolorspace support for fourcc " UYVY "
-      * 326447 : check that all elements in -base pass queries they can't ...
-      * 328263 : Fix build with gcc 2.95
-      * 328279 : [decodebin] timeout issue when pre-rolling
-      * 329326 : Fix oggmux removing pads from collect pads
-
-Changes since 0.10.1:
-    
-      * ported gnomevfssink, cdparanoia
-      * New library and base class: GstCddaBaseSrc
-      * ported mixerutils.h
-      * added 'sine-tab' waveform to audiotestsrc
-      * added float audio to audiorate
-
-Bugs fixed since 0.10.1:
-    
-      * 324216 : [cdparanoia] missing patches from 0.8
-      * 324696 : [videotestsrc] does not start counting the time from zero...
-      * 324900 : Problem compiling gst-plugins-base with Forte
-      * 325984 : [playbin] cannot handle sources that produce raw audio/video
-      * 325990 : patch videotestsrc for using glib types
-      * 326601 : GstRingBuffer crashes with alaw/mulaw caps
-      * 327114 : [theoradec] should post tags on the bus
-      * 327216 : vorbisdec segfaults on certain queries
-
-API added since 0.10.1:
-     
-      * added libgstcddabase
-      * added mixerutils.h
-        
-Changes since 0.10.0:
-    
-      * Parallel installability with 0.8.x series
-      * Threadsafe design and API
-      * removed gst-launch-ext
-      * Ported: ogmparse
-      * Fixes for: subparse, xvimagesink, audioresample, videorate, decodebin
-
-Bugs fixed since 0.10.0:
-    
-      * 322347 : GstBaseRtpDepayload timestamps are wring
-      * 323900 : Basertpdepayloader lets NEWSEGMENT events through unfiltered
-      * 323878 : missing < string.h > inclusion (for memset & FD_ZERO)
-
-API added since 0.10.0:
-    
-      * GstAlsaMixer::device
-      * GstAlsaMixer::device-name
-
-Bugs fixed since 0.9.7:
-    
-      * 319172 : gstreamer-plugins-base-0.9.pc doesn't export linking flags
-      * 323017 : While(1) loop with sleep(0) in basertpdepayload.c
-  
-Changes since 0.9.6:
-    
-      * Parallel installability with 0.8.x series
-      * Threadsafe design and API
-      * ximagesink and xvimagesink updates and interactive test
-      * added pango
-      * rename net to netbuffer library
-      * rtp element renaming
-      * stream selector fixes
-
-Bugs fixed since 0.9.6:
-    
-      * 319618 : [decodebin] some ogg videos don't play
-      * 320644 : RTP packetizer does't set the packet timestamps correctly
-      * 322388 : xvimagesink force-aspect-ratio=True always displays squar...
-      * 322704 : oggdemux typefind list leak
-
-Changes since 0.9.5:
-    
-      * Parallel installability with 0.8.x series
-      * Threadsafe design and API
-      * lots of leak fixes
-      * flicker-free and rewritten X sinks
-      * fractional framerates
-      * removed sinesrc, replaced by audiotestsrc
-
-Bugs fixed since 0.9.5:
-    
-      * 316442 : playbin should use autoaudiosink/autovideosink by default
-      * 318353 : [ffmpegcolorspace] forward-port fixes from 0.8 branch
-      * 320200 : vorbisenc: min-bitrate and max-bitrate are 1/1000 bps rat...
-      * 321164 : gstringbuffer stops working under load
-      * 321426 : ximage plugin should be renamed to ximagesink
-      * 321446 : sinesrc should be dropped in favour of audiotestsrc
-      * 321451 : GstRtpBuffer: no way to create a sub buffer with only the...
-      * 321816 : [API] xoverlay API to post prepare-xwindow-id message
-      * 321894 : vorbisenc doesn't compile
-      * 322117 : Rename libgsttagedit to libgsttag
-
-Changes since 0.9.4:
-    
-      * video caps now use a good range for framerate and w/h
-      * oggdemux/oggmux improvements
-      * playbin improvements
-
-Bugs fixed since 0.9.4:
-    
-      * 319110 : [PATCH] oggdemux chain finding is slow
-      * 320058 : playbin of a jpeg over http does not work
-      * 320923 : [volume] doesn't build on Solaris
-      * 321011 : gstbasertpdepayload doesn't send the " new segment " event ...
-
-Changes since 0.9.3:
-
-      * New element: audiotestsrc
-      * typefind improvements
-      * buffer-frames removed
-
-Changes since 0.9.2:
-
-      * RTP base classes
-
-Bugs fixed since 0.9.2:
-
-      * 313251 : ximagesink unused functions
-      * 315159 : audioconvert lost 24 bit conversions in the rewrite
+      * Ported to 0.11.0 core API changes
+      * Reworked video caps
+      * Improved video helper library
+      * Numerous cleanups and improvements
 
diff --git a/RELEASE b/RELEASE
index 7c4682f..f4e9235 100644 (file)
--- a/RELEASE
+++ b/RELEASE
@@ -1,16 +1,15 @@
 
-Release notes for GStreamer Base Plug-ins 0.10.35 "Short Notice"
+Release notes for GStreamer Base Plug-ins 0.11.0 "Just like a pacifier"
         
 
 
 The GStreamer team is proud to announce a new release
-in the 0.10.x stable series of the
-GStreamer Base Plug-ins.
+in the 0.11.x unstable series of the GStreamer Base Plug-ins.
 
 
-The 0.10.x series is a stable series targeted at end users.
-It is not API or ABI compatible with the stable 0.8.x series.
-It is, however, parallel installable with the 0.8.x series.
+The 0.11.x series is an unstable series targeted at developers
+It is not API or ABI compatible with the stable 0.10.x series.
+It is, however, parallel installable with the 0.10.x series.
 
 
 
@@ -55,13 +54,11 @@ contains a set of less supported plug-ins that haven't passed the
 
 Features of this release
     
-      * work around GLib atomic ops API change
-      * don't use G_CONST_RETURN in public headers
-      * subparse: typefinding fixes for subtitles in non-UTF8 charsets
-
-Bugs fixed in this release
-     
-      * 600043 : subparse: fails to recognise Cyrillic subtitles in windows-1251 encoding
+      * Parallel installability with 0.10.x series
+      * Ported to the new 0.11 core API
+      * Improved video helper classes
+There were no bugs fixed in this release
+    
 
 Download
 
@@ -91,9 +88,15 @@ Applications
 Contributors to this release
     
       * David Schleef
-      * Debarshi Ray
+      * Edward Hervey
+      * Jan Schmidt
+      * Jonathan Matthew
+      * Luis de Bethencourt
       * Mark Nauwelaerts
-      * Sebastian Dröge
-      * Stefan Kost
+      * Philip Jägenstedt
+      * Piotr Fusik
+      * Robert Swain
+      * Thiago Santos
       * Tim-Philipp Müller
+      * Wim Taymans
  
\ No newline at end of file
index c67a1df..b370591 100644 (file)
@@ -19,14 +19,14 @@ LOCAL_SRC_FILES:= $(addprefix ../,$(alsa_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
        libdl                   \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstinterfaces-0.10   \
-       libgstaudio-0.10
+       libgstinterfaces-0.11   \
+       libgstaudio-0.11
 
 LOCAL_MODULE:= libgstalsa
 
@@ -39,8 +39,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H       -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 
 
 $(TARGET_OUT)/lib/libgstalsa.so:
index 88dfb7d..ffa9459 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_app_COPY_HEADERS_TO := gstreamer-0.10/gst/app
+gst_app_COPY_HEADERS_TO := gstreamer-0.11/gst/app
 gst_app_COPY_HEADERS := \
        ../gst-libs/gst/app/gstappbuffer.h \
        ../gst-libs/gst/app/gstappsink.h \
@@ -20,14 +20,14 @@ app_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(app_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0 
 
-LOCAL_MODULE:= libgstapp-0.10
+LOCAL_MODULE:= libgstapp-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H         -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index 8e067fc..179e6c8 100644 (file)
@@ -10,13 +10,13 @@ app_plugin_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(app_plugin_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstapp-0.10
+       libgstapp-0.11
 
 LOCAL_MODULE:= libgstapp
 
@@ -27,8 +27,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index fa24286..cb613a5 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_audio_COPY_HEADERS_TO := gstreamer-0.10/gst/audio
+gst_audio_COPY_HEADERS_TO := gstreamer-0.11/gst/audio
 gst_audio_COPY_HEADERS_BASE := \
        gst-libs/gst/audio/audio.h \
        gst-libs/gst/audio/gstaudioclock.h \
@@ -39,15 +39,15 @@ audio_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(audio_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstinterfaces-0.10
+       libgstinterfaces-0.11
 
-LOCAL_MODULE:= libgstaudio-0.10
+LOCAL_MODULE:= libgstaudio-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index 015f39c..059b295 100644 (file)
@@ -15,14 +15,14 @@ audioconvert_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(audioconvert_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstaudio-0.10        \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstaudio-0.11        \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-    libgstpbutils-0.10
+    libgstpbutils-0.11
 
 LOCAL_MODULE:= libgstaudioconvert
 
@@ -33,8 +33,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index 2d20164..3a94fee 100644 (file)
@@ -11,13 +11,13 @@ decodebin_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(decodebin_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstpbutils-0.10
+       libgstpbutils-0.11
 
 LOCAL_MODULE:= libgstdecodebin
 
@@ -28,8 +28,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H       -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index 30f0ace..c9d32f2 100644 (file)
@@ -13,13 +13,13 @@ decodebin2_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(decodebin2_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstpbutils-0.10
+       libgstpbutils-0.11
 
 LOCAL_MODULE:= libgstdecodebin2
 
@@ -30,8 +30,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H        \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index 156bf28..801ad80 100644 (file)
@@ -12,13 +12,13 @@ gdp_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(gdp_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstdataprotocol-0.10
+       libgstdataprotocol-0.11
 
 LOCAL_MODULE:= libgstgdp
 
@@ -29,8 +29,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H  -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index 61564b3..6e0387a 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_interfaces_COPY_HEADERS_TO := gstreamer-0.10/gst/interfaces
+gst_interfaces_COPY_HEADERS_TO := gstreamer-0.11/gst/interfaces
 gst_interfaces_COPY_HEADERS_BASE := \
        gst-libs/gst/interfaces/colorbalance.h \
        gst-libs/gst/interfaces/colorbalancechannel.h \
@@ -15,7 +15,7 @@ gst_interfaces_COPY_HEADERS_BASE := \
        gst-libs/gst/interfaces/tunerchannel.h \
        gst-libs/gst/interfaces/tunernorm.h \
        gst-libs/gst/interfaces/videoorientation.h \
-       gst-libs/gst/interfaces/xoverlay.h \
+       gst-libs/gst/interfaces/videooverlay.h \
        gst-libs/gst/interfaces/interfaces-enumtypes.h 
 
 gst_interfaces_COPY_HEADERS := $(addprefix ../,$(gst_interfaces_COPY_HEADERS_BASE))
@@ -37,7 +37,7 @@ interfaces_LOCAL_SRC_FILES_BASE:= \
        gst-libs/gst/interfaces/tunernorm.c \
        gst-libs/gst/interfaces/tunerchannel.c \
        gst-libs/gst/interfaces/videoorientation.c \
-       gst-libs/gst/interfaces/xoverlay.c \
+       gst-libs/gst/interfaces/videooverlay.c \
        gst-libs/gst/interfaces/interfaces-marshal.c \
        gst-libs/gst/interfaces/interfaces-enumtypes.c
 
@@ -45,15 +45,14 @@ LOCAL_SRC_FILES:= $(addprefix ../,$(interfaces_LOCAL_SRC_FILES_BASE)) \
                                  $(addprefix ../android/,$(interfaces_LOCAL_SRC_FILES_ANDROID))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0
 
-LOCAL_MODULE:= libgstinterfaces-0.10
-
+LOCAL_MODULE:= libgstinterfaces-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index fd904bd..8b217f9 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_netbuffer_COPY_HEADERS_TO := gstreamer-0.10/gst/netbuffer
+gst_netbuffer_COPY_HEADERS_TO := gstreamer-0.11/gst/netbuffer
 gst_netbuffer_COPY_HEADERS := \
        ../gst-libs/gst/netbuffer/gstnetbuffer.h
 
@@ -15,14 +15,14 @@ netbuffer_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(netbuffer_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0
 
-LOCAL_MODULE:= libgstnetbuffer-0.10
+LOCAL_MODULE:= libgstnetbuffer-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index a9aebac..52ca383 100644 (file)
@@ -3,7 +3,7 @@ include $(CLEAR_VARS)
 
 GST_PBUTILS_DIR := gst-libs/gst/pbutils/
 
-gst_pbutils_COPY_HEADERS_TO := gstreamer-0.10/gst/pbutils
+gst_pbutils_COPY_HEADERS_TO := gstreamer-0.11/gst/pbutils
 gst_pbutils_COPY_HEADERS_BASE := \
        gst-libs/gst/pbutils/descriptions.h \
        gst-libs/gst/pbutils/install-plugins.h \
@@ -45,15 +45,15 @@ $(BUILT_SOURCES):
 
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstvideo-0.10        \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstvideo-0.11        \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     
 
-LOCAL_MODULE:= libgstpbutils-0.10
+LOCAL_MODULE:= libgstpbutils-0.11
 LOCAL_CFLAGS := -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
 #
index e792429..b81bf9e 100644 (file)
@@ -19,15 +19,15 @@ playbin_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(playbin_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstpbutils-0.10              \
-       libgstinterfaces-0.10   \
-       libgstvideo-0.10
+       libgstpbutils-0.11              \
+       libgstinterfaces-0.11   \
+       libgstvideo-0.11
 
 LOCAL_MODULE:= libgstplaybin
 
@@ -38,8 +38,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index 6c5fcd4..29b9929 100644 (file)
@@ -12,13 +12,13 @@ LOCAL_SRC_FILES:= $(addprefix ../,$(queue2_LOCAL_SRC_FILES_BASE))
 
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstpbutils-0.10
+       libgstpbutils-0.11
 
 LOCAL_MODULE:= libgstqueue2
 
@@ -29,7 +29,7 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H       \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 
 include $(BUILD_SHARED_LIBRARY)
index 759bdad..958235b 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_riffs_COPY_HEADERS_TO := gstreamer-0.10/gst/riff
+gst_riffs_COPY_HEADERS_TO := gstreamer-0.11/gst/riff
 gst_riffs_COPY_HEADERS := \
        ../gst-libs/gst/riff/riff-ids.h \
        ../gst-libs/gst/riff/riff-media.h \
@@ -19,17 +19,17 @@ riff_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(riff_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgsttag-0.10          \
-    libgstaudio-0.10     
+       libgsttag-0.11          \
+    libgstaudio-0.11     
 
 
-LOCAL_MODULE:= libgstriff-0.10
+LOCAL_MODULE:= libgstriff-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H         -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index 7ad0071..f39f86c 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_rtp_COPY_HEADERS_TO := gstreamer-0.10/gst/rtp
+gst_rtp_COPY_HEADERS_TO := gstreamer-0.11/gst/rtp
 gst_rtp_COPY_HEADERS := \
        ../gst-libs/gst/rtp/gstbasertpaudiopayload.h \
        ../gst-libs/gst/rtp/gstbasertpdepayload.h \
@@ -26,14 +26,14 @@ LOCAL_SRC_FILES:= $(addprefix ../,$(rtp_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
        libdl                   \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0             
 
-LOCAL_MODULE:= libgstrtp-0.10
+LOCAL_MODULE:= libgstrtp-0.11
 LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
 #
index fdc07b9..4f61f4e 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_rtsp_COPY_HEADERS_TO := gstreamer-0.10/gst/rtsp
+gst_rtsp_COPY_HEADERS_TO := gstreamer-0.11/gst/rtsp
 gst_rtsp_COPY_HEADERS_BASE := \
        gst-libs/gst/rtsp/gstrtspbase64.h \
        gst-libs/gst/rtsp/gstrtspdefs.h \
@@ -34,14 +34,14 @@ rtsp_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(rtsp_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0
 
-LOCAL_MODULE:= libgstrtsp-0.10
+LOCAL_MODULE:= libgstrtsp-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H -DINET_ADDRSTRLEN=16 -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index b83002c..7d0e7e8 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_sdp_COPY_HEADERS_TO := gstreamer-0.10/gst/sdp
+gst_sdp_COPY_HEADERS_TO := gstreamer-0.11/gst/sdp
 gst_sdp_COPY_HEADERS := \
        ../gst-libs/gst/sdp/gstsdp.h \
        ../gst-libs/gst/sdp/gstsdpmessage.h
@@ -16,14 +16,14 @@ sdp_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(sdp_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0
 
-LOCAL_MODULE:= libgstsdp-0.10
+LOCAL_MODULE:= libgstsdp-0.11
 LOCAL_CFLAGS := -DHAVE_CONFIG_H  -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
 #
index e4eaee6..7ca9081 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_tag_COPY_HEADERS_TO := gstreamer-0.10/gst/tag
+gst_tag_COPY_HEADERS_TO := gstreamer-0.11/gst/tag
 gst_tag_COPY_HEADERS := \
        ../gst-libs/gst/tag/gsttagdemux.h \
        ../gst-libs/gst/tag/tag.h
@@ -22,15 +22,14 @@ tag_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(tag_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0
 
-LOCAL_MODULE:= libgsttag-0.10
-
+LOCAL_MODULE:= libgsttag-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index 28f1dca..a4d6aa8 100644 (file)
@@ -18,13 +18,13 @@ tcp_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(tcp_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0                     \
-       libgstdataprotocol-0.10
+       libgstdataprotocol-0.11
 
 LOCAL_MODULE:= libgsttcp
 
@@ -35,8 +35,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H  -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index 2650e2b..c1c267c 100644 (file)
@@ -10,9 +10,9 @@ typefindfunctions_LOCAL_SRC_FILES:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(typefindfunctions_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
-    libgstpbutils-0.10     \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
+    libgstpbutils-0.11     \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
@@ -27,8 +27,8 @@ LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
 #
 LOCAL_PRELINK_MODULE := false
 
-#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.10
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
+#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
index fdfb6a2..f92949a 100644 (file)
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 #----------------------------------------
 # include 
-gst_video_COPY_HEADERS_TO := gstreamer-0.10/gst/video
+gst_video_COPY_HEADERS_TO := gstreamer-0.11/gst/video
 gst_video_COPY_HEADERS_BASE := \
        gst-libs/gst/video/gstvideofilter.h \
        gst-libs/gst/video/gstvideosink.h \
@@ -24,14 +24,14 @@ video_LOCAL_SRC_FILES_BASE:= \
 LOCAL_SRC_FILES:= $(addprefix ../,$(video_LOCAL_SRC_FILES_BASE))
 
 LOCAL_SHARED_LIBRARIES := \
-    libgstreamer-0.10       \
-    libgstbase-0.10         \
+    libgstreamer-0.11       \
+    libgstbase-0.11         \
     libglib-2.0             \
     libgthread-2.0          \
     libgmodule-2.0          \
     libgobject-2.0
 
-LOCAL_MODULE:= libgstvideo-0.10
+LOCAL_MODULE:= libgstvideo-0.11
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H        -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
similarity index 66%
rename from android/ffmpegcolorspace.mk
rename to android/videoconvert.mk
index c197a64..99d6391 100644 (file)
@@ -4,15 +4,12 @@ include $(CLEAR_VARS)
 
 LOCAL_ARM_MODE := arm
 
-ffmpegcolorspace_LOCAL_SRC_FILES:= \
-       gst/ffmpegcolorspace/gstffmpegcolorspace.c \
-       gst/ffmpegcolorspace/gstffmpegcodecmap.c \
-       gst/ffmpegcolorspace/dsputil.c \
-       gst/ffmpegcolorspace/imgconvert.c \
-       gst/ffmpegcolorspace/mem.c \
-       gst/ffmpegcolorspace/utils.c
+videoconvert_LOCAL_SRC_FILES:= \
+       gst/videoconvert/gstvideoconvert.c \
+       gst/videoconvert/gstvideoconvertorc-dist.c \
+       gst/videoconvert/videoconvert.c
 
-LOCAL_SRC_FILES:= $(addprefix ../,$(ffmpegcolorspace_LOCAL_SRC_FILES))
+LOCAL_SRC_FILES:= $(addprefix ../,$(videoconvert_LOCAL_SRC_FILES))
 
 LOCAL_SHARED_LIBRARIES := \
     libgstvideo-0.10        \
@@ -24,7 +21,7 @@ LOCAL_SHARED_LIBRARIES := \
     libgobject-2.0                     \
     libgstpbutils-0.10
 
-LOCAL_MODULE:= libgstffmpegcolorspace
+LOCAL_MODULE:= libgstvideoconvert
 
 LOCAL_CFLAGS := -DHAVE_CONFIG_H -DGSTREAMER_BUILT_FOR_ANDROID \
        $(GST_PLUGINS_BASE_CFLAGS)
index 56eae4e..9393453 100644 (file)
@@ -5,7 +5,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file
 dnl initialize autoconf
 dnl releases only do -Wall, git and prerelease does -Werror too
 dnl use a three digit version number for releases, and four for git/prerelease
-AC_INIT(GStreamer Base Plug-ins, 0.10.35.1,
+AC_INIT(GStreamer Base Plug-ins, 0.11.0.2,
     http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
     gst-plugins-base)
 
@@ -40,7 +40,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
 dnl our libraries and install dirs use major.minor as a version
 GST_MAJORMINOR=$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR
 dnl we override it here if we need to for the release candidate of new series
-GST_MAJORMINOR=0.10
+GST_MAJORMINOR=0.11
 AC_SUBST(GST_MAJORMINOR)
 
 dnl CURRENT, REVISION, AGE
@@ -49,7 +49,7 @@ dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
 dnl - interfaces added -> increment AGE
 dnl - interfaces removed -> AGE = 0
 dnl sets GST_LT_LDFLAGS
-AS_LIBTOOL(GST, 24, 0, 24)
+AS_LIBTOOL(GST, 25, 0, 0)
 
 dnl FIXME: this macro doesn't actually work;
 dnl the generated libtool script has no support for the listed tags.
@@ -60,7 +60,7 @@ AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
 dnl *** required versions of GStreamer stuff ***
-GST_REQ=0.10.35.1
+GST_REQ=0.11.0
 
 dnl *** autotools stuff ****
 
@@ -171,10 +171,6 @@ dnl *** checks for header files ***
 dnl check if we have ANSI C header files
 AC_HEADER_STDC
 
-dnl used in gst/ffmpegcolorspace/mem.c
-dnl FIXME: could be fixed by redefining av_malloc and av_free to GLib's
-AC_CHECK_HEADERS([malloc.h])
-
 ac_cppflags_save="$CPPFLAGS"
 CPPFLAGS="`$PKG_CONFIG --cflags libxml-2.0`"
 AC_COMPILE_IFELSE(
@@ -213,9 +209,6 @@ LIBS="$save_libs"
 dnl used in gst-libs/gst/pbutils and associated unit test
 AC_CHECK_HEADERS([process.h sys/types.h sys/wait.h sys/stat.h])
 
-AC_CHECK_HEADERS([xmmintrin.h emmintrin.h])
-
-dnl ffmpegcolorspace includes _stdint.h
 dnl also, Windows does not have long long
 AX_CREATE_STDINT_H
 
@@ -261,7 +254,7 @@ AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
 dnl *** checks for dependency libraries ***
 
 dnl GLib is required
-AG_GST_GLIB_CHECK([2.24])
+AG_GST_GLIB_CHECK([2.26])
 
 ORC_CHECK([0.4.11])
 
@@ -427,7 +420,7 @@ AG_GST_CHECK_PLUGIN(audioconvert)
 AG_GST_CHECK_PLUGIN(audiorate)
 AG_GST_CHECK_PLUGIN(audiotestsrc)
 AG_GST_CHECK_PLUGIN(encoding)
-AG_GST_CHECK_PLUGIN(ffmpegcolorspace)
+AG_GST_CHECK_PLUGIN(videoconvert)
 AG_GST_CHECK_PLUGIN(gdp)
 AG_GST_CHECK_PLUGIN(playback)
 AG_GST_CHECK_PLUGIN(audioresample)
@@ -439,11 +432,9 @@ AG_GST_CHECK_PLUGIN(videorate)
 AG_GST_CHECK_PLUGIN(videoscale)
 AG_GST_CHECK_PLUGIN(volume)
 
-dnl check for gstreamer core features (subsystems)
-dnl FIXME: this assumes srcdir == builddir for uninstalled setups
-GST_CONFIGPATH=`$PKG_CONFIG --variable=includedir gstreamer-0.10`"/gst/gstconfig.h"
-AG_GST_PARSE_SUBSYSTEM_DISABLES($GST_CONFIGPATH)
-AM_CONDITIONAL(USE_XML, test $GST_DISABLE_XML != "1")
+dnl FIXME 0.11: check for libxml, split subparse and move libxml parts to ext/
+AM_CONDITIONAL(USE_XML, false)
+AC_DEFINE([GST_DISABLE_XML], [1], [set to disable libxml2-dependent code in subparse])
 
 dnl disable plug-ins that require libxml2's HTML support if it is not available
 if test "x$HAVE_LIBXML_HTML" != "xyes"; then
@@ -586,51 +577,6 @@ AG_GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], , [
   AC_SUBST(XSHM_LIBS) 
 ])
 
-dnl v4l/v4l2 checks have been moved down because they require X
-
-dnl *** Video 4 Linux ***
-dnl for information about the header/define, see sys/v4l/gstv4lelement.h
-dnl renamed to GST_V4L in accordance with V4L2 below
-translit(dnm, m, l) AM_CONDITIONAL(USE_GST_V4L, true)
-AG_GST_CHECK_FEATURE(GST_V4L, [Video 4 Linux], video4linux, [
-  AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_GST_V4L="yes", HAVE_GST_V4L="no", [
-#include <sys/types.h>
-#define _LINUX_TIME_H
-#define __user
-#include <linux/videodev.h>
-  ])
-
-  dnl we can build v4l without Xv, but then we won't have XOverlay support
-  if test "x$HAVE_GST_V4L" = "xyes" -a "x$HAVE_XVIDEO" != "xyes"
-  then
-    AC_MSG_NOTICE([NO XVIDEO FOUND, VIDEO4LINUX WILL BE BUILT])
-    AC_MSG_NOTICE([WITHOUT XOVERLAY SUPPORT])
-  fi
-])
-
-# Optional gudev for device probing
-AC_ARG_WITH([gudev],
-  AC_HELP_STRING([--with-gudev],
-    [device detection with gudev]),
-  [],
-  [with_gudev=check])
-if test x$HAVE_GST_V4L = xyes; then
-  if test x$with_gudev != xno; then
-      PKG_CHECK_MODULES(GUDEV, [ gudev-1.0 >= 143 ],
-          [ have_gudev=yes
-            AC_DEFINE(HAVE_GUDEV, 1,
-               [Whether gudev is available for device detection])
-            AC_DEFINE([G_UDEV_API_IS_SUBJECT_TO_CHANGE], 1, [I know the API is subject to change.])
-          ], [
-          have_gudev=no
-          ])
-  else
-    have_gudev=no
-  fi
-fi
-AC_SUBST(GUDEV_CFLAGS)
-AC_SUBST(GUDEV_LIBS)
-
 dnl *** ext plug-ins ***
 dnl keep this list sorted alphabetically !
 
@@ -695,22 +641,6 @@ dnl FIXME : add second check somehow if that is necessary
 dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
 dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no)
 
-dnl *** GNOME VFS ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_GNOME_VFS, true)
-AG_GST_CHECK_FEATURE(GNOME_VFS, [GNOME VFS], gnomevfs, [
-  PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0, [
-      HAVE_GNOME_VFS="yes"
-      AC_SUBST(GNOME_VFS_CFLAGS)
-      AC_SUBST(GNOME_VFS_LIBS)
-      GNOME_VFS_MODULES_DIR="`$PKG_CONFIG --variable=modulesdir gnome-vfs-2.0`"
-      AC_DEFINE_UNQUOTED(GNOME_VFS_MODULES_DIR, "$GNOME_VFS_MODULES_DIR",
-             [The GnomeVFS modules directory.])
-    ],[
-      HAVE_GNOME_VFS="no"
-    ]
-    )
-])
-
 dnl *** ivorbis ***
 dnl AM_PATH_IVORBIS only takes two options
 translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
@@ -839,7 +769,6 @@ dnl but we still need to set the conditionals
 AM_CONDITIONAL(USE_ALSA, false)
 AM_CONDITIONAL(USE_CDPARANOIA, false)
 AM_CONDITIONAL(USE_GIO, false)
-AM_CONDITIONAL(USE_GNOME_VFS, false)
 AM_CONDITIONAL(USE_IVORBIS, false)
 AM_CONDITIONAL(USE_LIBVISUAL, false)
 AM_CONDITIONAL(USE_OGG, false)
@@ -902,6 +831,7 @@ AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
 
 dnl FIXME: do we want to rename to GST_ALL_* ?
 dnl add GST_OPTION_CFLAGS, but overridable
+GST_CFLAGS="$GST_CFLAGS -DGST_USE_UNSTABLE_API"
 GST_CXXFLAGS="$GLIB_CFLAGS $GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CXXFLAGS)"
 GST_CFLAGS="$GLIB_CFLAGS $GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CFLAGS)"
 AC_SUBST(GST_CFLAGS)
@@ -942,7 +872,7 @@ gst/audioconvert/Makefile
 gst/audiorate/Makefile
 gst/audiotestsrc/Makefile
 gst/encoding/Makefile
-gst/ffmpegcolorspace/Makefile
+gst/videoconvert/Makefile
 gst/gdp/Makefile
 gst/playback/Makefile
 gst/audioresample/Makefile
@@ -956,11 +886,9 @@ gst/volume/Makefile
 sys/Makefile
 sys/ximage/Makefile
 sys/xvimage/Makefile
-sys/v4l/Makefile
 ext/Makefile
 ext/alsa/Makefile
 ext/cdparanoia/Makefile
-ext/gnomevfs/Makefile
 ext/gio/Makefile
 ext/libvisual/Makefile
 ext/ogg/Makefile
@@ -1029,7 +957,6 @@ tests/examples/seek/Makefile
 tests/examples/snapshot/Makefile
 tests/examples/playrec/Makefile
 tests/examples/volume/Makefile
-tests/examples/v4l/Makefile
 tests/files/Makefile
 tests/icles/Makefile
 tests/icles/playback/Makefile
@@ -1080,7 +1007,7 @@ sed \
     -e "s/.* PACKAGE_STRING$/#define PACKAGE_STRING \"$PACKAGE_STRING\"/" \
     -e 's/.* PACKAGE_TARNAME$/#define PACKAGE_TARNAME "'$PACKAGE_TARNAME'"/' \
     -e 's/.* PACKAGE_VERSION$/#define PACKAGE_VERSION "'$PACKAGE_VERSION'"/' \
-    -e 's/.* PLUGINDIR$/#ifdef _DEBUG\n#  define PLUGINDIR PREFIX "\\\\debug\\\\lib\\\\gstreamer-0.10"\n#else\n#  define PLUGINDIR PREFIX "\\\\lib\\\\gstreamer-0.10"\n#endif/' \
+    -e 's/.* PLUGINDIR$/#ifdef _DEBUG\n#  define PLUGINDIR PREFIX "\\\\debug\\\\lib\\\\gstreamer-0.11"\n#else\n#  define PLUGINDIR PREFIX "\\\\lib\\\\gstreamer-0.11"\n#endif/' \
     -e 's/.* USE_BINARY_REGISTRY$/#define USE_BINARY_REGISTRY/' \
     -e 's/.* VERSION$/#define VERSION "'$VERSION'"/' \
     -e "s/.* DEFAULT_AUDIOSINK$/#define DEFAULT_AUDIOSINK \"directsoundsink\"/" \
index 07cd3d4..6506a4e 100644 (file)
@@ -29,7 +29,7 @@ non-target caps are left. It is commonly done while pre-rolling, but can also
 happen whenever a new pad appears on any element.
 
   Once a target caps has been found, that pad is ghosted and the
-'new-decoded-pad' signal is emitted.
+'pad-added' signal is emitted.
 
   If no compatible elements can be found for a GstCaps, the pad is ghosted and
 the 'unknown-type' signal is emitted.
diff --git a/docs/design/draft-media-types.txt b/docs/design/draft-media-types.txt
new file mode 100644 (file)
index 0000000..b4f3e43
--- /dev/null
@@ -0,0 +1,1012 @@
+Media Types
+-----------
+
+ video/x-raw
+
+  width, G_TYPE_INT
+    The width of the image in pixels.
+
+  height, G_TYPE_INT
+    The height of the image in pixels
+
+  framerate, GST_TYPE_FRACTION
+    The framerate of the video 0/1 for variable framerate
+
+  pixel-aspect-ratio, GST_TYPE_FRACTION
+    The pixel aspect ration of the video
+
+  format, G_TYPE_STRING
+    The format of the video
+
+  *  "I420" planar 4:2:0 YUV
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * RU2 (height)
+
+        Component 1: U
+          depth:           8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU4 (RU2 (width) / 2)
+          default size:    rstride (component1) * RU2 (height) / 2
+
+        Component 2: V
+          depth            8
+          pstride:         1
+          default offset:  offset (component1) + size (component1)
+          default rstride: RU4 (RU2 (width) / 2)
+          default size:    rstride (component2) * RU2 (height) / 2
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+  *  "YV12" planar 4:2:0 YUV
+
+        Same as I420 but with U and V planes swapped
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * RU2 (height)
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  offset (component2) + size (component2)
+          default rstride: RU4 (RU2 (width) / 2)
+          default size:    rstride (component1) * RU2 (height) / 2
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU4 (RU2 (width) / 2)
+          default size:    rstride (component2) * RU2 (height) / 2
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+
+  *  "YUY2" packed 4:2:2 YUV
+
+       +--+--+--+--+ +--+--+--+--+
+       |Y0|U0|Y1|V0| |Y2|U2|Y3|V2| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: Y
+          depth:           8
+          pstride:         2
+          offset:          0
+
+        Component 1: U
+          depth:           8
+          offset:          1
+          pstride:         4
+
+        Component 2: V
+          depth            8
+          offset:          3
+          pstride:         4
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+
+  *  "YVYU" packed 4:2:2 YUV
+  
+      Same as "YUY2" but with U and V planes swapped
+
+       +--+--+--+--+ +--+--+--+--+
+       |Y0|V0|Y1|U0| |Y2|V2|Y3|U2| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: Y
+          depth:           8
+          pstride:         2
+          offset:          0
+
+        Component 1: U
+          depth:           8
+          pstride:         4
+          offset:          3
+
+        Component 2: V
+          depth            8
+          pstride:         4
+          offset:          1
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+
+  *  "UYVY" packed 4:2:2 YUV
+
+       +--+--+--+--+ +--+--+--+--+
+       |U0|Y0|V0|Y1| |U2|Y2|V2|Y3| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: Y
+          depth:           8
+          pstride:         2
+          offset:          1
+
+        Component 1: U
+          depth:           8
+          pstride:         4
+          offset:          0
+
+        Component 2: V
+          depth            8
+          pstride:         4
+          offset:          2
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+
+  *  "AYUV" packed 4:4:4 YUV with alpha channel
+  
+       +--+--+--+--+ +--+--+--+--+
+       |A0|Y0|U0|V0| |A1|Y1|U1|V1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: Y
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 1: U
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 2: V
+          depth            8
+          pstride:         4
+          offset:          3
+
+        Component 3: A
+          depth            8
+          pstride:         4
+          offset:          0
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+
+  *  "RGBx" sparse rgb packed into 32 bit, space last
+
+       +--+--+--+--+ +--+--+--+--+
+       |R0|G0|B0|X | |R1|G1|B1|X | ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          0
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          2
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "BGRx" sparse reverse rgb packed into 32 bit, space last
+
+       +--+--+--+--+ +--+--+--+--+
+       |B0|G0|R0|X | |B1|G1|R1|X | ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          0
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "xRGB" sparse rgb packed into 32 bit, space first
+
+       +--+--+--+--+ +--+--+--+--+
+       |X |R0|G0|B0| |X |R1|G1|B1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          3
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "xBGR" sparse reverse rgb packed into 32 bit, space first
+
+       +--+--+--+--+ +--+--+--+--+
+       |X |B0|G0|R0| |X |B1|G1|R1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          3
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          1
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "RGBA" rgb with alpha channel last
+
+       +--+--+--+--+ +--+--+--+--+
+       |R0|G0|B0|A0| |R1|G1|B1|A1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          0
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          2
+
+        Component 3: A
+          depth            8
+          pstride:         4
+          offset:          3
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "BGRA" reverse rgb with alpha channel last
+
+       +--+--+--+--+ +--+--+--+--+
+       |B0|G0|R0|A0| |B1|G1|R1|A1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          0
+
+        Component 3: A
+          depth            8
+          pstride:         4
+          offset:          3
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "ARGB" rgb with alpha channel first
+
+       +--+--+--+--+ +--+--+--+--+
+       |A0|R0|G0|B0| |A1|R1|G1|B1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          3
+
+        Component 3: A
+          depth            8
+          pstride:         4
+          offset:          0
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "ABGR" reverse rgb with alpha channel first
+
+       +--+--+--+--+ +--+--+--+--+
+       |A0|R0|G0|B0| |A1|R1|G1|B1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         4
+          offset:          1
+
+        Component 1: G
+          depth:           8
+          pstride:         4
+          offset:          2
+
+        Component 2: B
+          depth            8
+          pstride:         4
+          offset:          3
+
+        Component 3: A
+          depth            8
+          pstride:         4
+          offset:          0
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
+  *  "RGB" rgb
+
+       +--+--+--+ +--+--+--+
+       |R0|G0|B0| |R1|G1|B1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         3
+          offset:          0
+
+        Component 1: G
+          depth:           8
+          pstride:         3
+          offset:          1
+
+        Component 2: B
+          depth            8
+          pstride:         3
+          offset:          2
+
+        Image
+          default rstride: RU4 (width * 3)
+          default size:    rstride (image) * height
+
+  *  "BGR" reverse rgb
+
+       +--+--+--+ +--+--+--+
+       |B0|G0|R0| |B1|G1|R1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           8
+          pstride:         3
+          offset:          2
+
+        Component 1: G
+          depth:           8
+          pstride:         3
+          offset:          1
+
+        Component 2: B
+          depth            8
+          pstride:         3
+          offset:          0
+
+        Image
+          default rstride: RU4 (width * 3)
+          default size:    rstride (image) * height
+
+  *  "Y41B" planar 4:1:1 YUV
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * height
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU16 (width) / 4
+          default size:    rstride (component1) * height
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  offset (component1) + size (component1)
+          default rstride: RU16 (width) / 4
+          default size:    rstride (component2) * height
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+
+  *  "Y42B" planar 4:2:2 YUV
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * height
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU8 (width) / 2
+          default size:    rstride (component1) * height
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  offset (component1) + size (component1)
+          default rstride: RU8 (width) / 2
+          default size:    rstride (component2) * height
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+
+  *  "Y444" planar 4:4:4 YUV
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * height
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU4 (width)
+          default size:    rstride (component1) * height
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  offset (component1) + size (component1)
+          default rstride: RU4 (width)
+          default size:    rstride (component2) * height
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+
+  *  "v210" packed 4:2:2 10-bit YUV, complex format
+
+        Component 0: Y
+          depth:           10
+
+        Component 1: U
+          depth            10
+
+        Component 2: V
+          depth:           10
+
+        Image
+          default rstride: RU48 (width) * 128
+          default size:    rstride (image) * height
+
+
+  *  "v216" packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order
+
+        Component 0: Y
+          depth:           16
+          pstride:         4
+          offset:          0
+
+        Component 1: U
+          depth            16
+          pstride:         8
+          offset:          2
+
+        Component 2: V
+          depth:           16
+          pstride:         8
+          offset:          6
+
+        Image
+          default rstride: RU8 (width * 2)
+          default size:    rstride (image) * height
+
+  *  "NV12" planar 4:2:0 YUV with interleaved UV plane
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * RU2 (height)
+
+        Component 1: U
+          depth            8
+          pstride:         2
+          default offset:  size (component0)
+          default rstride: RU4 (width)
+
+        Component 2: V
+          depth:           8
+          pstride:         2
+          default offset:  offset (component1) + 1
+          default rstride: RU4 (width)
+
+        Image
+          default size: RU4 (width) * RU2 (height) * 3 / 2
+
+
+  *  "NV21" planar 4:2:0 YUV with interleaved VU plane
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * RU2 (height)
+
+        Component 1: U
+          depth            8
+          pstride:         2
+          default offset:  offset (component1) + 1
+          default rstride: RU4 (width)
+
+        Component 2: V
+          depth:           8
+          pstride:         2
+          default offset:  size (component0)
+          default rstride: RU4 (width)
+
+        Image
+          default size: RU4 (width) * RU2 (height) * 3 / 2
+
+  *  "GRAY8"  8-bit grayscale
+  *  "Y800" same as "GRAY8"
+
+        Component 0: Y
+          depth:           8
+          offset:          0
+          pstride:         1
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * height
+
+        Image
+          default size:    size (component0)
+
+  *  "GRAY16_BE" 16-bit grayscale, most significant byte first
+
+        Component 0: Y
+          depth:           16
+          offset:          0
+          pstride:         2
+          default rstride: RU4 (width * 2)
+          default size:    rstride (component0) * height
+
+        Image
+          default size:    size (component0)
+
+  *  "GRAY16_LE" 16-bit grayscale, least significant byte first
+  *  "Y16" same as "GRAY16_LE"
+
+        Component 0: Y
+          depth:           16
+          offset:          0
+          pstride:         2
+          default rstride: RU4 (width * 2)
+          default size:    rstride (component0) * height
+
+        Image
+          default size:    size (component0)
+
+  *  "v308" packed 4:4:4 YUV
+
+       +--+--+--+ +--+--+--+
+       |Y0|U0|V0| |Y1|U1|V1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: Y
+          depth:           8
+          pstride:         3
+          offset:          0
+
+        Component 1: U
+          depth            8
+          pstride:         3
+          offset:          1
+
+        Component 2: V
+          depth:           8
+          pstride:         3
+          offset:          2
+
+        Image
+          default rstride: RU4 (width * 3)
+          default size:    rstride (image) * height
+
+
+  *  "RGB16" rgb 5-6-5 bits per component
+
+       +--+--+--+ +--+--+--+
+       |R0|G0|B0| |R1|G1|B1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           5
+          pstride:         2
+
+        Component 1: G
+          depth            6
+          pstride:         2
+
+        Component 2: B
+          depth:           5
+          pstride:         2
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+  *  "BGR16" reverse rgb 5-6-5 bits per component
+
+       +--+--+--+ +--+--+--+
+       |B0|G0|R0| |B1|G1|R1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           5
+          pstride:         2
+
+        Component 1: G
+          depth            6
+          pstride:         2
+
+        Component 2: B
+          depth:           5
+          pstride:         2
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+  *  "RGB15" rgb 5-5-5 bits per component
+
+       +--+--+--+ +--+--+--+
+       |R0|G0|B0| |R1|G1|B1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           5
+          pstride:         2
+
+        Component 1: G
+          depth            5
+          pstride:         2
+
+        Component 2: B
+          depth:           5
+          pstride:         2
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+  *  "BGR15" reverse rgb 5-5-5 bits per component
+
+       +--+--+--+ +--+--+--+
+       |B0|G0|R0| |B1|G1|R1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           5
+          pstride:         2
+
+        Component 1: G
+          depth            5
+          pstride:         2
+
+        Component 2: B
+          depth:           5
+          pstride:         2
+
+        Image
+          default rstride: RU4 (width * 2)
+          default size:    rstride (image) * height
+
+  *  "UYVP" packed 10-bit 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
+
+        Component 0: Y
+          depth:           10
+
+        Component 1: U
+          depth            10
+
+        Component 2: V
+          depth:           10
+
+        Image
+          default rstride: RU4 (width * 2 * 5)
+          default size:    rstride (image) * height
+
+  *  "A420" planar 4:4:2:0 AYUV
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * RU2 (height)
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU4 (RU2 (width) / 2)
+          default size:    rstride (component1) * (RU2 (height) / 2)
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  size (component0) + size (component1)
+          default rstride: RU4 (RU2 (width) / 2)
+          default size:    rstride (component2) * (RU2 (height) / 2)
+
+        Component 3: A
+          depth:           8
+          pstride:         1
+          default offset:  size (component0) + size (component1) +
+                           size (component2)
+          default rstride: RU4 (width)
+          default size:    rstride (component3) * RU2 (height)
+
+        Image
+          default size:    size (component0) +
+                           size (component1) + 
+                           size (component2) +
+                           size (component3)
+
+  *  "RGB8_PALETTED" 8-bit paletted RGB
+
+        Component 0: R
+          depth:           8
+
+        Component 1: G
+          depth            8
+
+        Component 2: B
+          depth:           8
+
+        Image
+          default pstride: 1
+          default rstride: RU4 (width)
+          default size:    rstride (image) * height
+
+  *  "YUV9" planar 4:1:0 YUV
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * height
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU4 (RU4 (width) / 4)
+          default size:    rstride (component1) * (RU4 (height) / 4)
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  offset (component1) + size (component1)
+          default rstride: RU4 (RU4 (width) / 4)
+          default size:    rstride (component2) * (RU4 (height) / 4)
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+
+  *  "YVU9" planar 4:1:0 YUV (like YUV9 but UV planes swapped)
+
+        Component 0: Y
+          depth:           8
+          pstride:         1
+          default offset:  0
+          default rstride: RU4 (width)
+          default size:    rstride (component0) * height
+
+        Component 1: U
+          depth            8
+          pstride:         1
+          default offset:  offset (component2) + size (component2)
+          default rstride: RU4 (RU4 (width) / 4)
+          default size:    rstride (component1) * (RU4 (height) / 4)
+
+        Component 2: V
+          depth:           8
+          pstride:         1
+          default offset:  size (component0)
+          default rstride: RU4 (RU4 (width) / 4)
+          default size:    rstride (component2) * (RU4 (height) / 4)
+
+        Image
+          default size: size (component0) + 
+                        size (component1) +
+                        size (component2)
+
+  *  "IYU1"  packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...)
+
+       +--+--+--+ +--+--+--+
+       |B0|G0|R0| |B1|G1|R1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: Y
+          depth:           8
+          offset:          1
+          pstride:         2
+
+        Component 1: U
+          depth            5
+          offset:          0
+          pstride:         2
+
+        Component 2: V
+          depth:           5
+          offset:          4
+          pstride:         2
+
+        Image
+          default rstride: RU4 (RU4 (width) + RU4 (width) / 2)
+          default size:    rstride (image) * height
+
+  *  "ARGB64" rgb with alpha channel first, 16 bits per channel
+
+       +--+--+--+--+ +--+--+--+--+
+       |A0|R0|G0|B0| |A1|R1|G1|B1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: R
+          depth:           16
+          pstride:         8
+          offset:          2
+
+        Component 1: G
+          depth            16
+          pstride:         8
+          offset:          4
+
+        Component 2: B
+          depth:           16
+          pstride:         8
+          offset:          6
+
+        Component 3: A
+          depth:           16
+          pstride:         8
+          offset:          0
+
+        Image
+          default rstride: width * 8
+          default size:    rstride (image) * height
+
+  *  "AYUV64" packed 4:4:4 YUV with alpha channel, 16 bits per channel (A0-Y0-U0-V0 ...)
+
+       +--+--+--+--+ +--+--+--+--+
+       |A0|Y0|U0|V0| |A1|Y1|U1|V1| ...
+       +--+--+--+--+ +--+--+--+--+
+
+        Component 0: Y
+          depth:           16
+          pstride:         8
+          offset:          2
+
+        Component 1: U
+          depth            16
+          pstride:         8
+          offset:          4
+
+        Component 2: V
+          depth:           16
+          pstride:         8
+          offset:          6
+
+        Component 3: A
+          depth:           16
+          pstride:         8
+          offset:          0
+
+        Image
+          default rstride: width * 8
+          default size:    rstride (image) * height
+
+  *  "r210" packed 4:4:4 RGB, 10 bits per channel
+
+       +--+--+--+ +--+--+--+
+       |R0|G0|B0| |R1|G1|B1| ...
+       +--+--+--+ +--+--+--+
+
+        Component 0: R
+          depth:           10
+          pstride:         4
+
+        Component 1: G
+          depth            10
+          pstride:         4
+
+        Component 2: B
+          depth:           10
+          pstride:         4
+
+        Image
+          default rstride: width * 4
+          default size:    rstride (image) * height
+
index af2632c..598c0e8 100644 (file)
@@ -92,7 +92,7 @@ extra_files =
 
 # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
 # contains GtkObjects/GObjects and you want to document signals and properties.
-GTKDOC_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
+GTKDOC_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) -DGST_USE_UNSTABLE_API
 GTKDOC_LIBS = $(SCANOBJ_DEPS) $(GST_BASE_LIBS)
 
 GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
index 65677ef..f4a0cb0 100644 (file)
       <xi:include href="xml/gsttunerchannel.xml" />
       <xi:include href="xml/gsttunernorm.xml" />
       <xi:include href="xml/gstvideoorientation.xml" />
-      <xi:include href="xml/gstxoverlay.xml" />
+      <xi:include href="xml/gstvideooverlay.xml" />
     </chapter>
 
     <chapter id="gstreamer-netbuffer">
index 2f050a6..bb794f1 100644 (file)
@@ -795,26 +795,22 @@ gst_video_orientation_get_type
 </SECTION>
 
 <SECTION>
-<FILE>gstxoverlay</FILE>
-<INCLUDE>gst/interfaces/xoverlay.h</INCLUDE>
+<FILE>gstvideooverlay</FILE>
+<INCLUDE>gst/interfaces/videooverlay.h</INCLUDE>
 GstXOverlay
-GstXOverlayClass
-gst_x_overlay_set_xwindow_id
-gst_x_overlay_got_xwindow_id
-gst_x_overlay_got_window_handle
-gst_x_overlay_set_window_handle
-gst_x_overlay_prepare_xwindow_id
-gst_x_overlay_expose
-gst_x_overlay_handle_events
-gst_x_overlay_set_render_rectangle
+GstXOverlayIface
+gst_video_overlay_got_window_handle
+gst_video_overlay_set_window_handle
+gst_video_overlay_prepare_window_handle
+gst_video_overlay_expose
+gst_video_overlay_handle_events
+gst_video_overlay_set_render_rectangle
 <SUBSECTION Standard>
-GST_TYPE_X_OVERLAY
-GST_X_OVERLAY
-GST_X_OVERLAY_CLASS
-GST_X_OVERLAY_GET_CLASS
-GST_IS_X_OVERLAY
-GST_IS_X_OVERLAY_CLASS
-gst_x_overlay_get_type
+GST_TYPE_VIDEO_OVERLAY
+GST_VIDEO_OVERLAY
+GST_IS_VIDEO_OVERLAY
+GST_VIDEO_OVERLAY_GET_IFACE
+gst_video_overlay_get_type
 </SECTION>
 
 
index f6c06af..d440b3b 100644 (file)
@@ -40,8 +40,8 @@ gst_tuner_norm_get_type
 gst_stream_volume_get_type
 #include <gst/interfaces/videoorientation.h>
 gst_video_orientation_get_type
-#include <gst/interfaces/xoverlay.h>
-gst_x_overlay_get_type
+#include <gst/interfaces/videooverlay.h>
+gst_video_overlay_get_type
 
 
 #include <gst/rtp/gstbasertpdepayload.h>
index c987b85..f304621 100644 (file)
@@ -64,7 +64,7 @@ CFILE_GLOB=$(DOC_SOURCE_DIR)/*/*/*.c
 SCANOBJ_DEPS =
 
 # Header files to ignore when scanning.
-IGNORE_HFILES = avcodec.h gstffmpegcodecmap.h dsputil.h arch.h speex_resampler.h speex_resampler_wrapper.h fixed_arm4.h fixed_arm5e.h fixed_bfin.h fixed_debug.h fixed_generic.h resample_sse.h
+IGNORE_HFILES = avcodec.h dsputil.h arch.h speex_resampler.h speex_resampler_wrapper.h fixed_arm4.h fixed_arm5e.h fixed_bfin.h fixed_debug.h fixed_generic.h resample_sse.h
 IGNORE_CFILES = utils.c mem.c imgconvert.c
 
 # we add all .h files of elements that have signals/args we want
@@ -84,8 +84,6 @@ EXTRA_HFILES = \
        $(top_srcdir)/ext/gio/gstgiosrc.h \
        $(top_srcdir)/ext/gio/gstgiostreamsink.h \
        $(top_srcdir)/ext/gio/gstgiostreamsrc.h \
-       $(top_srcdir)/ext/gnomevfs/gstgnomevfssink.h \
-       $(top_srcdir)/ext/gnomevfs/gstgnomevfssrc.h \
        $(top_srcdir)/ext/ogg/gstoggdemux.h \
        $(top_srcdir)/ext/ogg/gstoggmux.h \
        $(top_srcdir)/ext/pango/gstclockoverlay.h \
@@ -104,7 +102,6 @@ EXTRA_HFILES = \
        $(top_srcdir)/gst/audioconvert/gstaudioconvert.h \
        $(top_srcdir)/gst/audiotestsrc/gstaudiotestsrc.h \
        $(top_srcdir)/gst/encoding/gstencodebin.h \
-       $(top_srcdir)/gst/ffmpegcolorspace/gstffmpegcolorspace.h \
        $(top_srcdir)/gst/gdp/gstgdpdepay.h \
        $(top_srcdir)/gst/gdp/gstgdppay.h \
        $(top_srcdir)/gst/playback/gstplay-enum.h \
index ea603d6..e121096 100644 (file)
     <xi:include href="xml/element-decodebin.xml" />
     <xi:include href="xml/element-decodebin2.xml" />
     <xi:include href="xml/element-encodebin.xml" />
-    <xi:include href="xml/element-ffmpegcolorspace.xml" />
+    <xi:include href="xml/element-videoconvert.xml" />
     <xi:include href="xml/element-gdpdepay.xml" />
     <xi:include href="xml/element-gdppay.xml" />
     <xi:include href="xml/element-giosink.xml" />
     <xi:include href="xml/element-giosrc.xml" />
     <xi:include href="xml/element-giostreamsink.xml" />
     <xi:include href="xml/element-giostreamsrc.xml" />
-    <xi:include href="xml/element-gnomevfssink.xml" />
-    <xi:include href="xml/element-gnomevfssrc.xml" />
     <xi:include href="xml/element-multifdsink.xml" />
     <xi:include href="xml/element-oggdemux.xml" />
     <xi:include href="xml/element-oggmux.xml" />
     <xi:include href="xml/plugin-cdparanoia.xml" />
     <xi:include href="xml/plugin-decodebin.xml" />
     <xi:include href="xml/plugin-encoding.xml" />
-    <xi:include href="xml/plugin-ffmpegcolorspace.xml" />
+    <xi:include href="xml/plugin-videoconvert.xml" />
     <xi:include href="xml/plugin-gdp.xml" />
     <xi:include href="xml/plugin-gio.xml" />
-    <xi:include href="xml/plugin-gnomevfs.xml" />
     <xi:include href="xml/plugin-libvisual.xml" />
     <xi:include href="xml/plugin-ogg.xml" />
     <xi:include href="xml/plugin-pango.xml" />
@@ -95,7 +92,6 @@
     <xi:include href="xml/plugin-theora.xml" />
     <xi:include href="xml/plugin-typefindfunctions.xml" />
     <xi:include href="xml/plugin-uridecodebin.xml" />
-    <xi:include href="xml/plugin-video4linux.xml" />
     <xi:include href="xml/plugin-videorate.xml" />
     <xi:include href="xml/plugin-videoscale.xml" />
     <xi:include href="xml/plugin-videotestsrc.xml" />
index e94c450..b9fde4d 100644 (file)
@@ -241,9 +241,9 @@ GstDecodeBin
 </SECTION>
 
 <SECTION>
-<FILE>element-decodebin2</FILE>
-<TITLE>decodebin2</TITLE>
-GstDecodeBin2
+<FILE>element-decodebin</FILE>
+<TITLE>decodebin</TITLE>
+GstDecodeBin
 <SUBSECTION Standard>
 </SECTION>
 
@@ -264,16 +264,16 @@ gst_encode_bin_get_type
 
 
 <SECTION>
-<FILE>element-ffmpegcolorspace</FILE>
-<TITLE>ffmpegcolorspace</TITLE>
-GstFFMpegCsp
+<FILE>element-videoconvert</FILE>
+<TITLE>videoconvert</TITLE>
+GstVideoConvert
 <SUBSECTION Standard>
-GST_FFMPEGCSP
-GST_FFMPEGCSP_CLASS
-GST_IS_FFMPEGCSP
-GST_IS_FFMPEGCSP_CLASS
-GST_TYPE_FFMPEGCSP
-GstFFMpegCspClass
+GST_VIDEO_CONVERT
+GST_VIDEO_CONVERT_CLASS
+GST_IS_VIDEO_CONVERT_
+GST_IS_VIDEO_CONVERT_CLASS
+GST_TYPE_VIDEO_CONVERT_
+GstVideoConvertClass
 </SECTION>
 
 <SECTION>
@@ -396,34 +396,6 @@ gst_tcp_protocol_get_type
 </SECTION>
 
 <SECTION>
-<FILE>element-gnomevfssink</FILE>
-<TITLE>gnomevfssink</TITLE>
-GstGnomeVFSSink
-<SUBSECTION Standard>
-GstGnomeVFSSinkClass
-GST_GNOME_VFS_SINK_CLASS
-GST_TYPE_GNOME_VFS_SINK
-GST_IS_GNOME_VFS_SINK
-gst_gnome_vfs_sink_get_type
-GST_IS_GNOME_VFS_SINK_CLASS
-GST_GNOME_VFS_SINK
-</SECTION>
-
-<SECTION>
-<FILE>element-gnomevfssrc</FILE>
-<TITLE>gnomevfssrc</TITLE>
-GstGnomeVFSSrc
-<SUBSECTION Standard>
-GST_GNOME_VFS_SRC
-GST_GNOME_VFS_SRC_CLASS
-GST_IS_GNOME_VFS_SRC
-GST_IS_GNOME_VFS_SRC_CLASS
-GST_TYPE_GNOME_VFS_SRC
-GstGnomeVFSSrcClass
-gst_gnome_vfs_src_get_type
-</SECTION>
-
-<SECTION>
 <FILE>element-oggdemux</FILE>
 <TITLE>oggdemux</TITLE>
 GstOggDemux
@@ -461,13 +433,6 @@ GstOggMuxClass
 </SECTION>
 
 <SECTION>
-<FILE>gstplaybasebin</FILE>
-<TITLE>GstPlayBaseBin</TITLE>
-GstPlayBaseBin
-<SUBSECTION Standard>
-</SECTION>
-
-<SECTION>
 <FILE>element-playbin</FILE>
 <TITLE>playbin</TITLE>
 GstPlayBin
@@ -475,9 +440,9 @@ GstPlayBin
 </SECTION>
 
 <SECTION>
-<FILE>element-playbin2</FILE>
-<TITLE>playbin2</TITLE>
-GstPlayBin2
+<FILE>element-playbin</FILE>
+<TITLE>playbin</TITLE>
+GstPlayBin
 GstPlayFlags
 <SUBSECTION Standard>
 gst_play_flags_get_type
index 89307df..d28dd63 100644 (file)
 GObject
-  GInputStream
-  GOutputStream
-  GstColorBalanceChannel
+  GInitiallyUnowned
+    GstObject
+      GstPad
+      GstPadTemplate
+      GstPluginFeature
+        GstElementFactory
+        GstTypeFindFactory
+        GstIndexFactory
+      GstElement
+        GstBin
+          GstPipeline
+            GstPlayBaseBin
+              GstPlayBin
+            GstPlayBin2
+          GstEncodeBin
+          GstDecodeBin
+          GstPlaySink
+          GstSubtitleOverlay
+          GstDecodeBin2
+          GstURIDecodeBin
+        GstVisual
+          GstVisualjess
+          GstVisualbumpscope
+          GstVisualcorona
+          GstVisualinfinite
+          GstVisualjakdaw
+          GstVisuallv_analyzer
+          GstVisuallv_scope
+          GstVisualoinksie
+        GstBaseSrc
+          GstGnomeVFSSrc
+          GstGioBaseSrc
+            GstGioSrc
+            GstGioStreamSrc
+          GstPushSrc
+            GstCddaBaseSrc
+              GstCdParanoiaSrc
+            GstBaseAudioSrc
+              GstAudioSrc
+                GstAlsaSrc
+            GstV4lElement
+              GstV4lSrc
+            GstVideoTestSrc
+            GstTCPClientSrc
+            GstTCPServerSrc
+          GstAppSrc
+          GstAudioTestSrc
+        GstBaseSink
+          GstGnomeVFSSink
+          GstGioBaseSink
+            GstGioSink
+            GstGioStreamSink
+          GstBaseAudioSink
+            GstAudioSink
+              GstAlsaSink
+          GstVideoSink
+            GstXvImageSink
+            GstXImageSink
+          GstAppSink
+          GstTCPClientSink
+          GstMultiFdSink
+            GstTCPServerSink
+        GstTheoraDec
+        GstTheoraEnc
+        GstTheoraParse
+        GstBaseTextOverlay
+          GstTextOverlay
+          GstTimeOverlay
+          GstClockOverlay
+        GstTextRender
+        GstOggDemux
+        GstOggMux
+        GstOgmParse
+          GstOgmAudioParse
+          GstOgmVideoParse
+          GstOgmTextParse
+        GstOggParse
+        GstOggAviParse
+        GstVorbisEnc
+        GstVorbisDec
+        GstVorbisParse
+          GstVorbisTag
+        GstAlsaMixerElement
+        GstSubParse
+        GstSsaParse
+        GstBaseTransform
+          GstAudioFilter
+            GstVolume
+          GstVideoFilter
+            GstVideoScale
+            GstFFMpegCsp
+          GstAudioResample
+          GstAudioConvert
+        GstGDPDepay
+        GstGDPPay
+        GstAudioRate
+        GstAdder
+        GstVideoRate
+        GstStreamSelector
+      GstBus
+      GstTask
+      GstTaskPool
+      GstClock
+        GstSystemClock
+          GstAudioClock
+      GstPlugin
+      GstRegistry
+      GstRingBuffer
+        GstAudioSrcRingBuffer
+        GstAudioSinkRingBuffer
   GstMixerTrack
-  GstObject
-    GstBus
-    GstClock
-      GstSystemClock
-        GstAudioClock
-    GstElement
-      GstAdder
-      GstAlsaMixerElement
-      GstAudioRate
-      GstBaseSink
-        GstAppSink
-        GstBaseAudioSink
-          GstAudioSink
-            GstAlsaSink
-        GstGioBaseSink
-          GstGioSink
-          GstGioStreamSink
-        GstGnomeVFSSink
-        GstMultiFdSink
-          GstTCPServerSink
-        GstTCPClientSink
-        GstVideoSink
-          GstXImageSink
-          GstXvImageSink
-      GstBaseSrc
-        GstAppSrc
-        GstAudioTestSrc
-        GstGioBaseSrc
-          GstGioSrc
-          GstGioStreamSrc
-        GstGnomeVFSSrc
-        GstPushSrc
-          GstBaseAudioSrc
-            GstAudioSrc
-              GstAlsaSrc
-          GstCddaBaseSrc
-            GstCdParanoiaSrc
-          GstTCPClientSrc
-          GstTCPServerSrc
-          GstV4lElement
-            GstV4lSrc
-          GstVideoTestSrc
-      GstBaseTransform
-        GstAudioConvert
-        GstAudioFilter
-          GstVolume
-        GstAudioResample
-        GstVideoFilter
-          GstFFMpegCsp
-          GstVideoScale
-      GstBin
-        GstDecodeBin
-        GstDecodeBin2
-        GstEncodeBin
-        GstPipeline
-          GstPlayBaseBin
-            GstPlayBin
-          GstPlayBin2
-        GstPlaySink
-        GstSubtitleOverlay
-        GstURIDecodeBin
-      GstGDPDepay
-      GstGDPPay
-      GstOggAviParse
-      GstOggDemux
-      GstOggMux
-      GstOggParse
-      GstOgmParse
-        GstOgmAudioParse
-        GstOgmTextParse
-        GstOgmVideoParse
-      GstSsaParse
-      GstStreamSelector
-      GstSubParse
-      GstTextOverlay
-        GstClockOverlay
-        GstTimeOverlay
-      GstTextRender
-      GstTheoraDec
-      GstTheoraEnc
-      GstTheoraParse
-      GstVideoRate
-      GstVisual
-        GstVisualbumpscope
-        GstVisualcorona
-        GstVisualgforce
-        GstVisualinfinite
-        GstVisualjakdaw
-        GstVisualjess
-        GstVisuallv_scope
-        GstVisualoinksie
-      GstVorbisDec
-      GstVorbisEnc
-      GstVorbisParse
-        GstVorbisTag
-    GstPad
-    GstPadTemplate
-    GstPlugin
-    GstPluginFeature
-      GstElementFactory
-      GstIndexFactory
-      GstTypeFindFactory
-    GstRegistry
-    GstRingBuffer
-      GstAudioSinkRingBuffer
-      GstAudioSrcRingBuffer
-    GstTask
-    GstTaskPool
-  GstSignalObject
   GstStreamInfo
-  GstTunerChannel
+  GstEncodingProfile
   GstTunerNorm
-  PangoContext
+  GstTunerChannel
+  GstColorBalanceChannel
   PangoFontMap
     PangoFcFontMap
       PangoCairoFcFontMap
+  PangoContext
+  GInputStream
+  GOutputStream
 GInterface
-  GFile
   GTypePlugin
   GstChildProxy
-  GstColorBalance
+  GstURIHandler
+  GstPreset
+  GstTagSetter
   GstImplementsInterface
   GstMixer
-  GstNavigation
-  GstPreset
   GstPropertyProbe
-  GstStreamVolume
-  GstTagSetter
-  GstTuner
-  GstURIHandler
+  GstNavigation
   GstXOverlay
+  GstColorBalance
+  GstTuner
+  GstStreamVolume
   PangoCairoFontMap
+  GFile
index 8f393f4..4b602b1 100644 (file)
@@ -1,32 +1,32 @@
-GstAlsaMixerElement GstImplementsInterface GstMixer GstPropertyProbe
-GstAlsaSink GstPropertyProbe
-GstAlsaSrc GstImplementsInterface GstMixer GstPropertyProbe
-GstAppSink GstURIHandler
-GstAppSrc GstURIHandler
 GstBin GstChildProxy
-GstCdParanoiaSrc GstURIHandler
-GstCddaBaseSrc GstURIHandler
-GstDecodeBin GstChildProxy
-GstDecodeBin2 GstChildProxy
-GstEncodeBin GstChildProxy
-GstGioSink GstURIHandler
-GstGioSrc GstURIHandler
-GstGnomeVFSSink GstURIHandler
-GstGnomeVFSSrc GstURIHandler
-GstOggMux GstPreset
 GstPipeline GstChildProxy
 GstPlayBaseBin GstChildProxy
 GstPlayBin GstChildProxy
 GstPlayBin2 GstChildProxy GstStreamVolume
+GstEncodeBin GstChildProxy
+GstDecodeBin GstChildProxy
 GstPlaySink GstChildProxy
 GstSubtitleOverlay GstChildProxy
-GstTheoraEnc GstPreset
+GstDecodeBin2 GstChildProxy
 GstURIDecodeBin GstChildProxy
+GstGnomeVFSSrc GstURIHandler
+GstGioSrc GstURIHandler
+GstCddaBaseSrc GstURIHandler
+GstCdParanoiaSrc GstURIHandler
+GstAlsaSrc GstImplementsInterface GstMixer GstPropertyProbe
 GstV4lElement GstImplementsInterface GstTuner GstXOverlay GstColorBalance GstPropertyProbe
 GstV4lSrc GstImplementsInterface GstTuner GstXOverlay GstColorBalance GstPropertyProbe
-GstVolume GstImplementsInterface GstMixer GstStreamVolume
+GstAppSrc GstURIHandler
+GstGnomeVFSSink GstURIHandler
+GstGioSink GstURIHandler
+GstAlsaSink GstPropertyProbe
+GstXvImageSink GstImplementsInterface GstNavigation GstXOverlay GstColorBalance GstPropertyProbe
+GstXImageSink GstImplementsInterface GstNavigation GstXOverlay
+GstAppSink GstURIHandler
+GstTheoraEnc GstPreset
+GstOggMux GstPreset
 GstVorbisEnc GstTagSetter GstPreset
 GstVorbisTag GstTagSetter
-GstXImageSink GstImplementsInterface GstNavigation GstXOverlay
-GstXvImageSink GstImplementsInterface GstNavigation GstXOverlay GstColorBalance GstPropertyProbe
+GstAlsaMixerElement GstImplementsInterface GstMixer GstPropertyProbe
+GstVolume GstImplementsInterface GstMixer GstStreamVolume
 PangoCairoFcFontMap PangoCairoFontMap
index d111b2e..176f319 100644 (file)
@@ -1,10 +1,10 @@
-GFile GObject
 GstChildProxy GstObject
-GstColorBalance GstImplementsInterface GstElement
+GstTagSetter GstElement
 GstImplementsInterface GstElement
 GstMixer GstImplementsInterface GstElement
-GstStreamVolume GObject
-GstTagSetter GstElement
-GstTuner GstImplementsInterface GstElement
 GstXOverlay GstImplementsInterface GstElement
+GstColorBalance GstImplementsInterface GstElement
+GstTuner GstImplementsInterface GstElement
+GstStreamVolume GObject
 PangoCairoFontMap PangoFontMap
+GFile GObject
diff --git a/docs/plugins/inspect/plugin-ffmpegcolorspace.xml b/docs/plugins/inspect/plugin-ffmpegcolorspace.xml
deleted file mode 100644 (file)
index fbbbb76..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>ffmpegcolorspace</name>
-  <description>colorspace conversion copied from FFMpeg 0.4.9-pre1</description>
-  <filename>../../gst/ffmpegcolorspace/.libs/libgstffmpegcolorspace.so</filename>
-  <basename>libgstffmpegcolorspace.so</basename>
-  <version>0.10.35.1</version>
-  <license>LGPL</license>
-  <source>gst-plugins-base</source>
-  <package>FFMpeg</package>
-  <origin>http://ffmpeg.sourceforge.net/</origin>
-  <elements>
-    <element>
-      <name>ffmpegcolorspace</name>
-      <longname>FFMPEG Colorspace converter</longname>
-      <class>Filter/Converter/Video</class>
-      <description>Converts video from one colorspace to another</description>
-      <author>GStreamer maintainers &lt;gstreamer-devel@lists.sourceforge.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw-yuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], format=(fourcc){ I420, NV12, NV21, YV12, YUY2, Y42B, Y444, YUV9, YVU9, Y41B, Y800, Y8  , GREY, Y16 , UYVY, YVYU, IYU1, v308, AYUV, A420 }; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int)4321, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int)1234, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw-yuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], format=(fourcc){ I420, NV12, NV21, YV12, YUY2, Y42B, Y444, YUV9, YVU9, Y41B, Y800, Y8  , GREY, Y16 , UYVY, YVYU, IYU1, v308, AYUV, A420 }; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int)4321, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int)1234, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
diff --git a/docs/plugins/inspect/plugin-gnomevfs.xml b/docs/plugins/inspect/plugin-gnomevfs.xml
deleted file mode 100644 (file)
index e31d8b5..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<plugin>
-  <name>gnomevfs</name>
-  <description>elements to read from and write to  Gnome-VFS uri&apos;s</description>
-  <filename>../../ext/gnomevfs/.libs/libgstgnomevfs.so</filename>
-  <basename>libgstgnomevfs.so</basename>
-  <version>0.10.35.1</version>
-  <license>LGPL</license>
-  <source>gst-plugins-base</source>
-  <package>GStreamer Base Plug-ins git</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>gnomevfssink</name>
-      <longname>GnomeVFS Sink</longname>
-      <class>Sink/File</class>
-      <description>Write a stream to a GnomeVFS URI</description>
-      <author>Bastien Nocera &lt;hadess@hadess.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>gnomevfssrc</name>
-      <longname>GnomeVFS Source</longname>
-      <class>Source/File</class>
-      <description>Read from any GnomeVFS-supported file</description>
-      <author>Bastien Nocera &lt;hadess@hadess.net&gt;, GStreamer maintainers &lt;gstreamer-devel@lists.sourceforge.net&gt;</author>
-      <pads>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
diff --git a/docs/plugins/inspect/plugin-video4linux.xml b/docs/plugins/inspect/plugin-video4linux.xml
deleted file mode 100644 (file)
index eddf4b1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<plugin>
-  <name>video4linux</name>
-  <description>elements for Video 4 Linux</description>
-  <filename>../../sys/v4l/.libs/libgstvideo4linux.so</filename>
-  <basename>libgstvideo4linux.so</basename>
-  <version>0.10.32.1</version>
-  <license>LGPL</license>
-  <source>gst-plugins-base</source>
-  <package>GStreamer Base Plug-ins git</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>v4lsrc</name>
-      <longname>Video (video4linux/raw) Source</longname>
-      <class>Source/Video</class>
-      <description>Reads raw frames from a video4linux device</description>
-      <author>GStreamer maintainers &lt;gstreamer-devel@lists.sourceforge.net&gt;</author>
-      <pads>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
index b441978..f793d4b 100644 (file)
@@ -16,12 +16,6 @@ else
 GIO_DIR=
 endif
 
-if USE_GNOME_VFS
-GNOMEVFS_DIR=gnomevfs
-else
-GNOMEVFS_DIR=
-endif
-
 if USE_LIBVISUAL
 LIBVISUAL_DIR=libvisual
 else
@@ -64,7 +58,6 @@ SUBDIRS = \
   $(ALSA_DIR) \
   $(CDPARANOIA_DIR) \
   $(GIO_DIR) \
-  $(GNOMEVFS_DIR) \
   $(LIBVISUAL_DIR) \
   $(OGG_DIR) \
   $(PANGO_DIR) \
@@ -75,7 +68,6 @@ DIST_SUBDIRS = \
   alsa \
   cdparanoia \
   gio \
-  gnomevfs \
   libvisual \
   ogg \
   pango \
index 94ed44c..60f3f3e 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "gstalsa.h"
 
-#include <gst/audio/multichannel.h>
+#include <gst/audio/audio.h>
 
 static GstCaps *
 gst_alsa_detect_rates (GstObject * obj, snd_pcm_hw_params_t * hw_params,
@@ -117,18 +117,30 @@ gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
 
   for (i = 0; i < gst_caps_get_size (in_caps); ++i) {
     GstStructure *scopy;
+    const gchar *str;
+    GstAudioFormat format;
+    const GstAudioFormatInfo *finfo;
     gint w, width = 0, depth = 0;
 
     s = gst_caps_get_structure (in_caps, i);
-    if (!gst_structure_has_name (s, "audio/x-raw-int")) {
-      GST_WARNING_OBJECT (obj, "skipping non-int format");
+    if (!gst_structure_has_name (s, "audio/x-raw")) {
+      GST_WARNING_OBJECT (obj, "skipping non-raw format");
       continue;
     }
-    if (!gst_structure_get_int (s, "width", &width) ||
-        !gst_structure_get_int (s, "depth", &depth))
+
+    str = gst_structure_get_string (s, "format");
+    if (str == NULL)
+      continue;
+
+    format = gst_audio_format_from_string (str);
+    if (format == GST_AUDIO_FORMAT_UNKNOWN)
       continue;
-    if (width == 0 || (width % 8) != 0)
-      continue;                 /* Only full byte widths are valid */
+
+    finfo = gst_audio_format_get_info (format);
+
+    width = GST_AUDIO_FORMAT_INFO_WIDTH (finfo);
+    depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo);
+
     for (w = 0; w < G_N_ELEMENTS (pcmformats); w++)
       if (pcmformats[w].width == width && pcmformats[w].depth == depth)
         break;
@@ -137,22 +149,17 @@ gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
 
     if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat) &&
         snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
-      /* template contains { true, false } or just one, leave it as it is */
       scopy = gst_structure_copy (s);
     } else if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat)) {
       scopy = gst_structure_copy (s);
-      gst_structure_set (scopy, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      /* FIXME, remove unsigned version */
     } else if (snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
       scopy = gst_structure_copy (s);
-      gst_structure_set (scopy, "signed", G_TYPE_BOOLEAN, FALSE, NULL);
+      /* FIXME, remove signed version */
     } else {
       scopy = NULL;
     }
     if (scopy) {
-      if (width > 8) {
-        /* TODO: proper endianness detection, for now it's CPU endianness only */
-        gst_structure_set (scopy, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
-      }
       gst_caps_append_structure (caps, scopy);
     }
   }
index 83596a3..97d5f5e 100644 (file)
 #include "gstalsadeviceprobe.h"
 #include "gst/interfaces/propertyprobe.h"
 
+G_LOCK_DEFINE_STATIC (probe_lock);
+
 static const GList *
 gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe)
 {
   GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
   static GList *list = NULL;
 
-  /* well, not perfect, but better than no locking at all.
-   * In the worst case we leak a list node, so who cares? */
-  GST_CLASS_LOCK (GST_OBJECT_CLASS (klass));
+  G_LOCK (probe_lock);
 
   if (!list) {
     GParamSpec *pspec;
@@ -43,7 +43,7 @@ gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe)
     list = g_list_append (NULL, pspec);
   }
 
-  GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass));
+  G_UNLOCK (probe_lock);
 
   return list;
 }
index ccc3784..3165ff5 100644 (file)
@@ -93,14 +93,6 @@ void         _gst_alsa_mixer_set_interface   (GstAlsaMixer * mixer,
 GstMixerFlags   gst_alsa_mixer_get_mixer_flags  (GstAlsaMixer *mixer);
 
 #define GST_IMPLEMENT_ALSA_MIXER_METHODS(Type, interface_as_function)           \
-static gboolean                                                                 \
-interface_as_function ## _supported (Type *this, GType iface_type)              \
-{                                                                               \
-  g_assert (iface_type == GST_TYPE_MIXER);                                      \
-                                                                                \
-  return (this->mixer != NULL);                                                 \
-}                                                                               \
-                                                                                \
 static const GList*                                                             \
 interface_as_function ## _list_tracks (GstMixer * mixer)                        \
 {                                                                               \
index ec80039..1993cc4 100644 (file)
@@ -36,9 +36,10 @@ enum
 };
 
 static void gst_alsa_mixer_element_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstAlsaMixerElement, gst_alsa_mixer_element,
-    GstElement, GST_TYPE_ELEMENT, gst_alsa_mixer_element_init_interfaces);
+#define gst_alsa_mixer_element_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAlsaMixerElement, gst_alsa_mixer_element,
+    GST_TYPE_ELEMENT,
+    gst_alsa_mixer_element_init_interfaces (g_define_type_id));
 
 /* massive macro that takes care of all the GstMixer stuff */
 GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaMixerElement, gst_alsa_mixer_element);
@@ -52,54 +53,21 @@ static void gst_alsa_mixer_element_finalize (GObject * object);
 static GstStateChangeReturn gst_alsa_mixer_element_change_state (GstElement
     * element, GstStateChange transition);
 
-static gboolean
-gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * this,
-    GType interface_type)
-{
-  if (interface_type == GST_TYPE_MIXER) {
-    return gst_alsa_mixer_element_supported (this, interface_type);
-  }
-
-  g_return_val_if_reached (FALSE);
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = (gpointer) gst_alsa_mixer_element_interface_supported;
-}
-
 static void
 gst_alsa_mixer_element_init_interfaces (GType type)
 {
-  static const GInterfaceInfo implements_iface_info = {
-    (GInterfaceInitFunc) gst_implements_interface_init,
-    NULL,
-    NULL,
-  };
   static const GInterfaceInfo mixer_iface_info = {
     (GInterfaceInitFunc) gst_alsa_mixer_element_interface_init,
     NULL,
     NULL,
   };
 
-  g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
-      &implements_iface_info);
   g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
 
   gst_alsa_type_add_device_property_probe_interface (type);
 }
 
 static void
-gst_alsa_mixer_element_base_init (gpointer klass)
-{
-  gst_element_class_set_details_simple (GST_ELEMENT_CLASS (klass),
-      "Alsa mixer", "Generic/Audio",
-      "Control sound input and output levels with ALSA",
-      "Leif Johnson <leif@ambient.2y.net>");
-}
-
-static void
 gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass)
 {
   GstElementClass *element_class;
@@ -122,6 +90,11 @@ gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass)
           "Human-readable name of the sound device",
           DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (element_class,
+      "Alsa mixer", "Generic/Audio",
+      "Control sound input and output levels with ALSA",
+      "Leif Johnson <leif@ambient.2y.net>");
+
   element_class->change_state =
       GST_DEBUG_FUNCPTR (gst_alsa_mixer_element_change_state);
 }
@@ -137,8 +110,7 @@ gst_alsa_mixer_element_finalize (GObject * obj)
 }
 
 static void
-gst_alsa_mixer_element_init (GstAlsaMixerElement * this,
-    GstAlsaMixerElementClass * klass)
+gst_alsa_mixer_element_init (GstAlsaMixerElement * this)
 {
   this->mixer = NULL;
   this->device = g_strdup (DEFAULT_PROP_DEVICE);
index a1fdb7f..dea8ef0 100644 (file)
@@ -170,7 +170,8 @@ gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
   GST_LOG ("[%s] created new mixer track %p", name, track);
 
   /* This reflects the assumptions used for GstAlsaMixerTrack */
-  if (!(!!(flags & GST_MIXER_TRACK_OUTPUT) ^ !!(flags & GST_MIXER_TRACK_INPUT))) {
+  if (!(! !(flags & GST_MIXER_TRACK_OUTPUT) ^ ! !(flags &
+              GST_MIXER_TRACK_INPUT))) {
     GST_ERROR ("Mixer track must be either output or input!");
     g_return_val_if_reached (NULL);
   }
@@ -302,7 +303,7 @@ gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track)
     }
   }
 
-  if (!!(audible) != !(track->flags & GST_MIXER_TRACK_MUTE)) {
+  if (! !(audible) != !(track->flags & GST_MIXER_TRACK_MUTE)) {
     if (audible) {
       track->flags &= ~GST_MIXER_TRACK_MUTE;
 
index 2fb37df..298e5a8 100644 (file)
@@ -69,9 +69,9 @@ enum
 };
 
 static void gst_alsasink_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstAlsaSink, gst_alsasink, GstAudioSink,
-    GST_TYPE_AUDIO_SINK, gst_alsasink_init_interfaces);
+#define gst_alsasink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAlsaSink, gst_alsasink,
+    GST_TYPE_AUDIO_SINK, gst_alsasink_init_interfaces (g_define_type_id));
 
 static void gst_alsasink_finalise (GObject * object);
 static void gst_alsasink_set_property (GObject * object,
@@ -79,14 +79,14 @@ static void gst_alsasink_set_property (GObject * object,
 static void gst_alsasink_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
-static GstCaps *gst_alsasink_getcaps (GstBaseSink * bsink);
+static GstCaps *gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter);
 
 static gboolean gst_alsasink_open (GstAudioSink * asink);
 static gboolean gst_alsasink_prepare (GstAudioSink * asink,
     GstRingBufferSpec * spec);
 static gboolean gst_alsasink_unprepare (GstAudioSink * asink);
 static gboolean gst_alsasink_close (GstAudioSink * asink);
-static guint gst_alsasink_write (GstAudioSink * asink, gpointer data,
+static gint gst_alsasink_write (GstAudioSink * asink, gpointer data,
     guint length);
 static guint gst_alsasink_delay (GstAudioSink * asink);
 static void gst_alsasink_reset (GstAudioSink * asink);
@@ -95,46 +95,13 @@ static gint output_ref;         /* 0    */
 static snd_output_t *output;    /* NULL */
 static GStaticMutex output_mutex = G_STATIC_MUTEX_INIT;
 
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-# define ALSA_SINK_FACTORY_ENDIANNESS  "LITTLE_ENDIAN, BIG_ENDIAN"
-#else
-# define ALSA_SINK_FACTORY_ENDIANNESS  "BIG_ENDIAN, LITTLE_ENDIAN"
-#endif
-
 static GstStaticPadTemplate alsasink_sink_factory =
     GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 32, "
-        "depth = (int) 32, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 24, "
-        "depth = (int) 24, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 32, "
-        "depth = (int) 24, "
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "formats = (string) " GST_AUDIO_FORMATS_ALL ", "
         "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 8, "
-        "depth = (int) 8, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ];"
         "audio/x-iec958")
     );
 
@@ -164,26 +131,15 @@ gst_alsasink_init_interfaces (GType type)
 }
 
 static void
-gst_alsasink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Audio sink (ALSA)", "Sink/Audio",
-      "Output to a sound card via ALSA", "Wim Taymans <wim@fluendo.com>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&alsasink_sink_factory));
-}
-
-static void
 gst_alsasink_class_init (GstAlsaSinkClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   GstBaseSinkClass *gstbasesink_class;
   GstAudioSinkClass *gstaudiosink_class;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
   gstbasesink_class = (GstBaseSinkClass *) klass;
   gstaudiosink_class = (GstAudioSinkClass *) klass;
 
@@ -193,6 +149,13 @@ gst_alsasink_class_init (GstAlsaSinkClass * klass)
   gobject_class->get_property = gst_alsasink_get_property;
   gobject_class->set_property = gst_alsasink_set_property;
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "Audio sink (ALSA)", "Sink/Audio",
+      "Output to a sound card via ALSA", "Wim Taymans <wim@fluendo.com>");
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&alsasink_sink_factory));
+
   gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_alsasink_getcaps);
 
   gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_alsasink_open);
@@ -271,7 +234,7 @@ gst_alsasink_get_property (GObject * object, guint prop_id,
 }
 
 static void
-gst_alsasink_init (GstAlsaSink * alsasink, GstAlsaSinkClass * g_class)
+gst_alsasink_init (GstAlsaSink * alsasink)
 {
   GST_DEBUG_OBJECT (alsasink, "initializing alsasink");
 
@@ -295,12 +258,12 @@ if ((err = call) < 0)           \
 } G_STMT_END;
 
 static GstCaps *
-gst_alsasink_getcaps (GstBaseSink * bsink)
+gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter)
 {
   GstElementClass *element_class;
   GstPadTemplate *pad_template;
   GstAlsaSink *sink = GST_ALSA_SINK (bsink);
-  GstCaps *caps;
+  GstCaps *caps, *templ_caps;
 
   if (sink->handle == NULL) {
     GST_DEBUG_OBJECT (sink, "device not open, using template caps");
@@ -309,15 +272,21 @@ gst_alsasink_getcaps (GstBaseSink * bsink)
 
   if (sink->cached_caps) {
     GST_LOG_OBJECT (sink, "Returning cached caps");
-    return gst_caps_ref (sink->cached_caps);
+    if (filter)
+      return gst_caps_intersect_full (filter, sink->cached_caps,
+          GST_CAPS_INTERSECT_FIRST);
+    else
+      return gst_caps_ref (sink->cached_caps);
   }
 
   element_class = GST_ELEMENT_GET_CLASS (sink);
   pad_template = gst_element_class_get_pad_template (element_class, "sink");
   g_return_val_if_fail (pad_template != NULL, NULL);
 
+  templ_caps = gst_pad_template_get_caps (pad_template);
   caps = gst_alsa_probe_supported_formats (GST_OBJECT (sink), sink->handle,
-      gst_pad_template_get_caps (pad_template));
+      templ_caps);
+  gst_caps_unref (templ_caps);
 
   if (caps) {
     sink->cached_caps = gst_caps_ref (caps);
@@ -325,7 +294,16 @@ gst_alsasink_getcaps (GstBaseSink * bsink)
 
   GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, caps);
 
-  return caps;
+  if (filter) {
+    GstCaps *intersection;
+
+    intersection =
+        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    return intersection;
+  } else {
+    return caps;
+  }
 }
 
 static int
@@ -616,26 +594,96 @@ alsasink_parse_spec (GstAlsaSink * alsa, GstRingBufferSpec * spec)
   alsa->iec958 = FALSE;
 
   switch (spec->type) {
-    case GST_BUFTYPE_LINEAR:
-      GST_DEBUG_OBJECT (alsa,
-          "Linear format : depth=%d, width=%d, sign=%d, bigend=%d", spec->depth,
-          spec->width, spec->sign, spec->bigend);
-
-      alsa->format = snd_pcm_build_linear_format (spec->depth, spec->width,
-          spec->sign ? 0 : 1, spec->bigend ? 1 : 0);
-      break;
-    case GST_BUFTYPE_FLOAT:
-      switch (spec->format) {
-        case GST_FLOAT32_LE:
+    case GST_BUFTYPE_RAW:
+      switch (GST_AUDIO_INFO_FORMAT (&spec->info)) {
+        case GST_AUDIO_FORMAT_U8:
+          alsa->format = SND_PCM_FORMAT_U8;
+          break;
+        case GST_AUDIO_FORMAT_S8:
+          alsa->format = SND_PCM_FORMAT_S8;
+          break;
+        case GST_AUDIO_FORMAT_S16_LE:
+          alsa->format = SND_PCM_FORMAT_S16_LE;
+          break;
+        case GST_AUDIO_FORMAT_S16_BE:
+          alsa->format = SND_PCM_FORMAT_S16_BE;
+          break;
+        case GST_AUDIO_FORMAT_U16_LE:
+          alsa->format = SND_PCM_FORMAT_U16_LE;
+          break;
+        case GST_AUDIO_FORMAT_U16_BE:
+          alsa->format = SND_PCM_FORMAT_U16_BE;
+          break;
+        case GST_AUDIO_FORMAT_S24_LE:
+          alsa->format = SND_PCM_FORMAT_S24_LE;
+          break;
+        case GST_AUDIO_FORMAT_S24_BE:
+          alsa->format = SND_PCM_FORMAT_S24_BE;
+          break;
+        case GST_AUDIO_FORMAT_U24_LE:
+          alsa->format = SND_PCM_FORMAT_U24_LE;
+          break;
+        case GST_AUDIO_FORMAT_U24_BE:
+          alsa->format = SND_PCM_FORMAT_U24_BE;
+          break;
+        case GST_AUDIO_FORMAT_S32_LE:
+          alsa->format = SND_PCM_FORMAT_S32_LE;
+          break;
+        case GST_AUDIO_FORMAT_S32_BE:
+          alsa->format = SND_PCM_FORMAT_S32_BE;
+          break;
+        case GST_AUDIO_FORMAT_U32_LE:
+          alsa->format = SND_PCM_FORMAT_U32_LE;
+          break;
+        case GST_AUDIO_FORMAT_U32_BE:
+          alsa->format = SND_PCM_FORMAT_U32_BE;
+          break;
+        case GST_AUDIO_FORMAT_S24_3LE:
+          alsa->format = SND_PCM_FORMAT_S24_3LE;
+          break;
+        case GST_AUDIO_FORMAT_S24_3BE:
+          alsa->format = SND_PCM_FORMAT_S24_3BE;
+          break;
+        case GST_AUDIO_FORMAT_U24_3LE:
+          alsa->format = SND_PCM_FORMAT_U24_3LE;
+          break;
+        case GST_AUDIO_FORMAT_U24_3BE:
+          alsa->format = SND_PCM_FORMAT_U24_3BE;
+          break;
+        case GST_AUDIO_FORMAT_S20_3LE:
+          alsa->format = SND_PCM_FORMAT_S20_3LE;
+          break;
+        case GST_AUDIO_FORMAT_S20_3BE:
+          alsa->format = SND_PCM_FORMAT_S20_3BE;
+          break;
+        case GST_AUDIO_FORMAT_U20_3LE:
+          alsa->format = SND_PCM_FORMAT_U20_3LE;
+          break;
+        case GST_AUDIO_FORMAT_U20_3BE:
+          alsa->format = SND_PCM_FORMAT_U20_3BE;
+          break;
+        case GST_AUDIO_FORMAT_S18_3LE:
+          alsa->format = SND_PCM_FORMAT_S18_3LE;
+          break;
+        case GST_AUDIO_FORMAT_S18_3BE:
+          alsa->format = SND_PCM_FORMAT_S18_3BE;
+          break;
+        case GST_AUDIO_FORMAT_U18_3LE:
+          alsa->format = SND_PCM_FORMAT_U18_3LE;
+          break;
+        case GST_AUDIO_FORMAT_U18_3BE:
+          alsa->format = SND_PCM_FORMAT_U18_3BE;
+          break;
+        case GST_AUDIO_FORMAT_F32_LE:
           alsa->format = SND_PCM_FORMAT_FLOAT_LE;
           break;
-        case GST_FLOAT32_BE:
+        case GST_AUDIO_FORMAT_F32_BE:
           alsa->format = SND_PCM_FORMAT_FLOAT_BE;
           break;
-        case GST_FLOAT64_LE:
+        case GST_AUDIO_FORMAT_F64_LE:
           alsa->format = SND_PCM_FORMAT_FLOAT64_LE;
           break;
-        case GST_FLOAT64_BE:
+        case GST_AUDIO_FORMAT_F64_BE:
           alsa->format = SND_PCM_FORMAT_FLOAT64_BE;
           break;
         default:
@@ -656,8 +704,8 @@ alsasink_parse_spec (GstAlsaSink * alsa, GstRingBufferSpec * spec)
       goto error;
 
   }
-  alsa->rate = spec->rate;
-  alsa->channels = spec->channels;
+  alsa->rate = GST_AUDIO_INFO_RATE (&spec->info);
+  alsa->channels = GST_AUDIO_INFO_CHANNELS (&spec->info);
   alsa->buffer_time = spec->buffer_time;
   alsa->period_time = spec->latency_time;
   alsa->access = SND_PCM_ACCESS_RW_INTERLEAVED;
@@ -713,7 +761,7 @@ gst_alsasink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
 
   alsa = GST_ALSA_SINK (asink);
 
-  if (spec->format == GST_IEC958) {
+  if (spec->type == GST_BUFTYPE_IEC958) {
     snd_pcm_close (alsa->handle);
     alsa->handle = gst_alsa_open_iec958_pcm (GST_OBJECT (alsa));
     if (G_UNLIKELY (!alsa->handle)) {
@@ -727,8 +775,8 @@ gst_alsasink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
   CHECK (set_hwparams (alsa), hw_params_failed);
   CHECK (set_swparams (alsa), sw_params_failed);
 
-  alsa->bytes_per_sample = spec->bytes_per_sample;
-  spec->segsize = alsa->period_size * spec->bytes_per_sample;
+  alsa->bpf = GST_AUDIO_INFO_BPF (&spec->info);
+  spec->segsize = alsa->period_size * alsa->bpf;
   spec->segtotal = alsa->buffer_size / alsa->period_size;
 
   {
@@ -835,7 +883,7 @@ xrun_recovery (GstAlsaSink * alsa, snd_pcm_t * handle, gint err)
   return err;
 }
 
-static guint
+static gint
 gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
 {
   GstAlsaSink *alsa;
@@ -856,7 +904,7 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
 
   GST_LOG_OBJECT (asink, "received audio samples buffer of %u bytes", length);
 
-  cptr = length / alsa->bytes_per_sample;
+  cptr = length / alsa->bpf;
 
   GST_ALSA_SINK_LOCK (asink);
   while (cptr > 0) {
@@ -885,7 +933,7 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
   }
   GST_ALSA_SINK_UNLOCK (asink);
 
-  return length - (cptr * alsa->bytes_per_sample);
+  return length - (cptr * alsa->bpf);
 
 write_error:
   {
index 902dbf7..a4bcdbe 100644 (file)
@@ -61,7 +61,7 @@ struct _GstAlsaSink {
   snd_pcm_format_t format;
   guint rate;
   guint channels;
-  gint bytes_per_sample;
+  gint bpf;
   gboolean iec958;
   gboolean need_swap;
 
index cce52ea..425dc7f 100644 (file)
@@ -65,9 +65,9 @@ enum
 };
 
 static void gst_alsasrc_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstAlsaSrc, gst_alsasrc, GstAudioSrc,
-    GST_TYPE_AUDIO_SRC, gst_alsasrc_init_interfaces);
+#define gst_alsasrc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAlsaSrc, gst_alsasrc,
+    GST_TYPE_AUDIO_SRC, gst_alsasrc_init_interfaces (g_define_type_id));
 
 GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaSrc, gst_alsasrc_mixer);
 
@@ -77,7 +77,7 @@ static void gst_alsasrc_set_property (GObject * object,
 static void gst_alsasrc_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
-static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc);
+static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter);
 
 static gboolean gst_alsasrc_open (GstAudioSrc * asrc);
 static gboolean gst_alsasrc_prepare (GstAudioSrc * asrc,
@@ -107,37 +107,11 @@ enum
 #endif
 
 static GstStaticPadTemplate alsasrc_src_factory =
-    GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 32, "
-        "depth = (int) 32, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 32, "
-        "depth = (int) 24, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 24, "
-        "depth = (int) 24, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
-        "audio/x-raw-int, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 8, "
-        "depth = (int) 8, "
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " GST_AUDIO_FORMATS_ALL ", "
         "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
     );
 
@@ -152,56 +126,21 @@ gst_alsasrc_finalize (GObject * object)
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-static gboolean
-gst_alsasrc_interface_supported (GstAlsaSrc * this, GType interface_type)
-{
-  /* only support this one interface (wrapped by GstImplementsInterface) */
-  g_assert (interface_type == GST_TYPE_MIXER);
-
-  return gst_alsasrc_mixer_supported (this, interface_type);
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = (gpointer) gst_alsasrc_interface_supported;
-}
-
 static void
 gst_alsasrc_init_interfaces (GType type)
 {
-  static const GInterfaceInfo implements_iface_info = {
-    (GInterfaceInitFunc) gst_implements_interface_init,
-    NULL,
-    NULL,
-  };
   static const GInterfaceInfo mixer_iface_info = {
     (GInterfaceInitFunc) gst_alsasrc_mixer_interface_init,
     NULL,
     NULL,
   };
 
-  g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
-      &implements_iface_info);
   g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
 
   gst_alsa_type_add_device_property_probe_interface (type);
 }
 
 static void
-gst_alsasrc_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Audio source (ALSA)", "Source/Audio",
-      "Read from a sound card via ALSA", "Wim Taymans <wim@fluendo.com>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&alsasrc_src_factory));
-}
-
-static void
 gst_alsasrc_class_init (GstAlsaSrcClass * klass)
 {
   GObjectClass *gobject_class;
@@ -218,6 +157,13 @@ gst_alsasrc_class_init (GstAlsaSrcClass * klass)
   gobject_class->get_property = gst_alsasrc_get_property;
   gobject_class->set_property = gst_alsasrc_set_property;
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "Audio source (ALSA)", "Source/Audio",
+      "Read from a sound card via ALSA", "Wim Taymans <wim@fluendo.com>");
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&alsasrc_src_factory));
+
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_alsasrc_change_state);
 
   gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_alsasrc_getcaps);
@@ -392,7 +338,7 @@ gst_alsasrc_create (GstBaseSrc * bsrc, guint64 offset, guint length,
 }
 
 static void
-gst_alsasrc_init (GstAlsaSrc * alsasrc, GstAlsaSrcClass * g_class)
+gst_alsasrc_init (GstAlsaSrc * alsasrc)
 {
   GST_DEBUG_OBJECT (alsasrc, "initializing");
 
@@ -411,12 +357,12 @@ if ((err = call) < 0)           \
 
 
 static GstCaps *
-gst_alsasrc_getcaps (GstBaseSrc * bsrc)
+gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
 {
   GstElementClass *element_class;
   GstPadTemplate *pad_template;
   GstAlsaSrc *src;
-  GstCaps *caps;
+  GstCaps *caps, *templ_caps;
 
   src = GST_ALSA_SRC (bsrc);
 
@@ -427,15 +373,21 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc)
 
   if (src->cached_caps) {
     GST_LOG_OBJECT (src, "Returning cached caps");
-    return gst_caps_ref (src->cached_caps);
+    if (filter)
+      return gst_caps_intersect_full (filter, src->cached_caps,
+          GST_CAPS_INTERSECT_FIRST);
+    else
+      return gst_caps_ref (src->cached_caps);
   }
 
   element_class = GST_ELEMENT_GET_CLASS (src);
   pad_template = gst_element_class_get_pad_template (element_class, "src");
   g_return_val_if_fail (pad_template != NULL, NULL);
 
+  templ_caps = gst_pad_template_get_caps (pad_template);
   caps = gst_alsa_probe_supported_formats (GST_OBJECT (src), src->handle,
-      gst_pad_template_get_caps (pad_template));
+      templ_caps);
+  gst_caps_unref (templ_caps);
 
   if (caps) {
     src->cached_caps = gst_caps_ref (caps);
@@ -443,7 +395,16 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc)
 
   GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps);
 
-  return caps;
+  if (filter) {
+    GstCaps *intersection;
+
+    intersection =
+        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    return intersection;
+  } else {
+    return caps;
+  }
 }
 
 static int
@@ -668,22 +629,96 @@ static gboolean
 alsasrc_parse_spec (GstAlsaSrc * alsa, GstRingBufferSpec * spec)
 {
   switch (spec->type) {
-    case GST_BUFTYPE_LINEAR:
-      alsa->format = snd_pcm_build_linear_format (spec->depth, spec->width,
-          spec->sign ? 0 : 1, spec->bigend ? 1 : 0);
-      break;
-    case GST_BUFTYPE_FLOAT:
-      switch (spec->format) {
-        case GST_FLOAT32_LE:
+    case GST_BUFTYPE_RAW:
+      switch (GST_AUDIO_INFO_FORMAT (&spec->info)) {
+        case GST_AUDIO_FORMAT_U8:
+          alsa->format = SND_PCM_FORMAT_U8;
+          break;
+        case GST_AUDIO_FORMAT_S8:
+          alsa->format = SND_PCM_FORMAT_S8;
+          break;
+        case GST_AUDIO_FORMAT_S16_LE:
+          alsa->format = SND_PCM_FORMAT_S16_LE;
+          break;
+        case GST_AUDIO_FORMAT_S16_BE:
+          alsa->format = SND_PCM_FORMAT_S16_BE;
+          break;
+        case GST_AUDIO_FORMAT_U16_LE:
+          alsa->format = SND_PCM_FORMAT_U16_LE;
+          break;
+        case GST_AUDIO_FORMAT_U16_BE:
+          alsa->format = SND_PCM_FORMAT_U16_BE;
+          break;
+        case GST_AUDIO_FORMAT_S24_LE:
+          alsa->format = SND_PCM_FORMAT_S24_LE;
+          break;
+        case GST_AUDIO_FORMAT_S24_BE:
+          alsa->format = SND_PCM_FORMAT_S24_BE;
+          break;
+        case GST_AUDIO_FORMAT_U24_LE:
+          alsa->format = SND_PCM_FORMAT_U24_LE;
+          break;
+        case GST_AUDIO_FORMAT_U24_BE:
+          alsa->format = SND_PCM_FORMAT_U24_BE;
+          break;
+        case GST_AUDIO_FORMAT_S32_LE:
+          alsa->format = SND_PCM_FORMAT_S32_LE;
+          break;
+        case GST_AUDIO_FORMAT_S32_BE:
+          alsa->format = SND_PCM_FORMAT_S32_BE;
+          break;
+        case GST_AUDIO_FORMAT_U32_LE:
+          alsa->format = SND_PCM_FORMAT_U32_LE;
+          break;
+        case GST_AUDIO_FORMAT_U32_BE:
+          alsa->format = SND_PCM_FORMAT_U32_BE;
+          break;
+        case GST_AUDIO_FORMAT_S24_3LE:
+          alsa->format = SND_PCM_FORMAT_S24_3LE;
+          break;
+        case GST_AUDIO_FORMAT_S24_3BE:
+          alsa->format = SND_PCM_FORMAT_S24_3BE;
+          break;
+        case GST_AUDIO_FORMAT_U24_3LE:
+          alsa->format = SND_PCM_FORMAT_U24_3LE;
+          break;
+        case GST_AUDIO_FORMAT_U24_3BE:
+          alsa->format = SND_PCM_FORMAT_U24_3BE;
+          break;
+        case GST_AUDIO_FORMAT_S20_3LE:
+          alsa->format = SND_PCM_FORMAT_S20_3LE;
+          break;
+        case GST_AUDIO_FORMAT_S20_3BE:
+          alsa->format = SND_PCM_FORMAT_S20_3BE;
+          break;
+        case GST_AUDIO_FORMAT_U20_3LE:
+          alsa->format = SND_PCM_FORMAT_U20_3LE;
+          break;
+        case GST_AUDIO_FORMAT_U20_3BE:
+          alsa->format = SND_PCM_FORMAT_U20_3BE;
+          break;
+        case GST_AUDIO_FORMAT_S18_3LE:
+          alsa->format = SND_PCM_FORMAT_S18_3LE;
+          break;
+        case GST_AUDIO_FORMAT_S18_3BE:
+          alsa->format = SND_PCM_FORMAT_S18_3BE;
+          break;
+        case GST_AUDIO_FORMAT_U18_3LE:
+          alsa->format = SND_PCM_FORMAT_U18_3LE;
+          break;
+        case GST_AUDIO_FORMAT_U18_3BE:
+          alsa->format = SND_PCM_FORMAT_U18_3BE;
+          break;
+        case GST_AUDIO_FORMAT_F32_LE:
           alsa->format = SND_PCM_FORMAT_FLOAT_LE;
           break;
-        case GST_FLOAT32_BE:
+        case GST_AUDIO_FORMAT_F32_BE:
           alsa->format = SND_PCM_FORMAT_FLOAT_BE;
           break;
-        case GST_FLOAT64_LE:
+        case GST_AUDIO_FORMAT_F64_LE:
           alsa->format = SND_PCM_FORMAT_FLOAT64_LE;
           break;
-        case GST_FLOAT64_BE:
+        case GST_AUDIO_FORMAT_F64_BE:
           alsa->format = SND_PCM_FORMAT_FLOAT64_BE;
           break;
         default:
@@ -700,8 +735,8 @@ alsasrc_parse_spec (GstAlsaSrc * alsa, GstRingBufferSpec * spec)
       goto error;
 
   }
-  alsa->rate = spec->rate;
-  alsa->channels = spec->channels;
+  alsa->rate = GST_AUDIO_INFO_RATE (&spec->info);
+  alsa->channels = GST_AUDIO_INFO_CHANNELS (&spec->info);
   alsa->buffer_time = spec->buffer_time;
   alsa->period_time = spec->latency_time;
   alsa->access = SND_PCM_ACCESS_RW_INTERLEAVED;
@@ -766,13 +801,9 @@ gst_alsasrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
   CHECK (set_swparams (alsa), sw_params_failed);
   CHECK (snd_pcm_prepare (alsa->handle), prepare_failed);
 
-  alsa->bytes_per_sample = spec->bytes_per_sample;
-  spec->segsize = alsa->period_size * spec->bytes_per_sample;
+  alsa->bpf = GST_AUDIO_INFO_BPF (&spec->info);
+  spec->segsize = alsa->period_size * alsa->bpf;
   spec->segtotal = alsa->buffer_size / alsa->period_size;
-  spec->silence_sample[0] = 0;
-  spec->silence_sample[1] = 0;
-  spec->silence_sample[2] = 0;
-  spec->silence_sample[3] = 0;
 
   return TRUE;
 
@@ -882,7 +913,7 @@ gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length)
 
   alsa = GST_ALSA_SRC (asrc);
 
-  cptr = length / alsa->bytes_per_sample;
+  cptr = length / alsa->bpf;
   ptr = data;
 
   GST_ALSA_SRC_LOCK (asrc);
@@ -902,7 +933,7 @@ gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length)
   }
   GST_ALSA_SRC_UNLOCK (asrc);
 
-  return length - (cptr * alsa->bytes_per_sample);
+  return length - (cptr * alsa->bpf);
 
 read_error:
   {
index 7072ab7..de33833 100644 (file)
@@ -63,7 +63,7 @@ struct _GstAlsaSrc {
   snd_pcm_format_t      format;
   guint                 rate;
   guint                 channels;
-  gint                  bytes_per_sample;
+  gint                  bpf;
   gboolean              driver_timestamps;
 
   guint                 buffer_time;
index 864ebc7..200f589 100644 (file)
@@ -56,8 +56,8 @@ enum
 GST_DEBUG_CATEGORY_STATIC (gst_cd_paranoia_src_debug);
 #define GST_CAT_DEFAULT gst_cd_paranoia_src_debug
 
-GST_BOILERPLATE (GstCdParanoiaSrc, gst_cd_paranoia_src, GstCddaBaseSrc,
-    GST_TYPE_CDDA_BASE_SRC);
+#define gst_cd_paranoia_src_parent_class parent_class
+G_DEFINE_TYPE (GstCdParanoiaSrc, gst_cd_paranoia_src, GST_TYPE_CDDA_BASE_SRC);
 
 static void gst_cd_paranoia_src_finalize (GObject * obj);
 static void gst_cd_paranoia_src_get_property (GObject * object, guint prop_id,
@@ -103,18 +103,7 @@ gst_cd_paranoia_mode_get_type (void)
 }
 
 static void
-gst_cd_paranoia_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "CD Audio (cdda) Source, Paranoia IV", "Source/File",
-      "Read audio from CD in paranoid mode",
-      "Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim@fluendo.com>");
-}
-
-static void
-gst_cd_paranoia_src_init (GstCdParanoiaSrc * src, GstCdParanoiaSrcClass * klass)
+gst_cd_paranoia_src_init (GstCdParanoiaSrc * src)
 {
   src->d = NULL;
   src->p = NULL;
@@ -131,12 +120,18 @@ static void
 gst_cd_paranoia_src_class_init (GstCdParanoiaSrcClass * klass)
 {
   GstCddaBaseSrcClass *cddabasesrc_class = GST_CDDA_BASE_SRC_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
   gobject_class->set_property = gst_cd_paranoia_src_set_property;
   gobject_class->get_property = gst_cd_paranoia_src_get_property;
   gobject_class->finalize = gst_cd_paranoia_src_finalize;
 
+  gst_element_class_set_details_simple (element_class,
+      "CD Audio (cdda) Source, Paranoia IV", "Source/File",
+      "Read audio from CD in paranoid mode",
+      "Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim@fluendo.com>");
+
   cddabasesrc_class->open = gst_cd_paranoia_src_open;
   cddabasesrc_class->close = gst_cd_paranoia_src_close;
   cddabasesrc_class->read_sector = gst_cd_paranoia_src_read_sector;
@@ -400,7 +395,7 @@ gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector)
     goto read_failed;
 
   buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW);
-  memcpy (GST_BUFFER_DATA (buf), cdda_buf, CD_FRAMESIZE_RAW);
+  gst_buffer_fill (buf, 0, cdda_buf, CD_FRAMESIZE_RAW);
 
   /* cdda base class will take care of timestamping etc. */
   ++src->next_sector;
index 3bf9c69..35c8b85 100644 (file)
@@ -139,19 +139,19 @@ gst_gio_get_supported_protocols (void)
 }
 
 static GstURIType
-gst_gio_uri_handler_get_type_sink (void)
+gst_gio_uri_handler_get_type_sink (GType type)
 {
   return GST_URI_SINK;
 }
 
 static GstURIType
-gst_gio_uri_handler_get_type_src (void)
+gst_gio_uri_handler_get_type_src (GType type)
 {
   return GST_URI_SRC;
 }
 
 static gchar **
-gst_gio_uri_handler_get_protocols (void)
+gst_gio_uri_handler_get_protocols (GType type)
 {
   static gchar **protocols = NULL;
 
index 40a64eb..110f84a 100644 (file)
@@ -33,8 +33,8 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS_ANY);
 
-GST_BOILERPLATE (GstGioBaseSink, gst_gio_base_sink, GstBaseSink,
-    GST_TYPE_BASE_SINK);
+#define gst_gio_base_sink_parent_class parent_class
+G_DEFINE_TYPE (GstGioBaseSink, gst_gio_base_sink, GST_TYPE_BASE_SINK);
 
 static void gst_gio_base_sink_finalize (GObject * object);
 static gboolean gst_gio_base_sink_start (GstBaseSink * base_sink);
@@ -45,43 +45,36 @@ static gboolean gst_gio_base_sink_event (GstBaseSink * base_sink,
     GstEvent * event);
 static GstFlowReturn gst_gio_base_sink_render (GstBaseSink * base_sink,
     GstBuffer * buffer);
-static gboolean gst_gio_base_sink_query (GstPad * pad, GstQuery * query);
-
-static void
-gst_gio_base_sink_base_init (gpointer gclass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gio_base_sink_debug, "gio_base_sink", 0,
-      "GIO base sink");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
-}
+static gboolean gst_gio_base_sink_query (GstBaseSink * bsink, GstQuery * query);
 
 static void
 gst_gio_base_sink_class_init (GstGioBaseSinkClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
   GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (gst_gio_base_sink_debug, "gio_base_sink", 0,
+      "GIO base sink");
+
   gobject_class->finalize = gst_gio_base_sink_finalize;
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sink_factory));
+
   gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_gio_base_sink_start);
   gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_gio_base_sink_stop);
   gstbasesink_class->unlock = GST_DEBUG_FUNCPTR (gst_gio_base_sink_unlock);
   gstbasesink_class->unlock_stop =
       GST_DEBUG_FUNCPTR (gst_gio_base_sink_unlock_stop);
+  gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_gio_base_sink_query);
   gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_gio_base_sink_event);
   gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_gio_base_sink_render);
 }
 
 static void
-gst_gio_base_sink_init (GstGioBaseSink * sink, GstGioBaseSinkClass * gclass)
+gst_gio_base_sink_init (GstGioBaseSink * sink)
 {
-  gst_pad_set_query_function (GST_BASE_SINK_PAD (sink),
-      GST_DEBUG_FUNCPTR (gst_gio_base_sink_query));
-
   gst_base_sink_set_sync (GST_BASE_SINK (sink), FALSE);
 
   sink->cancel = g_cancellable_new ();
@@ -213,25 +206,23 @@ gst_gio_base_sink_event (GstBaseSink * base_sink, GstEvent * event)
     return TRUE;
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
       if (G_IS_OUTPUT_STREAM (sink->stream)) {
-        GstFormat format;
-        gint64 offset;
+        const GstSegment *segment;
 
-        gst_event_parse_new_segment (event, NULL, NULL, &format, &offset, NULL,
-            NULL);
+        gst_event_parse_segment (event, &segment);
 
-        if (format != GST_FORMAT_BYTES) {
-          GST_WARNING_OBJECT (sink, "ignored NEWSEGMENT event in %s format",
-              gst_format_get_name (format));
+        if (segment->format != GST_FORMAT_BYTES) {
+          GST_WARNING_OBJECT (sink, "ignored SEGMENT event in %s format",
+              gst_format_get_name (segment->format));
           break;
         }
 
         if (GST_GIO_STREAM_IS_SEEKABLE (sink->stream)) {
-          ret = gst_gio_seek (sink, G_SEEKABLE (sink->stream), offset,
+          ret = gst_gio_seek (sink, G_SEEKABLE (sink->stream), segment->start,
               sink->cancel);
           if (ret == GST_FLOW_OK)
-            sink->position = offset;
+            sink->position = segment->start;
         } else {
           ret = GST_FLOW_NOT_SUPPORTED;
         }
@@ -267,26 +258,32 @@ gst_gio_base_sink_render (GstBaseSink * base_sink, GstBuffer * buffer)
 {
   GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
   gssize written;
+  guint8 *data;
+  gsize size;
   gboolean success;
   GError *err = NULL;
 
   g_return_val_if_fail (G_IS_OUTPUT_STREAM (sink->stream), GST_FLOW_ERROR);
 
-  GST_LOG_OBJECT (sink, "writing %u bytes to offset %" G_GUINT64_FORMAT,
-      GST_BUFFER_SIZE (buffer), sink->position);
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+
+  GST_LOG_OBJECT (sink,
+      "writing %" G_GSIZE_FORMAT " bytes to offset %" G_GUINT64_FORMAT, size,
+      sink->position);
 
-  written = g_output_stream_write (sink->stream,
-      GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), sink->cancel, &err);
+  written =
+      g_output_stream_write (sink->stream, data, size, sink->cancel, &err);
+  gst_buffer_unmap (buffer, data, size);
 
   success = (written >= 0);
 
-  if (G_UNLIKELY (success && written < GST_BUFFER_SIZE (buffer))) {
+  if (G_UNLIKELY (success && written < size)) {
     /* FIXME: Can this happen?  Should we handle it gracefully?  gnomevfssink
      * doesn't... */
     GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL),
         ("Could not write to stream: (short write, only %"
-            G_GSSIZE_FORMAT " bytes of %d bytes written)",
-            written, GST_BUFFER_SIZE (buffer)));
+            G_GSSIZE_FORMAT " bytes of %" G_GSIZE_FORMAT " bytes written)",
+            written, size));
     return GST_FLOW_ERROR;
   }
 
@@ -313,9 +310,9 @@ gst_gio_base_sink_render (GstBaseSink * base_sink, GstBuffer * buffer)
 }
 
 static gboolean
-gst_gio_base_sink_query (GstPad * pad, GstQuery * query)
+gst_gio_base_sink_query (GstBaseSink * bsink, GstQuery * query)
 {
-  GstGioBaseSink *sink = GST_GIO_BASE_SINK (GST_PAD_PARENT (pad));
+  GstGioBaseSink *sink = GST_GIO_BASE_SINK (bsink);
   GstFormat format;
 
   switch (GST_QUERY_TYPE (query)) {
@@ -342,6 +339,6 @@ gst_gio_base_sink_query (GstPad * pad, GstQuery * query)
       }
       return FALSE;
     default:
-      return gst_pad_query_default (pad, query);
+      return GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
   }
 }
index 133e12c..7987d99 100644 (file)
@@ -35,8 +35,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS_ANY);
 
-GST_BOILERPLATE (GstGioBaseSrc, gst_gio_base_src, GstBaseSrc,
-    GST_TYPE_BASE_SRC);
+#define gst_gio_base_src_parent_class parent_class
+G_DEFINE_TYPE (GstGioBaseSrc, gst_gio_base_src, GST_TYPE_BASE_SRC);
 
 static void gst_gio_base_src_finalize (GObject * object);
 
@@ -47,32 +47,26 @@ static gboolean gst_gio_base_src_get_size (GstBaseSrc * base_src,
 static gboolean gst_gio_base_src_is_seekable (GstBaseSrc * base_src);
 static gboolean gst_gio_base_src_unlock (GstBaseSrc * base_src);
 static gboolean gst_gio_base_src_unlock_stop (GstBaseSrc * base_src);
-static gboolean gst_gio_base_src_check_get_range (GstBaseSrc * base_src);
 static GstFlowReturn gst_gio_base_src_create (GstBaseSrc * base_src,
     guint64 offset, guint size, GstBuffer ** buf);
 static gboolean gst_gio_base_src_query (GstBaseSrc * base_src,
     GstQuery * query);
 
 static void
-gst_gio_base_src_base_init (gpointer gclass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gio_base_src_debug, "gio_base_src", 0,
-      "GIO base source");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-}
-
-static void
 gst_gio_base_src_class_init (GstGioBaseSrcClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
   GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (gst_gio_base_src_debug, "gio_base_src", 0,
+      "GIO base source");
+
   gobject_class->finalize = gst_gio_base_src_finalize;
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_factory));
+
   gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_gio_base_src_start);
   gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_gio_base_src_stop);
   gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_gio_base_src_get_size);
@@ -81,14 +75,12 @@ gst_gio_base_src_class_init (GstGioBaseSrcClass * klass)
   gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_gio_base_src_unlock);
   gstbasesrc_class->unlock_stop =
       GST_DEBUG_FUNCPTR (gst_gio_base_src_unlock_stop);
-  gstbasesrc_class->check_get_range =
-      GST_DEBUG_FUNCPTR (gst_gio_base_src_check_get_range);
   gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_gio_base_src_create);
   gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gio_base_src_query);
 }
 
 static void
-gst_gio_base_src_init (GstGioBaseSrc * src, GstGioBaseSrcClass * gclass)
+gst_gio_base_src_init (GstGioBaseSrc * src)
 {
   src->cancel = g_cancellable_new ();
 }
@@ -299,13 +291,6 @@ gst_gio_base_src_unlock_stop (GstBaseSrc * base_src)
   return TRUE;
 }
 
-static gboolean
-gst_gio_base_src_check_get_range (GstBaseSrc * base_src)
-{
-  return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS,
-      check_get_range, (base_src), FALSE);
-}
-
 static GstFlowReturn
 gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
     GstBuffer ** buf_return)
@@ -327,14 +312,14 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
     GST_DEBUG_OBJECT (src, "Creating subbuffer from cached buffer: offset %"
         G_GUINT64_FORMAT " length %u", offset, size);
 
-    buf = gst_buffer_create_sub (src->cache,
+    buf = gst_buffer_copy_region (src->cache, GST_BUFFER_COPY_ALL,
         offset - GST_BUFFER_OFFSET (src->cache), size);
 
     GST_BUFFER_OFFSET (buf) = offset;
     GST_BUFFER_OFFSET_END (buf) = offset + size;
-    GST_BUFFER_SIZE (buf) = size;
   } else {
     guint cachesize = MAX (4096, size);
+    guint8 *bdata;
     gssize read, res;
     gboolean success, eos;
     GError *err = NULL;
@@ -357,7 +342,7 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
         return ret;
     }
 
-    src->cache = gst_buffer_try_new_and_alloc (cachesize);
+    src->cache = gst_buffer_new_and_alloc (cachesize);
     if (G_UNLIKELY (src->cache == NULL)) {
       GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", cachesize);
       return GST_FLOW_ERROR;
@@ -371,13 +356,14 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
      * supports reads up to 64k. So we loop here until we get at
      * at least the requested amount of bytes or a read returns
      * nothing. */
+    bdata = gst_buffer_map (src->cache, NULL, NULL, GST_MAP_WRITE);
     read = 0;
     while (size - read > 0 && (res =
             g_input_stream_read (G_INPUT_STREAM (src->stream),
-                GST_BUFFER_DATA (src->cache) + read, cachesize - read,
-                src->cancel, &err)) > 0) {
+                bdata + read, cachesize - read, src->cancel, &err)) > 0) {
       read += res;
     }
+    gst_buffer_unmap (src->cache, bdata, read);
 
     success = (read >= 0);
     eos = (cachesize > 0 && read == 0);
@@ -390,7 +376,6 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
 
     if (success && !eos) {
       src->position += read;
-      GST_BUFFER_SIZE (src->cache) = read;
 
       GST_BUFFER_OFFSET (src->cache) = offset;
       GST_BUFFER_OFFSET_END (src->cache) = offset + read;
@@ -400,11 +385,12 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
           "cached buffer: offset %" G_GUINT64_FORMAT " length %u", offset,
           size);
 
-      buf = gst_buffer_create_sub (src->cache, 0, MIN (size, read));
+      buf =
+          gst_buffer_copy_region (src->cache, GST_BUFFER_COPY_ALL, 0, MIN (size,
+              read));
 
       GST_BUFFER_OFFSET (buf) = offset;
       GST_BUFFER_OFFSET_END (buf) = offset + MIN (size, read);
-      GST_BUFFER_SIZE (buf) = MIN (size, read);
     } else {
       GST_DEBUG_OBJECT (src, "Read not successful");
       gst_buffer_unref (src->cache);
index 69e05e5..fe7a23f 100644 (file)
@@ -92,8 +92,9 @@ enum
   PROP_FILE
 };
 
-GST_BOILERPLATE_FULL (GstGioSink, gst_gio_sink, GstGioBaseSink,
-    GST_TYPE_GIO_BASE_SINK, gst_gio_uri_handler_do_init);
+#define gst_gio_sink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGioSink, gst_gio_sink, GST_TYPE_GIO_BASE_SINK,
+    gst_gio_uri_handler_do_init (g_define_type_id));
 
 static void gst_gio_sink_finalize (GObject * object);
 static void gst_gio_sink_set_property (GObject * object, guint prop_id,
@@ -103,25 +104,14 @@ static void gst_gio_sink_get_property (GObject * object, guint prop_id,
 static GOutputStream *gst_gio_sink_get_stream (GstGioBaseSink * base_sink);
 
 static void
-gst_gio_sink_base_init (gpointer gclass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gio_sink_debug, "gio_sink", 0, "GIO sink");
-
-  gst_element_class_set_details_simple (element_class, "GIO sink",
-      "Sink/File",
-      "Write to any GIO-supported location",
-      "Ren\xc3\xa9 Stadler <mail@renestadler.de>, "
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
 gst_gio_sink_class_init (GstGioSinkClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
   GstGioBaseSinkClass *gstgiobasesink_class = (GstGioBaseSinkClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (gst_gio_sink_debug, "gio_sink", 0, "GIO sink");
+
   gobject_class->finalize = gst_gio_sink_finalize;
   gobject_class->set_property = gst_gio_sink_set_property;
   gobject_class->get_property = gst_gio_sink_get_property;
@@ -141,13 +131,19 @@ gst_gio_sink_class_init (GstGioSinkClass * klass)
       g_param_spec_object ("file", "File", "GFile to write to",
           G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class, "GIO sink",
+      "Sink/File",
+      "Write to any GIO-supported location",
+      "Ren\xc3\xa9 Stadler <mail@renestadler.de>, "
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
   gstgiobasesink_class->get_stream =
       GST_DEBUG_FUNCPTR (gst_gio_sink_get_stream);
   gstgiobasesink_class->close_on_stop = TRUE;
 }
 
 static void
-gst_gio_sink_init (GstGioSink * sink, GstGioSinkClass * gclass)
+gst_gio_sink_init (GstGioSink * sink)
 {
 }
 
index 5fd810e..5e077ad 100644 (file)
@@ -83,8 +83,9 @@ enum
   PROP_FILE
 };
 
-GST_BOILERPLATE_FULL (GstGioSrc, gst_gio_src, GstGioBaseSrc,
-    GST_TYPE_GIO_BASE_SRC, gst_gio_uri_handler_do_init);
+#define gst_gio_src_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGioSrc, gst_gio_src,
+    GST_TYPE_GIO_BASE_SRC, gst_gio_uri_handler_do_init (g_define_type_id));
 
 static void gst_gio_src_finalize (GObject * object);
 
@@ -95,29 +96,18 @@ static void gst_gio_src_get_property (GObject * object, guint prop_id,
 
 static GInputStream *gst_gio_src_get_stream (GstGioBaseSrc * bsrc);
 
-static gboolean gst_gio_src_check_get_range (GstBaseSrc * base_src);
-
-static void
-gst_gio_src_base_init (gpointer gclass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gio_src_debug, "gio_src", 0, "GIO source");
-
-  gst_element_class_set_details_simple (element_class, "GIO source",
-      "Source/File",
-      "Read from any GIO-supported location",
-      "Ren\xc3\xa9 Stadler <mail@renestadler.de>, "
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
+static gboolean gst_gio_src_query (GstBaseSrc * base_src, GstQuery * query);
 
 static void
 gst_gio_src_class_init (GstGioSrcClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
   GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
   GstGioBaseSrcClass *gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (gst_gio_src_debug, "gio_src", 0, "GIO source");
+
   gobject_class->finalize = gst_gio_src_finalize;
   gobject_class->set_property = gst_gio_src_set_property;
   gobject_class->get_property = gst_gio_src_get_property;
@@ -137,15 +127,20 @@ gst_gio_src_class_init (GstGioSrcClass * klass)
       g_param_spec_object ("file", "File", "GFile to read from",
           G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  gstbasesrc_class->check_get_range =
-      GST_DEBUG_FUNCPTR (gst_gio_src_check_get_range);
+  gst_element_class_set_details_simple (gstelement_class, "GIO source",
+      "Source/File",
+      "Read from any GIO-supported location",
+      "Ren\xc3\xa9 Stadler <mail@renestadler.de>, "
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
+  gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gio_src_query);
 
   gstgiobasesrc_class->get_stream = GST_DEBUG_FUNCPTR (gst_gio_src_get_stream);
   gstgiobasesrc_class->close_on_stop = TRUE;
 }
 
 static void
-gst_gio_src_init (GstGioSrc * src, GstGioSrcClass * gclass)
+gst_gio_src_init (GstGioSrc * src)
 {
 }
 
@@ -252,40 +247,51 @@ gst_gio_src_get_property (GObject * object, guint prop_id,
 }
 
 static gboolean
-gst_gio_src_check_get_range (GstBaseSrc * base_src)
+gst_gio_src_query (GstBaseSrc * base_src, GstQuery * query)
 {
+  gboolean res;
   GstGioSrc *src = GST_GIO_SRC (base_src);
-  gchar *scheme;
-
-  if (src->file == NULL)
-    goto done;
-
-  scheme = g_file_get_uri_scheme (src->file);
-  if (scheme == NULL)
-    goto done;
-
-  if (strcmp (scheme, "file") == 0) {
-    GST_LOG_OBJECT (src, "local URI, assuming random access is possible");
-    g_free (scheme);
-    return TRUE;
-  } else if (strcmp (scheme, "http") == 0 || strcmp (scheme, "https") == 0) {
-    GST_LOG_OBJECT (src, "blacklisted protocol '%s', "
-        "no random access possible", scheme);
-    g_free (scheme);
-    return FALSE;
-  }
-
-  g_free (scheme);
 
-done:
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_SCHEDULING:
+    {
+      gchar *scheme;
+      gboolean pull_mode;
+
+      pull_mode = FALSE;
+      if (src->file == NULL)
+        goto forward_parent;
+
+      scheme = g_file_get_uri_scheme (src->file);
+      if (scheme == NULL)
+        goto forward_parent;
+
+      if (strcmp (scheme, "file") == 0) {
+        GST_LOG_OBJECT (src, "local URI, assuming random access is possible");
+        pull_mode = TRUE;
+      } else if (strcmp (scheme, "http") == 0 || strcmp (scheme, "https") == 0) {
+        GST_LOG_OBJECT (src, "blacklisted protocol '%s', "
+            "no random access possible", scheme);
+      } else {
+        GST_LOG_OBJECT (src, "unhandled protocol '%s', asking parent", scheme);
+        goto forward_parent;
+      }
+      g_free (scheme);
 
-  GST_DEBUG_OBJECT (src, "undecided about random access, asking base class");
+      gst_query_set_scheduling (query, pull_mode, pull_mode, FALSE, 1, -1, 1);
+      res = TRUE;
+      break;
+    }
+    default:
+    forward_parent:
+      res = GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS,
+          query, (base_src, query), FALSE);
+      break;
+  }
 
-  return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS,
-      check_get_range, (base_src), FALSE);
+  return res;
 }
 
-
 static GInputStream *
 gst_gio_src_get_stream (GstGioBaseSrc * bsrc)
 {
index 02dac71..a76a1e2 100644 (file)
@@ -83,8 +83,8 @@ enum
   PROP_STREAM
 };
 
-GST_BOILERPLATE (GstGioStreamSink, gst_gio_stream_sink, GstGioBaseSink,
-    GST_TYPE_GIO_BASE_SINK);
+#define gst_gio_stream_sink_parent_class parent_class
+G_DEFINE_TYPE (GstGioStreamSink, gst_gio_stream_sink, GST_TYPE_GIO_BASE_SINK);
 
 static void gst_gio_stream_sink_finalize (GObject * object);
 static void gst_gio_stream_sink_set_property (GObject * object, guint prop_id,
@@ -94,25 +94,15 @@ static void gst_gio_stream_sink_get_property (GObject * object, guint prop_id,
 static GOutputStream *gst_gio_stream_sink_get_stream (GstGioBaseSink * bsink);
 
 static void
-gst_gio_stream_sink_base_init (gpointer gclass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gio_stream_sink_debug, "gio_stream_sink", 0,
-      "GIO stream sink");
-
-  gst_element_class_set_details_simple (element_class, "GIO stream sink",
-      "Sink",
-      "Write to any GIO stream",
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
 gst_gio_stream_sink_class_init (GstGioStreamSinkClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
   GstGioBaseSinkClass *ggbsink_class = (GstGioBaseSinkClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (gst_gio_stream_sink_debug, "gio_stream_sink", 0,
+      "GIO stream sink");
+
   gobject_class->finalize = gst_gio_stream_sink_finalize;
   gobject_class->set_property = gst_gio_stream_sink_set_property;
   gobject_class->get_property = gst_gio_stream_sink_get_property;
@@ -121,13 +111,17 @@ gst_gio_stream_sink_class_init (GstGioStreamSinkClass * klass)
       g_param_spec_object ("stream", "Stream", "Stream to write to",
           G_TYPE_OUTPUT_STREAM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class, "GIO stream sink",
+      "Sink",
+      "Write to any GIO stream",
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
   ggbsink_class->get_stream =
       GST_DEBUG_FUNCPTR (gst_gio_stream_sink_get_stream);
 }
 
 static void
-gst_gio_stream_sink_init (GstGioStreamSink * sink,
-    GstGioStreamSinkClass * gclass)
+gst_gio_stream_sink_init (GstGioStreamSink * sink)
 {
 }
 
index bd6c686..600f347 100644 (file)
@@ -77,8 +77,8 @@ enum
   PROP_STREAM
 };
 
-GST_BOILERPLATE (GstGioStreamSrc, gst_gio_stream_src, GstGioBaseSrc,
-    GST_TYPE_GIO_BASE_SRC);
+#define gst_gio_stream_src_parent_class parent_class
+G_DEFINE_TYPE (GstGioStreamSrc, gst_gio_stream_src, GST_TYPE_GIO_BASE_SRC);
 
 static void gst_gio_stream_src_finalize (GObject * object);
 static void gst_gio_stream_src_set_property (GObject * object, guint prop_id,
@@ -88,25 +88,15 @@ static void gst_gio_stream_src_get_property (GObject * object, guint prop_id,
 static GInputStream *gst_gio_stream_src_get_stream (GstGioBaseSrc * bsrc);
 
 static void
-gst_gio_stream_src_base_init (gpointer gclass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gio_stream_src_debug, "gio_stream_src", 0,
-      "GIO source");
-
-  gst_element_class_set_details_simple (element_class, "GIO stream source",
-      "Source",
-      "Read from any GIO stream",
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
 gst_gio_stream_src_class_init (GstGioStreamSrcClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
   GstGioBaseSrcClass *gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (gst_gio_stream_src_debug, "gio_stream_src", 0,
+      "GIO source");
+
   gobject_class->finalize = gst_gio_stream_src_finalize;
   gobject_class->set_property = gst_gio_stream_src_set_property;
   gobject_class->get_property = gst_gio_stream_src_get_property;
@@ -115,12 +105,17 @@ gst_gio_stream_src_class_init (GstGioStreamSrcClass * klass)
       g_param_spec_object ("stream", "Stream", "Stream to read from",
           G_TYPE_INPUT_STREAM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class, "GIO stream source",
+      "Source",
+      "Read from any GIO stream",
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
   gstgiobasesrc_class->get_stream =
       GST_DEBUG_FUNCPTR (gst_gio_stream_src_get_stream);
 }
 
 static void
-gst_gio_stream_src_init (GstGioStreamSrc * src, GstGioStreamSrcClass * gclass)
+gst_gio_stream_src_init (GstGioStreamSrc * src)
 {
 }
 
diff --git a/ext/gnomevfs/Makefile.am b/ext/gnomevfs/Makefile.am
deleted file mode 100644 (file)
index ed18d39..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-plugin_LTLIBRARIES = libgstgnomevfs.la
-libgstgnomevfs_la_SOURCES = \
-       gstgnomevfs.c \
-       gstgnomevfssink.c \
-       gstgnomevfssrc.c \
-       gstgnomevfsuri.c
-
-libgstgnomevfs_la_CFLAGS = \
-       $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GNOME_VFS_CFLAGS)
-libgstgnomevfs_la_LIBADD = \
-       $(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \
-       $(GST_BASE_LIBS) $(GNOME_VFS_LIBS)
-libgstgnomevfs_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstgnomevfs_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
-       gstgnomevfs.h \
-       gstgnomevfssink.h \
-       gstgnomevfssrc.h \
-       gstgnomevfsuri.h
diff --git a/ext/gnomevfs/gstgnomevfs.c b/ext/gnomevfs/gstgnomevfs.c
deleted file mode 100644 (file)
index c00254e..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * gnomevfs.c: register gnomevfs elements
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "gstgnomevfs.h"
-#include "gstgnomevfssrc.h"
-#include "gstgnomevfssink.h"
-
-#include <libgnomevfs/gnome-vfs.h>
-#include <gst/gst.h>
-
-#include <string.h>
-
-gchar *
-gst_gnome_vfs_location_to_uri_string (const gchar * location)
-{
-  gchar *newloc, *ret;
-
-  if (location == NULL)
-    return NULL;
-
-  /* already an URI string? */
-  if (strstr (location, "://"))
-    return g_strdup (location);
-
-  newloc = gnome_vfs_escape_path_string (location);
-
-  if (newloc && *newloc == '/') {
-    ret = g_strdup_printf ("file://%s", newloc);
-  } else {
-    gchar *curdir;
-
-    curdir = g_get_current_dir ();
-    ret = g_strdup_printf ("file://%s/%s", curdir, newloc);
-    g_free (curdir);
-  }
-
-  g_free (newloc);
-  return ret;
-}
-
-GType
-gst_gnome_vfs_uri_get_type (void)
-{
-  static GType type;            /* 0 */
-
-  if (type == 0) {
-    type = g_boxed_type_register_static ("GnomeVFSURI",
-        (GBoxedCopyFunc) gnome_vfs_uri_ref,
-        (GBoxedFreeFunc) gnome_vfs_uri_unref);
-  }
-
-  return type;
-}
-
-static gpointer
-gst_gnome_vfs_handle_copy (gpointer handle)
-{
-  return handle;
-}
-
-static void
-gst_gnome_vfs_handle_free (gpointer handle)
-{
-  return;
-}
-
-GType
-gst_gnome_vfs_handle_get_type (void)
-{
-  static GType type;            /* 0 */
-
-  if (type == 0) {
-    /* hackish, but makes it show up nicely in gst-inspect */
-    type = g_boxed_type_register_static ("GnomeVFSHandle",
-        (GBoxedCopyFunc) gst_gnome_vfs_handle_copy,
-        (GBoxedFreeFunc) gst_gnome_vfs_handle_free);
-  }
-
-  return type;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  /* gnome vfs engine init */
-  if (!gnome_vfs_initialized ()) {
-    if (!gnome_vfs_init ()) {
-      GST_WARNING ("Failed to initialize GnomeVFS - not registering plugin!");
-      return FALSE;
-    }
-  }
-
-  gst_plugin_add_dependency_simple (plugin, NULL, GNOME_VFS_MODULES_DIR, NULL,
-      GST_PLUGIN_DEPENDENCY_FLAG_NONE);
-
-  if (!gst_element_register (plugin, "gnomevfssrc", GST_RANK_MARGINAL,
-          gst_gnome_vfs_src_get_type ()))
-    return FALSE;
-
-  if (!gst_element_register (plugin, "gnomevfssink", GST_RANK_MARGINAL,
-          gst_gnome_vfs_sink_get_type ()))
-    return FALSE;
-
-#ifdef ENABLE_NLS
-/* FIXME: add category
-  GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, LOCALEDIR);
- */
-  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    "gnomevfs",
-    "elements to read from and write to  Gnome-VFS uri's",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/gnomevfs/gstgnomevfs.h b/ext/gnomevfs/gstgnomevfs.h
deleted file mode 100644 (file)
index f2228be..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_GNOME_VFS_H__
-#define __GST_GNOME_VFS_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GNOME_VFS_URI     (gst_gnome_vfs_uri_get_type ())
-#define GST_TYPE_GNOME_VFS_HANDLE  (gst_gnome_vfs_handle_get_type ())
-
-GType gst_gnome_vfs_uri_get_type (void);
-GType gst_gnome_vfs_handle_get_type (void);
-
-gchar * gst_gnome_vfs_location_to_uri_string (const gchar * location);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_H__ */
diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c
deleted file mode 100644 (file)
index 1a5f31f..0000000
+++ /dev/null
@@ -1,628 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *                    2001 Bastien Nocera <hadess@hadess.net>
- *                    2003 Colin Walters <walters@verbum.org>
- *                    2005 Tim-Philipp Müller <tim centricular net>
- *
- * gstgnomevfssink.c: 
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-gnomevfssink
- * @see_also: #GstFileSink, #GstGnomeVFSSrc
- *
- * This plugin writes incoming data to a local or remote location specified
- * by an URI. This location can be specified using any protocol supported by
- * the GnomeVFS library. Common protocols are 'file', 'ftp', or 'smb'.
- *
- * Applications can connect to the #GstGnomeVFSSink::allow-overwrite signal to
- * receive a callback when an existing file will be overwritten. The return
- * value of the signal will determine if gnomevfssink will overwrite the
- * resource or abort with an error.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v filesrc location=input.xyz ! gnomevfssink location=file:///home/joe/out.xyz
- * ]| The above pipeline will simply copy a local file. Instead of gnomevfssink,
- * we could just as well have used the filesink element here.
- * |[
- * gst-launch -v filesrc location=foo.mp3 ! mad ! flacenc ! gnomevfssink location=smb://othercomputer/foo.flac
- * ]| The above pipeline will re-encode an mp3 file into FLAC format and store
- * it on a remote host using the Samba protocol.
- * </refsect2>
- *
- * Last reviewed on 2006-02-28 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgnomevfssink.h"
-
-#include "gst/gst-i18n-plugin.h"
-
-#include <gst/gst.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <string.h>
-#include <errno.h>
-
-enum
-{
-  SIGNAL_ERASE_ASK,
-  LAST_SIGNAL
-};
-
-enum
-{
-  ARG_0,
-  ARG_LOCATION,
-  ARG_URI,
-  ARG_HANDLE
-};
-
-static void gst_gnome_vfs_sink_finalize (GObject * obj);
-
-static void gst_gnome_vfs_sink_uri_handler_init (gpointer g_iface,
-    gpointer iface_data);
-
-static void gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_gnome_vfs_sink_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-static gboolean gst_gnome_vfs_sink_open_file (GstGnomeVFSSink * sink);
-static void gst_gnome_vfs_sink_close_file (GstGnomeVFSSink * sink);
-static gboolean gst_gnome_vfs_sink_start (GstBaseSink * basesink);
-static gboolean gst_gnome_vfs_sink_stop (GstBaseSink * basesink);
-static GstFlowReturn gst_gnome_vfs_sink_render (GstBaseSink * basesink,
-    GstBuffer * buffer);
-static gboolean gst_gnome_vfs_sink_handle_event (GstBaseSink * basesink,
-    GstEvent * event);
-static gboolean gst_gnome_vfs_sink_query (GstPad * pad, GstQuery * query);
-
-static guint gst_gnome_vfs_sink_signals[LAST_SIGNAL];   /* all 0 */
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS_ANY);
-
-GST_DEBUG_CATEGORY_STATIC (gst_gnome_vfs_sink_debug);
-#define GST_CAT_DEFAULT gst_gnome_vfs_sink_debug
-
-static void
-gst_gnome_vfs_sink_do_init (GType type)
-{
-  static const GInterfaceInfo urihandler_info = {
-    gst_gnome_vfs_sink_uri_handler_init,
-    NULL,
-    NULL
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
-
-  GST_DEBUG_CATEGORY_INIT (gst_gnome_vfs_sink_debug, "gnomevfssink", 0,
-      "Gnome VFS sink element");
-}
-
-GST_BOILERPLATE_FULL (GstGnomeVFSSink, gst_gnome_vfs_sink, GstBaseSink,
-    GST_TYPE_BASE_SINK, gst_gnome_vfs_sink_do_init);
-
-static void
-gst_gnome_vfs_sink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sinktemplate));
-
-  gst_element_class_set_details_simple (element_class,
-      "GnomeVFS Sink", "Sink/File",
-      "Write a stream to a GnomeVFS URI", "Bastien Nocera <hadess@hadess.net>");
-}
-
-static gboolean
-_gst_boolean_allow_overwrite_accumulator (GSignalInvocationHint * ihint,
-    GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
-  gboolean allow_overwrite;
-
-  allow_overwrite = g_value_get_boolean (handler_return);
-  if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
-    g_value_set_boolean (return_accu, allow_overwrite);
-
-  /* stop emission if signal doesn't allow overwriting */
-  return allow_overwrite;
-}
-
-static void
-gst_gnome_vfs_sink_class_init (GstGnomeVFSSinkClass * klass)
-{
-  GstBaseSinkClass *basesink_class;
-  GObjectClass *gobject_class;
-
-  gobject_class = (GObjectClass *) klass;
-  basesink_class = (GstBaseSinkClass *) klass;
-
-  gobject_class->set_property = gst_gnome_vfs_sink_set_property;
-  gobject_class->get_property = gst_gnome_vfs_sink_get_property;
-  gobject_class->finalize = gst_gnome_vfs_sink_finalize;
-
-  g_object_class_install_property (gobject_class, ARG_LOCATION,
-      g_param_spec_string ("location", "File Location",
-          "Location of the file to write", NULL,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, ARG_URI,
-      g_param_spec_boxed ("uri", "GnomeVFSURI", "URI for GnomeVFS",
-          GST_TYPE_GNOME_VFS_URI, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, ARG_HANDLE,
-      g_param_spec_boxed ("handle", "GnomeVFSHandle", "Handle for GnomeVFS",
-          GST_TYPE_GNOME_VFS_HANDLE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  /**
-   * GstGnomeVFSSink::allow-overwrite
-   * @sink: the object which received the signal
-   * @uri: the URI to be overwritten
-   *
-   * This signal is fired when gnomevfssink is about to overwrite an
-   * existing resource. The application can connect to this signal and ask
-   * the user if the resource may be overwritten. 
-   *
-   * Returns: A boolean indicating that the resource may be overwritten.
-   */
-  gst_gnome_vfs_sink_signals[SIGNAL_ERASE_ASK] =
-      g_signal_new ("allow-overwrite", G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_CLEANUP, G_STRUCT_OFFSET (GstGnomeVFSSinkClass, erase_ask),
-      _gst_boolean_allow_overwrite_accumulator, NULL,
-      gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, GST_TYPE_GNOME_VFS_URI);
-
-  basesink_class->stop = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_stop);
-  basesink_class->start = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_start);
-  basesink_class->event = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_handle_event);
-  basesink_class->render = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_render);
-  basesink_class->get_times = NULL;
-}
-
-static void
-gst_gnome_vfs_sink_finalize (GObject * obj)
-{
-  GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (obj);
-
-  if (sink->uri) {
-    gnome_vfs_uri_unref (sink->uri);
-    sink->uri = NULL;
-  }
-
-  if (sink->uri_name) {
-    g_free (sink->uri_name);
-    sink->uri_name = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_gnome_vfs_sink_init (GstGnomeVFSSink * sink, GstGnomeVFSSinkClass * klass)
-{
-  gst_pad_set_query_function (GST_BASE_SINK_PAD (sink),
-      GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_query));
-
-  sink->uri = NULL;
-  sink->uri_name = NULL;
-  sink->handle = NULL;
-  sink->own_handle = FALSE;
-  sink->current_pos = 0;
-
-  GST_BASE_SINK (sink)->sync = FALSE;
-}
-
-static void
-gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstGnomeVFSSink *sink;
-  GstState cur_state;
-
-  sink = GST_GNOME_VFS_SINK (object);
-
-  gst_element_get_state (GST_ELEMENT (sink), &cur_state, NULL, 0);
-
-  if (cur_state == GST_STATE_PLAYING || cur_state == GST_STATE_PAUSED) {
-    GST_WARNING_OBJECT (sink, "cannot set property when PAUSED or PLAYING");
-    return;
-  }
-
-  GST_OBJECT_LOCK (sink);
-
-  switch (prop_id) {
-    case ARG_LOCATION:{
-      const gchar *new_location;
-
-      if (sink->uri) {
-        gnome_vfs_uri_unref (sink->uri);
-        sink->uri = NULL;
-      }
-      if (sink->uri_name) {
-        g_free (sink->uri_name);
-        sink->uri_name = NULL;
-      }
-
-      new_location = g_value_get_string (value);
-      if (new_location) {
-        sink->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
-        sink->uri = gnome_vfs_uri_new (sink->uri_name);
-      }
-      break;
-    }
-    case ARG_URI:{
-      if (sink->uri) {
-        gnome_vfs_uri_unref (sink->uri);
-        sink->uri = NULL;
-      }
-      if (sink->uri_name) {
-        g_free (sink->uri_name);
-        sink->uri_name = NULL;
-      }
-      if (g_value_get_boxed (value)) {
-        sink->uri = (GnomeVFSURI *) g_value_dup_boxed (value);
-        sink->uri_name = gnome_vfs_uri_to_string (sink->uri, 0);
-      }
-      break;
-    }
-    case ARG_HANDLE:{
-      if (sink->uri) {
-        gnome_vfs_uri_unref (sink->uri);
-        sink->uri = NULL;
-      }
-      if (sink->uri_name) {
-        g_free (sink->uri_name);
-        sink->uri_name = NULL;
-      }
-      sink->handle = g_value_get_boxed (value);
-      break;
-    }
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-
-  GST_OBJECT_UNLOCK (sink);
-}
-
-static void
-gst_gnome_vfs_sink_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstGnomeVFSSink *sink;
-
-  sink = GST_GNOME_VFS_SINK (object);
-
-  GST_OBJECT_LOCK (sink);
-
-  switch (prop_id) {
-    case ARG_LOCATION:
-      g_value_set_string (value, sink->uri_name);
-      break;
-    case ARG_URI:
-      g_value_set_boxed (value, sink->uri);
-      break;
-    case ARG_HANDLE:
-      g_value_set_boxed (value, sink->handle);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-
-  GST_OBJECT_UNLOCK (sink);
-}
-
-static gboolean
-gst_gnome_vfs_sink_open_file (GstGnomeVFSSink * sink)
-{
-  GnomeVFSResult result;
-
-  if (sink->uri) {
-    /* open the file, all permissions, umask will apply */
-    result = gnome_vfs_create_uri (&(sink->handle), sink->uri,
-        GNOME_VFS_OPEN_WRITE, TRUE,
-        GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE |
-        GNOME_VFS_PERM_GROUP_READ | GNOME_VFS_PERM_GROUP_WRITE |
-        GNOME_VFS_PERM_OTHER_READ | GNOME_VFS_PERM_OTHER_WRITE);
-
-    /* if the file existed and the property says to ask, then ask! */
-    if (result == GNOME_VFS_ERROR_FILE_EXISTS) {
-      gboolean erase_anyway = FALSE;
-
-      g_signal_emit (G_OBJECT (sink),
-          gst_gnome_vfs_sink_signals[SIGNAL_ERASE_ASK], 0, sink->uri,
-          &erase_anyway);
-      if (erase_anyway) {
-        result = gnome_vfs_create_uri (&(sink->handle), sink->uri,
-            GNOME_VFS_OPEN_WRITE, FALSE,
-            GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE |
-            GNOME_VFS_PERM_GROUP_READ | GNOME_VFS_PERM_GROUP_WRITE |
-            GNOME_VFS_PERM_OTHER_READ | GNOME_VFS_PERM_OTHER_WRITE);
-      }
-    }
-
-    GST_DEBUG_OBJECT (sink, "open: %s", gnome_vfs_result_to_string (result));
-
-    if (result != GNOME_VFS_OK) {
-      gchar *filename = gnome_vfs_uri_to_string (sink->uri,
-          GNOME_VFS_URI_HIDE_PASSWORD);
-
-      GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
-          (_("Could not open vfs file \"%s\" for writing: %s."),
-              filename, gnome_vfs_result_to_string (result)), GST_ERROR_SYSTEM);
-      g_free (filename);
-      return FALSE;
-    }
-    sink->own_handle = TRUE;
-  } else if (!sink->handle) {
-    GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, (_("No filename given")),
-        (NULL));
-    return FALSE;
-  } else {
-    sink->own_handle = FALSE;
-  }
-
-  sink->current_pos = 0;
-
-  return TRUE;
-}
-
-static void
-gst_gnome_vfs_sink_close_file (GstGnomeVFSSink * sink)
-{
-  GnomeVFSResult result;
-
-  if (sink->own_handle) {
-    /* close the file */
-    result = gnome_vfs_close (sink->handle);
-
-    if (result != GNOME_VFS_OK) {
-      gchar *filename = gnome_vfs_uri_to_string (sink->uri,
-          GNOME_VFS_URI_HIDE_PASSWORD);
-
-      GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
-          (_("Could not close vfs file \"%s\"."), filename), GST_ERROR_SYSTEM);
-      g_free (filename);
-    }
-
-    sink->own_handle = FALSE;
-    sink->handle = NULL;
-  }
-}
-
-static gboolean
-gst_gnome_vfs_sink_start (GstBaseSink * basesink)
-{
-  gboolean ret;
-
-  ret = gst_gnome_vfs_sink_open_file (GST_GNOME_VFS_SINK (basesink));
-
-  return ret;
-}
-
-static gboolean
-gst_gnome_vfs_sink_stop (GstBaseSink * basesink)
-{
-  GST_DEBUG_OBJECT (basesink, "closing ...");
-  gst_gnome_vfs_sink_close_file (GST_GNOME_VFS_SINK (basesink));
-  return TRUE;
-}
-
-static gboolean
-gst_gnome_vfs_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
-{
-  GstGnomeVFSSink *sink;
-  gboolean ret = TRUE;
-
-  sink = GST_GNOME_VFS_SINK (basesink);
-
-  GST_DEBUG_OBJECT (sink, "processing %s event", GST_EVENT_TYPE_NAME (event));
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:{
-      GnomeVFSResult res;
-      GstFormat format;
-      gint64 offset;
-
-      gst_event_parse_new_segment (event, NULL, NULL, &format, &offset,
-          NULL, NULL);
-
-      if (format != GST_FORMAT_BYTES) {
-        GST_WARNING_OBJECT (sink, "ignored NEWSEGMENT event in %s format",
-            gst_format_get_name (format));
-        break;
-      }
-
-      GST_LOG_OBJECT (sink, "seeking to offset %" G_GINT64_FORMAT, offset);
-      res = gnome_vfs_seek (sink->handle, GNOME_VFS_SEEK_START, offset);
-
-      if (res != GNOME_VFS_OK) {
-        GST_ERROR_OBJECT (sink, "Failed to seek to offset %"
-            G_GINT64_FORMAT ": %s", offset, gnome_vfs_result_to_string (res));
-        ret = FALSE;
-      } else {
-        sink->current_pos = offset;
-      }
-
-      break;
-    }
-
-    case GST_EVENT_FLUSH_START:
-    case GST_EVENT_EOS:{
-      /* No need to flush with GnomeVfs */
-      break;
-    }
-    default:
-      break;
-  }
-
-  return ret;
-}
-
-static gboolean
-gst_gnome_vfs_sink_query (GstPad * pad, GstQuery * query)
-{
-  GstGnomeVFSSink *sink;
-  GstFormat format;
-
-  sink = GST_GNOME_VFS_SINK (GST_PAD_PARENT (pad));
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_POSITION:
-      gst_query_parse_position (query, &format, NULL);
-      switch (format) {
-        case GST_FORMAT_DEFAULT:
-        case GST_FORMAT_BYTES:
-          gst_query_set_position (query, GST_FORMAT_BYTES, sink->current_pos);
-          return TRUE;
-        default:
-          return FALSE;
-      }
-
-    case GST_QUERY_FORMATS:
-      gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES);
-      return TRUE;
-
-    case GST_QUERY_URI:
-      gst_query_set_uri (query, sink->uri_name);
-      return TRUE;
-
-    default:
-      return gst_pad_query_default (pad, query);
-  }
-}
-
-static GstFlowReturn
-gst_gnome_vfs_sink_render (GstBaseSink * basesink, GstBuffer * buf)
-{
-  GnomeVFSFileSize written, cur_pos;
-  GstGnomeVFSSink *sink;
-  GnomeVFSResult result;
-  GstFlowReturn ret;
-
-  sink = GST_GNOME_VFS_SINK (basesink);
-
-  if (gnome_vfs_tell (sink->handle, &cur_pos) == GNOME_VFS_OK) {
-    /* bring up to date with current position for proper reporting */
-    sink->current_pos = cur_pos;
-  }
-
-  result = gnome_vfs_write (sink->handle, GST_BUFFER_DATA (buf),
-      GST_BUFFER_SIZE (buf), &written);
-
-  switch (result) {
-    case GNOME_VFS_OK:{
-      GST_DEBUG_OBJECT (sink, "wrote %" G_GINT64_FORMAT " bytes at %"
-          G_GINT64_FORMAT, (gint64) written, (gint64) cur_pos);
-
-      if (written < GST_BUFFER_SIZE (buf)) {
-        /* FIXME: what to do here? (tpm) */
-        g_warning ("%s: %d bytes should be written, only %"
-            G_GUINT64_FORMAT " bytes written", G_STRLOC,
-            GST_BUFFER_SIZE (buf), written);
-      }
-
-      sink->current_pos += GST_BUFFER_SIZE (buf);
-      ret = GST_FLOW_OK;
-      break;
-    }
-    case GNOME_VFS_ERROR_NO_SPACE:{
-      /* TODO: emit signal/send msg on out-of-diskspace and
-       * handle this gracefully (see open bug) (tpm) */
-      GST_ELEMENT_ERROR (sink, RESOURCE, NO_SPACE_LEFT, (NULL),
-          ("bufsize=%u, written=%u", GST_BUFFER_SIZE (buf), (guint) written));
-      ret = GST_FLOW_ERROR;
-      break;
-    }
-    default:{
-      gchar *filename = gnome_vfs_uri_to_string (sink->uri,
-          GNOME_VFS_URI_HIDE_PASSWORD);
-
-      GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
-          (_("Error while writing to file \"%s\"."), filename),
-          ("%s, bufsize=%u, written=%u", gnome_vfs_result_to_string (result),
-              GST_BUFFER_SIZE (buf), (guint) written));
-
-      g_free (filename);
-      ret = GST_FLOW_ERROR;
-      break;
-    }
-  }
-
-  return ret;
-}
-
-/*** GSTURIHANDLER INTERFACE *************************************************/
-
-static GstURIType
-gst_gnome_vfs_sink_uri_get_type (void)
-{
-  return GST_URI_SINK;
-}
-
-static gchar **
-gst_gnome_vfs_sink_uri_get_protocols (void)
-{
-  return gst_gnomevfs_get_supported_uris ();
-}
-
-static const gchar *
-gst_gnome_vfs_sink_uri_get_uri (GstURIHandler * handler)
-{
-  GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (handler);
-
-  return sink->uri_name;
-}
-
-static gboolean
-gst_gnome_vfs_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
-  GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (handler);
-  GstState cur_state;
-
-  gst_element_get_state (GST_ELEMENT (sink), &cur_state, NULL, 0);
-
-  if (cur_state == GST_STATE_PLAYING || cur_state == GST_STATE_PAUSED) {
-    GST_WARNING_OBJECT (sink, "cannot set uri when PAUSED or PLAYING");
-    return FALSE;
-  }
-
-  g_object_set (sink, "location", uri, NULL);
-
-  return TRUE;
-}
-
-static void
-gst_gnome_vfs_sink_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
-  GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
-  iface->get_type = gst_gnome_vfs_sink_uri_get_type;
-  iface->get_protocols = gst_gnome_vfs_sink_uri_get_protocols;
-  iface->get_uri = gst_gnome_vfs_sink_uri_get_uri;
-  iface->set_uri = gst_gnome_vfs_sink_uri_set_uri;
-}
diff --git a/ext/gnomevfs/gstgnomevfssink.h b/ext/gnomevfs/gstgnomevfssink.h
deleted file mode 100644 (file)
index 409add9..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *                    2001 Bastien Nocera <hadess@hadess.net>
- *                    2003 Colin Walters <walters@verbum.org>
- *                    2005 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GNOME_VFS_SINK_H__
-#define __GST_GNOME_VFS_SINK_H__
-
-#include "gstgnomevfs.h"
-#include "gstgnomevfsuri.h"
-#include <gst/base/gstbasesink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GNOME_VFS_SINK \
-  (gst_gnome_vfs_sink_get_type())
-#define GST_GNOME_VFS_SINK(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GNOME_VFS_SINK,GstGnomeVFSSink))
-#define GST_GNOME_VFS_SINK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GNOME_VFS_SINK,GstGnomeVFSSinkClass))
-#define GST_IS_GNOME_VFS_SINK(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GNOME_VFS_SINK))
-#define GST_IS_GNOME_VFS_SINK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GNOME_VFS_SINK))
-
-typedef struct _GstGnomeVFSSink GstGnomeVFSSink;
-typedef struct _GstGnomeVFSSinkClass GstGnomeVFSSinkClass;
-
-/**
- * GstGnomeVFSSink:
- *
- * Opaque data structure.
- */
-struct _GstGnomeVFSSink
-{
-  GstBaseSink basesink;
-
-  /*< private >*/
-
-  /* uri */
-  GnomeVFSURI *uri;
-  gchar *uri_name;
-
-  /* handle */
-  GnomeVFSHandle *handle;
-
-  /* whether we opened the handle ourselves */
-  gboolean own_handle;
-
-  guint64  current_pos;
-};
-
-struct _GstGnomeVFSSinkClass
-{
-  GstBaseSinkClass basesink_class;
-
-  /* signals */
-  gboolean (*erase_ask) (GstElement * element, GnomeVFSURI * uri);
-};
-
-GType gst_gnome_vfs_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_SINK_H__ */
-
diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c
deleted file mode 100644 (file)
index ef9ab74..0000000
+++ /dev/null
@@ -1,961 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *                    2001 Bastien Nocera <hadess@hadess.net>
- *                    2002 Kristian Rietveld <kris@gtk.org>
- *                    2002,2003 Colin Walters <walters@gnu.org>
- *
- * gnomevfssrc.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-gnomevfssrc
- * @see_also: #GstFileSrc, #GstGnomeVFSSink
- *
- * This plugin reads data from a local or remote location specified
- * by an URI. This location can be specified using any protocol supported by
- * the GnomeVFS library. Common protocols are 'file', 'http', 'ftp', or 'smb'.
- *
- * In case the #GstGnomeVFSSrc:iradio-mode property is set and the
- * location is a http resource, gnomevfssrc will send special icecast http
- * headers to the server to request additional icecast metainformation. If
- * the server is not an icecast server, it will display the same behaviour
- * as if the #GstGnomeVFSSrc:iradio-mode property was not set. However,
- * if the server is in fact an icecast server, gnomevfssrc will output
- * data with a media type of application/x-icy, in which case you will
- * need to use the #GstICYDemux element as follow-up element to extract
- * the icecast meta data and to determine the underlying media type.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v gnomevfssrc location=file:///home/joe/foo.xyz ! fakesink
- * ]| The above pipeline will simply read a local file and do nothing with the
- * data read. Instead of gnomevfssrc, we could just as well have used the
- * filesrc element here.
- * |[
- * gst-launch -v gnomevfssrc location=smb://othercomputer/foo.xyz ! filesink location=/home/joe/foo.xyz
- * ]| The above pipeline will copy a file from a remote host to the local file
- * system using the Samba protocol.
- * |[
- * gst-launch -v gnomevfssrc location=http://music.foobar.com/demo.mp3 ! mad ! audioconvert ! audioresample ! alsasink
- * ]| The above pipeline will read and decode and play an mp3 file from a
- * web server using the http protocol.
- * </refsect2>
- */
-
-
-#define BROKEN_SIG 1
-/*#undef BROKEN_SIG */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "gstgnomevfssrc.h"
-#include <gnome-vfs-module-2.0/libgnomevfs/gnome-vfs-cancellable-ops.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <string.h>
-
-#include <gst/gst.h>
-#include <gst/tag/tag.h>
-
-/* gnome-vfs.h doesn't include the following header, which we need: */
-#include <libgnomevfs/gnome-vfs-standard-callbacks.h>
-
-GST_DEBUG_CATEGORY_STATIC (gnomevfssrc_debug);
-#define GST_CAT_DEFAULT gnomevfssrc_debug
-
-static GStaticMutex count_lock = G_STATIC_MUTEX_INIT;
-static gint ref_count = 0;
-static gboolean vfs_owner = FALSE;
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS_ANY);
-
-enum
-{
-  ARG_0,
-  ARG_HANDLE,
-  ARG_LOCATION,
-  ARG_IRADIO_MODE,
-  ARG_IRADIO_NAME,
-  ARG_IRADIO_GENRE,
-  ARG_IRADIO_URL,
-  ARG_IRADIO_TITLE
-};
-
-static void gst_gnome_vfs_src_base_init (gpointer g_class);
-static void gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass);
-static void gst_gnome_vfs_src_init (GstGnomeVFSSrc * gnomevfssrc);
-static void gst_gnome_vfs_src_finalize (GObject * object);
-static void gst_gnome_vfs_src_uri_handler_init (gpointer g_iface,
-    gpointer iface_data);
-
-static void gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_gnome_vfs_src_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-static gboolean gst_gnome_vfs_src_stop (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_start (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_is_seekable (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_check_get_range (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_unlock (GstBaseSrc * basesrc);
-static gboolean gst_gnome_vfs_src_unlock_stop (GstBaseSrc * basesrc);
-static gboolean gst_gnome_vfs_src_get_size (GstBaseSrc * src, guint64 * size);
-static GstFlowReturn gst_gnome_vfs_src_create (GstBaseSrc * basesrc,
-    guint64 offset, guint size, GstBuffer ** buffer);
-static gboolean gst_gnome_vfs_src_query (GstBaseSrc * src, GstQuery * query);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_gnome_vfs_src_get_type (void)
-{
-  static GType gnomevfssrc_type = 0;
-
-  if (!gnomevfssrc_type) {
-    static const GTypeInfo gnomevfssrc_info = {
-      sizeof (GstGnomeVFSSrcClass),
-      gst_gnome_vfs_src_base_init,
-      NULL,
-      (GClassInitFunc) gst_gnome_vfs_src_class_init,
-      NULL,
-      NULL,
-      sizeof (GstGnomeVFSSrc),
-      0,
-      (GInstanceInitFunc) gst_gnome_vfs_src_init,
-    };
-    static const GInterfaceInfo urihandler_info = {
-      gst_gnome_vfs_src_uri_handler_init,
-      NULL,
-      NULL
-    };
-
-    gnomevfssrc_type =
-        g_type_register_static (GST_TYPE_BASE_SRC,
-        "GstGnomeVFSSrc", &gnomevfssrc_info, 0);
-    g_type_add_interface_static (gnomevfssrc_type, GST_TYPE_URI_HANDLER,
-        &urihandler_info);
-  }
-  return gnomevfssrc_type;
-}
-
-static void
-gst_gnome_vfs_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&srctemplate));
-  gst_element_class_set_details_simple (element_class,
-      "GnomeVFS Source", "Source/File",
-      "Read from any GnomeVFS-supported file",
-      "Bastien Nocera <hadess@hadess.net>, "
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-  GST_DEBUG_CATEGORY_INIT (gnomevfssrc_debug, "gnomevfssrc", 0,
-      "Gnome-VFS Source");
-}
-
-static void
-gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstBaseSrcClass *gstbasesrc_class;
-
-  gobject_class = G_OBJECT_CLASS (klass);
-  gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_class->finalize = gst_gnome_vfs_src_finalize;
-  gobject_class->set_property = gst_gnome_vfs_src_set_property;
-  gobject_class->get_property = gst_gnome_vfs_src_get_property;
-
-  /* properties */
-  gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass),
-      "location", ARG_LOCATION, G_PARAM_READWRITE, NULL);
-  g_object_class_install_property (gobject_class,
-      ARG_HANDLE,
-      g_param_spec_boxed ("handle",
-          "GnomeVFSHandle", "Handle for GnomeVFS",
-          GST_TYPE_GNOME_VFS_HANDLE,
-          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
-          G_PARAM_STATIC_STRINGS));
-
-  /* icecast stuff */
-  g_object_class_install_property (gobject_class,
-      ARG_IRADIO_MODE,
-      g_param_spec_boolean ("iradio-mode",
-          "iradio-mode",
-          "Enable internet radio mode (extraction of shoutcast/icecast metadata)",
-          FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class,
-      ARG_IRADIO_NAME,
-      g_param_spec_string ("iradio-name",
-          "iradio-name", "Name of the stream", NULL,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, ARG_IRADIO_GENRE,
-      g_param_spec_string ("iradio-genre", "iradio-genre",
-          "Genre of the stream", NULL,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, ARG_IRADIO_URL,
-      g_param_spec_string ("iradio-url", "iradio-url",
-          "Homepage URL for radio stream", NULL,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, ARG_IRADIO_TITLE,
-      g_param_spec_string ("iradio-title", "iradio-title",
-          "Name of currently playing song", NULL,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_start);
-  gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_stop);
-  gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_unlock);
-  gstbasesrc_class->unlock_stop =
-      GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_unlock_stop);
-  gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_get_size);
-  gstbasesrc_class->is_seekable =
-      GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_is_seekable);
-  gstbasesrc_class->check_get_range =
-      GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_check_get_range);
-  gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_create);
-  gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_query);
-}
-
-static void
-gst_gnome_vfs_src_init (GstGnomeVFSSrc * gnomevfssrc)
-{
-  gnomevfssrc->uri = NULL;
-  gnomevfssrc->uri_name = NULL;
-  gnomevfssrc->context = NULL;
-  gnomevfssrc->handle = NULL;
-  gnomevfssrc->interrupted = FALSE;
-  gnomevfssrc->curoffset = 0;
-  gnomevfssrc->seekable = FALSE;
-
-  gnomevfssrc->iradio_mode = FALSE;
-  gnomevfssrc->http_callbacks_pushed = FALSE;
-  gnomevfssrc->iradio_name = NULL;
-  gnomevfssrc->iradio_genre = NULL;
-  gnomevfssrc->iradio_url = NULL;
-  gnomevfssrc->iradio_title = NULL;
-
-  g_static_mutex_lock (&count_lock);
-  if (ref_count == 0) {
-    /* gnome vfs engine init */
-    if (gnome_vfs_initialized () == FALSE) {
-      gnome_vfs_init ();
-      vfs_owner = TRUE;
-    }
-  }
-  ref_count++;
-  g_static_mutex_unlock (&count_lock);
-}
-
-static void
-gst_gnome_vfs_src_finalize (GObject * object)
-{
-  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (object);
-
-  g_static_mutex_lock (&count_lock);
-  ref_count--;
-  if (ref_count == 0 && vfs_owner) {
-    if (gnome_vfs_initialized () == TRUE) {
-      gnome_vfs_shutdown ();
-    }
-  }
-  g_static_mutex_unlock (&count_lock);
-
-  if (src->uri) {
-    gnome_vfs_uri_unref (src->uri);
-    src->uri = NULL;
-  }
-
-  g_free (src->uri_name);
-  src->uri_name = NULL;
-
-  g_free (src->iradio_name);
-  src->iradio_name = NULL;
-
-  g_free (src->iradio_genre);
-  src->iradio_genre = NULL;
-
-  g_free (src->iradio_url);
-  src->iradio_url = NULL;
-
-  g_free (src->iradio_title);
-  src->iradio_title = NULL;
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/*
- * URI interface support.
- */
-
-static GstURIType
-gst_gnome_vfs_src_uri_get_type (void)
-{
-  return GST_URI_SRC;
-}
-
-static gchar **
-gst_gnome_vfs_src_uri_get_protocols (void)
-{
-  return gst_gnomevfs_get_supported_uris ();
-}
-
-static const gchar *
-gst_gnome_vfs_src_uri_get_uri (GstURIHandler * handler)
-{
-  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (handler);
-
-  return src->uri_name;
-}
-
-static gboolean
-gst_gnome_vfs_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
-  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (handler);
-
-  if (GST_STATE (src) == GST_STATE_PLAYING ||
-      GST_STATE (src) == GST_STATE_PAUSED)
-    return FALSE;
-
-  g_object_set (G_OBJECT (src), "location", uri, NULL);
-
-  return TRUE;
-}
-
-static void
-gst_gnome_vfs_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
-  GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
-  iface->get_type = gst_gnome_vfs_src_uri_get_type;
-  iface->get_protocols = gst_gnome_vfs_src_uri_get_protocols;
-  iface->get_uri = gst_gnome_vfs_src_uri_get_uri;
-  iface->set_uri = gst_gnome_vfs_src_uri_set_uri;
-}
-
-static void
-gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (object);
-
-  switch (prop_id) {
-    case ARG_LOCATION:{
-      const gchar *new_location;
-
-      /* the element must be stopped or paused in order to do this */
-      if (GST_STATE (src) == GST_STATE_PLAYING ||
-          GST_STATE (src) == GST_STATE_PAUSED)
-        break;
-
-      if (src->uri) {
-        gnome_vfs_uri_unref (src->uri);
-        src->uri = NULL;
-      }
-      if (src->uri_name) {
-        g_free (src->uri_name);
-        src->uri_name = NULL;
-      }
-
-      new_location = g_value_get_string (value);
-      if (new_location) {
-        src->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
-        src->uri = gnome_vfs_uri_new (src->uri_name);
-      }
-      break;
-    }
-    case ARG_HANDLE:
-      if (GST_STATE (src) == GST_STATE_NULL ||
-          GST_STATE (src) == GST_STATE_READY) {
-        if (src->uri) {
-          gnome_vfs_uri_unref (src->uri);
-          src->uri = NULL;
-        }
-        if (src->uri_name) {
-          g_free (src->uri_name);
-          src->uri_name = NULL;
-        }
-        src->handle = g_value_get_boxed (value);
-      }
-      break;
-    case ARG_IRADIO_MODE:
-      src->iradio_mode = g_value_get_boolean (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_gnome_vfs_src_get_property (GObject * object, guint prop_id, GValue * value,
-    GParamSpec * pspec)
-{
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (object);
-
-  switch (prop_id) {
-    case ARG_LOCATION:
-      g_value_set_string (value, src->uri_name);
-      break;
-    case ARG_HANDLE:
-      g_value_set_boxed (value, src->handle);
-      break;
-    case ARG_IRADIO_MODE:
-      g_value_set_boolean (value, src->iradio_mode);
-      break;
-    case ARG_IRADIO_NAME:
-      g_value_set_string (value, src->iradio_name);
-      break;
-    case ARG_IRADIO_GENRE:
-      g_value_set_string (value, src->iradio_genre);
-      break;
-    case ARG_IRADIO_URL:
-      g_value_set_string (value, src->iradio_url);
-      break;
-    case ARG_IRADIO_TITLE:
-      g_value_set_string (value, src->iradio_title);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static char *
-gst_gnome_vfs_src_unicodify (const char *str)
-{
-  const gchar *env_vars[] = { "GST_ICY_TAG_ENCODING",
-    "GST_TAG_ENCODING", NULL
-  };
-
-  return gst_tag_freeform_string_to_utf8 (str, -1, env_vars);
-}
-
-static void
-gst_gnome_vfs_src_send_additional_headers_callback (gconstpointer in,
-    gsize in_size, gpointer out, gsize out_size, gpointer callback_data)
-{
-  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (callback_data);
-  GnomeVFSModuleCallbackAdditionalHeadersOut *out_args =
-      (GnomeVFSModuleCallbackAdditionalHeadersOut *) out;
-
-  if (!src->iradio_mode)
-    return;
-  GST_DEBUG_OBJECT (src, "sending headers\n");
-
-  out_args->headers = g_list_append (out_args->headers,
-      g_strdup ("icy-metadata:1\r\n"));
-}
-
-static void
-gst_gnome_vfs_src_received_headers_callback (gconstpointer in,
-    gsize in_size, gpointer out, gsize out_size, gpointer callback_data)
-{
-  GList *i;
-  gint icy_metaint;
-  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (callback_data);
-  GnomeVFSModuleCallbackReceivedHeadersIn *in_args =
-      (GnomeVFSModuleCallbackReceivedHeadersIn *) in;
-
-  /* This is only used for internet radio stuff right now */
-  if (!src->iradio_mode)
-    return;
-
-  GST_DEBUG_OBJECT (src, "receiving internet radio metadata\n");
-
-  /* FIXME: Could we use "Accept-Ranges: bytes"
-   * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.5
-   * to enable pull-mode?
-   */
-
-  for (i = in_args->headers; i; i = i->next) {
-    char *data = (char *) i->data;
-    char *value = strchr (data, ':');
-    char *key;
-
-    if (!value)
-      continue;
-
-    value++;
-    g_strstrip (value);
-    if (!strlen (value))
-      continue;
-
-    GST_LOG_OBJECT (src, "data %s", data);
-
-    /* Icecast stuff */
-    if (strncmp (data, "icy-metaint:", 12) == 0) {      /* ugh */
-      if (sscanf (data + 12, "%d", &icy_metaint) == 1) {
-        if (icy_metaint > 0) {
-          GstCaps *icy_caps;
-
-          icy_caps = gst_caps_new_simple ("application/x-icy",
-              "metadata-interval", G_TYPE_INT, icy_metaint, NULL);
-          gst_pad_set_caps (GST_BASE_SRC_PAD (src), icy_caps);
-          gst_caps_unref (icy_caps);
-        }
-      }
-      continue;
-    }
-
-    if (!strncmp (data, "icy-", 4))
-      key = data + 4;
-    else
-      continue;
-
-    GST_DEBUG_OBJECT (src, "key: %s", key);
-    if (!strncmp (key, "name", 4)) {
-      g_free (src->iradio_name);
-      src->iradio_name = gst_gnome_vfs_src_unicodify (value);
-      if (src->iradio_name)
-        g_object_notify (G_OBJECT (src), "iradio-name");
-    } else if (!strncmp (key, "genre", 5)) {
-      g_free (src->iradio_genre);
-      src->iradio_genre = gst_gnome_vfs_src_unicodify (value);
-      if (src->iradio_genre)
-        g_object_notify (G_OBJECT (src), "iradio-genre");
-    } else if (!strncmp (key, "url", 3)) {
-      g_free (src->iradio_url);
-      src->iradio_url = gst_gnome_vfs_src_unicodify (value);
-      if (src->iradio_url)
-        g_object_notify (G_OBJECT (src), "iradio-url");
-    }
-  }
-}
-
-static void
-gst_gnome_vfs_src_push_callbacks (GstGnomeVFSSrc * src)
-{
-  if (src->http_callbacks_pushed)
-    return;
-
-  GST_DEBUG_OBJECT (src, "pushing callbacks");
-  gnome_vfs_module_callback_push
-      (GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS,
-      gst_gnome_vfs_src_send_additional_headers_callback, src, NULL);
-  gnome_vfs_module_callback_push
-      (GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS,
-      gst_gnome_vfs_src_received_headers_callback, src, NULL);
-
-  src->http_callbacks_pushed = TRUE;
-}
-
-static void
-gst_gnome_vfs_src_pop_callbacks (GstGnomeVFSSrc * src)
-{
-  if (!src->http_callbacks_pushed)
-    return;
-
-  GST_DEBUG_OBJECT (src, "popping callbacks");
-  gnome_vfs_module_callback_pop
-      (GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS);
-  gnome_vfs_module_callback_pop
-      (GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS);
-
-  src->http_callbacks_pushed = FALSE;
-}
-
-/*
- * Read a new buffer from src->reqoffset, takes care of events
- * and seeking and such.
- */
-static GstFlowReturn
-gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
-    GstBuffer ** buffer)
-{
-  GnomeVFSResult res;
-  GstBuffer *buf;
-  GnomeVFSFileSize readbytes;
-  guint8 *data;
-  guint todo;
-  GstGnomeVFSSrc *src;
-  gboolean interrupted = FALSE;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-
-  GST_DEBUG ("now at %" G_GINT64_FORMAT ", reading from %" G_GUINT64_FORMAT
-      ", size %u", src->curoffset, offset, size);
-
-  /* seek if required */
-  if (G_UNLIKELY (src->curoffset != offset)) {
-    GST_DEBUG ("need to seek");
-    if (src->seekable) {
-      GST_DEBUG ("seeking to %" G_GUINT64_FORMAT, offset);
-      res = gnome_vfs_seek (src->handle, GNOME_VFS_SEEK_START, offset);
-      if (res != GNOME_VFS_OK)
-        goto seek_failed;
-      src->curoffset = offset;
-    } else {
-      goto cannot_seek;
-    }
-  }
-
-  buf = gst_buffer_try_new_and_alloc (size);
-  if (G_UNLIKELY (buf == NULL)) {
-    GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size);
-    return GST_FLOW_ERROR;
-  }
-
-  data = GST_BUFFER_DATA (buf);
-
-  todo = size;
-  while (!src->interrupted && todo > 0) {
-    /* this can return less that we ask for */
-    res =
-        gnome_vfs_read_cancellable (src->handle, data, todo, &readbytes,
-        src->context);
-
-    if (G_UNLIKELY (res == GNOME_VFS_ERROR_CANCELLED)) {
-      GST_DEBUG_OBJECT (src, "interrupted");
-
-      /* Just take what we've so far gotten and return */
-      size = size - todo;
-      GST_BUFFER_SIZE (buf) = size;
-      todo = 0;
-      interrupted = TRUE;
-      break;
-    }
-
-    if (G_UNLIKELY (res == GNOME_VFS_ERROR_EOF || (res == GNOME_VFS_OK
-                && readbytes == 0)))
-      goto eos;
-
-    if (G_UNLIKELY (res != GNOME_VFS_OK))
-      goto read_failed;
-
-    if (readbytes < todo) {
-      data = &data[readbytes];
-      todo -= readbytes;
-    } else {
-      todo = 0;
-    }
-    GST_LOG ("  got size %" G_GUINT64_FORMAT, readbytes);
-  }
-
-  if (interrupted)
-    goto interrupted;
-
-  GST_BUFFER_OFFSET (buf) = src->curoffset;
-  src->curoffset += size;
-
-  /* we're done, return the buffer */
-  *buffer = buf;
-
-  return GST_FLOW_OK;
-
-seek_failed:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
-        ("Failed to seek to requested position %" G_GINT64_FORMAT ": %s",
-            offset, gnome_vfs_result_to_string (res)));
-    return GST_FLOW_ERROR;
-  }
-cannot_seek:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
-        ("Requested seek from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT
-            " on non-seekable stream", src->curoffset, offset));
-    return GST_FLOW_ERROR;
-  }
-read_failed:
-  {
-    gst_buffer_unref (buf);
-    GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
-        ("Failed to read data: %s", gnome_vfs_result_to_string (res)));
-    return GST_FLOW_ERROR;
-  }
-interrupted:
-  {
-    gst_buffer_unref (buf);
-    return GST_FLOW_WRONG_STATE;
-  }
-eos:
-  {
-    gst_buffer_unref (buf);
-    GST_DEBUG_OBJECT (src, "Reading data gave EOS");
-    return GST_FLOW_UNEXPECTED;
-  }
-}
-
-static gboolean
-gst_gnome_vfs_src_query (GstBaseSrc * basesrc, GstQuery * query)
-{
-  gboolean ret = FALSE;
-  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (basesrc);
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_URI:
-      gst_query_set_uri (query, src->uri_name);
-      ret = TRUE;
-      break;
-    default:
-      ret = FALSE;
-      break;
-  }
-
-  if (!ret)
-    ret = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
-
-  return ret;
-}
-
-static gboolean
-gst_gnome_vfs_src_is_seekable (GstBaseSrc * basesrc)
-{
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-
-  return src->seekable;
-}
-
-static gboolean
-gst_gnome_vfs_src_check_get_range (GstBaseSrc * basesrc)
-{
-  GstGnomeVFSSrc *src;
-  const gchar *protocol;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-
-  if (src->uri == NULL) {
-    GST_WARNING_OBJECT (src, "no URI set yet");
-    return FALSE;
-  }
-
-  if (gnome_vfs_uri_is_local (src->uri)) {
-    GST_LOG_OBJECT (src, "local URI (%s), assuming random access is possible",
-        GST_STR_NULL (src->uri_name));
-    return TRUE;
-  }
-
-  /* blacklist certain protocols we know won't work getrange-based */
-  protocol = gnome_vfs_uri_get_scheme (src->uri);
-  if (protocol == NULL)
-    goto undecided;
-
-  if (strcmp (protocol, "http") == 0 || strcmp (protocol, "https") == 0) {
-    GST_LOG_OBJECT (src, "blacklisted protocol '%s', no random access possible"
-        " (URI=%s)", protocol, GST_STR_NULL (src->uri_name));
-    return FALSE;
-  }
-
-  /* fall through to undecided */
-
-undecided:
-  {
-    /* don't know what to do, let the basesrc class decide for us */
-    GST_LOG_OBJECT (src, "undecided about URI '%s', let base class handle it",
-        GST_STR_NULL (src->uri_name));
-
-    if (GST_BASE_SRC_CLASS (parent_class)->check_get_range)
-      return GST_BASE_SRC_CLASS (parent_class)->check_get_range (basesrc);
-
-    return FALSE;
-  }
-}
-
-/* Interrupt a blocking request. */
-static gboolean
-gst_gnome_vfs_src_unlock (GstBaseSrc * basesrc)
-{
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-  GST_DEBUG_OBJECT (src, "unlock()");
-  src->interrupted = TRUE;
-  if (src->context) {
-    GnomeVFSCancellation *cancel =
-        gnome_vfs_context_get_cancellation (src->context);
-    if (cancel)
-      gnome_vfs_cancellation_cancel (cancel);
-  }
-  return TRUE;
-}
-
-/* Interrupt interrupt. */
-static gboolean
-gst_gnome_vfs_src_unlock_stop (GstBaseSrc * basesrc)
-{
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-  GST_DEBUG_OBJECT (src, "unlock_stop()");
-
-  src->interrupted = FALSE;
-  return TRUE;
-}
-
-static gboolean
-gst_gnome_vfs_src_get_size (GstBaseSrc * basesrc, guint64 * size)
-{
-  GstGnomeVFSSrc *src;
-  GnomeVFSFileInfo *info;
-  GnomeVFSFileInfoOptions options;
-  GnomeVFSResult res;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-
-  *size = -1;
-  info = gnome_vfs_file_info_new ();
-  options = GNOME_VFS_FILE_INFO_DEFAULT | GNOME_VFS_FILE_INFO_FOLLOW_LINKS;
-  res = gnome_vfs_get_file_info_from_handle (src->handle, info, options);
-  if (res == GNOME_VFS_OK) {
-    if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) {
-      *size = info->size;
-      GST_DEBUG_OBJECT (src, "from handle: %" G_GUINT64_FORMAT " bytes", *size);
-    } else if (src->own_handle && gnome_vfs_uri_is_local (src->uri)) {
-      GST_DEBUG_OBJECT (src,
-          "file size not known, file local, trying fallback");
-      res = gnome_vfs_get_file_info_uri (src->uri, info, options);
-      if (res == GNOME_VFS_OK &&
-          (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) {
-        *size = info->size;
-        GST_DEBUG_OBJECT (src, "from uri: %" G_GUINT64_FORMAT " bytes", *size);
-      }
-    }
-  } else {
-    GST_WARNING_OBJECT (src, "getting info failed: %s",
-        gnome_vfs_result_to_string (res));
-  }
-  gnome_vfs_file_info_unref (info);
-
-  if (*size == (GnomeVFSFileSize) - 1)
-    return FALSE;
-
-  GST_DEBUG_OBJECT (src, "return size %" G_GUINT64_FORMAT, *size);
-
-  return TRUE;
-}
-
-/* open the file, do stuff necessary to go to PAUSED state */
-static gboolean
-gst_gnome_vfs_src_start (GstBaseSrc * basesrc)
-{
-  GnomeVFSResult res;
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-
-  gst_gnome_vfs_src_push_callbacks (src);
-
-  src->context = gnome_vfs_context_new ();
-  if (src->uri != NULL) {
-    GnomeVFSOpenMode mode = GNOME_VFS_OPEN_READ;
-
-    /* this can block... */
-    res = gnome_vfs_open_uri (&src->handle, src->uri, mode);
-    if (res != GNOME_VFS_OK)
-      goto open_failed;
-    src->own_handle = TRUE;
-  } else if (!src->handle) {
-    goto no_filename;
-  } else {
-    src->own_handle = FALSE;
-  }
-
-  if (gnome_vfs_seek (src->handle, GNOME_VFS_SEEK_CURRENT, 0) == GNOME_VFS_OK) {
-    src->seekable = TRUE;
-  } else {
-    src->seekable = FALSE;
-  }
-
-  return TRUE;
-
-  /* ERRORS */
-open_failed:
-  {
-    gchar *filename = gnome_vfs_uri_to_string (src->uri,
-        GNOME_VFS_URI_HIDE_PASSWORD);
-
-    gst_gnome_vfs_src_pop_callbacks (src);
-
-    if (res == GNOME_VFS_ERROR_NOT_FOUND ||
-        res == GNOME_VFS_ERROR_HOST_NOT_FOUND ||
-        res == GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE) {
-      GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
-          ("Could not open vfs file \"%s\" for reading: %s (%d)",
-              filename, gnome_vfs_result_to_string (res), res));
-    } else {
-      GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
-          ("Could not open vfs file \"%s\" for reading: %s (%d)",
-              filename, gnome_vfs_result_to_string (res), res));
-    }
-    g_free (filename);
-    return FALSE;
-  }
-no_filename:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("No filename given"));
-    return FALSE;
-  }
-}
-
-static gboolean
-gst_gnome_vfs_src_stop (GstBaseSrc * basesrc)
-{
-  GstGnomeVFSSrc *src;
-
-  src = GST_GNOME_VFS_SRC (basesrc);
-
-  gst_gnome_vfs_src_pop_callbacks (src);
-
-  if (src->own_handle) {
-    GnomeVFSResult res;
-
-    res = gnome_vfs_close (src->handle);
-    if (res != GNOME_VFS_OK) {
-      GST_ELEMENT_ERROR (src, RESOURCE, CLOSE, (NULL),
-          ("Could not close vfs handle: %s", gnome_vfs_result_to_string (res)));
-    }
-    src->handle = NULL;
-  }
-  src->curoffset = 0;
-  src->interrupted = FALSE;
-  gnome_vfs_context_free (src->context);
-  src->context = NULL;
-
-  return TRUE;
-}
diff --git a/ext/gnomevfs/gstgnomevfssrc.h b/ext/gnomevfs/gstgnomevfssrc.h
deleted file mode 100644 (file)
index e8c228d..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *                    2001 Bastien Nocera <hadess@hadess.net>
- *                    2002 Kristian Rietveld <kris@gtk.org>
- *                    2002,2003 Colin Walters <walters@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GNOME_VFS_SRC_H__
-#define __GST_GNOME_VFS_SRC_H__
-
-#include <gst/base/gstbasesrc.h>
-
-#include "gstgnomevfs.h"
-#include "gstgnomevfsuri.h"
-#include <libgnomevfs/gnome-vfs.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GNOME_VFS_SRC \
-  (gst_gnome_vfs_src_get_type())
-#define GST_GNOME_VFS_SRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GNOME_VFS_SRC,GstGnomeVFSSrc))
-#define GST_GNOME_VFS_SRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GNOME_VFS_SRC,GstGnomeVFSSrcClass))
-#define GST_IS_GNOME_VFS_SRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GNOME_VFS_SRC))
-#define GST_IS_GNOME_VFS_SRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GNOME_VFS_SRC))
-
-typedef struct _GstGnomeVFSSrc      GstGnomeVFSSrc;
-typedef struct _GstGnomeVFSSrcClass GstGnomeVFSSrcClass;
-
-/**
- * GstGnomeVFSSrc:
- *
- * Opaque data structure.
- */
-struct _GstGnomeVFSSrc
-{
-  GstBaseSrc basesrc;
-
-  /* uri, file, ... */
-  GnomeVFSURI *uri;
-  gchar *uri_name;
-  GnomeVFSContext *context;
-  GnomeVFSHandle *handle;
-  gboolean own_handle;
-  gboolean interrupted;
-  GnomeVFSFileOffset curoffset; /* current offset in file */
-  gboolean seekable;
-
-  /* shoutcast/icecast metadata extraction handling */
-  gboolean iradio_mode;
-  gboolean http_callbacks_pushed;
-
-  gchar *iradio_name;
-  gchar *iradio_genre;
-  gchar *iradio_url;
-  gchar *iradio_title;
-};
-
-struct _GstGnomeVFSSrcClass
-{
-  GstBaseSrcClass  basesrc_class;
-};
-
-GType gst_gnome_vfs_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_SRC_H__ */
-
-
diff --git a/ext/gnomevfs/gstgnomevfsuri.c b/ext/gnomevfs/gstgnomevfsuri.c
deleted file mode 100644 (file)
index e811c31..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *                    2001 Bastien Nocera <hadess@hadess.net>
- *                    2003 Colin Walters <walters@verbum.org>
- *
- * gstgnomevfssink.c: 
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <libgnomevfs/gnome-vfs.h>
-#include "gstgnomevfsuri.h"
-
-#include <gst/gst.h>
-
-/* FIXME: move this to source and sink and remove this file:
- * e.g. sinks cannot save to http:// and src cannot read from burn://
- */
-static gpointer
-_internal_get_supported_uris (gpointer data)
-{
-  /* no dav/davs in the list, because they don't appear to be reliable enough */
-  const gchar *uris[] = {
-    "http://localhost/bla",
-    "https://localhost/bla",
-    "file:///bla",
-    "smb://localhost/bla",
-    "ftp://localhost/bla",
-    "sftp://localhost/bla",
-    "nfs://localhost/bla",
-    "ssh://localhost/bla",
-    "burn://"
-  };
-  GnomeVFSURI *uri;
-  gchar **result;
-  gint n, r = 0;
-
-  result = g_new0 (gchar *, G_N_ELEMENTS (uris) + 1);
-  for (n = 0; n < G_N_ELEMENTS (uris); n++) {
-    uri = gnome_vfs_uri_new (uris[n]);
-    if (uri != NULL) {
-      gchar *protocol = g_strdup (uris[n]);
-      gint n;
-
-      gnome_vfs_uri_unref (uri);
-      for (n = 0; protocol[n] != '\0'; n++) {
-        if (protocol[n] == ':') {
-          protocol[n] = '\0';
-          break;
-        }
-      }
-
-      GST_DEBUG ("adding protocol '%s'", protocol);
-      result[r++] = protocol;
-    } else {
-      GST_DEBUG ("could not create GnomeVfsUri from '%s'", uris[n]);
-    }
-  }
-  result[r] = NULL;
-
-  return result;
-}
-
-gchar **
-gst_gnomevfs_get_supported_uris (void)
-{
-  static GOnce once = G_ONCE_INIT;
-
-  g_once (&once, _internal_get_supported_uris, NULL);
-  return (gchar **) once.retval;
-}
diff --git a/ext/gnomevfs/gstgnomevfsuri.h b/ext/gnomevfs/gstgnomevfsuri.h
deleted file mode 100644 (file)
index f99b1f7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_GNOME_VFS_URI_H__
-#define __GST_GNOME_VFS_URI_H__
-
-#include <libgnomevfs/gnome-vfs.h>
-
-G_BEGIN_DECLS
-
-gchar **gst_gnomevfs_get_supported_uris (void);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_URI_H__ */
index 839900e..27431e5 100644 (file)
@@ -2,7 +2,9 @@ plugin_LTLIBRARIES = libgstlibvisual.la
 
 libgstlibvisual_la_SOURCES = visual.c 
 libgstlibvisual_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LIBVISUAL_CFLAGS)
-libgstlibvisual_la_LIBADD = $(GST_BASE_LIBS) $(LIBVISUAL_LIBS)
+libgstlibvisual_la_LIBADD = \
+        $(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
+       $(GST_BASE_LIBS) $(LIBVISUAL_LIBS)
 libgstlibvisual_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstlibvisual_la_LIBTOOLFLAGS = --tag=disable-static
 
index 48c1e27..14c0e96 100644 (file)
@@ -63,9 +63,7 @@ struct _GstVisual
   VisActor *actor;
 
   /* audio/video state */
-  gint channels;
-  gint rate;                    /* Input samplerate */
-  gint bps;
+  GstAudioInfo info;
 
   /* framerate numerator & denominator */
   gint fps_n;
@@ -74,6 +72,7 @@ struct _GstVisual
   gint height;
   GstClockTime duration;
   guint outsize;
+  GstBufferPool *pool;
 
   /* samples per frame based on caps */
   guint spf;
@@ -100,23 +99,21 @@ GType gst_visual_get_type (void);
 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN "; "
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (" { "
 #if G_BYTE_ORDER == G_BIG_ENDIAN
-        GST_VIDEO_CAPS_RGB "; "
+            "\"xRGB\", " "\"RGB\", "
 #else
-        GST_VIDEO_CAPS_BGR "; "
+            "\"BGRx\", " "\"BGR\", "
 #endif
-        GST_VIDEO_CAPS_RGB_16)
+            "\"RGB16\" } "))
     );
 
 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "endianness = (int) BYTE_ORDER, "
-        "signed = (boolean) TRUE, " "channels = (int) { 1, 2 }, "
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " GST_AUDIO_NE (S16) ", "
+        "channels = (int) { 1, 2 }, "
 #if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
         "rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }"
 #else
@@ -128,7 +125,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
 
 static void gst_visual_class_init (gpointer g_class, gpointer class_data);
 static void gst_visual_init (GstVisual * visual);
-static void gst_visual_dispose (GObject * object);
+static void gst_visual_finalize (GObject * object);
 
 static GstStateChangeReturn gst_visual_change_state (GstElement * element,
     GstStateChange transition);
@@ -139,8 +136,7 @@ static gboolean gst_visual_src_event (GstPad * pad, GstEvent * event);
 static gboolean gst_visual_src_query (GstPad * pad, GstQuery * query);
 
 static gboolean gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_visual_src_setcaps (GstPad * pad, GstCaps * caps);
-static GstCaps *gst_visual_getcaps (GstPad * pad);
+static GstCaps *gst_visual_getcaps (GstPad * pad, GstCaps * filter);
 static void libvisual_log_handler (const char *message, const char *funcname,
     void *priv);
 
@@ -198,6 +194,7 @@ gst_visual_class_init (gpointer g_class, gpointer class_data)
         gst_static_pad_template_get (&src_template));
     gst_element_class_add_pad_template (element,
         gst_static_pad_template_get (&sink_template));
+
     gst_element_class_set_details_simple (element,
         longname, "Visualization",
         klass->plugin->info->about, "Benjamin Otte <otte@gnome.org>");
@@ -205,7 +202,7 @@ gst_visual_class_init (gpointer g_class, gpointer class_data)
     g_free (longname);
   }
 
-  object->dispose = gst_visual_dispose;
+  object->finalize = gst_visual_finalize;
 }
 
 static void
@@ -213,13 +210,11 @@ gst_visual_init (GstVisual * visual)
 {
   /* create the sink and src pads */
   visual->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
-  gst_pad_set_setcaps_function (visual->sinkpad, gst_visual_sink_setcaps);
   gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain);
   gst_pad_set_event_function (visual->sinkpad, gst_visual_sink_event);
   gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad);
 
   visual->srcpad = gst_pad_new_from_static_template (&src_template, "src");
-  gst_pad_set_setcaps_function (visual->srcpad, gst_visual_src_setcaps);
   gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps);
   gst_pad_set_event_function (visual->srcpad, gst_visual_src_event);
   gst_pad_set_query_function (visual->srcpad, gst_visual_src_query);
@@ -246,17 +241,16 @@ gst_visual_clear_actors (GstVisual * visual)
 }
 
 static void
-gst_visual_dispose (GObject * object)
+gst_visual_finalize (GObject * object)
 {
   GstVisual *visual = GST_VISUAL (object);
 
-  if (visual->adapter) {
-    g_object_unref (visual->adapter);
-    visual->adapter = NULL;
-  }
+  g_object_unref (visual->adapter);
+  if (visual->pool)
+    gst_object_unref (visual->pool);
   gst_visual_clear_actors (visual);
 
-  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+  GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
 }
 
 static void
@@ -272,14 +266,14 @@ gst_visual_reset (GstVisual * visual)
 }
 
 static GstCaps *
-gst_visual_getcaps (GstPad * pad)
+gst_visual_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstCaps *ret;
   GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
   int depths;
 
   if (!visual->actor) {
-    ret = gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad));
+    ret = gst_pad_get_pad_template_caps (visual->srcpad);
     goto beach;
   }
 
@@ -297,32 +291,46 @@ gst_visual_getcaps (GstPad * pad)
   GST_DEBUG_OBJECT (visual, "libvisual plugin supports depths %u (0x%04x)",
       depths, depths);
   /* if (depths & VISUAL_VIDEO_DEPTH_32BIT) Always supports 32bit output */
-  gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN));
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+  gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("xRGB")));
+#else
+  gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGRx")));
+#endif
 
   if (depths & VISUAL_VIDEO_DEPTH_24BIT) {
 #if G_BYTE_ORDER == G_BIG_ENDIAN
-    gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB));
+    gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB")));
 #else
-    gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_BGR));
+    gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGR")));
 #endif
   }
   if (depths & VISUAL_VIDEO_DEPTH_16BIT) {
-    gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB_16));
+    gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB16")));
   }
 
 beach:
 
+  if (filter) {
+    GstCaps *intersection;
+
+    intersection =
+        gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (ret);
+    ret = intersection;
+  }
+
   GST_DEBUG_OBJECT (visual, "returning caps %" GST_PTR_FORMAT, ret);
   gst_object_unref (visual);
   return ret;
 }
 
 static gboolean
-gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
+gst_visual_src_setcaps (GstVisual * visual, GstCaps * caps)
 {
-  GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
+  gboolean res;
   GstStructure *structure;
-  gint depth, pitch;
+  gint depth, pitch, rate;
+  const gchar *fmt;
 
   structure = gst_caps_get_structure (caps, 0);
 
@@ -332,12 +340,19 @@ gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
     goto error;
   if (!gst_structure_get_int (structure, "height", &visual->height))
     goto error;
-  if (!gst_structure_get_int (structure, "bpp", &depth))
+  if (!(fmt = gst_structure_get_string (structure, "format")))
     goto error;
   if (!gst_structure_get_fraction (structure, "framerate", &visual->fps_n,
           &visual->fps_d))
     goto error;
 
+  if (!strcmp (fmt, "BGR") || !strcmp (fmt, "RGB"))
+    depth = 24;
+  else if (!strcmp (fmt, "BGRx") || !strcmp (fmt, "xRGB"))
+    depth = 32;
+  else
+    depth = 16;
+
   visual_video_set_depth (visual->video,
       visual_video_depth_enum_from_value (depth));
   visual_video_set_dimension (visual->video, visual->width, visual->height);
@@ -345,21 +360,22 @@ gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
   visual_video_set_pitch (visual->video, pitch);
   visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
 
+  rate = GST_AUDIO_INFO_RATE (&visual->info);
+
   /* precalc some values */
   visual->outsize = visual->video->height * pitch;
-  visual->spf =
-      gst_util_uint64_scale_int (visual->rate, visual->fps_d, visual->fps_n);
+  visual->spf = gst_util_uint64_scale_int (rate, visual->fps_d, visual->fps_n);
   visual->duration =
       gst_util_uint64_scale_int (GST_SECOND, visual->fps_d, visual->fps_n);
 
-  gst_object_unref (visual);
-  return TRUE;
+  res = gst_pad_push_event (visual->srcpad, gst_event_new_caps (caps));
+
+  return res;
 
   /* ERRORS */
 error:
   {
     GST_DEBUG_OBJECT (visual, "error parsing caps");
-    gst_object_unref (visual);
     return FALSE;
   }
 }
@@ -368,23 +384,34 @@ static gboolean
 gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps)
 {
   GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
-  GstStructure *structure;
+  GstAudioInfo info;
+  gint rate;
 
-  structure = gst_caps_get_structure (caps, 0);
+  if (!gst_audio_info_from_caps (&info, caps))
+    goto invalid_caps;
 
-  gst_structure_get_int (structure, "channels", &visual->channels);
-  gst_structure_get_int (structure, "rate", &visual->rate);
+  visual->info = info;
+
+  rate = GST_AUDIO_INFO_RATE (&info);
 
   /* this is how many samples we need to fill one frame at the requested
    * framerate. */
   if (visual->fps_n != 0) {
     visual->spf =
-        gst_util_uint64_scale_int (visual->rate, visual->fps_d, visual->fps_n);
+        gst_util_uint64_scale_int (rate, visual->fps_d, visual->fps_n);
   }
-  visual->bps = visual->channels * sizeof (gint16);
 
   gst_object_unref (visual);
+
   return TRUE;
+
+  /* ERRORS */
+invalid_caps:
+  {
+    GST_ERROR_OBJECT (visual, "invalid caps received");
+    gst_object_unref (visual);
+    return FALSE;
+  }
 }
 
 static gboolean
@@ -393,25 +420,29 @@ gst_vis_src_negotiate (GstVisual * visual)
   GstCaps *othercaps, *target;
   GstStructure *structure;
   GstCaps *caps;
+  GstQuery *query;
+  GstBufferPool *pool = NULL;
+  guint size, min, max, prefix, alignment;
 
-  caps = gst_pad_get_caps (visual->srcpad);
+  caps = gst_pad_get_caps (visual->srcpad, NULL);
 
   /* see what the peer can do */
-  othercaps = gst_pad_peer_get_caps (visual->srcpad);
+  othercaps = gst_pad_peer_get_caps (visual->srcpad, caps);
   if (othercaps) {
-    target = gst_caps_intersect (othercaps, caps);
-    gst_caps_unref (othercaps);
+    target = othercaps;
     gst_caps_unref (caps);
 
     if (gst_caps_is_empty (target))
       goto no_format;
 
+    target = gst_caps_make_writable (target);
     gst_caps_truncate (target);
   } else {
     /* need a copy, we'll be modifying it when fixating */
     target = gst_caps_copy (caps);
     gst_caps_unref (caps);
   }
+  GST_DEBUG_OBJECT (visual, "before fixate caps %" GST_PTR_FORMAT, target);
 
   /* fixate in case something is not fixed. This does nothing if the value is
    * already fixed. For video we always try to fixate to something like
@@ -422,7 +453,46 @@ gst_vis_src_negotiate (GstVisual * visual)
   gst_structure_fixate_field_nearest_fraction (structure, "framerate",
       DEFAULT_FPS_N, DEFAULT_FPS_D);
 
-  gst_pad_set_caps (visual->srcpad, target);
+  gst_pad_fixate_caps (visual->srcpad, target);
+
+  GST_DEBUG_OBJECT (visual, "after fixate caps %" GST_PTR_FORMAT, target);
+
+  gst_visual_src_setcaps (visual, target);
+
+  /* try to get a bufferpool now */
+  /* find a pool for the negotiated caps now */
+  query = gst_query_new_allocation (target, TRUE);
+
+  if (gst_pad_peer_query (visual->srcpad, query)) {
+    /* we got configuration from our peer, parse them */
+    gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
+        &alignment, &pool);
+  } else {
+    size = visual->outsize;
+    min = max = 0;
+    prefix = 0;
+    alignment = 0;
+  }
+
+  if (pool == NULL) {
+    GstStructure *config;
+
+    /* we did not get a pool, make one ourselves then */
+    pool = gst_buffer_pool_new ();
+
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_set (config, target, size, min, max, prefix,
+        alignment);
+    gst_buffer_pool_set_config (pool, config);
+  }
+
+  if (visual->pool)
+    gst_object_unref (visual->pool);
+  visual->pool = pool;
+
+  /* and activate */
+  gst_buffer_pool_set_active (pool, TRUE);
+
   gst_caps_unref (target);
 
   return TRUE;
@@ -454,29 +524,28 @@ gst_visual_sink_event (GstPad * pad, GstEvent * event)
       gst_visual_reset (visual);
       res = gst_pad_push_event (visual->srcpad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_CAPS:
     {
-      GstFormat format;
-      gdouble rate, arate;
-      gint64 start, stop, time;
-      gboolean update;
+      GstCaps *caps;
 
+      gst_event_parse_caps (event, &caps);
+      res = gst_visual_sink_setcaps (pad, caps);
+      gst_event_unref (event);
+      break;
+    }
+    case GST_EVENT_SEGMENT:
+    {
       /* the newsegment values are used to clip the input samples
        * and to convert the incomming timestamps to running time so
        * we can do QoS */
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
-
-      /* now configure the values */
-      gst_segment_set_newsegment_full (&visual->segment, update,
-          rate, arate, format, start, stop, time);
+      gst_event_copy_segment (event, &visual->segment);
 
       /* and forward */
       res = gst_pad_push_event (visual->srcpad, event);
       break;
     }
     default:
-      res = gst_pad_push_event (visual->srcpad, event);
+      res = gst_pad_event_default (pad, event);
       break;
   }
 
@@ -499,7 +568,7 @@ gst_visual_src_event (GstPad * pad, GstEvent * event)
       GstClockTimeDiff diff;
       GstClockTime timestamp;
 
-      gst_event_parse_qos (event, &proportion, &diff, &timestamp);
+      gst_event_parse_qos (event, NULL, &proportion, &diff, &timestamp);
 
       /* save stuff for the _chain function */
       GST_OBJECT_LOCK (visual);
@@ -516,8 +585,13 @@ gst_visual_src_event (GstPad * pad, GstEvent * event)
       res = gst_pad_push_event (visual->sinkpad, event);
       break;
     }
+    case GST_EVENT_RECONFIGURE:
+      /* dont't forward */
+      gst_event_unref (event);
+      res = TRUE;
+      break;
     default:
-      res = gst_pad_push_event (visual->sinkpad, event);
+      res = gst_pad_event_default (pad, event);
       break;
   }
 
@@ -553,7 +627,8 @@ gst_visual_src_query (GstPad * pad, GstQuery * query)
         /* the max samples we must buffer buffer */
         max_samples = MAX (VISUAL_SAMPLES, visual->spf);
         our_latency =
-            gst_util_uint64_scale_int (max_samples, GST_SECOND, visual->rate);
+            gst_util_uint64_scale_int (max_samples, GST_SECOND,
+            GST_AUDIO_INFO_RATE (&visual->info));
 
         GST_DEBUG_OBJECT (visual, "Our latency: %" GST_TIME_FORMAT,
             GST_TIME_ARGS (our_latency));
@@ -582,35 +657,22 @@ gst_visual_src_query (GstPad * pad, GstQuery * query)
   return res;
 }
 
-/* allocate and output buffer, if no format was negotiated, this
- * function will negotiate one. After calling this function, a
- * reverse negotiation could have happened. */
+/* Make sure we are negotiated */
 static GstFlowReturn
-get_buffer (GstVisual * visual, GstBuffer ** outbuf)
+ensure_negotiated (GstVisual * visual)
 {
-  GstFlowReturn ret;
+  gboolean reconfigure;
+
+  GST_OBJECT_LOCK (visual->srcpad);
+  reconfigure = GST_PAD_NEEDS_RECONFIGURE (visual->srcpad);
+  GST_OBJECT_FLAG_UNSET (visual->srcpad, GST_PAD_NEED_RECONFIGURE);
+  GST_OBJECT_UNLOCK (visual->srcpad);
 
   /* we don't know an output format yet, pick one */
-  if (GST_PAD_CAPS (visual->srcpad) == NULL) {
+  if (reconfigure || !gst_pad_has_current_caps (visual->srcpad)) {
     if (!gst_vis_src_negotiate (visual))
       return GST_FLOW_NOT_NEGOTIATED;
   }
-
-  GST_DEBUG_OBJECT (visual, "allocating output buffer with caps %"
-      GST_PTR_FORMAT, GST_PAD_CAPS (visual->srcpad));
-
-  /* now allocate a buffer with the last negotiated format. 
-   * Downstream could renegotiate a new format, which will trigger
-   * our setcaps function on the source pad. */
-  ret =
-      gst_pad_alloc_buffer_and_set_caps (visual->srcpad,
-      GST_BUFFER_OFFSET_NONE, visual->outsize,
-      GST_PAD_CAPS (visual->srcpad), outbuf);
-
-  /* no buffer allocated, we don't care why. */
-  if (ret != GST_FLOW_OK)
-    return ret;
-
   return GST_FLOW_OK;
 }
 
@@ -622,17 +684,15 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
   GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
   GstFlowReturn ret = GST_FLOW_OK;
   guint avail;
+  gint bpf, rate, channels;
 
   GST_DEBUG_OBJECT (visual, "chain function called");
 
-  /* If we don't have an output format yet, preallocate a buffer to try and
-   * set one */
-  if (GST_PAD_CAPS (visual->srcpad) == NULL) {
-    ret = get_buffer (visual, &outbuf);
-    if (ret != GST_FLOW_OK) {
-      gst_buffer_unref (buffer);
-      goto beach;
-    }
+  /* Make sure have an output format */
+  ret = ensure_negotiated (visual);
+  if (ret != GST_FLOW_OK) {
+    gst_buffer_unref (buffer);
+    goto beach;
   }
 
   /* resync on DISCONT */
@@ -640,9 +700,13 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
     gst_adapter_clear (visual->adapter);
   }
 
+  rate = GST_AUDIO_INFO_RATE (&visual->info);
+  bpf = GST_AUDIO_INFO_BPF (&visual->info);
+  channels = GST_AUDIO_INFO_CHANNELS (&visual->info);
+
   GST_DEBUG_OBJECT (visual,
       "Input buffer has %d samples, time=%" G_GUINT64_FORMAT,
-      GST_BUFFER_SIZE (buffer) / visual->bps, GST_BUFFER_TIMESTAMP (buffer));
+      gst_buffer_get_size (buffer) / bpf, GST_BUFFER_TIMESTAMP (buffer));
 
   gst_adapter_push (visual->adapter, buffer);
 
@@ -650,6 +714,8 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
     gboolean need_skip;
     const guint16 *data;
     guint64 dist, timestamp;
+    guint8 *outdata;
+    gsize outsize;
 
     GST_DEBUG_OBJECT (visual, "processing buffer");
 
@@ -657,19 +723,19 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
     GST_DEBUG_OBJECT (visual, "avail now %u", avail);
 
     /* we need at least VISUAL_SAMPLES samples */
-    if (avail < VISUAL_SAMPLES * visual->bps)
+    if (avail < VISUAL_SAMPLES * bpf)
       break;
 
     /* we need at least enough samples to make one frame */
-    if (avail < visual->spf * visual->bps)
+    if (avail < visual->spf * bpf)
       break;
 
     /* get timestamp of the current adapter byte */
     timestamp = gst_adapter_prev_timestamp (visual->adapter, &dist);
     if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
       /* convert bytes to time */
-      dist /= visual->bps;
-      timestamp += gst_util_uint64_scale_int (dist, GST_SECOND, visual->rate);
+      dist /= bpf;
+      timestamp += gst_util_uint64_scale_int (dist, GST_SECOND, rate);
     }
 
     if (timestamp != -1) {
@@ -696,19 +762,19 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
 
     /* Read VISUAL_SAMPLES samples per channel */
     data =
-        (const guint16 *) gst_adapter_peek (visual->adapter,
-        VISUAL_SAMPLES * visual->bps);
+        (const guint16 *) gst_adapter_map (visual->adapter,
+        VISUAL_SAMPLES * bpf);
 
 #if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
     {
       VisBuffer *lbuf, *rbuf;
       guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
-      VisAudioSampleRateType rate;
+      VisAudioSampleRateType vrate;
 
       lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
       rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
 
-      if (visual->channels == 2) {
+      if (channels == 2) {
         for (i = 0; i < VISUAL_SAMPLES; i++) {
           ldata[i] = *data++;
           rdata[i] = *data++;
@@ -720,32 +786,32 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
         }
       }
 
-      switch (visual->rate) {
+      switch (rate) {
         case 8000:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_8000;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_8000;
           break;
         case 11250:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_11250;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_11250;
           break;
         case 22500:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_22500;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_22500;
           break;
         case 32000:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_32000;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_32000;
           break;
         case 44100:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_44100;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_44100;
           break;
         case 48000:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_48000;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_48000;
           break;
         case 96000:
-          rate = VISUAL_AUDIO_SAMPLE_RATE_96000;
+          vrate = VISUAL_AUDIO_SAMPLE_RATE_96000;
           break;
         default:
           visual_object_unref (VISUAL_OBJECT (lbuf));
           visual_object_unref (VISUAL_OBJECT (rbuf));
-          GST_ERROR_OBJECT (visual, "unsupported rate %d", visual->rate);
+          GST_ERROR_OBJECT (visual, "unsupported rate %d", rate);
           ret = GST_FLOW_ERROR;
           goto beach;
           break;
@@ -753,10 +819,10 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
 
       visual_audio_samplepool_input_channel (visual->audio->samplepool,
           lbuf,
-          rate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
+          vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
           (char *) VISUAL_AUDIO_CHANNEL_LEFT);
       visual_audio_samplepool_input_channel (visual->audio->samplepool, rbuf,
-          rate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
+          vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
           (char *) VISUAL_AUDIO_CHANNEL_RIGHT);
 
       visual_object_unref (VISUAL_OBJECT (lbuf));
@@ -780,17 +846,23 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
     /* alloc a buffer if we don't have one yet, this happens
      * when we pushed a buffer in this while loop before */
     if (outbuf == NULL) {
-      ret = get_buffer (visual, &outbuf);
+      GST_DEBUG_OBJECT (visual, "allocating output buffer");
+      ret = gst_buffer_pool_acquire_buffer (visual->pool, &outbuf, NULL);
       if (ret != GST_FLOW_OK) {
+        gst_adapter_unmap (visual->adapter, 0);
         goto beach;
       }
     }
-    visual_video_set_buffer (visual->video, GST_BUFFER_DATA (outbuf));
+    outdata = gst_buffer_map (outbuf, &outsize, NULL, GST_MAP_WRITE);
+    visual_video_set_buffer (visual->video, outdata);
     visual_audio_analyze (visual->audio);
     visual_actor_run (visual->actor, visual->audio);
     visual_video_set_buffer (visual->video, NULL);
+    gst_buffer_unmap (outbuf, outdata, outsize);
     GST_DEBUG_OBJECT (visual, "rendered one frame");
 
+    gst_adapter_unmap (visual->adapter, 0);
+
     GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
     GST_BUFFER_DURATION (outbuf) = visual->duration;
 
@@ -802,7 +874,7 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
         visual->spf);
 
     /* Flush out the number of samples per frame */
-    gst_adapter_flush (visual->adapter, visual->spf * visual->bps);
+    gst_adapter_flush (visual->adapter, visual->spf * bpf);
 
     /* quit the loop if something was wrong */
     if (ret != GST_FLOW_OK)
@@ -856,6 +928,11 @@ gst_visual_change_state (GstElement * element, GstStateChange transition)
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
+      if (visual->pool) {
+        gst_buffer_pool_set_active (visual->pool, FALSE);
+        gst_object_unref (visual->pool);
+        visual->pool = NULL;
+      }
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_visual_clear_actors (visual);
index 2851e52..3a2b892 100644 (file)
@@ -164,7 +164,6 @@ gst_ogg_avi_parse_init (GstOggAviParse * ogg)
   ogg->sinkpad =
       gst_pad_new_from_static_template (&ogg_avi_parse_sink_template_factory,
       "sink");
-  gst_pad_set_setcaps_function (ogg->sinkpad, gst_ogg_avi_parse_setcaps);
   gst_pad_set_event_function (ogg->sinkpad, gst_ogg_avi_parse_event);
   gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_avi_parse_chain);
   gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
@@ -196,8 +195,8 @@ gst_ogg_avi_parse_setcaps (GstPad * pad, GstCaps * caps)
   GstStructure *structure;
   const GValue *codec_data;
   GstBuffer *buffer;
-  guint8 *data;
-  guint size;
+  guint8 *data, *ptr;
+  gsize size, left;
   guint32 sizes[3];
   GstCaps *outcaps;
   gint i, offs;
@@ -221,36 +220,39 @@ gst_ogg_avi_parse_setcaps (GstPad * pad, GstCaps * caps)
   /* first 22 bytes are bits_per_sample, channel_mask, GUID
    * Then we get 3 LE guint32 with the 3 header sizes
    * then we get the bytes of the 3 headers. */
-  data = GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer);
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+
+  ptr = data;
+  left = size;
 
-  GST_LOG_OBJECT (ogg, "configuring codec_data of size %u", size);
+  GST_LOG_OBJECT (ogg, "configuring codec_data of size %" G_GSIZE_FORMAT, left);
 
   /* skip headers */
-  data += 22;
-  size -= 22;
+  ptr += 22;
+  left -= 22;
 
   /* we need at least 12 bytes for the packet sizes of the 3 headers */
-  if (size < 12)
+  if (left < 12)
     goto buffer_too_small;
 
   /* read sizes of the 3 headers */
-  sizes[0] = GST_READ_UINT32_LE (data);
-  sizes[1] = GST_READ_UINT32_LE (data + 4);
-  sizes[2] = GST_READ_UINT32_LE (data + 8);
+  sizes[0] = GST_READ_UINT32_LE (ptr);
+  sizes[1] = GST_READ_UINT32_LE (ptr + 4);
+  sizes[2] = GST_READ_UINT32_LE (ptr + 8);
 
   GST_DEBUG_OBJECT (ogg, "header sizes: %u %u %u", sizes[0], sizes[1],
       sizes[2]);
 
-  size -= 12;
+  left -= 12;
 
   /* and we need at least enough data for all the headers */
-  if (size < sizes[0] + sizes[1] + sizes[2])
+  if (left < sizes[0] + sizes[1] + sizes[2])
     goto buffer_too_small;
 
   /* set caps */
   outcaps = gst_caps_new_simple ("audio/x-vorbis", NULL);
-  gst_pad_set_caps (ogg->srcpad, outcaps);
+  gst_pad_push_event (ogg->srcpad, gst_event_new_caps (outcaps));
+  gst_caps_unref (outcaps);
 
   /* copy header data */
   offs = 34;
@@ -258,13 +260,12 @@ gst_ogg_avi_parse_setcaps (GstPad * pad, GstCaps * caps)
     GstBuffer *out;
 
     /* now output the raw vorbis header packets */
-    out = gst_buffer_create_sub (buffer, offs, sizes[i]);
-    gst_buffer_set_caps (out, outcaps);
+    out = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offs, sizes[i]);
     gst_pad_push (ogg->srcpad, out);
 
     offs += sizes[i];
   }
-  gst_caps_unref (outcaps);
+  gst_buffer_unmap (buffer, data, size);
 
   return TRUE;
 
@@ -282,6 +283,7 @@ wrong_format:
 buffer_too_small:
   {
     GST_DEBUG_OBJECT (ogg, "codec_data is too small");
+    gst_buffer_unmap (buffer, data, size);
     return FALSE;
   }
 }
@@ -295,6 +297,15 @@ gst_ogg_avi_parse_event (GstPad * pad, GstEvent * event)
   ogg = GST_OGG_AVI_PARSE (GST_OBJECT_PARENT (pad));
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_ogg_avi_parse_setcaps (pad, caps);
+      gst_event_unref (event);
+      break;
+    }
     case GST_EVENT_FLUSH_START:
       ret = gst_pad_push_event (ogg->srcpad, event);
       break;
@@ -319,7 +330,7 @@ gst_ogg_avi_parse_push_packet (GstOggAviParse * ogg, ogg_packet * packet)
 
   /* allocate space for header and body */
   buffer = gst_buffer_new_and_alloc (packet->bytes);
-  memcpy (GST_BUFFER_DATA (buffer), packet->packet, packet->bytes);
+  gst_buffer_fill (buffer, 0, packet->packet, packet->bytes);
 
   GST_LOG_OBJECT (ogg, "created buffer %p from page", buffer);
 
@@ -340,15 +351,13 @@ gst_ogg_avi_parse_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstFlowReturn result = GST_FLOW_OK;
   GstOggAviParse *ogg;
-  guint8 *data;
   guint size;
   gchar *oggbuf;
   gint ret = -1;
 
   ogg = GST_OGG_AVI_PARSE (GST_OBJECT_PARENT (pad));
 
-  data = GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer);
+  size = gst_buffer_get_size (buffer);
 
   GST_LOG_OBJECT (ogg, "Chain function received buffer of size %d", size);
 
@@ -359,7 +368,7 @@ gst_ogg_avi_parse_chain (GstPad * pad, GstBuffer * buffer)
 
   /* write data to sync layer */
   oggbuf = ogg_sync_buffer (&ogg->sync, size);
-  memcpy (oggbuf, data, size);
+  gst_buffer_extract (buffer, 0, oggbuf, size);
   ogg_sync_wrote (&ogg->sync, size);
   gst_buffer_unref (buffer);
 
index ff05c82..ac904e9 100644 (file)
@@ -114,7 +114,6 @@ static void gst_ogg_pad_finalize (GObject * object);
 static const GstQueryType *gst_ogg_pad_query_types (GstPad * pad);
 static gboolean gst_ogg_pad_src_query (GstPad * pad, GstQuery * query);
 static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event);
-static GstCaps *gst_ogg_pad_getcaps (GstPad * pad);
 static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain,
     guint32 serialno);
 
@@ -144,12 +143,11 @@ gst_ogg_pad_init (GstOggPad * pad)
 {
   gst_pad_set_event_function (GST_PAD (pad),
       GST_DEBUG_FUNCPTR (gst_ogg_pad_event));
-  gst_pad_set_getcaps_function (GST_PAD (pad),
-      GST_DEBUG_FUNCPTR (gst_ogg_pad_getcaps));
   gst_pad_set_query_type_function (GST_PAD (pad),
       GST_DEBUG_FUNCPTR (gst_ogg_pad_query_types));
   gst_pad_set_query_function (GST_PAD (pad),
       GST_DEBUG_FUNCPTR (gst_ogg_pad_src_query));
+  gst_pad_use_fixed_caps (GST_PAD (pad));
 
   pad->mode = GST_OGG_PAD_MODE_INIT;
 
@@ -158,7 +156,7 @@ gst_ogg_pad_init (GstOggPad * pad)
 
   pad->start_time = GST_CLOCK_TIME_NONE;
 
-  pad->last_stop = GST_CLOCK_TIME_NONE;
+  pad->position = GST_CLOCK_TIME_NONE;
 
   pad->have_type = FALSE;
   pad->continued = NULL;
@@ -226,12 +224,6 @@ gst_ogg_pad_query_types (GstPad * pad)
   return query_types;
 }
 
-static GstCaps *
-gst_ogg_pad_getcaps (GstPad * pad)
-{
-  return gst_caps_ref (GST_PAD_CAPS (pad));
-}
-
 static gboolean
 gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
 {
@@ -412,7 +404,7 @@ gst_ogg_pad_reset (GstOggPad * pad)
   pad->continued = NULL;
 
   pad->last_ret = GST_FLOW_OK;
-  pad->last_stop = GST_CLOCK_TIME_NONE;
+  pad->position = GST_CLOCK_TIME_NONE;
   pad->current_granule = -1;
   pad->keyframe_granule = -1;
   pad->is_eos = FALSE;
@@ -574,14 +566,14 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
     goto not_added;
 
   buf = gst_buffer_new_and_alloc (packet->bytes - offset - trim);
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
 
   /* set delta flag for OGM content */
   if (delta_unit)
     GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
 
   /* copy packet in buffer */
-  memcpy (buf->data, packet->packet + offset, packet->bytes - offset - trim);
+  gst_buffer_fill (buf, 0, packet->packet + offset,
+      packet->bytes - offset - trim);
 
   GST_BUFFER_TIMESTAMP (buf) = out_timestamp;
   GST_BUFFER_DURATION (buf) = out_duration;
@@ -594,7 +586,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
     pad->discont = FALSE;
   }
 
-  pad->last_stop = ogg->segment.last_stop;
+  pad->position = ogg->segment.position;
 
   /* don't push the header packets when we are asked to skip them */
   if (!packet->b_o_s || push_headers) {
@@ -611,7 +603,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
 
   /* check if valid granulepos, then we can calculate the current
    * position. We know the granule for each packet but we only want to update
-   * the last_stop when we have a valid granulepos on the packet because else
+   * the position when we have a valid granulepos on the packet because else
    * our time jumps around for the different streams. */
   if (packet->granulepos < 0)
     goto done;
@@ -631,7 +623,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
   }
 
   /* and store as the current position */
-  gst_segment_set_last_stop (&ogg->segment, GST_FORMAT_TIME, current_time);
+  ogg->segment.position = current_time;
 
   GST_DEBUG_OBJECT (ogg, "ogg current time %" GST_TIME_FORMAT,
       GST_TIME_ARGS (current_time));
@@ -865,6 +857,7 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
 
         if (start_time != G_MAXUINT64) {
           gint64 segment_time;
+          GstSegment segment;
 
           GST_DEBUG_OBJECT (ogg, "start_time:  %" GST_TIME_FORMAT,
               GST_TIME_ARGS (start_time));
@@ -876,8 +869,13 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
             segment_time = chain->begin_time;
 
           /* create the newsegment event we are going to send out */
-          event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
-              GST_FORMAT_TIME, start_time, chain->segment_stop, segment_time);
+          gst_segment_init (&segment, GST_FORMAT_TIME);
+          segment.rate = ogg->segment.rate;
+          segment.applied_rate = ogg->segment.applied_rate;
+          segment.start = start_time;
+          segment.stop = chain->segment_stop;
+          segment.time = segment_time;
+          event = gst_event_new_segment (&segment);
 
           ogg->resync = FALSE;
         }
@@ -885,6 +883,7 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
         /* see if we have enough info to activate the chain, we have enough info
          * when all streams have a valid start time. */
         if (gst_ogg_demux_collect_chain_info (ogg, chain)) {
+          GstSegment segment;
 
           GST_DEBUG_OBJECT (ogg, "segment_start: %" GST_TIME_FORMAT,
               GST_TIME_ARGS (chain->segment_start));
@@ -894,9 +893,13 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
               GST_TIME_ARGS (chain->begin_time));
 
           /* create the newsegment event we are going to send out */
-          event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
-              GST_FORMAT_TIME, chain->segment_start, chain->segment_stop,
-              chain->begin_time);
+          gst_segment_init (&segment, GST_FORMAT_TIME);
+          segment.rate = ogg->segment.rate;
+          segment.applied_rate = ogg->segment.applied_rate;
+          segment.start = chain->segment_start;
+          segment.stop = chain->segment_stop;
+          segment.time = chain->begin_time;
+          event = gst_event_new_segment (&segment);
         }
       }
 
@@ -1157,8 +1160,7 @@ gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
 
   ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
   /* we own this one */
-  gst_object_ref (ret);
-  gst_object_sink (ret);
+  gst_object_ref_sink (ret);
 
   GST_PAD_DIRECTION (ret) = GST_PAD_SRC;
   gst_ogg_pad_mark_discont (ret);
@@ -1184,6 +1186,7 @@ gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
       "created new ogg src %p for stream with serial %08x", ret, serialno);
 
   g_array_append_val (chain->streams, ret);
+  gst_pad_set_active (GST_PAD_CAST (ret), TRUE);
 
   return ret;
 
@@ -1264,29 +1267,24 @@ static gboolean gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event);
 
 static void gst_ogg_print (GstOggDemux * demux);
 
-GST_BOILERPLATE (GstOggDemux, gst_ogg_demux, GstElement, GST_TYPE_ELEMENT);
+#define gst_ogg_demux_parent_class parent_class
+G_DEFINE_TYPE (GstOggDemux, gst_ogg_demux, GST_TYPE_ELEMENT);
 
 static void
-gst_ogg_demux_base_init (gpointer g_class)
+gst_ogg_demux_class_init (GstOggDemuxClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  gst_element_class_set_details_simple (element_class,
+  gst_element_class_set_details_simple (gstelement_class,
       "Ogg demuxer", "Codec/Demuxer",
       "demux ogg streams (info about ogg: http://xiph.org)",
       "Wim Taymans <wim@fluendo.com>");
 
-  gst_element_class_add_pad_template (element_class,
+  gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&ogg_demux_sink_template_factory));
-  gst_element_class_add_pad_template (element_class,
+  gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&ogg_demux_src_template_factory));
-}
-
-static void
-gst_ogg_demux_class_init (GstOggDemuxClass * klass)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
   gstelement_class->change_state = gst_ogg_demux_change_state;
   gstelement_class->send_event = gst_ogg_demux_receive_event;
@@ -1295,7 +1293,7 @@ gst_ogg_demux_class_init (GstOggDemuxClass * klass)
 }
 
 static void
-gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class)
+gst_ogg_demux_init (GstOggDemux * ogg)
 {
   /* create the sink pad */
   ogg->sinkpad =
@@ -1373,7 +1371,7 @@ gst_ogg_demux_sink_event (GstPad * pad, GstEvent * event)
       res = gst_ogg_demux_send_event (ogg, event);
       gst_ogg_demux_reset_streams (ogg);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
       GST_DEBUG_OBJECT (ogg, "got a new segment event");
       gst_event_unref (event);
       res = TRUE;
@@ -1401,15 +1399,12 @@ gst_ogg_demux_sink_event (GstPad * pad, GstEvent * event)
 static GstFlowReturn
 gst_ogg_demux_submit_buffer (GstOggDemux * ogg, GstBuffer * buffer)
 {
-  gint size;
-  guint8 *data;
+  gsize size;
   gchar *oggbuffer;
   GstFlowReturn ret = GST_FLOW_OK;
 
-  size = GST_BUFFER_SIZE (buffer);
-  data = GST_BUFFER_DATA (buffer);
-
-  GST_DEBUG_OBJECT (ogg, "submitting %u bytes", size);
+  size = gst_buffer_get_size (buffer);
+  GST_DEBUG_OBJECT (ogg, "submitting %" G_GSIZE_FORMAT " bytes", size);
   if (G_UNLIKELY (size == 0))
     goto done;
 
@@ -1417,7 +1412,8 @@ gst_ogg_demux_submit_buffer (GstOggDemux * ogg, GstBuffer * buffer)
   if (G_UNLIKELY (oggbuffer == NULL))
     goto no_buffer;
 
-  memcpy (oggbuffer, data, size);
+  gst_buffer_extract (buffer, 0, oggbuffer, size);
+
   if (G_UNLIKELY (ogg_sync_wrote (&ogg->sync, size) < 0))
     goto write_failed;
 
@@ -1436,8 +1432,8 @@ no_buffer:
   }
 write_failed:
   {
-    GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
-        (NULL), ("failed to write %d bytes to the sync buffer", size));
+    GST_ELEMENT_ERROR (ogg, STREAM, DECODE, (NULL),
+        ("failed to write %" G_GSIZE_FORMAT " bytes to the sync buffer", size));
     ret = GST_FLOW_ERROR;
     goto done;
   }
@@ -1480,7 +1476,7 @@ gst_ogg_demux_get_data (GstOggDemux * ogg, gint64 end_offset)
   if (ret != GST_FLOW_OK)
     goto error;
 
-  ogg->read_offset += GST_BUFFER_SIZE (buffer);
+  ogg->read_offset += gst_buffer_get_size (buffer);
 
   ret = gst_ogg_demux_submit_buffer (ogg, buffer);
 
@@ -1726,7 +1722,7 @@ gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg, GstCaps * caps,
     ogg_packet *op = headers->data;
     g_assert (op);
     buffer = gst_buffer_new_and_alloc (op->bytes);
-    memcpy (GST_BUFFER_DATA (buffer), op->packet, op->bytes);
+    gst_buffer_fill (buffer, 0, op->packet, op->bytes);
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
     g_value_init (&value, GST_TYPE_BUFFER);
     gst_value_take_buffer (&value, buffer);
@@ -1777,7 +1773,8 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
     gst_ogg_pad_mark_discont (pad);
     pad->last_ret = GST_FLOW_OK;
 
-    if (pad->map.is_skeleton || pad->added || GST_PAD_CAPS (pad) == NULL)
+    if (pad->map.is_skeleton || pad->added
+        || !gst_pad_has_current_caps (GST_PAD_CAST (pad)))
       continue;
 
     GST_DEBUG_OBJECT (ogg, "adding pad %" GST_PTR_FORMAT, pad);
@@ -2049,7 +2046,7 @@ gst_ogg_demux_do_seek (GstOggDemux * ogg, GstSegment * segment,
   gint i, pending, len;
   gboolean first_parsed_page = TRUE;
 
-  position = segment->last_stop;
+  position = segment->position;
 
   /* first find the chain to search in */
   total = ogg->total_time;
@@ -2204,7 +2201,7 @@ done:
   if (keyframe) {
     if (segment->rate > 0.0)
       segment->time = keytarget;
-    segment->last_stop = keytarget - begintime;
+    segment->position = keytarget - begintime;
   }
 
   *rchain = chain;
@@ -2302,28 +2299,8 @@ gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event)
    * forever. */
   GST_PAD_STREAM_LOCK (ogg->sinkpad);
 
-  if (ogg->segment_running && !flush) {
-    /* create the segment event to close the current segment */
-    if ((chain = ogg->current_chain)) {
-      GstEvent *newseg;
-      gint64 chain_start = 0;
-
-      if (chain->segment_start != GST_CLOCK_TIME_NONE)
-        chain_start = chain->segment_start;
-
-      newseg = gst_event_new_new_segment (TRUE, ogg->segment.rate,
-          GST_FORMAT_TIME, ogg->segment.start + chain_start,
-          ogg->segment.last_stop + chain_start, ogg->segment.time);
-      /* set the seqnum of the running segment */
-      gst_event_set_seqnum (newseg, ogg->seqnum);
-
-      /* send segment on old chain, FIXME, must be sent from streaming thread. */
-      gst_ogg_demux_send_event (ogg, newseg);
-    }
-  }
-
   if (event) {
-    gst_segment_set_seek (&ogg->segment, rate, format, flags,
+    gst_segment_do_seek (&ogg->segment, rate, format, flags,
         cur_type, cur, stop_type, stop, &update);
   }
 
@@ -2334,7 +2311,7 @@ gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event)
   /* we need to stop flushing on the srcpad as we're going to use it
    * next. We can do this as we have the STREAM lock now. */
   if (flush) {
-    tevent = gst_event_new_flush_stop ();
+    tevent = gst_event_new_flush_stop (TRUE);
     gst_event_set_seqnum (tevent, seqnum);
     gst_pad_push_event (ogg->sinkpad, tevent);
   }
@@ -2370,11 +2347,12 @@ gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event)
     GstEvent *event;
     gint64 stop;
     gint64 start;
-    gint64 last_stop, begin_time;
+    gint64 position, begin_time;
+    GstSegment segment;
 
     /* we have to send the flush to the old chain, not the new one */
     if (flush) {
-      tevent = gst_event_new_flush_stop ();
+      tevent = gst_event_new_flush_stop (TRUE);
       gst_event_set_seqnum (tevent, seqnum);
       gst_ogg_demux_send_event (ogg, tevent);
     }
@@ -2407,18 +2385,21 @@ gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event)
       stop = MIN (stop, chain->segment_stop);
     }
 
-    last_stop = ogg->segment.last_stop;
+    position = ogg->segment.position;
     if (chain->segment_start != GST_CLOCK_TIME_NONE)
-      last_stop += chain->segment_start;
+      position += chain->segment_start;
 
-    /* create the segment event we are going to send out */
-    if (ogg->segment.rate >= 0.0)
-      event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
-          ogg->segment.format, last_stop, stop, ogg->segment.time);
-    else
-      event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
-          ogg->segment.format, start, last_stop, ogg->segment.time);
+    gst_segment_copy_into (&ogg->segment, &segment);
 
+    /* create the segment event we are going to send out */
+    if (ogg->segment.rate >= 0.0) {
+      segment.start = position;
+      segment.stop = stop;
+    } else {
+      segment.start = start;
+      segment.stop = position;
+    }
+    event = gst_event_new_segment (&segment);
     gst_event_set_seqnum (event, seqnum);
 
     if (chain != ogg->current_chain) {
@@ -2438,13 +2419,12 @@ gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event)
       GstMessage *message;
 
       message = gst_message_new_segment_start (GST_OBJECT (ogg),
-          GST_FORMAT_TIME, ogg->segment.last_stop);
+          GST_FORMAT_TIME, ogg->segment.position);
       gst_message_set_seqnum (message, seqnum);
 
       gst_element_post_message (GST_ELEMENT (ogg), message);
     }
 
-    ogg->segment_running = TRUE;
     ogg->seqnum = seqnum;
     /* restart our task since it might have been stopped when we did the 
      * flush. */
@@ -2945,7 +2925,7 @@ gst_ogg_demux_collect_info (GstOggDemux * ogg)
 
     ogg->total_time += chain->total_time;
   }
-  gst_segment_set_duration (&ogg->segment, GST_FORMAT_TIME, ogg->total_time);
+  ogg->segment.duration = ogg->total_time;
 }
 
 /* find all the chains in the ogg file, this reads the first and
@@ -2957,7 +2937,6 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg)
 {
   ogg_page og;
   GstPad *peer;
-  GstFormat format;
   gboolean res;
   guint32 serialno;
   GstOggChain *chain;
@@ -2968,8 +2947,7 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg)
     goto no_peer;
 
   /* find length to read last page, we store this for later use. */
-  format = GST_FORMAT_BYTES;
-  res = gst_pad_query_duration (peer, &format, &ogg->length);
+  res = gst_pad_query_duration (peer, GST_FORMAT_BYTES, &ogg->length);
   gst_object_unref (peer);
   if (!res || ogg->length <= 0)
     goto no_length;
@@ -3068,13 +3046,17 @@ gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
     if (chain) {
       GstEvent *event;
       gint64 start = 0;
+      GstSegment segment;
 
       if (chain->segment_start != GST_CLOCK_TIME_NONE)
         start = chain->segment_start;
 
       /* create the newsegment event we are going to send out */
-      event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
-          GST_FORMAT_TIME, start, chain->segment_stop, chain->begin_time);
+      gst_segment_copy_into (&ogg->segment, &segment);
+      segment.start = start;
+      segment.stop = chain->segment_stop;
+      segment.time = chain->begin_time;
+      event = gst_event_new_segment (&segment);
       gst_event_set_seqnum (event, ogg->seqnum);
 
       GST_DEBUG_OBJECT (ogg,
@@ -3095,7 +3077,7 @@ gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
       if (ogg->pullmode)
         goto unknown_chain;
 
-      current_time = ogg->segment.last_stop;
+      current_time = ogg->segment.position;
 
       /* time of new chain is current time */
       chain_time = current_time;
@@ -3273,7 +3255,7 @@ gst_ogg_demux_loop_forward (GstOggDemux * ogg)
     goto done;
   }
 
-  ogg->offset += GST_BUFFER_SIZE (buffer);
+  ogg->offset += gst_buffer_get_size (buffer);
 
   if (G_UNLIKELY (ogg->newsegment)) {
     gst_ogg_demux_send_event (ogg, ogg->newsegment);
@@ -3352,7 +3334,7 @@ gst_ogg_demux_sync_streams (GstOggDemux * ogg)
   guint i;
 
   chain = ogg->current_chain;
-  cur = ogg->segment.last_stop;
+  cur = ogg->segment.position;
   if (chain == NULL || cur == -1)
     return;
 
@@ -3362,18 +3344,24 @@ gst_ogg_demux_sync_streams (GstOggDemux * ogg)
     /* Theoretically, we should be doing this for all streams, but we're only
      * doing it for known-to-be-sparse streams at the moment in order not to
      * break things for wrongly-muxed streams (like we used to produce once) */
-    if (stream->map.is_sparse && stream->last_stop != GST_CLOCK_TIME_NONE) {
+    if (stream->map.is_sparse && stream->position != GST_CLOCK_TIME_NONE) {
 
       /* Does this stream lag? Random threshold of 2 seconds */
-      if (GST_CLOCK_DIFF (stream->last_stop, cur) > (2 * GST_SECOND)) {
+      if (GST_CLOCK_DIFF (stream->position, cur) > (2 * GST_SECOND)) {
         GST_DEBUG_OBJECT (stream, "synchronizing stream with others by "
             "advancing time from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
-            GST_TIME_ARGS (stream->last_stop), GST_TIME_ARGS (cur));
-        stream->last_stop = cur;
+            GST_TIME_ARGS (stream->position), GST_TIME_ARGS (cur));
+
+        stream->position = cur;
+
+#if 0
+        ogg->segment.base += cur - stream->position;
         /* advance stream time (FIXME: is this right, esp. time_pos?) */
         gst_pad_push_event (GST_PAD_CAST (stream),
             gst_event_new_new_segment (TRUE, ogg->segment.rate,
-                GST_FORMAT_TIME, stream->last_stop, -1, stream->last_stop));
+                ogg->segment.applied_rate,
+                GST_FORMAT_TIME, stream->position, -1, stream->position));
+#endif
       }
     }
   }
@@ -3451,7 +3439,6 @@ pause:
     GstEvent *event = NULL;
 
     GST_LOG_OBJECT (ogg, "pausing task, reason %s", reason);
-    ogg->segment_running = FALSE;
     gst_pad_pause_task (ogg->sinkpad);
 
     if (ret == GST_FLOW_UNEXPECTED) {
@@ -3523,10 +3510,26 @@ gst_ogg_demux_clear_chains (GstOggDemux * ogg)
 static gboolean
 gst_ogg_demux_sink_activate (GstPad * sinkpad)
 {
-  if (gst_pad_check_pull_range (sinkpad)) {
-    GST_DEBUG_OBJECT (sinkpad, "activating pull");
-    return gst_pad_activate_pull (sinkpad, TRUE);
-  } else {
+  GstQuery *query;
+  gboolean pull_mode;
+
+  query = gst_query_new_scheduling ();
+
+  if (!gst_pad_peer_query (sinkpad, query)) {
+    gst_query_unref (query);
+    goto activate_push;
+  }
+
+  gst_query_parse_scheduling (query, &pull_mode, NULL, NULL, NULL, NULL, NULL);
+
+  if (!pull_mode)
+    goto activate_push;
+
+  GST_DEBUG_OBJECT (sinkpad, "activating pull");
+  return gst_pad_activate_pull (sinkpad, TRUE);
+
+activate_push:
+  {
     GST_DEBUG_OBJECT (sinkpad, "activating push");
     return gst_pad_activate_push (sinkpad, TRUE);
   }
@@ -3585,7 +3588,6 @@ gst_ogg_demux_change_state (GstElement * element, GstStateChange transition)
       ogg_sync_reset (&ogg->sync);
       ogg->running = FALSE;
       ogg->bitrate = 0;
-      ogg->segment_running = FALSE;
       ogg->total_time = -1;
       gst_segment_init (&ogg->segment, GST_FORMAT_TIME);
       break;
@@ -3595,7 +3597,7 @@ gst_ogg_demux_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  result = parent_class->change_state (element, transition);
+  result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
@@ -3604,7 +3606,6 @@ gst_ogg_demux_change_state (GstElement * element, GstStateChange transition)
       gst_ogg_demux_clear_chains (ogg);
       GST_OBJECT_LOCK (ogg);
       ogg->running = FALSE;
-      ogg->segment_running = FALSE;
       GST_OBJECT_UNLOCK (ogg);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
index 031627b..2a0ba2b 100644 (file)
@@ -103,7 +103,7 @@ struct _GstOggPad
   gint64 first_granule;         /* the granulepos of first page == first sample in next page */
   GstClockTime first_time;      /* the timestamp of the second page or granuletime of first page */
 
-  GstClockTime last_stop;       /* last_stop when last push occured; used to detect when we
+  GstClockTime position;        /* position when last push occured; used to detect when we
                                  * need to send a newsegment update event for sparse streams */
 
   GList *continued;
@@ -152,7 +152,6 @@ struct _GstOggDemux
 
   /* playback start/stop positions */
   GstSegment segment;
-  gboolean segment_running;
   guint32  seqnum;
 
   GstEvent *event;
index f039efc..f153c98 100644 (file)
@@ -27,7 +27,7 @@
  * <refsect2>
  * <title>Example pipelines</title>
  * |[
- * gst-launch v4l2src num-buffers=500 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=video.ogg
+ * gst-launch v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! videoconvert ! theoraenc ! oggmux ! filesink location=video.ogg
  * ]| Encodes a video stream captured from a v4l2-compatible camera to Ogg/Theora
  * (the encoding will stop automatically after 500 frames)
  * </refsect2>
@@ -107,16 +107,13 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d",
         "subtitle/x-kate; application/x-kate")
     );
 
-static void gst_ogg_mux_base_init (gpointer g_class);
-static void gst_ogg_mux_class_init (GstOggMuxClass * klass);
-static void gst_ogg_mux_init (GstOggMux * ogg_mux);
 static void gst_ogg_mux_finalize (GObject * object);
 
 static GstFlowReturn
 gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux);
 static gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event);
 static GstPad *gst_ogg_mux_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name);
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
 static void gst_ogg_mux_release_pad (GstElement * element, GstPad * pad);
 
 static void gst_ogg_mux_set_property (GObject * object,
@@ -126,57 +123,10 @@ static void gst_ogg_mux_get_property (GObject * object,
 static GstStateChangeReturn gst_ogg_mux_change_state (GstElement * element,
     GstStateChange transition);
 
-static GstElementClass *parent_class = NULL;
-
 /*static guint gst_ogg_mux_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_ogg_mux_get_type (void)
-{
-  static GType ogg_mux_type = 0;
-
-  if (G_UNLIKELY (ogg_mux_type == 0)) {
-    static const GTypeInfo ogg_mux_info = {
-      sizeof (GstOggMuxClass),
-      gst_ogg_mux_base_init,
-      NULL,
-      (GClassInitFunc) gst_ogg_mux_class_init,
-      NULL,
-      NULL,
-      sizeof (GstOggMux),
-      0,
-      (GInstanceInitFunc) gst_ogg_mux_init,
-    };
-    static const GInterfaceInfo preset_info = {
-      NULL,
-      NULL,
-      NULL
-    };
-
-    ogg_mux_type =
-        g_type_register_static (GST_TYPE_ELEMENT, "GstOggMux", &ogg_mux_info,
-        0);
-
-    g_type_add_interface_static (ogg_mux_type, GST_TYPE_PRESET, &preset_info);
-  }
-  return ogg_mux_type;
-}
-
-static void
-gst_ogg_mux_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
-
-  gst_element_class_set_details_simple (element_class,
-      "Ogg muxer", "Codec/Muxer",
-      "mux ogg streams (info about ogg: http://xiph.org)",
-      "Wim Taymans <wim@fluendo.com>");
-}
+#define gst_ogg_mux_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstOggMux, gst_ogg_mux, GST_TYPE_ELEMENT,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
 
 static void
 gst_ogg_mux_class_init (GstOggMuxClass * klass)
@@ -187,12 +137,20 @@ gst_ogg_mux_class_init (GstOggMuxClass * klass)
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  parent_class = g_type_class_peek_parent (klass);
-
   gobject_class->finalize = gst_ogg_mux_finalize;
   gobject_class->get_property = gst_ogg_mux_get_property;
   gobject_class->set_property = gst_ogg_mux_set_property;
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sink_factory));
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "Ogg muxer", "Codec/Muxer",
+      "mux ogg streams (info about ogg: http://xiph.org)",
+      "Wim Taymans <wim@fluendo.com>");
+
   gstelement_class->request_new_pad = gst_ogg_mux_request_new_pad;
   gstelement_class->release_pad = gst_ogg_mux_release_pad;
 
@@ -326,26 +284,20 @@ gst_ogg_mux_sink_event (GstPad * pad, GstEvent * event)
   GST_DEBUG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:{
-      gboolean update;
-      gdouble rate;
-      gdouble applied_rate;
-      GstFormat format;
-      gint64 start, stop, position;
+    case GST_EVENT_SEGMENT:
+    {
+      const GstSegment *segment;
 
-      gst_event_parse_new_segment_full (event, &update, &rate,
-          &applied_rate, &format, &start, &stop, &position);
+      gst_event_parse_segment (event, &segment);
 
       /* We don't support non time NEWSEGMENT events */
-      if (format != GST_FORMAT_TIME) {
+      if (segment->format != GST_FORMAT_TIME) {
         gst_event_unref (event);
         event = NULL;
         break;
       }
 
-      gst_segment_set_newsegment_full (&ogg_pad->segment, update, rate,
-          applied_rate, format, start, stop, position);
-
+      gst_segment_copy_into (segment, &ogg_pad->segment);
       break;
     }
     case GST_EVENT_FLUSH_STOP:{
@@ -394,7 +346,7 @@ gst_ogg_mux_generate_serialno (GstOggMux * ogg_mux)
 
 static GstPad *
 gst_ogg_mux_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * req_name)
+    GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
 {
   GstOggMux *ogg_mux;
   GstPad *newpad;
@@ -533,9 +485,8 @@ gst_ogg_mux_buffer_from_page (GstOggMux * mux, ogg_page * page, gboolean delta)
 
   /* allocate space for header and body */
   buffer = gst_buffer_new_and_alloc (page->header_len + page->body_len);
-  memcpy (GST_BUFFER_DATA (buffer), page->header, page->header_len);
-  memcpy (GST_BUFFER_DATA (buffer) + page->header_len,
-      page->body, page->body_len);
+  gst_buffer_fill (buffer, 0, page->header, page->header_len);
+  gst_buffer_fill (buffer, page->header_len, page->body, page->body_len);
 
   /* Here we set granulepos as our OFFSET_END to give easy direct access to
    * this value later. Before we push it, we reset this to OFFSET + SIZE
@@ -555,11 +506,9 @@ static GstFlowReturn
 gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
     GstOggPadData * oggpad)
 {
-  GstCaps *caps;
-
   /* fix up OFFSET and OFFSET_END again */
   GST_BUFFER_OFFSET (buffer) = mux->offset;
-  mux->offset += GST_BUFFER_SIZE (buffer);
+  mux->offset += gst_buffer_get_size (buffer);
   GST_BUFFER_OFFSET_END (buffer) = mux->offset;
 
   /* Ensure we have monotonically increasing timestamps in the output. */
@@ -571,11 +520,6 @@ gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
       mux->last_ts = run_time;
   }
 
-  caps = gst_pad_get_negotiated_caps (mux->srcpad);
-  gst_buffer_set_caps (buffer, caps);
-  if (caps)
-    gst_caps_unref (caps);
-
   return gst_pad_push (mux->srcpad, buffer);
 }
 
@@ -790,9 +734,10 @@ gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
   GstClockTime next_time;
   GstClockTimeDiff diff;
   ogg_packet packet;
+  gsize size;
 
   /* ensure messing with metadata is ok */
-  buf = gst_buffer_make_metadata_writable (buf);
+  buf = gst_buffer_make_writable (buf);
 
   /* convert time to running time, so we need no longer bother about that */
   time = GST_BUFFER_TIMESTAMP (buf);
@@ -811,9 +756,10 @@ gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
       pad->map.granulerate_n <= 0 || pad->map.granulerate_d <= 0)
     goto no_granule;
 
-  packet.packet = GST_BUFFER_DATA (buf);
-  packet.bytes = GST_BUFFER_SIZE (buf);
+  packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  packet.bytes = size;
   duration = gst_ogg_stream_get_packet_duration (&pad->map, &packet);
+  gst_buffer_unmap (buf, packet.packet, size);
 
   /* give up if no duration can be determined, relying on upstream */
   if (G_UNLIKELY (duration < 0)) {
@@ -943,19 +889,22 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
           /* and we have one */
           ogg_packet packet;
           gboolean is_header;
+          gsize size;
 
-          packet.packet = GST_BUFFER_DATA (buf);
-          packet.bytes = GST_BUFFER_SIZE (buf);
+          packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+          packet.bytes = size;
 
           /* if we're not yet in data mode, ensure we're setup on the first packet */
           if (!pad->have_type) {
+            GstCaps *caps;
+
             /* Use headers in caps, if any; this will allow us to be resilient
              * to starting streams on the fly, and some streams (like VP8
              * at least) do not send headers packets, as other muxers don't
              * expect/need them. */
+            caps = gst_pad_get_current_caps (GST_PAD_CAST (data->pad));
             pad->have_type =
-                gst_ogg_stream_setup_map_from_caps_headers (&pad->map,
-                GST_BUFFER_CAPS (buf));
+                gst_ogg_stream_setup_map_from_caps_headers (&pad->map, caps);
 
             if (!pad->have_type) {
               /* fallback on the packet */
@@ -963,11 +912,13 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
             }
             if (!pad->have_type) {
               GST_ERROR_OBJECT (pad, "mapper didn't recognise input stream "
-                  "(pad caps: %" GST_PTR_FORMAT ")", GST_PAD_CAPS (pad));
+                  "(pad caps: %" GST_PTR_FORMAT ")", caps);
             } else {
               GST_DEBUG_OBJECT (pad, "caps detected: %" GST_PTR_FORMAT,
                   pad->map.caps);
             }
+            if (caps)
+              gst_caps_unref (caps);
           }
 
           if (pad->have_type)
@@ -975,6 +926,8 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
           else                  /* fallback (FIXME 0.11: remove IN_CAPS hack) */
             is_header = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
 
+          gst_buffer_unmap (buf, packet.packet, size);
+
           if (is_header) {
             GST_DEBUG_OBJECT (ogg_mux,
                 "got header buffer in control state, ignoring");
@@ -1038,7 +991,7 @@ gst_ogg_mux_get_headers (GstOggPadData * pad)
 
   GST_LOG_OBJECT (thepad, "getting headers");
 
-  caps = gst_pad_get_negotiated_caps (thepad);
+  caps = gst_pad_get_current_caps (thepad);
   if (caps != NULL) {
     const GValue *streamheader;
 
@@ -1104,7 +1057,8 @@ gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers)
     walk = walk->next;
 
     /* mark buffer */
-    GST_LOG ("Setting IN_CAPS on buffer of length %d", GST_BUFFER_SIZE (buf));
+    GST_LOG ("Setting IN_CAPS on buffer of length %" G_GSIZE_FORMAT,
+        gst_buffer_get_size (buf));
     GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
 
     g_value_init (&value, GST_TYPE_BUFFER);
@@ -1121,10 +1075,8 @@ gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers)
 }
 
 static void
-create_header_packet (ogg_packet * packet, GstBuffer * buf, GstOggPadData * pad)
+create_header_packet (ogg_packet * packet, GstOggPadData * pad)
 {
-  packet->packet = GST_BUFFER_DATA (buf);
-  packet->bytes = GST_BUFFER_SIZE (buf);
   packet->granulepos = 0;
   /* mark BOS and packet number */
   packet->b_o_s = (pad->packetno == 0);
@@ -1185,10 +1137,11 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
     GstCaps *caps;
     GstStructure *structure;
     GstBuffer *hbuf;
+    gsize size;
 
     pad = (GstOggPadData *) walk->data;
     thepad = pad->collect.pad;
-    caps = gst_pad_get_negotiated_caps (thepad);
+    caps = gst_pad_get_current_caps (thepad);
     structure = gst_caps_get_structure (caps, 0);
 
     walk = walk->next;
@@ -1213,10 +1166,15 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
     }
 
     /* create a packet from the buffer */
-    create_header_packet (&packet, buf, pad);
+    packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+    packet.bytes = size;
+
+    create_header_packet (&packet, pad);
 
     /* swap the packet in */
     ogg_stream_packetin (&pad->map.stream, &packet);
+
+    gst_buffer_unmap (buf, packet.packet, size);
     gst_buffer_unref (buf);
 
     GST_LOG_OBJECT (thepad, "flushing out BOS page");
@@ -1264,14 +1222,19 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
       GstBuffer *buf = GST_BUFFER (hwalk->data);
       ogg_packet packet;
       ogg_page page;
+      gsize size;
 
       hwalk = hwalk->next;
 
       /* create a packet from the buffer */
-      create_header_packet (&packet, buf, pad);
+      packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+      packet.bytes = size;
+
+      create_header_packet (&packet, pad);
 
       /* swap the packet in */
       ogg_stream_packetin (&pad->map.stream, &packet);
+      gst_buffer_unmap (buf, packet.packet, size);
       gst_buffer_unref (buf);
 
       /* if last header, flush page */
@@ -1302,7 +1265,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
   /* hbufs holds all buffers for the headers now */
 
   /* create caps with the buffers */
-  caps = gst_pad_get_caps (mux->srcpad);
+  caps = gst_pad_get_caps (mux->srcpad, NULL);
   if (caps) {
     caps = gst_ogg_mux_set_header_on_caps (caps, hbufs);
     gst_pad_set_caps (mux->srcpad, caps);
@@ -1447,6 +1410,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
     GstOggPadData *pad = ogg_mux->pulling;
     gint64 duration;
     gboolean force_flush;
+    gsize size;
 
     GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "pulling from pad");
 
@@ -1470,8 +1434,8 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
           GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
     }
     /* create a packet from the buffer */
-    packet.packet = GST_BUFFER_DATA (buf);
-    packet.bytes = GST_BUFFER_SIZE (buf);
+    packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+    packet.bytes = size;
     packet.granulepos = GST_BUFFER_OFFSET_END (buf);
     if (packet.granulepos == -1)
       packet.granulepos = 0;
@@ -1561,6 +1525,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
       GST_DEBUG_OBJECT (pad->collect.pad, "swapping in BOS packet");
 
     ogg_stream_packetin (&pad->map.stream, &packet);
+    gst_buffer_unmap (buf, packet.packet, size);
     pad->data_pushed = TRUE;
 
     gp_time = GST_BUFFER_OFFSET (pad->buffer);
index 4d9c771..9008291 100644 (file)
@@ -286,15 +286,14 @@ gst_ogg_parse_dispose (GObject * object)
 static GstFlowReturn
 gst_ogg_parse_submit_buffer (GstOggParse * ogg, GstBuffer * buffer)
 {
-  guint size;
+  gsize size;
   guint8 *data;
   gchar *oggbuffer;
   GstFlowReturn ret = GST_FLOW_OK;
 
-  size = GST_BUFFER_SIZE (buffer);
-  data = GST_BUFFER_DATA (buffer);
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
 
-  GST_DEBUG_OBJECT (ogg, "submitting %u bytes", size);
+  GST_DEBUG_OBJECT (ogg, "submitting %" G_GSIZE_FORMAT " bytes", size);
   if (G_UNLIKELY (size == 0))
     goto done;
 
@@ -308,12 +307,13 @@ gst_ogg_parse_submit_buffer (GstOggParse * ogg, GstBuffer * buffer)
 
   memcpy (oggbuffer, data, size);
   if (G_UNLIKELY (ogg_sync_wrote (&ogg->sync, size) < 0)) {
-    GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
-        (NULL), ("failed to write %d bytes to the sync buffer", size));
+    GST_ELEMENT_ERROR (ogg, STREAM, DECODE, (NULL),
+        ("failed to write %" G_GSIZE_FORMAT " bytes to the sync buffer", size));
     ret = GST_FLOW_ERROR;
   }
 
 done:
+  gst_buffer_unmap (buffer, data, size);
   gst_buffer_unref (buffer);
 
   return ret;
@@ -368,8 +368,8 @@ gst_ogg_parse_buffer_from_page (ogg_page * page,
   int size = page->header_len + page->body_len;
   GstBuffer *buf = gst_buffer_new_and_alloc (size);
 
-  memcpy (GST_BUFFER_DATA (buf), page->header, page->header_len);
-  memcpy (GST_BUFFER_DATA (buf) + page->header_len, page->body, page->body_len);
+  gst_buffer_fill (buf, 0, page->header, page->header_len);
+  gst_buffer_fill (buf, page->header_len, page->body, page->body_len);
 
   GST_BUFFER_TIMESTAMP (buf) = timestamp;
   GST_BUFFER_OFFSET (buf) = offset;
@@ -394,8 +394,9 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
 
   ogg = GST_OGG_PARSE (GST_OBJECT_PARENT (pad));
 
-  GST_LOG_OBJECT (ogg, "Chain function received buffer of size %d",
-      GST_BUFFER_SIZE (buffer));
+  GST_LOG_OBJECT (ogg,
+      "Chain function received buffer of size %" G_GSIZE_FORMAT,
+      gst_buffer_get_size (buffer));
 
   gst_ogg_parse_submit_buffer (ogg, buffer);
 
@@ -581,7 +582,7 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
               }
             }
 
-            caps = gst_pad_get_caps (ogg->srcpad);
+            caps = gst_pad_get_caps (ogg->srcpad, NULL);
             caps = gst_caps_make_writable (caps);
 
             structure = gst_caps_get_structure (caps, 0);
@@ -603,9 +604,6 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
               GstOggStream *stream = (GstOggStream *) l->data;
               GstBuffer *buf = GST_BUFFER (stream->headers->data);
 
-              buf = gst_buffer_make_metadata_writable (buf);
-              gst_buffer_set_caps (buf, caps);
-
               result = gst_pad_push (ogg->srcpad, buf);
               if (result != GST_FLOW_OK)
                 return result;
@@ -618,9 +616,6 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
               for (j = stream->headers->next; j != NULL; j = j->next) {
                 GstBuffer *buf = GST_BUFFER (j->data);
 
-                buf = gst_buffer_make_metadata_writable (buf);
-                gst_buffer_set_caps (buf, caps);
-
                 result = gst_pad_push (ogg->srcpad, buf);
                 if (result != GST_FLOW_OK)
                   return result;
@@ -647,10 +642,8 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
                   g_list_length (stream->unknown_pages) + 1);
 
               for (k = stream->unknown_pages; k != NULL; k = k->next) {
-                GstBuffer *buf;
+                GstBuffer *buf = GST_BUFFER (k->data);
 
-                buf = gst_buffer_make_metadata_writable (GST_BUFFER (k->data));
-                gst_buffer_set_caps (buf, caps);
                 result = gst_pad_push (ogg->srcpad, buf);
                 if (result != GST_FLOW_OK)
                   return result;
@@ -669,8 +662,8 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
             while (stream->stored_buffers) {
               GstBuffer *buf = stream->stored_buffers->data;
 
-              buf = gst_buffer_make_metadata_writable (buf);
-              gst_buffer_set_caps (buf, ogg->caps);
+              buf = gst_buffer_make_writable (buf);
+
               GST_BUFFER_TIMESTAMP (buf) = buffertimestamp;
               if (!keyframe) {
                 GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
@@ -687,8 +680,7 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
                   stream->stored_buffers);
             }
 
-            pagebuffer = gst_buffer_make_metadata_writable (pagebuffer);
-            gst_buffer_set_caps (pagebuffer, ogg->caps);
+            pagebuffer = gst_buffer_make_writable (pagebuffer);
             if (!keyframe) {
               GST_BUFFER_FLAG_SET (pagebuffer, GST_BUFFER_FLAG_DELTA_UNIT);
             } else {
index a0b4e68..c694fad 100644 (file)
@@ -316,19 +316,14 @@ static gboolean
 tag_list_from_vorbiscomment_packet (ogg_packet * packet,
     const guint8 * id_data, const guint id_data_length, GstTagList ** tags)
 {
-  GstBuffer *buf = NULL;
   gchar *encoder = NULL;
   GstTagList *list;
   gboolean ret = TRUE;
 
   g_return_val_if_fail (tags != NULL, FALSE);
 
-  buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) packet->packet;
-  GST_BUFFER_SIZE (buf) = packet->bytes;
-
-  list = gst_tag_list_from_vorbiscomment_buffer (buf, id_data, id_data_length,
-      &encoder);
+  list = gst_tag_list_from_vorbiscomment (packet->packet, packet->bytes,
+      id_data, id_data_length, &encoder);
 
   if (!list) {
     GST_WARNING ("failed to decode vorbis comments");
@@ -348,8 +343,6 @@ exit:
     gst_tag_list_free (*tags);
   *tags = list;
 
-  gst_buffer_unref (buf);
-
   return ret;
 }
 
@@ -1422,12 +1415,14 @@ setup_ogmaudio_mapper (GstOggStream * pad, ogg_packet * packet)
 {
   guint8 *data = packet->packet;
   guint32 fourcc;
+  gchar *fstr;
 
   pad->granulerate_n = GST_READ_UINT64_LE (data + 25);
   pad->granulerate_d = 1;
 
   fourcc = GST_READ_UINT32_LE (data + 9);
-  GST_DEBUG ("fourcc: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
+  fstr = g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
+  GST_DEBUG ("fourcc: %s", fstr);
 
   pad->caps = gst_riff_create_audio_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
 
@@ -1440,9 +1435,10 @@ setup_ogmaudio_mapper (GstOggStream * pad, ogg_packet * packet)
         "rate", G_TYPE_INT, pad->granulerate_n, NULL);
   } else {
     pad->caps = gst_caps_new_simple ("audio/x-ogm-unknown",
-        "fourcc", GST_TYPE_FOURCC, fourcc,
+        "fourcc", G_TYPE_STRING, fstr,
         "rate", G_TYPE_INT, pad->granulerate_n, NULL);
   }
+  g_free (fstr);
 
   pad->n_header_packets = 1;
   pad->is_ogm = TRUE;
@@ -1457,6 +1453,7 @@ setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
   guint32 fourcc;
   int width, height;
   gint64 time_unit;
+  gchar *fstr;
 
   GST_DEBUG ("time unit %d", GST_READ_UINT32_LE (data + 16));
   GST_DEBUG ("samples per unit %d", GST_READ_UINT32_LE (data + 24));
@@ -1476,13 +1473,14 @@ setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
   fourcc = GST_READ_UINT32_LE (data + 9);
   width = GST_READ_UINT32_LE (data + 45);
   height = GST_READ_UINT32_LE (data + 49);
-  GST_DEBUG ("fourcc: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
+  fstr = g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
+  GST_DEBUG ("fourcc: %s", fstr);
 
   pad->caps = gst_riff_create_video_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
 
   if (pad->caps == NULL) {
     pad->caps = gst_caps_new_simple ("video/x-ogm-unknown",
-        "fourcc", GST_TYPE_FOURCC, fourcc,
+        "fourcc", G_TYPE_STRING, fstr,
         "framerate", GST_TYPE_FRACTION, pad->granulerate_n,
         pad->granulerate_d, NULL);
   } else {
@@ -1492,6 +1490,7 @@ setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
         "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
   }
   GST_DEBUG ("caps: %" GST_PTR_FORMAT, pad->caps);
+  g_free (fstr);
 
   pad->n_header_packets = 1;
   pad->frame_size = 1;
@@ -1572,56 +1571,36 @@ setup_pcm_mapper (GstOggStream * pad, ogg_packet * packet)
 
   switch (format) {
     case OGGPCM_FMT_S8:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 8,
-          "width", G_TYPE_INT, 8, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S8", NULL);
       break;
     case OGGPCM_FMT_U8:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 8,
-          "width", G_TYPE_INT, 8, "signed", G_TYPE_BOOLEAN, FALSE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "U8", NULL);
       break;
     case OGGPCM_FMT_S16_LE:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 16,
-          "width", G_TYPE_INT, 16,
-          "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
-          "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S16_LE", NULL);
       break;
     case OGGPCM_FMT_S16_BE:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 16,
-          "width", G_TYPE_INT, 16,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN,
-          "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S16_BE", NULL);
       break;
     case OGGPCM_FMT_S24_LE:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 24,
-          "width", G_TYPE_INT, 24,
-          "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
-          "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S24_3LE", NULL);
       break;
     case OGGPCM_FMT_S24_BE:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 24,
-          "width", G_TYPE_INT, 24,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN,
-          "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S24_3BE", NULL);
       break;
     case OGGPCM_FMT_S32_LE:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 32,
-          "width", G_TYPE_INT, 32,
-          "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
-          "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S32_LE", NULL);
       break;
     case OGGPCM_FMT_S32_BE:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "depth", G_TYPE_INT, 32,
-          "width", G_TYPE_INT, 32,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN,
-          "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "S32_BE", NULL);
       break;
     case OGGPCM_FMT_ULAW:
       caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
@@ -1630,30 +1609,26 @@ setup_pcm_mapper (GstOggStream * pad, ogg_packet * packet)
       caps = gst_caps_new_simple ("audio/x-alaw", NULL);
       break;
     case OGGPCM_FMT_FLT32_LE:
-      caps = gst_caps_new_simple ("audio/x-raw-float",
-          "width", G_TYPE_INT, 32,
-          "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "F32_LE", NULL);
       break;
     case OGGPCM_FMT_FLT32_BE:
-      caps = gst_caps_new_simple ("audio/x-raw-float",
-          "width", G_TYPE_INT, 32,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "F32_BE", NULL);
       break;
     case OGGPCM_FMT_FLT64_LE:
-      caps = gst_caps_new_simple ("audio/x-raw-float",
-          "width", G_TYPE_INT, 64,
-          "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "F64_LE", NULL);
       break;
     case OGGPCM_FMT_FLT64_BE:
-      caps = gst_caps_new_simple ("audio/x-raw-float",
-          "width", G_TYPE_INT, 64,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
+      caps = gst_caps_new_simple ("audio/x-raw",
+          "format", G_TYPE_STRING, "F64_BE", NULL);
       break;
     default:
       return FALSE;
   }
 
-  gst_caps_set_simple (caps, "audio/x-raw-int",
+  gst_caps_set_simple (caps,
       "rate", G_TYPE_INT, pad->granulerate_n,
       "channels", G_TYPE_INT, channels, NULL);
   pad->caps = caps;
@@ -1869,7 +1844,7 @@ const GstOggMap mappers[] = {
   },
   {
     "PCM     ", 8, 0,
-    "audio/x-raw-int",
+    "audio/x-raw",
     setup_pcm_mapper,
     NULL,
     NULL,
@@ -2073,11 +2048,14 @@ gboolean
 gst_ogg_stream_setup_map_from_caps_headers (GstOggStream * pad,
     const GstCaps * caps)
 {
+  GstBuffer *buf;
   const GstStructure *structure;
-  const GstBuffer *buf;
   const GValue *streamheader;
   const GValue *first_element;
   ogg_packet packet;
+  guint8 *data;
+  gsize size;
+  gboolean ret;
 
   GST_INFO ("Checking streamheader on caps %" GST_PTR_FORMAT, caps);
 
@@ -2110,16 +2088,26 @@ gst_ogg_stream_setup_map_from_caps_headers (GstOggStream * pad,
   }
 
   buf = gst_value_get_buffer (first_element);
-  if (buf == NULL || GST_BUFFER_SIZE (buf) == 0) {
+  if (buf == NULL) {
+    GST_ERROR ("no first streamheader buffer");
+    return FALSE;
+  }
+
+  data = gst_buffer_map (buf, &size, 0, GST_MAP_READ);
+  if (data == NULL || size == 0) {
     GST_ERROR ("invalid first streamheader buffer");
     return FALSE;
   }
 
-  GST_MEMDUMP ("streamheader", GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+  GST_MEMDUMP ("streamheader", data, size);
 
-  packet.packet = GST_BUFFER_DATA (buf);
-  packet.bytes = GST_BUFFER_SIZE (buf);
+  packet.packet = data;
+  packet.bytes = size;
 
   GST_INFO ("Found headers on caps, using those to determine type");
-  return gst_ogg_stream_setup_map (pad, &packet);
+  ret = gst_ogg_stream_setup_map (pad, &packet);
+
+  gst_buffer_unmap (buf, data, size);
+
+  return ret;
 }
index 6b054a2..b81856a 100644 (file)
@@ -284,6 +284,7 @@ gst_ogm_audio_parse_base_init (GstOgmParseClass * klass)
   audio_src_templ = gst_pad_template_new ("src",
       GST_PAD_SRC, GST_PAD_SOMETIMES, caps);
   gst_element_class_add_pad_template (element_class, audio_src_templ);
+  gst_caps_unref (caps);
 }
 
 static void
@@ -302,6 +303,7 @@ gst_ogm_video_parse_base_init (GstOgmParseClass * klass)
   video_src_templ = gst_pad_template_new ("src",
       GST_PAD_SRC, GST_PAD_SOMETIMES, caps);
   gst_element_class_add_pad_template (element_class, video_src_templ);
+  gst_caps_unref (caps);
 }
 
 static void
@@ -320,6 +322,7 @@ gst_ogm_text_parse_base_init (GstOgmParseClass * klass)
   text_src_templ = gst_pad_template_new ("src",
       GST_PAD_SRC, GST_PAD_SOMETIMES, caps);
   gst_element_class_add_pad_template (element_class, text_src_templ);
+  gst_caps_unref (caps);
 }
 
 static void
@@ -582,7 +585,7 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
         GST_WARNING_OBJECT (ogm, "could not find video caps for fourcc %"
             GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
         caps = gst_caps_new_simple ("video/x-ogm-unknown", "fourcc",
-            GST_TYPE_FOURCC, fourcc, NULL);
+            G_TYPE_STRING, ogm->hdr.subtype, NULL);
         break;
       }
 
@@ -622,16 +625,19 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
     goto cannot_decode;
 
   if (ogm->srcpad) {
-    GstCaps *current_caps = GST_PAD_CAPS (ogm->srcpad);
-
-    if (current_caps && caps && !gst_caps_is_equal (current_caps, caps)) {
-      GST_WARNING_OBJECT (ogm, "Already an existing pad %s:%s",
-          GST_DEBUG_PAD_NAME (ogm->srcpad));
-      gst_pad_set_active (ogm->srcpad, FALSE);
-      gst_element_remove_pad (GST_ELEMENT (ogm), ogm->srcpad);
-      ogm->srcpad = NULL;
-    } else {
-      GST_DEBUG_OBJECT (ogm, "Existing pad has the same caps, do nothing");
+    GstCaps *current_caps = gst_pad_get_current_caps (ogm->srcpad);
+
+    if (current_caps) {
+      if (caps && !gst_caps_is_equal (current_caps, caps)) {
+        GST_WARNING_OBJECT (ogm, "Already an existing pad %s:%s",
+            GST_DEBUG_PAD_NAME (ogm->srcpad));
+        gst_pad_set_active (ogm->srcpad, FALSE);
+        gst_element_remove_pad (GST_ELEMENT (ogm), ogm->srcpad);
+        ogm->srcpad = NULL;
+      } else {
+        GST_DEBUG_OBJECT (ogm, "Existing pad has the same caps, do nothing");
+      }
+      gst_caps_unref (current_caps);
     }
   }
 
@@ -640,8 +646,8 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
 
     ogm->srcpad = gst_pad_new_from_template (ogm->srcpadtempl, "src");
     gst_pad_use_fixed_caps (ogm->srcpad);
-    gst_pad_set_caps (ogm->srcpad, caps);
     gst_pad_set_active (ogm->srcpad, TRUE);
+    gst_pad_set_caps (ogm->srcpad, caps);
     gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad);
     GST_INFO_OBJECT (ogm, "Added pad %s:%s with caps %" GST_PTR_FORMAT,
         GST_DEBUG_PAD_NAME (ogm->srcpad), caps);
@@ -714,8 +720,6 @@ gst_ogm_parse_comment_packet (GstOgmParse * ogm, GstBuffer * buf)
     /* do not push packet downstream, just let parent unref it */
     ret = GST_FLOW_OK;
   } else {
-    buf = gst_buffer_copy (buf);
-    gst_buffer_set_caps (buf, GST_PAD_CAPS (ogm->srcpad));
     ret = gst_pad_push (ogm->srcpad, buf);
   }
 
@@ -725,32 +729,27 @@ gst_ogm_parse_comment_packet (GstOgmParse * ogm, GstBuffer * buf)
 static void
 gst_ogm_text_parse_strip_trailing_zeroes (GstOgmParse * ogm, GstBuffer * buf)
 {
-  const guint8 *data;
-  guint size;
+  guint8 *data;
+  gsize size;
 
-  g_assert (gst_buffer_is_metadata_writable (buf));
+  g_assert (gst_buffer_is_writable (buf));
 
   /* zeroes are not valid UTF-8 characters, so strip them from output */
-  data = GST_BUFFER_DATA (buf);
-  size = GST_BUFFER_SIZE (buf);
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_WRITE);
   while (size > 0 && data[size - 1] == '\0') {
     --size;
   }
-
-  GST_BUFFER_SIZE (buf) = size;
+  gst_buffer_unmap (buf, data, size);
 }
 
 static GstFlowReturn
-gst_ogm_parse_data_packet (GstOgmParse * ogm, GstBuffer * buf)
+gst_ogm_parse_data_packet (GstOgmParse * ogm, GstBuffer * buf,
+    const guint8 * data, gsize size)
 {
   GstFlowReturn ret;
-  const guint8 *data;
   GstBuffer *sbuf;
   gboolean keyframe;
-  guint size, len, n, xsize = 0;
-
-  data = GST_BUFFER_DATA (buf);
-  size = GST_BUFFER_SIZE (buf);
+  guint len, n, xsize = 0;
 
   if ((data[0] & 0x01) != 0)
     goto invalid_startcode;
@@ -766,10 +765,12 @@ gst_ogm_parse_data_packet (GstOgmParse * ogm, GstBuffer * buf)
     xsize = (xsize << 8) | data[n];
   }
 
-  GST_LOG_OBJECT (ogm, "[0x%02x] samples: %d, hdrbytes: %d, datasize: %d",
-      data[0], xsize, len, size - len - 1);
+  GST_LOG_OBJECT (ogm, "[0x%02x] samples: %d, hdrbytes: %d, datasize: %"
+      G_GSIZE_FORMAT, data[0], xsize, len, size - len - 1);
 
-  sbuf = gst_buffer_create_sub (buf, len + 1, size - len - 1);
+  sbuf =
+      gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, len + 1,
+      size - len - 1);
 
   if (GST_BUFFER_OFFSET_END_IS_VALID (buf))
     ogm->next_granulepos = GST_BUFFER_OFFSET_END (buf);
@@ -823,7 +824,6 @@ gst_ogm_parse_data_packet (GstOgmParse * ogm, GstBuffer * buf)
   }
 
   if (ogm->srcpad) {
-    gst_buffer_set_caps (sbuf, GST_PAD_CAPS (ogm->srcpad));
     GST_LOG_OBJECT (ogm, "Pushing buffer with ts=%" GST_TIME_FORMAT,
         GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (sbuf)));
     ret = gst_pad_push (ogm->srcpad, sbuf);
@@ -847,7 +847,7 @@ invalid_startcode:
 buffer_too_small:
   {
     GST_ELEMENT_ERROR (ogm, STREAM, DECODE, (NULL),
-        ("buffer too small, len+1=%u, size=%u", len + 1, size));
+        ("buffer too small, len+1=%u, size=%" G_GSIZE_FORMAT, len + 1, size));
     return GST_FLOW_ERROR;
   }
 }
@@ -857,9 +857,10 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buf)
 {
   GstFlowReturn ret = GST_FLOW_OK;
   GstOgmParse *ogm = GST_OGM_PARSE (GST_PAD_PARENT (pad));
-  guint8 *data = GST_BUFFER_DATA (buf);
-  guint size = GST_BUFFER_SIZE (buf);
+  guint8 *data;
+  gsize size;
 
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
   if (size < 1)
     goto buffer_too_small;
 
@@ -875,11 +876,12 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buf)
       break;
     }
     default:{
-      ret = gst_ogm_parse_data_packet (ogm, buf);
+      ret = gst_ogm_parse_data_packet (ogm, buf, data, size);
       break;
     }
   }
 
+  gst_buffer_unmap (buf, data, size);
   gst_buffer_unref (buf);
 
   if (ret != GST_FLOW_OK) {
@@ -892,6 +894,7 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buf)
 buffer_too_small:
   {
     GST_ELEMENT_ERROR (ogm, STREAM, DECODE, (NULL), ("buffer too small"));
+    gst_buffer_unmap (buf, data, size);
     gst_buffer_unref (buf);
     return GST_FLOW_ERROR;
   }
index 55aa3a0..86c8612 100644 (file)
@@ -1,12 +1,14 @@
 plugin_LTLIBRARIES = libgstpango.la
 
 noinst_HEADERS = \
+        gstbasetextoverlay.h \
        gstclockoverlay.h \
        gsttextoverlay.h \
        gsttextrender.h \
        gsttimeoverlay.h
 
 libgstpango_la_SOURCES = \
+       gstbasetextoverlay.c \
        gstclockoverlay.c \
        gsttextoverlay.c \
        gsttextrender.c \
diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c
new file mode 100644 (file)
index 0000000..7df78f4
--- /dev/null
@@ -0,0 +1,2781 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ * Copyright (C) <2006> Julien Moutte <julien@moutte.net>
+ * Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
+ * Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:element-textoverlay
+ * @see_also: #GstTextRender, #GstClockOverlay, #GstTimeOverlay, #GstSubParse
+ *
+ * This plugin renders text on top of a video stream. This can be either
+ * static text or text from buffers received on the text sink pad, e.g.
+ * as produced by the subparse element. If the text sink pad is not linked,
+ * the text set via the "text" property will be rendered. If the text sink
+ * pad is linked, text will be rendered as it is received on that pad,
+ * honouring and matching the buffer timestamps of both input streams.
+ *
+ * The text can contain newline characters and text wrapping is enabled by
+ * default.
+ *
+ * <refsect2>
+ * <title>Example launch lines</title>
+ * |[
+ * gst-launch -v videotestsrc ! textoverlay text="Room A" valign=top halign=left ! xvimagesink
+ * ]| Here is a simple pipeline that displays a static text in the top left
+ * corner of the video picture
+ * |[
+ * gst-launch -v filesrc location=subtitles.srt ! subparse ! txt.   videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink
+ * ]| Here is another pipeline that displays subtitles from an .srt subtitle
+ * file, centered at the bottom of the picture and with a rectangular shading
+ * around the text in the background:
+ * <para>
+ * If you do not have such a subtitle file, create one looking like this
+ * in a text editor:
+ * |[
+ * 1
+ * 00:00:03,000 --> 00:00:05,000
+ * Hello? (3-5s)
+ *
+ * 2
+ * 00:00:08,000 --> 00:00:13,000
+ * Yes, this is a subtitle. Don&apos;t
+ * you like it? (8-13s)
+ *
+ * 3
+ * 00:00:18,826 --> 00:01:02,886
+ * Uh? What are you talking about?
+ * I don&apos;t understand  (18-62s)
+ * ]|
+ * </para>
+ * </refsect2>
+ */
+
+/* FIXME: alloc segment as part of instance struct */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gst/video/video.h>
+
+#include "gstbasetextoverlay.h"
+#include "gsttextoverlay.h"
+#include "gsttimeoverlay.h"
+#include "gstclockoverlay.h"
+#include "gsttextrender.h"
+#include <string.h>
+
+/* FIXME:
+ *  - use proper strides and offset for I420
+ *  - if text is wider than the video picture, it does not get
+ *    clipped properly during blitting (if wrapping is disabled)
+ *  - make 'shading_value' a property (or enum:  light/normal/dark/verydark)?
+ */
+
+GST_DEBUG_CATEGORY (pango_debug);
+#define GST_CAT_DEFAULT pango_debug
+
+#define DEFAULT_PROP_TEXT      ""
+#define DEFAULT_PROP_SHADING   FALSE
+#define DEFAULT_PROP_VALIGNMENT        GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE
+#define DEFAULT_PROP_HALIGNMENT        GST_BASE_TEXT_OVERLAY_HALIGN_CENTER
+#define DEFAULT_PROP_VALIGN    "baseline"
+#define DEFAULT_PROP_HALIGN    "center"
+#define DEFAULT_PROP_XPAD      25
+#define DEFAULT_PROP_YPAD      25
+#define DEFAULT_PROP_DELTAX    0
+#define DEFAULT_PROP_DELTAY    0
+#define DEFAULT_PROP_XPOS       0.5
+#define DEFAULT_PROP_YPOS       0.5
+#define DEFAULT_PROP_WRAP_MODE  GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR
+#define DEFAULT_PROP_FONT_DESC ""
+#define DEFAULT_PROP_SILENT    FALSE
+#define DEFAULT_PROP_LINE_ALIGNMENT GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER
+#define DEFAULT_PROP_WAIT_TEXT TRUE
+#define DEFAULT_PROP_AUTO_ADJUST_SIZE TRUE
+#define DEFAULT_PROP_VERTICAL_RENDER  FALSE
+#define DEFAULT_PROP_COLOR      0xffffffff
+#define DEFAULT_PROP_OUTLINE_COLOR 0xff000000
+
+/* make a property of me */
+#define DEFAULT_SHADING_VALUE    -80
+
+#define MINIMUM_OUTLINE_OFFSET 1.0
+#define DEFAULT_SCALE_BASIS    640
+
+#define COMP_Y(ret, r, g, b) \
+{ \
+   ret = (int) (((19595 * r) >> 16) + ((38470 * g) >> 16) + ((7471 * b) >> 16)); \
+   ret = CLAMP (ret, 0, 255); \
+}
+
+#define COMP_U(ret, r, g, b) \
+{ \
+   ret = (int) (-((11059 * r) >> 16) - ((21709 * g) >> 16) + ((32768 * b) >> 16) + 128); \
+   ret = CLAMP (ret, 0, 255); \
+}
+
+#define COMP_V(ret, r, g, b) \
+{ \
+   ret = (int) (((32768 * r) >> 16) - ((27439 * g) >> 16) - ((5329 * b) >> 16) + 128); \
+   ret = CLAMP (ret, 0, 255); \
+}
+
+#define BLEND(ret, alpha, v0, v1) \
+{ \
+       ret = (v0 * alpha + v1 * (255 - alpha)) / 255; \
+}
+
+#define OVER(ret, alphaA, Ca, alphaB, Cb, alphaNew)    \
+{ \
+    gint _tmp; \
+    _tmp = (Ca * alphaA + Cb * alphaB * (255 - alphaA) / 255) / alphaNew; \
+    ret = CLAMP (_tmp, 0, 255); \
+}
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define CAIRO_ARGB_A 3
+# define CAIRO_ARGB_R 2
+# define CAIRO_ARGB_G 1
+# define CAIRO_ARGB_B 0
+#else
+# define CAIRO_ARGB_A 0
+# define CAIRO_ARGB_R 1
+# define CAIRO_ARGB_G 2
+# define CAIRO_ARGB_B 3
+#endif
+
+enum
+{
+  PROP_0,
+  PROP_TEXT,
+  PROP_SHADING,
+  PROP_VALIGN,                  /* deprecated */
+  PROP_HALIGN,                  /* deprecated */
+  PROP_HALIGNMENT,
+  PROP_VALIGNMENT,
+  PROP_XPAD,
+  PROP_YPAD,
+  PROP_DELTAX,
+  PROP_DELTAY,
+  PROP_XPOS,
+  PROP_YPOS,
+  PROP_WRAP_MODE,
+  PROP_FONT_DESC,
+  PROP_SILENT,
+  PROP_LINE_ALIGNMENT,
+  PROP_WAIT_TEXT,
+  PROP_AUTO_ADJUST_SIZE,
+  PROP_VERTICAL_RENDER,
+  PROP_COLOR,
+  PROP_SHADOW,
+  PROP_OUTLINE_COLOR,
+  PROP_LAST
+};
+
+#define VIDEO_FORMATS "{ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, AYUV, I420, UYVY, NV12, NV21 } "
+
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (VIDEO_FORMATS))
+    );
+
+static GstStaticPadTemplate video_sink_template_factory =
+GST_STATIC_PAD_TEMPLATE ("video_sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (VIDEO_FORMATS))
+    );
+
+#define GST_TYPE_BASE_TEXT_OVERLAY_VALIGN (gst_base_text_overlay_valign_get_type())
+static GType
+gst_base_text_overlay_valign_get_type (void)
+{
+  static GType base_text_overlay_valign_type = 0;
+  static const GEnumValue base_text_overlay_valign[] = {
+    {GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE, "baseline", "baseline"},
+    {GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
+    {GST_BASE_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
+    {GST_BASE_TEXT_OVERLAY_VALIGN_POS, "position", "position"},
+    {GST_BASE_TEXT_OVERLAY_VALIGN_CENTER, "center", "center"},
+    {0, NULL, NULL},
+  };
+
+  if (!base_text_overlay_valign_type) {
+    base_text_overlay_valign_type =
+        g_enum_register_static ("GstBaseTextOverlayVAlign",
+        base_text_overlay_valign);
+  }
+  return base_text_overlay_valign_type;
+}
+
+#define GST_TYPE_BASE_TEXT_OVERLAY_HALIGN (gst_base_text_overlay_halign_get_type())
+static GType
+gst_base_text_overlay_halign_get_type (void)
+{
+  static GType base_text_overlay_halign_type = 0;
+  static const GEnumValue base_text_overlay_halign[] = {
+    {GST_BASE_TEXT_OVERLAY_HALIGN_LEFT, "left", "left"},
+    {GST_BASE_TEXT_OVERLAY_HALIGN_CENTER, "center", "center"},
+    {GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT, "right", "right"},
+    {GST_BASE_TEXT_OVERLAY_HALIGN_POS, "position", "position"},
+    {0, NULL, NULL},
+  };
+
+  if (!base_text_overlay_halign_type) {
+    base_text_overlay_halign_type =
+        g_enum_register_static ("GstBaseTextOverlayHAlign",
+        base_text_overlay_halign);
+  }
+  return base_text_overlay_halign_type;
+}
+
+
+#define GST_TYPE_BASE_TEXT_OVERLAY_WRAP_MODE (gst_base_text_overlay_wrap_mode_get_type())
+static GType
+gst_base_text_overlay_wrap_mode_get_type (void)
+{
+  static GType base_text_overlay_wrap_mode_type = 0;
+  static const GEnumValue base_text_overlay_wrap_mode[] = {
+    {GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE, "none", "none"},
+    {GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD, "word", "word"},
+    {GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR, "char", "char"},
+    {GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR, "wordchar", "wordchar"},
+    {0, NULL, NULL},
+  };
+
+  if (!base_text_overlay_wrap_mode_type) {
+    base_text_overlay_wrap_mode_type =
+        g_enum_register_static ("GstBaseTextOverlayWrapMode",
+        base_text_overlay_wrap_mode);
+  }
+  return base_text_overlay_wrap_mode_type;
+}
+
+#define GST_TYPE_BASE_TEXT_OVERLAY_LINE_ALIGN (gst_base_text_overlay_line_align_get_type())
+static GType
+gst_base_text_overlay_line_align_get_type (void)
+{
+  static GType base_text_overlay_line_align_type = 0;
+  static const GEnumValue base_text_overlay_line_align[] = {
+    {GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT, "left", "left"},
+    {GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER, "center", "center"},
+    {GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT, "right", "right"},
+    {0, NULL, NULL}
+  };
+
+  if (!base_text_overlay_line_align_type) {
+    base_text_overlay_line_align_type =
+        g_enum_register_static ("GstBaseTextOverlayLineAlign",
+        base_text_overlay_line_align);
+  }
+  return base_text_overlay_line_align_type;
+}
+
+#define GST_BASE_TEXT_OVERLAY_GET_COND(ov) (((GstBaseTextOverlay *)ov)->cond)
+#define GST_BASE_TEXT_OVERLAY_WAIT(ov)     (g_cond_wait (GST_BASE_TEXT_OVERLAY_GET_COND (ov), GST_OBJECT_GET_LOCK (ov)))
+#define GST_BASE_TEXT_OVERLAY_SIGNAL(ov)   (g_cond_signal (GST_BASE_TEXT_OVERLAY_GET_COND (ov)))
+#define GST_BASE_TEXT_OVERLAY_BROADCAST(ov)(g_cond_broadcast (GST_BASE_TEXT_OVERLAY_GET_COND (ov)))
+
+static GstElementClass *parent_class = NULL;
+static void gst_base_text_overlay_base_init (gpointer g_class);
+static void gst_base_text_overlay_class_init (GstBaseTextOverlayClass * klass);
+static void gst_base_text_overlay_init (GstBaseTextOverlay * overlay,
+    GstBaseTextOverlayClass * klass);
+
+static GstStateChangeReturn gst_base_text_overlay_change_state (GstElement *
+    element, GstStateChange transition);
+
+static GstCaps *gst_base_text_overlay_getcaps (GstPad * pad, GstCaps * filter);
+static gboolean gst_base_text_overlay_setcaps (GstBaseTextOverlay * overlay,
+    GstCaps * caps);
+static gboolean gst_base_text_overlay_setcaps_txt (GstBaseTextOverlay * overlay,
+    GstCaps * caps);
+static gboolean gst_base_text_overlay_src_event (GstPad * pad,
+    GstEvent * event);
+static gboolean gst_base_text_overlay_src_query (GstPad * pad,
+    GstQuery * query);
+
+static gboolean gst_base_text_overlay_video_event (GstPad * pad,
+    GstEvent * event);
+static GstFlowReturn gst_base_text_overlay_video_chain (GstPad * pad,
+    GstBuffer * buffer);
+
+static gboolean gst_base_text_overlay_text_event (GstPad * pad,
+    GstEvent * event);
+static GstFlowReturn gst_base_text_overlay_text_chain (GstPad * pad,
+    GstBuffer * buffer);
+static GstPadLinkReturn gst_base_text_overlay_text_pad_link (GstPad * pad,
+    GstPad * peer);
+static void gst_base_text_overlay_text_pad_unlink (GstPad * pad);
+static void gst_base_text_overlay_pop_text (GstBaseTextOverlay * overlay);
+static void gst_base_text_overlay_update_render_mode (GstBaseTextOverlay *
+    overlay);
+
+static void gst_base_text_overlay_finalize (GObject * object);
+static void gst_base_text_overlay_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_base_text_overlay_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void
+gst_base_text_overlay_adjust_values_with_fontdesc (GstBaseTextOverlay * overlay,
+    PangoFontDescription * desc);
+
+GType
+gst_base_text_overlay_get_type (void)
+{
+  static GType type = 0;
+
+  if (g_once_init_enter ((gsize *) & type)) {
+    static const GTypeInfo info = {
+      sizeof (GstBaseTextOverlayClass),
+      (GBaseInitFunc) gst_base_text_overlay_base_init,
+      NULL,
+      (GClassInitFunc) gst_base_text_overlay_class_init,
+      NULL,
+      NULL,
+      sizeof (GstBaseTextOverlay),
+      0,
+      (GInstanceInitFunc) gst_base_text_overlay_init,
+    };
+
+    g_once_init_leave ((gsize *) & type,
+        g_type_register_static (GST_TYPE_ELEMENT, "GstBaseTextOverlay", &info,
+            0));
+  }
+
+  return type;
+}
+
+static gchar *
+gst_base_text_overlay_get_text (GstBaseTextOverlay * overlay,
+    GstBuffer * video_frame)
+{
+  return g_strdup (overlay->default_text);
+}
+
+static void
+gst_base_text_overlay_base_init (gpointer g_class)
+{
+  GstBaseTextOverlayClass *klass = GST_BASE_TEXT_OVERLAY_CLASS (g_class);
+  PangoFontMap *fontmap;
+
+  /* Only lock for the subclasses here, the base class
+   * doesn't have this mutex yet and it's not necessary
+   * here */
+  if (klass->pango_lock)
+    g_mutex_lock (klass->pango_lock);
+  fontmap = pango_cairo_font_map_get_default ();
+  klass->pango_context =
+      pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
+  if (klass->pango_lock)
+    g_mutex_unlock (klass->pango_lock);
+}
+
+static void
+gst_base_text_overlay_class_init (GstBaseTextOverlayClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->finalize = gst_base_text_overlay_finalize;
+  gobject_class->set_property = gst_base_text_overlay_set_property;
+  gobject_class->get_property = gst_base_text_overlay_get_property;
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&video_sink_template_factory));
+
+  gstelement_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_change_state);
+
+  klass->pango_lock = g_mutex_new ();
+
+  klass->get_text = gst_base_text_overlay_get_text;
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TEXT,
+      g_param_spec_string ("text", "text",
+          "Text to be display.", DEFAULT_PROP_TEXT,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SHADING,
+      g_param_spec_boolean ("shaded-background", "shaded background",
+          "Whether to shade the background under the text area",
+          DEFAULT_PROP_SHADING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGNMENT,
+      g_param_spec_enum ("valignment", "vertical alignment",
+          "Vertical alignment of the text", GST_TYPE_BASE_TEXT_OVERLAY_VALIGN,
+          DEFAULT_PROP_VALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
+      g_param_spec_enum ("halignment", "horizontal alignment",
+          "Horizontal alignment of the text", GST_TYPE_BASE_TEXT_OVERLAY_HALIGN,
+          DEFAULT_PROP_HALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGN,
+      g_param_spec_string ("valign", "vertical alignment",
+          "Vertical alignment of the text (deprecated; use valignment)",
+          DEFAULT_PROP_VALIGN, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGN,
+      g_param_spec_string ("halign", "horizontal alignment",
+          "Horizontal alignment of the text (deprecated; use halignment)",
+          DEFAULT_PROP_HALIGN, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPAD,
+      g_param_spec_int ("xpad", "horizontal paddding",
+          "Horizontal paddding when using left/right alignment", 0, G_MAXINT,
+          DEFAULT_PROP_XPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPAD,
+      g_param_spec_int ("ypad", "vertical padding",
+          "Vertical padding when using top/bottom alignment", 0, G_MAXINT,
+          DEFAULT_PROP_YPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAX,
+      g_param_spec_int ("deltax", "X position modifier",
+          "Shift X position to the left or to the right. Unit is pixels.",
+          G_MININT, G_MAXINT, DEFAULT_PROP_DELTAX,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAY,
+      g_param_spec_int ("deltay", "Y position modifier",
+          "Shift Y position up or down. Unit is pixels.", G_MININT, G_MAXINT,
+          DEFAULT_PROP_DELTAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstBaseTextOverlay:xpos
+   *
+   * Horizontal position of the rendered text when using positioned alignment.
+   *
+   * Since: 0.10.31
+   **/
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPOS,
+      g_param_spec_double ("xpos", "horizontal position",
+          "Horizontal position when using position alignment", 0, 1.0,
+          DEFAULT_PROP_XPOS,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstBaseTextOverlay:ypos
+   *
+   * Vertical position of the rendered text when using positioned alignment.
+   *
+   * Since: 0.10.31
+   **/
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPOS,
+      g_param_spec_double ("ypos", "vertical position",
+          "Vertical position when using position alignment", 0, 1.0,
+          DEFAULT_PROP_YPOS,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WRAP_MODE,
+      g_param_spec_enum ("wrap-mode", "wrap mode",
+          "Whether to wrap the text and if so how.",
+          GST_TYPE_BASE_TEXT_OVERLAY_WRAP_MODE, DEFAULT_PROP_WRAP_MODE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FONT_DESC,
+      g_param_spec_string ("font-desc", "font description",
+          "Pango font description of font to be used for rendering. "
+          "See documentation of pango_font_description_from_string "
+          "for syntax.", DEFAULT_PROP_FONT_DESC,
+          G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstBaseTextOverlay:color
+   *
+   * Color of the rendered text.
+   *
+   * Since: 0.10.31
+   **/
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COLOR,
+      g_param_spec_uint ("color", "Color",
+          "Color to use for text (big-endian ARGB).", 0, G_MAXUINT32,
+          DEFAULT_PROP_COLOR,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstTextOverlay:outline-color
+   *
+   * Color of the outline of the rendered text.
+   *
+   * Since: 0.10.35
+   **/
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_OUTLINE_COLOR,
+      g_param_spec_uint ("outline-color", "Text Outline Color",
+          "Color to use for outline the text (big-endian ARGB).", 0,
+          G_MAXUINT32, DEFAULT_PROP_OUTLINE_COLOR,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstBaseTextOverlay:line-alignment
+   *
+   * Alignment of text lines relative to each other (for multi-line text)
+   *
+   * Since: 0.10.15
+   **/
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LINE_ALIGNMENT,
+      g_param_spec_enum ("line-alignment", "line alignment",
+          "Alignment of text lines relative to each other.",
+          GST_TYPE_BASE_TEXT_OVERLAY_LINE_ALIGN, DEFAULT_PROP_LINE_ALIGNMENT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstBaseTextOverlay:silent
+   *
+   * If set, no text is rendered. Useful to switch off text rendering
+   * temporarily without removing the textoverlay element from the pipeline.
+   *
+   * Since: 0.10.15
+   **/
+  /* FIXME 0.11: rename to "visible" or "text-visible" or "render-text" */
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SILENT,
+      g_param_spec_boolean ("silent", "silent",
+          "Whether to render the text string",
+          DEFAULT_PROP_SILENT,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstBaseTextOverlay:wait-text
+   *
+   * If set, the video will block until a subtitle is received on the text pad.
+   * If video and subtitles are sent in sync, like from the same demuxer, this
+   * property should be set.
+   *
+   * Since: 0.10.20
+   **/
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WAIT_TEXT,
+      g_param_spec_boolean ("wait-text", "Wait Text",
+          "Whether to wait for subtitles",
+          DEFAULT_PROP_WAIT_TEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+      PROP_AUTO_ADJUST_SIZE, g_param_spec_boolean ("auto-resize", "auto resize",
+          "Automatically adjust font size to screen-size.",
+          DEFAULT_PROP_AUTO_ADJUST_SIZE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VERTICAL_RENDER,
+      g_param_spec_boolean ("vertical-render", "vertical render",
+          "Vertical Render.", DEFAULT_PROP_VERTICAL_RENDER,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_base_text_overlay_finalize (GObject * object)
+{
+  GstBaseTextOverlay *overlay = GST_BASE_TEXT_OVERLAY (object);
+
+  g_free (overlay->default_text);
+
+  if (overlay->text_image) {
+    g_free (overlay->text_image);
+    overlay->text_image = NULL;
+  }
+
+  if (overlay->layout) {
+    g_object_unref (overlay->layout);
+    overlay->layout = NULL;
+  }
+
+  if (overlay->text_buffer) {
+    gst_buffer_unref (overlay->text_buffer);
+    overlay->text_buffer = NULL;
+  }
+
+  if (overlay->cond) {
+    g_cond_free (overlay->cond);
+    overlay->cond = NULL;
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_base_text_overlay_init (GstBaseTextOverlay * overlay,
+    GstBaseTextOverlayClass * klass)
+{
+  GstPadTemplate *template;
+  PangoFontDescription *desc;
+
+  /* video sink */
+  template = gst_static_pad_template_get (&video_sink_template_factory);
+  overlay->video_sinkpad = gst_pad_new_from_template (template, "video_sink");
+  gst_object_unref (template);
+  gst_pad_set_getcaps_function (overlay->video_sinkpad,
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_getcaps));
+  gst_pad_set_event_function (overlay->video_sinkpad,
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_video_event));
+  gst_pad_set_chain_function (overlay->video_sinkpad,
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_video_chain));
+  gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad);
+
+  template =
+      gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass),
+      "text_sink");
+  if (template) {
+    /* text sink */
+    overlay->text_sinkpad = gst_pad_new_from_template (template, "text_sink");
+    gst_object_unref (template);
+
+    gst_pad_set_event_function (overlay->text_sinkpad,
+        GST_DEBUG_FUNCPTR (gst_base_text_overlay_text_event));
+    gst_pad_set_chain_function (overlay->text_sinkpad,
+        GST_DEBUG_FUNCPTR (gst_base_text_overlay_text_chain));
+    gst_pad_set_link_function (overlay->text_sinkpad,
+        GST_DEBUG_FUNCPTR (gst_base_text_overlay_text_pad_link));
+    gst_pad_set_unlink_function (overlay->text_sinkpad,
+        GST_DEBUG_FUNCPTR (gst_base_text_overlay_text_pad_unlink));
+    gst_element_add_pad (GST_ELEMENT (overlay), overlay->text_sinkpad);
+  }
+
+  /* (video) source */
+  template = gst_static_pad_template_get (&src_template_factory);
+  overlay->srcpad = gst_pad_new_from_template (template, "src");
+  gst_object_unref (template);
+  gst_pad_set_getcaps_function (overlay->srcpad,
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_getcaps));
+  gst_pad_set_event_function (overlay->srcpad,
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_src_event));
+  gst_pad_set_query_function (overlay->srcpad,
+      GST_DEBUG_FUNCPTR (gst_base_text_overlay_src_query));
+  gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
+
+  g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+  overlay->line_align = DEFAULT_PROP_LINE_ALIGNMENT;
+  overlay->layout =
+      pango_layout_new (GST_BASE_TEXT_OVERLAY_GET_CLASS
+      (overlay)->pango_context);
+  desc =
+      pango_context_get_font_description (GST_BASE_TEXT_OVERLAY_GET_CLASS
+      (overlay)->pango_context);
+  gst_base_text_overlay_adjust_values_with_fontdesc (overlay, desc);
+
+  overlay->color = DEFAULT_PROP_COLOR;
+  overlay->outline_color = DEFAULT_PROP_OUTLINE_COLOR;
+  overlay->halign = DEFAULT_PROP_HALIGNMENT;
+  overlay->valign = DEFAULT_PROP_VALIGNMENT;
+  overlay->xpad = DEFAULT_PROP_XPAD;
+  overlay->ypad = DEFAULT_PROP_YPAD;
+  overlay->deltax = DEFAULT_PROP_DELTAX;
+  overlay->deltay = DEFAULT_PROP_DELTAY;
+  overlay->xpos = DEFAULT_PROP_XPOS;
+  overlay->ypos = DEFAULT_PROP_YPOS;
+
+  overlay->wrap_mode = DEFAULT_PROP_WRAP_MODE;
+
+  overlay->want_shading = DEFAULT_PROP_SHADING;
+  overlay->shading_value = DEFAULT_SHADING_VALUE;
+  overlay->silent = DEFAULT_PROP_SILENT;
+  overlay->wait_text = DEFAULT_PROP_WAIT_TEXT;
+  overlay->auto_adjust_size = DEFAULT_PROP_AUTO_ADJUST_SIZE;
+
+  overlay->default_text = g_strdup (DEFAULT_PROP_TEXT);
+  overlay->need_render = TRUE;
+  overlay->text_image = NULL;
+  overlay->use_vertical_render = DEFAULT_PROP_VERTICAL_RENDER;
+  gst_base_text_overlay_update_render_mode (overlay);
+
+  overlay->text_buffer = NULL;
+  overlay->text_linked = FALSE;
+  overlay->cond = g_cond_new ();
+  gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
+  g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+}
+
+static void
+gst_base_text_overlay_update_wrap_mode (GstBaseTextOverlay * overlay)
+{
+  if (overlay->wrap_mode == GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE) {
+    GST_DEBUG_OBJECT (overlay, "Set wrap mode NONE");
+    pango_layout_set_width (overlay->layout, -1);
+  } else {
+    int width;
+
+    if (overlay->auto_adjust_size) {
+      width = DEFAULT_SCALE_BASIS * PANGO_SCALE;
+      if (overlay->use_vertical_render) {
+        width = width * (overlay->height - overlay->ypad * 2) / overlay->width;
+      }
+    } else {
+      width =
+          (overlay->use_vertical_render ? overlay->height : overlay->width) *
+          PANGO_SCALE;
+    }
+
+    GST_DEBUG_OBJECT (overlay, "Set layout width %d", overlay->width);
+    GST_DEBUG_OBJECT (overlay, "Set wrap mode    %d", overlay->wrap_mode);
+    pango_layout_set_width (overlay->layout, width);
+    pango_layout_set_wrap (overlay->layout, (PangoWrapMode) overlay->wrap_mode);
+  }
+}
+
+static void
+gst_base_text_overlay_update_render_mode (GstBaseTextOverlay * overlay)
+{
+  PangoMatrix matrix = PANGO_MATRIX_INIT;
+  PangoContext *context = pango_layout_get_context (overlay->layout);
+
+  if (overlay->use_vertical_render) {
+    pango_matrix_rotate (&matrix, -90);
+    pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO);
+    pango_context_set_matrix (context, &matrix);
+    pango_layout_set_alignment (overlay->layout, PANGO_ALIGN_LEFT);
+  } else {
+    pango_context_set_base_gravity (context, PANGO_GRAVITY_SOUTH);
+    pango_context_set_matrix (context, &matrix);
+    pango_layout_set_alignment (overlay->layout, overlay->line_align);
+  }
+}
+
+static gboolean
+gst_base_text_overlay_setcaps_txt (GstBaseTextOverlay * overlay, GstCaps * caps)
+{
+  GstStructure *structure;
+
+  structure = gst_caps_get_structure (caps, 0);
+  overlay->have_pango_markup =
+      gst_structure_has_name (structure, "text/x-pango-markup");
+
+  return TRUE;
+}
+
+/* FIXME: upstream nego (e.g. when the video window is resized) */
+
+static gboolean
+gst_base_text_overlay_setcaps (GstBaseTextOverlay * overlay, GstCaps * caps)
+{
+  GstVideoInfo info;
+  gboolean ret = FALSE;
+
+  if (!gst_video_info_from_caps (&info, caps))
+    goto invalid_caps;
+
+  overlay->info = info;
+  overlay->format = GST_VIDEO_INFO_FORMAT (&info);
+  overlay->width = GST_VIDEO_INFO_WIDTH (&info);
+  overlay->height = GST_VIDEO_INFO_HEIGHT (&info);
+
+  ret = gst_pad_push_event (overlay->srcpad, gst_event_new_caps (caps));
+
+  if (ret) {
+    GST_OBJECT_LOCK (overlay);
+    g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+    gst_base_text_overlay_update_wrap_mode (overlay);
+    g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+    GST_OBJECT_UNLOCK (overlay);
+  }
+
+  return ret;
+
+  /* ERRORS */
+invalid_caps:
+  {
+    GST_DEBUG_OBJECT (overlay, "could not parse caps");
+    return FALSE;
+  }
+}
+
+static void
+gst_base_text_overlay_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstBaseTextOverlay *overlay = GST_BASE_TEXT_OVERLAY (object);
+
+  GST_OBJECT_LOCK (overlay);
+  switch (prop_id) {
+    case PROP_TEXT:
+      g_free (overlay->default_text);
+      overlay->default_text = g_value_dup_string (value);
+      overlay->need_render = TRUE;
+      break;
+    case PROP_SHADING:
+      overlay->want_shading = g_value_get_boolean (value);
+      break;
+    case PROP_XPAD:
+      overlay->xpad = g_value_get_int (value);
+      break;
+    case PROP_YPAD:
+      overlay->ypad = g_value_get_int (value);
+      break;
+    case PROP_DELTAX:
+      overlay->deltax = g_value_get_int (value);
+      break;
+    case PROP_DELTAY:
+      overlay->deltay = g_value_get_int (value);
+      break;
+    case PROP_XPOS:
+      overlay->xpos = g_value_get_double (value);
+      break;
+    case PROP_YPOS:
+      overlay->ypos = g_value_get_double (value);
+      break;
+    case PROP_HALIGN:{
+      const gchar *s = g_value_get_string (value);
+
+      if (s && g_ascii_strcasecmp (s, "left") == 0)
+        overlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_LEFT;
+      else if (s && g_ascii_strcasecmp (s, "center") == 0)
+        overlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_CENTER;
+      else if (s && g_ascii_strcasecmp (s, "right") == 0)
+        overlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT;
+      else
+        g_warning ("Invalid value '%s' for textoverlay property 'halign'",
+            GST_STR_NULL (s));
+      break;
+    }
+    case PROP_VALIGN:{
+      const gchar *s = g_value_get_string (value);
+
+      if (s && g_ascii_strcasecmp (s, "baseline") == 0)
+        overlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE;
+      else if (s && g_ascii_strcasecmp (s, "bottom") == 0)
+        overlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM;
+      else if (s && g_ascii_strcasecmp (s, "top") == 0)
+        overlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
+      else
+        g_warning ("Invalid value '%s' for textoverlay property 'valign'",
+            GST_STR_NULL (s));
+      break;
+    }
+    case PROP_VALIGNMENT:
+      overlay->valign = g_value_get_enum (value);
+      break;
+    case PROP_HALIGNMENT:
+      overlay->halign = g_value_get_enum (value);
+      break;
+    case PROP_WRAP_MODE:
+      overlay->wrap_mode = g_value_get_enum (value);
+      g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      gst_base_text_overlay_update_wrap_mode (overlay);
+      g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      break;
+    case PROP_FONT_DESC:
+    {
+      PangoFontDescription *desc;
+      const gchar *fontdesc_str;
+
+      fontdesc_str = g_value_get_string (value);
+      g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      desc = pango_font_description_from_string (fontdesc_str);
+      if (desc) {
+        GST_LOG_OBJECT (overlay, "font description set: %s", fontdesc_str);
+        pango_layout_set_font_description (overlay->layout, desc);
+        gst_base_text_overlay_adjust_values_with_fontdesc (overlay, desc);
+        pango_font_description_free (desc);
+      } else {
+        GST_WARNING_OBJECT (overlay, "font description parse failed: %s",
+            fontdesc_str);
+      }
+      g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      break;
+    }
+    case PROP_COLOR:
+      overlay->color = g_value_get_uint (value);
+      break;
+    case PROP_OUTLINE_COLOR:
+      overlay->outline_color = g_value_get_uint (value);
+      break;
+    case PROP_SILENT:
+      overlay->silent = g_value_get_boolean (value);
+      break;
+    case PROP_LINE_ALIGNMENT:
+      overlay->line_align = g_value_get_enum (value);
+      g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      pango_layout_set_alignment (overlay->layout,
+          (PangoAlignment) overlay->line_align);
+      g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      break;
+    case PROP_WAIT_TEXT:
+      overlay->wait_text = g_value_get_boolean (value);
+      break;
+    case PROP_AUTO_ADJUST_SIZE:
+      overlay->auto_adjust_size = g_value_get_boolean (value);
+      overlay->need_render = TRUE;
+      break;
+    case PROP_VERTICAL_RENDER:
+      overlay->use_vertical_render = g_value_get_boolean (value);
+      g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      gst_base_text_overlay_update_render_mode (overlay);
+      g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+      overlay->need_render = TRUE;
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+  overlay->need_render = TRUE;
+  GST_OBJECT_UNLOCK (overlay);
+}
+
+static void
+gst_base_text_overlay_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstBaseTextOverlay *overlay = GST_BASE_TEXT_OVERLAY (object);
+
+  GST_OBJECT_LOCK (overlay);
+  switch (prop_id) {
+    case PROP_TEXT:
+      g_value_set_string (value, overlay->default_text);
+      break;
+    case PROP_SHADING:
+      g_value_set_boolean (value, overlay->want_shading);
+      break;
+    case PROP_XPAD:
+      g_value_set_int (value, overlay->xpad);
+      break;
+    case PROP_YPAD:
+      g_value_set_int (value, overlay->ypad);
+      break;
+    case PROP_DELTAX:
+      g_value_set_int (value, overlay->deltax);
+      break;
+    case PROP_DELTAY:
+      g_value_set_int (value, overlay->deltay);
+      break;
+    case PROP_XPOS:
+      g_value_set_double (value, overlay->xpos);
+      break;
+    case PROP_YPOS:
+      g_value_set_double (value, overlay->ypos);
+      break;
+    case PROP_VALIGNMENT:
+      g_value_set_enum (value, overlay->valign);
+      break;
+    case PROP_HALIGNMENT:
+      g_value_set_enum (value, overlay->halign);
+      break;
+    case PROP_WRAP_MODE:
+      g_value_set_enum (value, overlay->wrap_mode);
+      break;
+    case PROP_SILENT:
+      g_value_set_boolean (value, overlay->silent);
+      break;
+    case PROP_LINE_ALIGNMENT:
+      g_value_set_enum (value, overlay->line_align);
+      break;
+    case PROP_WAIT_TEXT:
+      g_value_set_boolean (value, overlay->wait_text);
+      break;
+    case PROP_AUTO_ADJUST_SIZE:
+      g_value_set_boolean (value, overlay->auto_adjust_size);
+      break;
+    case PROP_VERTICAL_RENDER:
+      g_value_set_boolean (value, overlay->use_vertical_render);
+      break;
+    case PROP_COLOR:
+      g_value_set_uint (value, overlay->color);
+      break;
+    case PROP_OUTLINE_COLOR:
+      g_value_set_uint (value, overlay->outline_color);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+  overlay->need_render = TRUE;
+  GST_OBJECT_UNLOCK (overlay);
+}
+
+static gboolean
+gst_base_text_overlay_src_query (GstPad * pad, GstQuery * query)
+{
+  gboolean ret = FALSE;
+  GstBaseTextOverlay *overlay = NULL;
+
+  overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
+
+  ret = gst_pad_peer_query (overlay->video_sinkpad, query);
+
+  gst_object_unref (overlay);
+
+  return ret;
+}
+
+static gboolean
+gst_base_text_overlay_src_event (GstPad * pad, GstEvent * event)
+{
+  gboolean ret = FALSE;
+  GstBaseTextOverlay *overlay = NULL;
+
+  overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_SEEK:{
+      GstSeekFlags flags;
+
+      /* We don't handle seek if we have not text pad */
+      if (!overlay->text_linked) {
+        GST_DEBUG_OBJECT (overlay, "seek received, pushing upstream");
+        ret = gst_pad_push_event (overlay->video_sinkpad, event);
+        goto beach;
+      }
+
+      GST_DEBUG_OBJECT (overlay, "seek received, driving from here");
+
+      gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
+
+      /* Flush downstream, only for flushing seek */
+      if (flags & GST_SEEK_FLAG_FLUSH)
+        gst_pad_push_event (overlay->srcpad, gst_event_new_flush_start ());
+
+      /* Mark ourself as flushing, unblock chains */
+      GST_OBJECT_LOCK (overlay);
+      overlay->video_flushing = TRUE;
+      overlay->text_flushing = TRUE;
+      gst_base_text_overlay_pop_text (overlay);
+      GST_OBJECT_UNLOCK (overlay);
+
+      /* Seek on each sink pad */
+      gst_event_ref (event);
+      ret = gst_pad_push_event (overlay->video_sinkpad, event);
+      if (ret) {
+        ret = gst_pad_push_event (overlay->text_sinkpad, event);
+      } else {
+        gst_event_unref (event);
+      }
+      break;
+    }
+    default:
+      if (overlay->text_linked) {
+        gst_event_ref (event);
+        ret = gst_pad_push_event (overlay->video_sinkpad, event);
+        gst_pad_push_event (overlay->text_sinkpad, event);
+      } else {
+        ret = gst_pad_push_event (overlay->video_sinkpad, event);
+      }
+      break;
+  }
+
+beach:
+  gst_object_unref (overlay);
+
+  return ret;
+}
+
+static GstCaps *
+gst_base_text_overlay_getcaps (GstPad * pad, GstCaps * filter)
+{
+  GstBaseTextOverlay *overlay;
+  GstPad *otherpad;
+  GstCaps *caps;
+
+  overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
+
+  if (pad == overlay->srcpad)
+    otherpad = overlay->video_sinkpad;
+  else
+    otherpad = overlay->srcpad;
+
+  /* we can do what the peer can */
+  caps = gst_pad_peer_get_caps (otherpad, filter);
+  if (caps) {
+    GstCaps *temp, *templ;
+
+    GST_DEBUG_OBJECT (pad, "peer caps  %" GST_PTR_FORMAT, caps);
+
+    /* filtered against our padtemplate */
+    templ = gst_pad_get_pad_template_caps (otherpad);
+    GST_DEBUG_OBJECT (pad, "our template  %" GST_PTR_FORMAT, templ);
+    temp = gst_caps_intersect_full (caps, templ, GST_CAPS_INTERSECT_FIRST);
+    GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp);
+    gst_caps_unref (caps);
+    gst_caps_unref (templ);
+    /* this is what we can do */
+    caps = temp;
+  } else {
+    /* no peer, our padtemplate is enough then */
+    caps = gst_pad_get_pad_template_caps (pad);
+    if (filter) {
+      GstCaps *intersection;
+
+      intersection =
+          gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+      gst_caps_unref (caps);
+      caps = intersection;
+    }
+  }
+
+  GST_DEBUG_OBJECT (overlay, "returning  %" GST_PTR_FORMAT, caps);
+
+  gst_object_unref (overlay);
+
+  return caps;
+}
+
+static void
+gst_base_text_overlay_adjust_values_with_fontdesc (GstBaseTextOverlay * overlay,
+    PangoFontDescription * desc)
+{
+  gint font_size = pango_font_description_get_size (desc) / PANGO_SCALE;
+  overlay->shadow_offset = (double) (font_size) / 13.0;
+  overlay->outline_offset = (double) (font_size) / 15.0;
+  if (overlay->outline_offset < MINIMUM_OUTLINE_OFFSET)
+    overlay->outline_offset = MINIMUM_OUTLINE_OFFSET;
+}
+
+#define CAIRO_UNPREMULTIPLY(a,r,g,b) G_STMT_START { \
+  b = (a > 0) ? MIN ((b * 255 + a / 2) / a, 255) : 0; \
+  g = (a > 0) ? MIN ((g * 255 + a / 2) / a, 255) : 0; \
+  r = (a > 0) ? MIN ((r * 255 + a / 2) / a, 255) : 0; \
+} G_STMT_END
+
+static inline void
+gst_base_text_overlay_blit_1 (GstBaseTextOverlay * overlay, guchar * dest,
+    gint xpos, gint ypos, guchar * text_image, guint dest_stride)
+{
+  gint i, j = 0;
+  gint x, y;
+  guchar r, g, b, a;
+  guchar *pimage;
+  guchar *py;
+  gint width = overlay->image_width;
+  gint height = overlay->image_height;
+
+  if (xpos < 0) {
+    xpos = 0;
+  }
+
+  if (xpos + width > overlay->width) {
+    width = overlay->width - xpos;
+  }
+
+  if (ypos + height > overlay->height) {
+    height = overlay->height - ypos;
+  }
+
+  dest += (ypos / 1) * dest_stride;
+
+  for (i = 0; i < height; i++) {
+    pimage = text_image + 4 * (i * overlay->image_width);
+    py = dest + i * dest_stride + xpos;
+    for (j = 0; j < width; j++) {
+      b = pimage[CAIRO_ARGB_B];
+      g = pimage[CAIRO_ARGB_G];
+      r = pimage[CAIRO_ARGB_R];
+      a = pimage[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a, r, g, b);
+
+      pimage += 4;
+      if (a == 0) {
+        py++;
+        continue;
+      }
+      COMP_Y (y, r, g, b);
+      x = *py;
+      BLEND (*py++, a, y, x);
+    }
+  }
+}
+
+static inline void
+gst_base_text_overlay_blit_sub2x2cbcr (GstBaseTextOverlay * overlay,
+    guchar * destcb, guchar * destcr, gint xpos, gint ypos, guchar * text_image,
+    guint destcb_stride, guint destcr_stride, guint pix_stride)
+{
+  gint i, j;
+  gint x, cb, cr;
+  gushort r, g, b, a;
+  gushort r1, g1, b1, a1;
+  guchar *pimage1, *pimage2;
+  guchar *pcb, *pcr;
+  gint width = overlay->image_width - 2;
+  gint height = overlay->image_height - 2;
+
+  xpos *= pix_stride;
+
+  if (xpos < 0) {
+    xpos = 0;
+  }
+
+  if (xpos + width > overlay->width) {
+    width = overlay->width - xpos;
+  }
+
+  if (ypos + height > overlay->height) {
+    height = overlay->height - ypos;
+  }
+
+  destcb += (ypos / 2) * destcb_stride;
+  destcr += (ypos / 2) * destcr_stride;
+
+  for (i = 0; i < height; i += 2) {
+    pimage1 = text_image + 4 * (i * overlay->image_width);
+    pimage2 = pimage1 + 4 * overlay->image_width;
+    pcb = destcb + (i / 2) * destcb_stride + xpos / 2;
+    pcr = destcr + (i / 2) * destcr_stride + xpos / 2;
+    for (j = 0; j < width; j += 2) {
+      b = pimage1[CAIRO_ARGB_B];
+      g = pimage1[CAIRO_ARGB_G];
+      r = pimage1[CAIRO_ARGB_R];
+      a = pimage1[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a, r, g, b);
+      pimage1 += 4;
+
+      b1 = pimage1[CAIRO_ARGB_B];
+      g1 = pimage1[CAIRO_ARGB_G];
+      r1 = pimage1[CAIRO_ARGB_R];
+      a1 = pimage1[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
+      b += b1;
+      g += g1;
+      r += r1;
+      a += a1;
+      pimage1 += 4;
+
+      b1 = pimage2[CAIRO_ARGB_B];
+      g1 = pimage2[CAIRO_ARGB_G];
+      r1 = pimage2[CAIRO_ARGB_R];
+      a1 = pimage2[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
+      b += b1;
+      g += g1;
+      r += r1;
+      a += a1;
+      pimage2 += 4;
+
+      /* + 2 for rounding */
+      b1 = pimage2[CAIRO_ARGB_B];
+      g1 = pimage2[CAIRO_ARGB_G];
+      r1 = pimage2[CAIRO_ARGB_R];
+      a1 = pimage2[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
+      b += b1 + 2;
+      g += g1 + 2;
+      r += r1 + 2;
+      a += a1 + 2;
+      pimage2 += 4;
+
+      b /= 4;
+      g /= 4;
+      r /= 4;
+      a /= 4;
+
+      if (a == 0) {
+        pcb += pix_stride;
+        pcr += pix_stride;
+        continue;
+      }
+      COMP_U (cb, r, g, b);
+      COMP_V (cr, r, g, b);
+
+      x = *pcb;
+      BLEND (*pcb, a, cb, x);
+      x = *pcr;
+      BLEND (*pcr, a, cr, x);
+
+      pcb += pix_stride;
+      pcr += pix_stride;
+    }
+  }
+}
+
+static void
+gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay,
+    const gchar * string, gint textlen)
+{
+  cairo_t *cr;
+  cairo_surface_t *surface;
+  PangoRectangle ink_rect, logical_rect;
+  cairo_matrix_t cairo_matrix;
+  int width, height;
+  double scalef = 1.0;
+  double a, r, g, b;
+
+  g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+
+  if (overlay->auto_adjust_size) {
+    /* 640 pixel is default */
+    scalef = (double) (overlay->width) / DEFAULT_SCALE_BASIS;
+  }
+  pango_layout_set_width (overlay->layout, -1);
+  /* set text on pango layout */
+  pango_layout_set_markup (overlay->layout, string, textlen);
+
+  /* get subtitle image size */
+  pango_layout_get_pixel_extents (overlay->layout, &ink_rect, &logical_rect);
+
+  width = (logical_rect.width + overlay->shadow_offset) * scalef;
+
+  if (width + overlay->deltax >
+      (overlay->use_vertical_render ? overlay->height : overlay->width)) {
+    /*
+     * subtitle image width is larger then overlay width
+     * so rearrange overlay wrap mode.
+     */
+    gst_base_text_overlay_update_wrap_mode (overlay);
+    pango_layout_get_pixel_extents (overlay->layout, &ink_rect, &logical_rect);
+    width = overlay->width;
+  }
+
+  height =
+      (logical_rect.height + logical_rect.y + overlay->shadow_offset) * scalef;
+  if (height > overlay->height) {
+    height = overlay->height;
+  }
+  if (overlay->use_vertical_render) {
+    PangoRectangle rect;
+    PangoContext *context;
+    PangoMatrix matrix = PANGO_MATRIX_INIT;
+    int tmp;
+
+    context = pango_layout_get_context (overlay->layout);
+
+    pango_matrix_rotate (&matrix, -90);
+
+    rect.x = rect.y = 0;
+    rect.width = width;
+    rect.height = height;
+    pango_matrix_transform_pixel_rectangle (&matrix, &rect);
+    matrix.x0 = -rect.x;
+    matrix.y0 = -rect.y;
+
+    pango_context_set_matrix (context, &matrix);
+
+    cairo_matrix.xx = matrix.xx;
+    cairo_matrix.yx = matrix.yx;
+    cairo_matrix.xy = matrix.xy;
+    cairo_matrix.yy = matrix.yy;
+    cairo_matrix.x0 = matrix.x0;
+    cairo_matrix.y0 = matrix.y0;
+    cairo_matrix_scale (&cairo_matrix, scalef, scalef);
+
+    tmp = height;
+    height = width;
+    width = tmp;
+  } else {
+    cairo_matrix_init_scale (&cairo_matrix, scalef, scalef);
+  }
+
+  /* reallocate surface */
+  overlay->text_image = g_realloc (overlay->text_image, 4 * width * height);
+
+  surface = cairo_image_surface_create_for_data (overlay->text_image,
+      CAIRO_FORMAT_ARGB32, width, height, width * 4);
+  cr = cairo_create (surface);
+
+  /* clear surface */
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint (cr);
+
+  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
+  if (overlay->want_shading)
+    cairo_paint_with_alpha (cr, overlay->shading_value);
+
+  /* apply transformations */
+  cairo_set_matrix (cr, &cairo_matrix);
+
+  /* FIXME: We use show_layout everywhere except for the surface
+   * because it's really faster and internally does all kinds of
+   * caching. Unfortunately we have to paint to a cairo path for
+   * the outline and this is slow. Once Pango supports user fonts
+   * we should use them, see
+   * https://bugzilla.gnome.org/show_bug.cgi?id=598695
+   *
+   * Idea would the be, to create a cairo user font that
+   * does shadow, outline, text painting in the
+   * render_glyph function.
+   */
+
+  /* draw shadow text */
+  cairo_save (cr);
+  cairo_translate (cr, overlay->shadow_offset, overlay->shadow_offset);
+  cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
+  pango_cairo_show_layout (cr, overlay->layout);
+  cairo_restore (cr);
+
+  a = (overlay->outline_color >> 24) & 0xff;
+  r = (overlay->outline_color >> 16) & 0xff;
+  g = (overlay->outline_color >> 8) & 0xff;
+  b = (overlay->outline_color >> 0) & 0xff;
+
+  /* draw outline text */
+  cairo_save (cr);
+  cairo_set_source_rgba (cr, r / 255.0, g / 255.0, b / 255.0, a / 255.0);
+  cairo_set_line_width (cr, overlay->outline_offset);
+  pango_cairo_layout_path (cr, overlay->layout);
+  cairo_stroke (cr);
+  cairo_restore (cr);
+
+  a = (overlay->color >> 24) & 0xff;
+  r = (overlay->color >> 16) & 0xff;
+  g = (overlay->color >> 8) & 0xff;
+  b = (overlay->color >> 0) & 0xff;
+
+  /* draw text */
+  cairo_save (cr);
+  cairo_set_source_rgba (cr, r / 255.0, g / 255.0, b / 255.0, a / 255.0);
+  pango_cairo_show_layout (cr, overlay->layout);
+  cairo_restore (cr);
+
+  cairo_destroy (cr);
+  cairo_surface_destroy (surface);
+  overlay->image_width = width;
+  overlay->image_height = height;
+  overlay->baseline_y = ink_rect.y;
+  g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
+}
+
+#define BOX_XPAD         6
+#define BOX_YPAD         6
+
+static inline void
+gst_base_text_overlay_shade_planar_Y (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint x0, gint x1, gint y0, gint y1)
+{
+  gint i, j, dest_stride;
+  guint8 *dest_ptr;
+
+  dest_stride = dest->info.stride[0];
+  dest_ptr = dest->data[0];
+
+  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
+  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
+
+  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
+  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
+
+  for (i = y0; i < y1; ++i) {
+    for (j = x0; j < x1; ++j) {
+      gint y = dest_ptr[(i * dest_stride) + j] + overlay->shading_value;
+
+      dest_ptr[(i * dest_stride) + j] = CLAMP (y, 0, 255);
+    }
+  }
+}
+
+static inline void
+gst_base_text_overlay_shade_packed_Y (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint x0, gint x1, gint y0, gint y1)
+{
+  gint i, j;
+  guint dest_stride, pixel_stride;
+  guint8 *dest_ptr;
+
+  dest_stride = GST_VIDEO_FRAME_COMP_STRIDE (dest, 0);
+  dest_ptr = GST_VIDEO_FRAME_COMP_DATA (dest, 0);
+  pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (dest, 0);
+
+  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
+  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
+
+  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
+  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
+
+  if (x0 != 0)
+    x0 = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (dest->info.finfo, 0, x0);
+  if (x1 != 0)
+    x1 = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (dest->info.finfo, 0, x1);
+
+  if (y0 != 0)
+    y0 = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (dest->info.finfo, 0, y0);
+  if (y1 != 0)
+    y1 = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (dest->info.finfo, 0, y1);
+
+  for (i = y0; i < y1; i++) {
+    for (j = x0; j < x1; j++) {
+      gint y;
+      gint y_pos;
+
+      y_pos = (i * dest_stride) + j * pixel_stride;
+      y = dest_ptr[y_pos] + overlay->shading_value;
+
+      dest_ptr[y_pos] = CLAMP (y, 0, 255);
+    }
+  }
+}
+
+#define gst_base_text_overlay_shade_BGRx gst_base_text_overlay_shade_xRGB
+#define gst_base_text_overlay_shade_RGBx gst_base_text_overlay_shade_xRGB
+#define gst_base_text_overlay_shade_xBGR gst_base_text_overlay_shade_xRGB
+static inline void
+gst_base_text_overlay_shade_xRGB (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint x0, gint x1, gint y0, gint y1)
+{
+  gint i, j;
+  guint8 *dest_ptr;
+
+  dest_ptr = dest->data[0];
+
+  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
+  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
+
+  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
+  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
+
+  for (i = y0; i < y1; i++) {
+    for (j = x0; j < x1; j++) {
+      gint y, y_pos, k;
+
+      y_pos = (i * 4 * overlay->width) + j * 4;
+      for (k = 0; k < 4; k++) {
+        y = dest_ptr[y_pos + k] + overlay->shading_value;
+        dest_ptr[y_pos + k] = CLAMP (y, 0, 255);
+      }
+    }
+  }
+}
+
+#define ARGB_SHADE_FUNCTION(name, OFFSET)      \
+static inline void \
+gst_base_text_overlay_shade_##name (GstBaseTextOverlay * overlay, GstVideoFrame * dest, \
+gint x0, gint x1, gint y0, gint y1) \
+{ \
+  gint i, j;\
+  guint8 *dest_ptr;\
+  \
+  dest_ptr = dest->data[0];\
+  \
+  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);\
+  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);\
+  \
+  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);\
+  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);\
+  \
+  for (i = y0; i < y1; i++) {\
+    for (j = x0; j < x1; j++) {\
+      gint y, y_pos, k;\
+      y_pos = (i * 4 * overlay->width) + j * 4;\
+      for (k = OFFSET; k < 3+OFFSET; k++) {\
+        y = dest_ptr[y_pos + k] + overlay->shading_value;\
+        dest_ptr[y_pos + k] = CLAMP (y, 0, 255);\
+      }\
+    }\
+  }\
+}
+ARGB_SHADE_FUNCTION (ARGB, 1);
+ARGB_SHADE_FUNCTION (ABGR, 1);
+ARGB_SHADE_FUNCTION (RGBA, 0);
+ARGB_SHADE_FUNCTION (BGRA, 0);
+
+
+/* FIXME:
+ *  - use proper strides and offset for I420
+ *  - don't draw over the edge of the picture (try a longer
+ *    text with a huge font size)
+ */
+
+static inline void
+gst_base_text_overlay_blit_NV12_NV21 (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint xpos, gint ypos)
+{
+  int y_stride, u_stride, v_stride;
+  guint8 *y_pixels, *u_pixels, *v_pixels;
+
+  /* because U/V is 2x2 subsampled, we need to round, either up or down,
+   * to a boundary of integer number of U/V pixels:
+   */
+  xpos = GST_ROUND_UP_2 (xpos);
+  ypos = GST_ROUND_UP_2 (ypos);
+
+  y_pixels = dest->data[0];
+  u_pixels = dest->data[1];
+  v_pixels = dest->data[2];
+  y_stride = dest->info.stride[0];
+  u_stride = dest->info.stride[1];
+  v_stride = dest->info.stride[2];
+
+  gst_base_text_overlay_blit_1 (overlay, y_pixels, xpos, ypos,
+      overlay->text_image, y_stride);
+  gst_base_text_overlay_blit_sub2x2cbcr (overlay, u_pixels,
+      v_pixels, xpos, ypos, overlay->text_image, u_stride, v_stride, 2);
+}
+
+static inline void
+gst_base_text_overlay_blit_I420 (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint xpos, gint ypos)
+{
+  int y_stride, u_stride, v_stride;
+  guint8 *y_pixels, *u_pixels, *v_pixels;
+
+  /* because U/V is 2x2 subsampled, we need to round, either up or down,
+   * to a boundary of integer number of U/V pixels:
+   */
+  xpos = GST_ROUND_UP_2 (xpos);
+  ypos = GST_ROUND_UP_2 (ypos);
+
+  y_pixels = dest->data[0];
+  u_pixels = dest->data[1];
+  v_pixels = dest->data[2];
+  y_stride = dest->info.stride[0];
+  u_stride = dest->info.stride[1];
+  v_stride = dest->info.stride[2];
+
+  gst_base_text_overlay_blit_1 (overlay, y_pixels, xpos, ypos,
+      overlay->text_image, y_stride);
+  gst_base_text_overlay_blit_sub2x2cbcr (overlay, u_pixels,
+      v_pixels, xpos, ypos, overlay->text_image, u_stride, v_stride, 1);
+}
+
+static inline void
+gst_base_text_overlay_blit_UYVY (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint xpos, gint ypos)
+{
+  int a0, r0, g0, b0;
+  int a1, r1, g1, b1;
+  int y0, y1, u, v;
+  int i, j;
+  int h, w;
+  guchar *pimage, *dest_ptr;
+  guint8 *yuv_pixels;
+
+  yuv_pixels = dest->data[0];
+
+  /* because U/V is 2x horizontally subsampled, we need to round to a
+   * boundary of integer number of U/V pixels in x dimension:
+   */
+  xpos = GST_ROUND_UP_2 (xpos);
+
+  w = overlay->image_width - 2;
+  h = overlay->image_height - 2;
+
+  if (xpos < 0) {
+    xpos = 0;
+  }
+
+  if (xpos + w > overlay->width) {
+    w = overlay->width - xpos;
+  }
+
+  if (ypos + h > overlay->height) {
+    h = overlay->height - ypos;
+  }
+
+  for (i = 0; i < h; i++) {
+    pimage = overlay->text_image + i * overlay->image_width * 4;
+    dest_ptr = yuv_pixels + (i + ypos) * overlay->width * 2 + xpos * 2;
+    for (j = 0; j < w; j += 2) {
+      b0 = pimage[CAIRO_ARGB_B];
+      g0 = pimage[CAIRO_ARGB_G];
+      r0 = pimage[CAIRO_ARGB_R];
+      a0 = pimage[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a0, r0, g0, b0);
+      pimage += 4;
+
+      b1 = pimage[CAIRO_ARGB_B];
+      g1 = pimage[CAIRO_ARGB_G];
+      r1 = pimage[CAIRO_ARGB_R];
+      a1 = pimage[CAIRO_ARGB_A];
+      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
+      pimage += 4;
+
+      a0 += a1 + 2;
+      a0 /= 2;
+      if (a0 == 0) {
+        dest_ptr += 4;
+        continue;
+      }
+
+      COMP_Y (y0, r0, g0, b0);
+      COMP_Y (y1, r1, g1, b1);
+
+      b0 += b1 + 2;
+      g0 += g1 + 2;
+      r0 += r1 + 2;
+
+      b0 /= 2;
+      g0 /= 2;
+      r0 /= 2;
+
+      COMP_U (u, r0, g0, b0);
+      COMP_V (v, r0, g0, b0);
+
+      BLEND (*dest_ptr, a0, u, *dest_ptr);
+      dest_ptr++;
+      BLEND (*dest_ptr, a0, y0, *dest_ptr);
+      dest_ptr++;
+      BLEND (*dest_ptr, a0, v, *dest_ptr);
+      dest_ptr++;
+      BLEND (*dest_ptr, a0, y1, *dest_ptr);
+      dest_ptr++;
+    }
+  }
+}
+
+static inline void
+gst_base_text_overlay_blit_AYUV (GstBaseTextOverlay * overlay,
+    GstVideoFrame * dest, gint xpos, gint ypos)
+{
+  int a, r, g, b, a1;
+  int y, u, v;
+  int i, j;
+  int h, w;
+  guchar *pimage, *dest_ptr;
+  guint8 *rgb_pixels;
+
+  rgb_pixels = dest->data[0];
+
+  w = overlay->image_width;
+  h = overlay->image_height;
+
+  if (xpos < 0) {
+    xpos = 0;
+  }
+
+  if (xpos + w > overlay->width) {
+    w = overlay->width - xpos;
+  }
+
+  if (ypos + h > overlay->height) {
+    h = overlay->height - ypos;
+  }
+
+  for (i = 0; i < h; i++) {
+    pimage = overlay->text_image + i * overlay->image_width * 4;
+    dest_ptr = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4;
+    for (j = 0; j < w; j++) {
+      a = pimage[CAIRO_ARGB_A];
+      b = pimage[CAIRO_ARGB_B];
+      g = pimage[CAIRO_ARGB_G];
+      r = pimage[CAIRO_ARGB_R];
+
+      CAIRO_UNPREMULTIPLY (a, r, g, b);
+
+      // convert background to yuv
+      COMP_Y (y, r, g, b);
+      COMP_U (u, r, g, b);
+      COMP_V (v, r, g, b);
+
+      // preform text "OVER" background alpha compositing
+      a1 = a + (dest_ptr[0] * (255 - a)) / 255 + 1;     // add 1 to prevent divide by 0
+      OVER (dest_ptr[1], a, y, dest_ptr[0], dest_ptr[1], a1);
+      OVER (dest_ptr[2], a, u, dest_ptr[0], dest_ptr[2], a1);
+      OVER (dest_ptr[3], a, v, dest_ptr[0], dest_ptr[3], a1);
+      dest_ptr[0] = a1 - 1;     // remove the temporary 1 we added
+
+      pimage += 4;
+      dest_ptr += 4;
+    }
+  }
+}
+
+#define xRGB_BLIT_FUNCTION(name, R, G, B) \
+static inline void \
+gst_base_text_overlay_blit_##name (GstBaseTextOverlay * overlay, \
+    GstVideoFrame * dest, gint xpos, gint ypos) \
+{ \
+  int a, r, g, b; \
+  int i, j; \
+  int h, w; \
+  guchar *pimage, *dest_ptr; \
+  guint8 *rgb_pixels;\
+  \
+  rgb_pixels = dest->data[0];\
+  \
+  w = overlay->image_width; \
+  h = overlay->image_height; \
+  \
+  if (xpos < 0) { \
+    xpos = 0; \
+  } \
+  \
+  if (xpos + w > overlay->width) { \
+    w = overlay->width - xpos; \
+  } \
+  \
+  if (ypos + h > overlay->height) { \
+    h = overlay->height - ypos; \
+  } \
+  \
+  for (i = 0; i < h; i++) { \
+    pimage = overlay->text_image + i * overlay->image_width * 4; \
+    dest_ptr = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4; \
+    for (j = 0; j < w; j++) { \
+      a = pimage[CAIRO_ARGB_A]; \
+      b = pimage[CAIRO_ARGB_B]; \
+      g = pimage[CAIRO_ARGB_G]; \
+      r = pimage[CAIRO_ARGB_R]; \
+      CAIRO_UNPREMULTIPLY (a, r, g, b); \
+      b = (b*a + dest_ptr[B] * (255-a)) / 255; \
+      g = (g*a + dest_ptr[G] * (255-a)) / 255; \
+      r = (r*a + dest_ptr[R] * (255-a)) / 255; \
+      \
+      dest_ptr[B] = b; \
+      dest_ptr[G] = g; \
+      dest_ptr[R] = r; \
+      pimage += 4; \
+      dest_ptr += 4; \
+    } \
+  } \
+}
+xRGB_BLIT_FUNCTION (xRGB, 1, 2, 3);
+xRGB_BLIT_FUNCTION (BGRx, 2, 1, 0);
+xRGB_BLIT_FUNCTION (xBGR, 3, 2, 1);
+xRGB_BLIT_FUNCTION (RGBx, 0, 1, 2);
+
+#define ARGB_BLIT_FUNCTION(name, A, R, G, B)   \
+static inline void \
+gst_base_text_overlay_blit_##name (GstBaseTextOverlay * overlay, \
+    GstVideoFrame * dest, gint xpos, gint ypos) \
+{ \
+  int a, r, g, b, a1;                          \
+  int i, j; \
+  int h, w; \
+  guchar *pimage, *dest_ptr; \
+  guint8 *rgb_pixels;\
+  \
+  rgb_pixels = dest->data[0];\
+  \
+  w = overlay->image_width; \
+  h = overlay->image_height; \
+  \
+  if (xpos < 0) { \
+    xpos = 0; \
+  } \
+  \
+  if (xpos + w > overlay->width) { \
+    w = overlay->width - xpos; \
+  } \
+  \
+  if (ypos + h > overlay->height) { \
+    h = overlay->height - ypos; \
+  } \
+  \
+  for (i = 0; i < h; i++) { \
+    pimage = overlay->text_image + i * overlay->image_width * 4; \
+    dest_ptr = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4; \
+    for (j = 0; j < w; j++) { \
+      a = pimage[CAIRO_ARGB_A]; \
+      b = pimage[CAIRO_ARGB_B]; \
+      g = pimage[CAIRO_ARGB_G]; \
+      r = pimage[CAIRO_ARGB_R]; \
+      CAIRO_UNPREMULTIPLY (a, r, g, b); \
+      a1 = a + (dest_ptr[A] * (255 - a)) / 255 + 1; \
+      OVER (dest_ptr[R], a, r, dest_ptr[0], dest_ptr[R], a1); \
+      OVER (dest_ptr[G], a, g, dest_ptr[0], dest_ptr[G], a1); \
+      OVER (dest_ptr[B], a, b, dest_ptr[0], dest_ptr[B], a1); \
+      dest_ptr[A] = a1 - 1; \
+      pimage += 4; \
+      dest_ptr += 4; \
+    } \
+  } \
+}
+ARGB_BLIT_FUNCTION (RGBA, 3, 0, 1, 2);
+ARGB_BLIT_FUNCTION (BGRA, 3, 2, 1, 0);
+ARGB_BLIT_FUNCTION (ARGB, 0, 1, 2, 3);
+ARGB_BLIT_FUNCTION (ABGR, 0, 3, 2, 1);
+
+static void
+gst_base_text_overlay_render_text (GstBaseTextOverlay * overlay,
+    const gchar * text, gint textlen)
+{
+  gchar *string;
+
+  if (!overlay->need_render) {
+    GST_DEBUG ("Using previously rendered text.");
+    return;
+  }
+
+  /* -1 is the whole string */
+  if (text != NULL && textlen < 0) {
+    textlen = strlen (text);
+  }
+
+  if (text != NULL) {
+    string = g_strndup (text, textlen);
+  } else {                      /* empty string */
+    string = g_strdup (" ");
+  }
+  g_strdelimit (string, "\r\t", ' ');
+  textlen = strlen (string);
+
+  /* FIXME: should we check for UTF-8 here? */
+
+  GST_DEBUG ("Rendering '%s'", string);
+  gst_base_text_overlay_render_pangocairo (overlay, string, textlen);
+
+  g_free (string);
+
+  overlay->need_render = FALSE;
+}
+
+static GstFlowReturn
+gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay,
+    GstBuffer * video_frame)
+{
+  gint xpos, ypos;
+  gint width, height;
+  GstBaseTextOverlayVAlign valign;
+  GstBaseTextOverlayHAlign halign;
+  GstVideoFrame frame;
+
+  width = overlay->image_width;
+  height = overlay->image_height;
+
+  video_frame = gst_buffer_make_writable (video_frame);
+
+  if (!gst_video_frame_map (&frame, &overlay->info, video_frame, GST_MAP_WRITE))
+    goto invalid_frame;
+
+  if (overlay->use_vertical_render)
+    halign = GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT;
+  else
+    halign = overlay->halign;
+
+  switch (halign) {
+    case GST_BASE_TEXT_OVERLAY_HALIGN_LEFT:
+      xpos = overlay->xpad;
+      break;
+    case GST_BASE_TEXT_OVERLAY_HALIGN_CENTER:
+      xpos = (overlay->width - width) / 2;
+      break;
+    case GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT:
+      xpos = overlay->width - width - overlay->xpad;
+      break;
+    case GST_BASE_TEXT_OVERLAY_HALIGN_POS:
+      xpos = (gint) (overlay->width * overlay->xpos) - width / 2;
+      xpos = CLAMP (xpos, 0, overlay->width - width);
+      if (xpos < 0)
+        xpos = 0;
+      break;
+    default:
+      xpos = 0;
+  }
+  xpos += overlay->deltax;
+
+  if (overlay->use_vertical_render)
+    valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
+  else
+    valign = overlay->valign;
+
+  switch (valign) {
+    case GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM:
+      ypos = overlay->height - height - overlay->ypad;
+      break;
+    case GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE:
+      ypos = overlay->height - (height + overlay->ypad);
+      break;
+    case GST_BASE_TEXT_OVERLAY_VALIGN_TOP:
+      ypos = overlay->ypad;
+      break;
+    case GST_BASE_TEXT_OVERLAY_VALIGN_POS:
+      ypos = (gint) (overlay->height * overlay->ypos) - height / 2;
+      ypos = CLAMP (ypos, 0, overlay->height - height);
+      break;
+    case GST_BASE_TEXT_OVERLAY_VALIGN_CENTER:
+      ypos = (overlay->height - height) / 2;
+      break;
+    default:
+      ypos = overlay->ypad;
+      break;
+  }
+  ypos += overlay->deltay;
+
+  /* shaded background box */
+  if (overlay->want_shading) {
+    switch (overlay->format) {
+      case GST_VIDEO_FORMAT_I420:
+      case GST_VIDEO_FORMAT_NV12:
+      case GST_VIDEO_FORMAT_NV21:
+        gst_base_text_overlay_shade_planar_Y (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_AYUV:
+      case GST_VIDEO_FORMAT_UYVY:
+        gst_base_text_overlay_shade_packed_Y (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_xRGB:
+        gst_base_text_overlay_shade_xRGB (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_xBGR:
+        gst_base_text_overlay_shade_xBGR (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_BGRx:
+        gst_base_text_overlay_shade_BGRx (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_RGBx:
+        gst_base_text_overlay_shade_RGBx (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_ARGB:
+        gst_base_text_overlay_shade_ARGB (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_ABGR:
+        gst_base_text_overlay_shade_ABGR (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_RGBA:
+        gst_base_text_overlay_shade_RGBA (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      case GST_VIDEO_FORMAT_BGRA:
+        gst_base_text_overlay_shade_BGRA (overlay, &frame,
+            xpos, xpos + overlay->image_width,
+            ypos, ypos + overlay->image_height);
+        break;
+      default:
+        g_assert_not_reached ();
+    }
+  }
+
+  if (ypos < 0)
+    ypos = 0;
+
+  if (overlay->text_image) {
+    switch (overlay->format) {
+      case GST_VIDEO_FORMAT_I420:
+        gst_base_text_overlay_blit_I420 (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_NV12:
+      case GST_VIDEO_FORMAT_NV21:
+        gst_base_text_overlay_blit_NV12_NV21 (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_UYVY:
+        gst_base_text_overlay_blit_UYVY (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_AYUV:
+        gst_base_text_overlay_blit_AYUV (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_BGRx:
+        gst_base_text_overlay_blit_BGRx (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_xRGB:
+        gst_base_text_overlay_blit_xRGB (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_RGBx:
+        gst_base_text_overlay_blit_RGBx (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_xBGR:
+        gst_base_text_overlay_blit_xBGR (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_ARGB:
+        gst_base_text_overlay_blit_ARGB (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_ABGR:
+        gst_base_text_overlay_blit_ABGR (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_RGBA:
+        gst_base_text_overlay_blit_RGBA (overlay, &frame, xpos, ypos);
+        break;
+      case GST_VIDEO_FORMAT_BGRA:
+        gst_base_text_overlay_blit_BGRA (overlay, &frame, xpos, ypos);
+        break;
+      default:
+        g_assert_not_reached ();
+    }
+  }
+  gst_video_frame_unmap (&frame);
+
+  return gst_pad_push (overlay->srcpad, video_frame);
+
+  /* ERRORS */
+invalid_frame:
+  {
+    GST_DEBUG_OBJECT (overlay, "received invalid buffer");
+    return GST_FLOW_OK;
+  }
+}
+
+static GstPadLinkReturn
+gst_base_text_overlay_text_pad_link (GstPad * pad, GstPad * peer)
+{
+  GstBaseTextOverlay *overlay;
+
+  overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT (overlay, "Text pad linked");
+
+  overlay->text_linked = TRUE;
+
+  gst_object_unref (overlay);
+
+  return GST_PAD_LINK_OK;
+}
+
+static void
+gst_base_text_overlay_text_pad_unlink (GstPad * pad)
+{
+  GstBaseTextOverlay *overlay;
+
+  /* don't use gst_pad_get_parent() here, will deadlock */
+  overlay = GST_BASE_TEXT_OVERLAY (GST_PAD_PARENT (pad));
+
+  GST_DEBUG_OBJECT (overlay, "Text pad unlinked");
+
+  overlay->text_linked = FALSE;
+
+  gst_segment_init (&overlay->text_segment, GST_FORMAT_UNDEFINED);
+}
+
+static gboolean
+gst_base_text_overlay_text_event (GstPad * pad, GstEvent * event)
+{
+  gboolean ret = FALSE;
+  GstBaseTextOverlay *overlay = NULL;
+
+  overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
+
+  GST_LOG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_base_text_overlay_setcaps_txt (overlay, caps);
+      gst_event_unref (event);
+      break;
+    }
+    case GST_EVENT_SEGMENT:
+    {
+      const GstSegment *segment;
+
+      overlay->text_eos = FALSE;
+
+      gst_event_parse_segment (event, &segment);
+
+      if (segment->format == GST_FORMAT_TIME) {
+        GST_OBJECT_LOCK (overlay);
+        gst_segment_copy_into (segment, &overlay->text_segment);
+        GST_DEBUG_OBJECT (overlay, "TEXT SEGMENT now: %" GST_SEGMENT_FORMAT,
+            &overlay->text_segment);
+        GST_OBJECT_UNLOCK (overlay);
+      } else {
+        GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
+            ("received non-TIME newsegment event on text input"));
+      }
+
+      gst_event_unref (event);
+      ret = TRUE;
+
+      /* wake up the video chain, it might be waiting for a text buffer or
+       * a text segment update */
+      GST_OBJECT_LOCK (overlay);
+      GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
+      GST_OBJECT_UNLOCK (overlay);
+      break;
+    }
+    case GST_EVENT_FLUSH_STOP:
+      GST_OBJECT_LOCK (overlay);
+      GST_INFO_OBJECT (overlay, "text flush stop");
+      overlay->text_flushing = FALSE;
+      overlay->text_eos = FALSE;
+      gst_base_text_overlay_pop_text (overlay);
+      gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
+      GST_OBJECT_UNLOCK (overlay);
+      gst_event_unref (event);
+      ret = TRUE;
+      break;
+    case GST_EVENT_FLUSH_START:
+      GST_OBJECT_LOCK (overlay);
+      GST_INFO_OBJECT (overlay, "text flush start");
+      overlay->text_flushing = TRUE;
+      GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
+      GST_OBJECT_UNLOCK (overlay);
+      gst_event_unref (event);
+      ret = TRUE;
+      break;
+    case GST_EVENT_EOS:
+      GST_OBJECT_LOCK (overlay);
+      overlay->text_eos = TRUE;
+      GST_INFO_OBJECT (overlay, "text EOS");
+      /* wake up the video chain, it might be waiting for a text buffer or
+       * a text segment update */
+      GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
+      GST_OBJECT_UNLOCK (overlay);
+      gst_event_unref (event);
+      ret = TRUE;
+      break;
+    default:
+      ret = gst_pad_event_default (pad, event);
+      break;
+  }
+
+  gst_object_unref (overlay);
+
+  return ret;
+}
+
+static gboolean
+gst_base_text_overlay_video_event (GstPad * pad, GstEvent * event)
+{
+  gboolean ret = FALSE;
+  GstBaseTextOverlay *overlay = NULL;
+
+  overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_base_text_overlay_setcaps (overlay, caps);
+      gst_event_unref (event);
+      break;
+    }
+    case GST_EVENT_SEGMENT:
+    {
+      const GstSegment *segment;
+
+      GST_DEBUG_OBJECT (overlay, "received new segment");
+
+      gst_event_parse_segment (event, &segment);
+
+      if (segment->format == GST_FORMAT_TIME) {
+        GST_DEBUG_OBJECT (overlay, "VIDEO SEGMENT now: %" GST_SEGMENT_FORMAT,
+            &overlay->segment);
+
+        gst_segment_copy_into (segment, &overlay->segment);
+      } else {
+        GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
+            ("received non-TIME newsegment event on video input"));
+      }
+
+      ret = gst_pad_event_default (pad, event);
+      break;
+    }
+    case GST_EVENT_EOS:
+      GST_OBJECT_LOCK (overlay);
+      GST_INFO_OBJECT (overlay, "video EOS");
+      overlay->video_eos = TRUE;
+      GST_OBJECT_UNLOCK (overlay);
+      ret = gst_pad_event_default (pad, event);
+      break;
+    case GST_EVENT_FLUSH_START:
+      GST_OBJECT_LOCK (overlay);
+      GST_INFO_OBJECT (overlay, "video flush start");
+      overlay->video_flushing = TRUE;
+      GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
+      GST_OBJECT_UNLOCK (overlay);
+      ret = gst_pad_event_default (pad, event);
+      break;
+    case GST_EVENT_FLUSH_STOP:
+      GST_OBJECT_LOCK (overlay);
+      GST_INFO_OBJECT (overlay, "video flush stop");
+      overlay->video_flushing = FALSE;
+      overlay->video_eos = FALSE;
+      gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
+      GST_OBJECT_UNLOCK (overlay);
+      ret = gst_pad_event_default (pad, event);
+      break;
+    default:
+      ret = gst_pad_event_default (pad, event);
+      break;
+  }
+
+  gst_object_unref (overlay);
+
+  return ret;
+}
+
+/* Called with lock held */
+static void
+gst_base_text_overlay_pop_text (GstBaseTextOverlay * overlay)
+{
+  g_return_if_fail (GST_IS_BASE_TEXT_OVERLAY (overlay));
+
+  if (overlay->text_buffer) {
+    GST_DEBUG_OBJECT (overlay, "releasing text buffer %p",
+        overlay->text_buffer);
+    gst_buffer_unref (overlay->text_buffer);
+    overlay->text_buffer = NULL;
+  }
+
+  /* Let the text task know we used that buffer */
+  GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
+}
+
+/* We receive text buffers here. If they are out of segment we just ignore them.
+   If the buffer is in our segment we keep it internally except if another one
+   is already waiting here, in that case we wait that it gets kicked out */
+static GstFlowReturn
+gst_base_text_overlay_text_chain (GstPad * pad, GstBuffer * buffer)
+{
+  GstFlowReturn ret = GST_FLOW_OK;
+  GstBaseTextOverlay *overlay = NULL;
+  gboolean in_seg = FALSE;
+  guint64 clip_start = 0, clip_stop = 0;
+
+  overlay = GST_BASE_TEXT_OVERLAY (GST_PAD_PARENT (pad));
+
+  GST_OBJECT_LOCK (overlay);
+
+  if (overlay->text_flushing) {
+    GST_OBJECT_UNLOCK (overlay);
+    ret = GST_FLOW_WRONG_STATE;
+    GST_LOG_OBJECT (overlay, "text flushing");
+    goto beach;
+  }
+
+  if (overlay->text_eos) {
+    GST_OBJECT_UNLOCK (overlay);
+    ret = GST_FLOW_UNEXPECTED;
+    GST_LOG_OBJECT (overlay, "text EOS");
+    goto beach;
+  }
+
+  GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT "  BUFFER: ts=%"
+      GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment,
+      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
+      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer) +
+          GST_BUFFER_DURATION (buffer)));
+
+  if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))) {
+    GstClockTime stop;
+
+    if (G_LIKELY (GST_BUFFER_DURATION_IS_VALID (buffer)))
+      stop = GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer);
+    else
+      stop = GST_CLOCK_TIME_NONE;
+
+    in_seg = gst_segment_clip (&overlay->text_segment, GST_FORMAT_TIME,
+        GST_BUFFER_TIMESTAMP (buffer), stop, &clip_start, &clip_stop);
+  } else {
+    in_seg = TRUE;
+  }
+
+  if (in_seg) {
+    if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
+      GST_BUFFER_TIMESTAMP (buffer) = clip_start;
+    else if (GST_BUFFER_DURATION_IS_VALID (buffer))
+      GST_BUFFER_DURATION (buffer) = clip_stop - clip_start;
+
+    /* Wait for the previous buffer to go away */
+    while (overlay->text_buffer != NULL) {
+      GST_DEBUG ("Pad %s:%s has a buffer queued, waiting",
+          GST_DEBUG_PAD_NAME (pad));
+      GST_BASE_TEXT_OVERLAY_WAIT (overlay);
+      GST_DEBUG ("Pad %s:%s resuming", GST_DEBUG_PAD_NAME (pad));
+      if (overlay->text_flushing) {
+        GST_OBJECT_UNLOCK (overlay);
+        ret = GST_FLOW_WRONG_STATE;
+        goto beach;
+      }
+    }
+
+    if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
+      overlay->text_segment.position = clip_start;
+
+    overlay->text_buffer = buffer;
+    /* That's a new text buffer we need to render */
+    overlay->need_render = TRUE;
+
+    /* in case the video chain is waiting for a text buffer, wake it up */
+    GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
+  }
+
+  GST_OBJECT_UNLOCK (overlay);
+
+beach:
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_base_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
+{
+  GstBaseTextOverlayClass *klass;
+  GstBaseTextOverlay *overlay;
+  GstFlowReturn ret = GST_FLOW_OK;
+  gboolean in_seg = FALSE;
+  guint64 start, stop, clip_start = 0, clip_stop = 0;
+  gchar *text = NULL;
+
+  overlay = GST_BASE_TEXT_OVERLAY (GST_PAD_PARENT (pad));
+  klass = GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay);
+
+  if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
+    goto missing_timestamp;
+
+  /* ignore buffers that are outside of the current segment */
+  start = GST_BUFFER_TIMESTAMP (buffer);
+
+  if (!GST_BUFFER_DURATION_IS_VALID (buffer)) {
+    stop = GST_CLOCK_TIME_NONE;
+  } else {
+    stop = start + GST_BUFFER_DURATION (buffer);
+  }
+
+  GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT "  BUFFER: ts=%"
+      GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment,
+      GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
+
+  /* segment_clip() will adjust start unconditionally to segment_start if
+   * no stop time is provided, so handle this ourselves */
+  if (stop == GST_CLOCK_TIME_NONE && start < overlay->segment.start)
+    goto out_of_segment;
+
+  in_seg = gst_segment_clip (&overlay->segment, GST_FORMAT_TIME, start, stop,
+      &clip_start, &clip_stop);
+
+  if (!in_seg)
+    goto out_of_segment;
+
+  /* if the buffer is only partially in the segment, fix up stamps */
+  if (clip_start != start || (stop != -1 && clip_stop != stop)) {
+    GST_DEBUG_OBJECT (overlay, "clipping buffer timestamp/duration to segment");
+    buffer = gst_buffer_make_writable (buffer);
+    GST_BUFFER_TIMESTAMP (buffer) = clip_start;
+    if (stop != -1)
+      GST_BUFFER_DURATION (buffer) = clip_stop - clip_start;
+  }
+
+  /* now, after we've done the clipping, fix up end time if there's no
+   * duration (we only use those estimated values internally though, we
+   * don't want to set bogus values on the buffer itself) */
+  if (stop == -1) {
+    GstCaps *caps;
+    GstStructure *s;
+    gint fps_num, fps_denom;
+
+    /* FIXME, store this in setcaps */
+    caps = gst_pad_get_current_caps (pad);
+    s = gst_caps_get_structure (caps, 0);
+    if (gst_structure_get_fraction (s, "framerate", &fps_num, &fps_denom) &&
+        fps_num && fps_denom) {
+      GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate");
+      stop = start + gst_util_uint64_scale_int (GST_SECOND, fps_denom, fps_num);
+    } else {
+      GST_WARNING_OBJECT (overlay, "no duration, assuming minimal duration");
+      stop = start + 1;         /* we need to assume some interval */
+    }
+    gst_caps_unref (caps);
+  }
+
+  gst_object_sync_values (G_OBJECT (overlay), GST_BUFFER_TIMESTAMP (buffer));
+
+wait_for_text_buf:
+
+  GST_OBJECT_LOCK (overlay);
+
+  if (overlay->video_flushing)
+    goto flushing;
+
+  if (overlay->video_eos)
+    goto have_eos;
+
+  if (overlay->silent) {
+    GST_OBJECT_UNLOCK (overlay);
+    ret = gst_pad_push (overlay->srcpad, buffer);
+
+    /* Update position */
+    overlay->segment.position = clip_start;
+
+    return ret;
+  }
+
+  /* Text pad not linked, rendering internal text */
+  if (!overlay->text_linked) {
+    if (klass->get_text) {
+      text = klass->get_text (overlay, buffer);
+    } else {
+      text = g_strdup (overlay->default_text);
+    }
+
+    GST_LOG_OBJECT (overlay, "Text pad not linked, rendering default "
+        "text: '%s'", GST_STR_NULL (text));
+
+    GST_OBJECT_UNLOCK (overlay);
+
+    if (text != NULL && *text != '\0') {
+      /* Render and push */
+      gst_base_text_overlay_render_text (overlay, text, -1);
+      ret = gst_base_text_overlay_push_frame (overlay, buffer);
+    } else {
+      /* Invalid or empty string */
+      ret = gst_pad_push (overlay->srcpad, buffer);
+    }
+  } else {
+    /* Text pad linked, check if we have a text buffer queued */
+    if (overlay->text_buffer) {
+      gboolean pop_text = FALSE, valid_text_time = TRUE;
+      GstClockTime text_start = GST_CLOCK_TIME_NONE;
+      GstClockTime text_end = GST_CLOCK_TIME_NONE;
+      GstClockTime text_running_time = GST_CLOCK_TIME_NONE;
+      GstClockTime text_running_time_end = GST_CLOCK_TIME_NONE;
+      GstClockTime vid_running_time, vid_running_time_end;
+
+      /* if the text buffer isn't stamped right, pop it off the
+       * queue and display it for the current video frame only */
+      if (!GST_BUFFER_TIMESTAMP_IS_VALID (overlay->text_buffer) ||
+          !GST_BUFFER_DURATION_IS_VALID (overlay->text_buffer)) {
+        GST_WARNING_OBJECT (overlay,
+            "Got text buffer with invalid timestamp or duration");
+        pop_text = TRUE;
+        valid_text_time = FALSE;
+      } else {
+        text_start = GST_BUFFER_TIMESTAMP (overlay->text_buffer);
+        text_end = text_start + GST_BUFFER_DURATION (overlay->text_buffer);
+      }
+
+      vid_running_time =
+          gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
+          start);
+      vid_running_time_end =
+          gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
+          stop);
+
+      /* If timestamp and duration are valid */
+      if (valid_text_time) {
+        text_running_time =
+            gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
+            text_start);
+        text_running_time_end =
+            gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
+            text_end);
+      }
+
+      GST_LOG_OBJECT (overlay, "T: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (text_running_time),
+          GST_TIME_ARGS (text_running_time_end));
+      GST_LOG_OBJECT (overlay, "V: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (vid_running_time),
+          GST_TIME_ARGS (vid_running_time_end));
+
+      /* Text too old or in the future */
+      if (valid_text_time && text_running_time_end <= vid_running_time) {
+        /* text buffer too old, get rid of it and do nothing  */
+        GST_LOG_OBJECT (overlay, "text buffer too old, popping");
+        pop_text = FALSE;
+        gst_base_text_overlay_pop_text (overlay);
+        GST_OBJECT_UNLOCK (overlay);
+        goto wait_for_text_buf;
+      } else if (valid_text_time && vid_running_time_end <= text_running_time) {
+        GST_LOG_OBJECT (overlay, "text in future, pushing video buf");
+        GST_OBJECT_UNLOCK (overlay);
+        /* Push the video frame */
+        ret = gst_pad_push (overlay->srcpad, buffer);
+      } else {
+        gchar *in_text, *otext;
+        gsize in_size, osize;
+
+        otext =
+            gst_buffer_map (overlay->text_buffer, &osize, NULL, GST_MAP_READ);
+        in_text = otext;
+        in_size = osize;
+
+        /* g_markup_escape_text() absolutely requires valid UTF8 input, it
+         * might crash otherwise. We don't fall back on GST_SUBTITLE_ENCODING
+         * here on purpose, this is something that needs fixing upstream */
+        if (!g_utf8_validate (in_text, in_size, NULL)) {
+          const gchar *end = NULL;
+
+          GST_WARNING_OBJECT (overlay, "received invalid UTF-8");
+          in_text = g_strndup (in_text, in_size);
+          while (!g_utf8_validate (in_text, in_size, &end) && end)
+            *((gchar *) end) = '*';
+        }
+
+        /* Get the string */
+        if (overlay->have_pango_markup) {
+          text = g_strndup (in_text, in_size);
+        } else {
+          text = g_markup_escape_text (in_text, in_size);
+        }
+
+        if (text != NULL && *text != '\0') {
+          gint text_len = strlen (text);
+
+          while (text_len > 0 && (text[text_len - 1] == '\n' ||
+                  text[text_len - 1] == '\r')) {
+            --text_len;
+          }
+          GST_DEBUG_OBJECT (overlay, "Rendering text '%*s'", text_len, text);
+          gst_base_text_overlay_render_text (overlay, text, text_len);
+        } else {
+          GST_DEBUG_OBJECT (overlay, "No text to render (empty buffer)");
+          gst_base_text_overlay_render_text (overlay, " ", 1);
+        }
+        gst_buffer_unmap (overlay->text_buffer, otext, osize);
+
+        if (in_text != otext)
+          g_free (in_text);
+
+        GST_OBJECT_UNLOCK (overlay);
+        ret = gst_base_text_overlay_push_frame (overlay, buffer);
+
+        if (valid_text_time && text_running_time_end <= vid_running_time_end) {
+          GST_LOG_OBJECT (overlay, "text buffer not needed any longer");
+          pop_text = TRUE;
+        }
+      }
+      if (pop_text) {
+        GST_OBJECT_LOCK (overlay);
+        gst_base_text_overlay_pop_text (overlay);
+        GST_OBJECT_UNLOCK (overlay);
+      }
+    } else {
+      gboolean wait_for_text_buf = TRUE;
+
+      if (overlay->text_eos)
+        wait_for_text_buf = FALSE;
+
+      if (!overlay->wait_text)
+        wait_for_text_buf = FALSE;
+
+      /* Text pad linked, but no text buffer available - what now? */
+      if (overlay->text_segment.format == GST_FORMAT_TIME) {
+        GstClockTime text_start_running_time, text_position_running_time;
+        GstClockTime vid_running_time;
+
+        vid_running_time =
+            gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
+            GST_BUFFER_TIMESTAMP (buffer));
+        text_start_running_time =
+            gst_segment_to_running_time (&overlay->text_segment,
+            GST_FORMAT_TIME, overlay->text_segment.start);
+        text_position_running_time =
+            gst_segment_to_running_time (&overlay->text_segment,
+            GST_FORMAT_TIME, overlay->text_segment.position);
+
+        if ((GST_CLOCK_TIME_IS_VALID (text_start_running_time) &&
+                vid_running_time < text_start_running_time) ||
+            (GST_CLOCK_TIME_IS_VALID (text_position_running_time) &&
+                vid_running_time < text_position_running_time)) {
+          wait_for_text_buf = FALSE;
+        }
+      }
+
+      if (wait_for_text_buf) {
+        GST_DEBUG_OBJECT (overlay, "no text buffer, need to wait for one");
+        GST_BASE_TEXT_OVERLAY_WAIT (overlay);
+        GST_DEBUG_OBJECT (overlay, "resuming");
+        GST_OBJECT_UNLOCK (overlay);
+        goto wait_for_text_buf;
+      } else {
+        GST_OBJECT_UNLOCK (overlay);
+        GST_LOG_OBJECT (overlay, "no need to wait for a text buffer");
+        ret = gst_pad_push (overlay->srcpad, buffer);
+      }
+    }
+  }
+
+  g_free (text);
+
+  /* Update position */
+  overlay->segment.position = clip_start;
+
+  return ret;
+
+missing_timestamp:
+  {
+    GST_WARNING_OBJECT (overlay, "buffer without timestamp, discarding");
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }
+
+flushing:
+  {
+    GST_OBJECT_UNLOCK (overlay);
+    GST_DEBUG_OBJECT (overlay, "flushing, discarding buffer");
+    gst_buffer_unref (buffer);
+    return GST_FLOW_WRONG_STATE;
+  }
+have_eos:
+  {
+    GST_OBJECT_UNLOCK (overlay);
+    GST_DEBUG_OBJECT (overlay, "eos, discarding buffer");
+    gst_buffer_unref (buffer);
+    return GST_FLOW_UNEXPECTED;
+  }
+out_of_segment:
+  {
+    GST_DEBUG_OBJECT (overlay, "buffer out of segment, discarding");
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }
+}
+
+static GstStateChangeReturn
+gst_base_text_overlay_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+  GstBaseTextOverlay *overlay = GST_BASE_TEXT_OVERLAY (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      GST_OBJECT_LOCK (overlay);
+      overlay->text_flushing = TRUE;
+      overlay->video_flushing = TRUE;
+      /* pop_text will broadcast on the GCond and thus also make the video
+       * chain exit if it's waiting for a text buffer */
+      gst_base_text_overlay_pop_text (overlay);
+      GST_OBJECT_UNLOCK (overlay);
+      break;
+    default:
+      break;
+  }
+
+  ret = parent_class->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      GST_OBJECT_LOCK (overlay);
+      overlay->text_flushing = FALSE;
+      overlay->video_flushing = FALSE;
+      overlay->video_eos = FALSE;
+      overlay->text_eos = FALSE;
+      gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
+      gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
+      GST_OBJECT_UNLOCK (overlay);
+      break;
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  gst_controller_init (NULL, NULL);
+
+  if (!gst_element_register (plugin, "textoverlay", GST_RANK_NONE,
+          GST_TYPE_TEXT_OVERLAY) ||
+      !gst_element_register (plugin, "timeoverlay", GST_RANK_NONE,
+          GST_TYPE_TIME_OVERLAY) ||
+      !gst_element_register (plugin, "clockoverlay", GST_RANK_NONE,
+          GST_TYPE_CLOCK_OVERLAY) ||
+      !gst_element_register (plugin, "textrender", GST_RANK_NONE,
+          GST_TYPE_TEXT_RENDER)) {
+    return FALSE;
+  }
+
+  /*texttestsrc_plugin_init(module, plugin); */
+
+  GST_DEBUG_CATEGORY_INIT (pango_debug, "pango", 0, "Pango elements");
+
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
+    "pango", "Pango-based text rendering and overlay", plugin_init,
+    VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/pango/gstbasetextoverlay.h b/ext/pango/gstbasetextoverlay.h
new file mode 100644 (file)
index 0000000..b7db8de
--- /dev/null
@@ -0,0 +1,170 @@
+#ifndef __GST_BASE_TEXT_OVERLAY_H__
+#define __GST_BASE_TEXT_OVERLAY_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/controller/gstcontroller.h>
+#include <pango/pangocairo.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_BASE_TEXT_OVERLAY            (gst_base_text_overlay_get_type())
+#define GST_BASE_TEXT_OVERLAY(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),\
+                                         GST_TYPE_BASE_TEXT_OVERLAY, GstBaseTextOverlay))
+#define GST_BASE_TEXT_OVERLAY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),\
+                                         GST_TYPE_BASE_TEXT_OVERLAY,GstBaseTextOverlayClass))
+#define GST_BASE_TEXT_OVERLAY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),\
+                                         GST_TYPE_BASE_TEXT_OVERLAY, GstBaseTextOverlayClass))
+#define GST_IS_BASE_TEXT_OVERLAY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
+                                         GST_TYPE_BASE_TEXT_OVERLAY))
+#define GST_IS_BASE_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
+                                         GST_TYPE_BASE_TEXT_OVERLAY))
+
+typedef struct _GstBaseTextOverlay      GstBaseTextOverlay;
+typedef struct _GstBaseTextOverlayClass GstBaseTextOverlayClass;
+
+/**
+ * GstBaseTextOverlayVAlign:
+ * @GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE: draw text on the baseline
+ * @GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM: draw text on the bottom
+ * @GST_BASE_TEXT_OVERLAY_VALIGN_TOP: draw text on top
+ * @GST_BASE_TEXT_OVERLAY_VALIGN_POS: draw text according to the #GstBaseTextOverlay:ypos property
+ * @GST_BASE_TEXT_OVERLAY_VALIGN_CENTER: draw text vertically centered
+ *
+ * Vertical alignment of the text.
+ */
+typedef enum {
+    GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE,
+    GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM,
+    GST_BASE_TEXT_OVERLAY_VALIGN_TOP,
+    GST_BASE_TEXT_OVERLAY_VALIGN_POS,
+    GST_BASE_TEXT_OVERLAY_VALIGN_CENTER
+} GstBaseTextOverlayVAlign;
+
+/**
+ * GstBaseTextOverlayHAlign:
+ * @GST_BASE_TEXT_OVERLAY_HALIGN_LEFT: align text left
+ * @GST_BASE_TEXT_OVERLAY_HALIGN_CENTER: align text center
+ * @GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT: align text right
+ * @GST_BASE_TEXT_OVERLAY_HALIGN_POS: position text according to the #GstBaseTextOverlay:xpos property
+ *
+ * Horizontal alignment of the text.
+ */
+/* FIXME 0.11: remove GST_BASE_TEXT_OVERLAY_HALIGN_UNUSED */
+typedef enum {
+    GST_BASE_TEXT_OVERLAY_HALIGN_LEFT,
+    GST_BASE_TEXT_OVERLAY_HALIGN_CENTER,
+    GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT,
+    GST_BASE_TEXT_OVERLAY_HALIGN_UNUSED,
+    GST_BASE_TEXT_OVERLAY_HALIGN_POS
+} GstBaseTextOverlayHAlign;
+
+/**
+ * GstBaseTextOverlayWrapMode:
+ * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE: no wrapping
+ * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD: do word wrapping
+ * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR: do char wrapping
+ * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR: do word and char wrapping
+ *
+ * Whether to wrap the text and if so how.
+ */
+typedef enum {
+    GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
+    GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
+    GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
+    GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
+} GstBaseTextOverlayWrapMode;
+
+/**
+ * GstBaseTextOverlayLineAlign:
+ * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT: lines are left-aligned
+ * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER: lines are center-aligned
+ * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT: lines are right-aligned
+ *
+ * Alignment of text lines relative to each other
+ */
+typedef enum {
+    GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
+    GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
+    GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
+} GstBaseTextOverlayLineAlign;
+
+/**
+ * GstBaseTextOverlay:
+ *
+ * Opaque textoverlay object structure
+ */
+struct _GstBaseTextOverlay {
+    GstElement               element;
+
+    GstPad                  *video_sinkpad;
+    GstPad                  *text_sinkpad;
+    GstPad                  *srcpad;
+
+    GstSegment               segment;
+    GstSegment               text_segment;
+    GstBuffer               *text_buffer;
+    gboolean                text_linked;
+    gboolean                video_flushing;
+    gboolean                video_eos;
+    gboolean                text_flushing;
+    gboolean                text_eos;
+
+    GCond                   *cond;  /* to signal removal of a queued text
+                                     * buffer, arrival of a text buffer,
+                                     * a text segment update, or a change
+                                     * in status (e.g. shutdown, flushing) */
+
+    GstVideoInfo             info;
+    GstVideoFormat           format;
+    gint                     width;
+    gint                     height;
+
+    GstBaseTextOverlayVAlign     valign;
+    GstBaseTextOverlayHAlign     halign;
+    GstBaseTextOverlayWrapMode   wrap_mode;
+    GstBaseTextOverlayLineAlign  line_align;
+
+    gint                     xpad;
+    gint                     ypad;
+    gint                     deltax;
+    gint                     deltay;
+    gdouble                  xpos;
+    gdouble                  ypos;
+    gchar                   *default_text;
+    gboolean                 want_shading;
+    gboolean                 silent;
+    gboolean                 wait_text;
+    guint                    color, outline_color;
+
+    PangoLayout             *layout;
+    gdouble                  shadow_offset;
+    gdouble                  outline_offset;
+    guchar                  *text_image;
+    gint                     image_width;
+    gint                     image_height;
+    gint                     baseline_y;
+
+    gboolean                 auto_adjust_size;
+    gboolean                 need_render;
+
+    gint                     shading_value;  /* for timeoverlay subclass */
+
+    gboolean                 have_pango_markup;
+    gboolean                 use_vertical_render;
+};
+
+struct _GstBaseTextOverlayClass {
+    GstElementClass parent_class;
+
+    PangoContext *pango_context;
+    GMutex       *pango_lock;
+
+    gchar *     (*get_text) (GstBaseTextOverlay *overlay, GstBuffer *video_frame);
+};
+
+GType gst_base_text_overlay_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GST_BASE_TEXT_OVERLAY_H */
index d90cff1..4841274 100644 (file)
 
 /**
  * SECTION:element-clockoverlay
- * @see_also: #GstTextOverlay, #GstTimeOverlay
+ * @see_also: #GstBaseTextOverlay, #GstTimeOverlay
  *
  * This element overlays the current clock time on top of a video
  * stream. You can position the text and configure the font details
- * using the properties of the #GstTextOverlay class. By default, the
+ * using the properties of the #GstBaseTextOverlay class. By default, the
  * time is displayed in the top left corner of the picture, with some
  * padding to the left and to the top.
  *
@@ -34,7 +34,7 @@
  * gst-launch -v videotestsrc ! clockoverlay ! xvimagesink
  * ]| Display the current time in the top left corner of the video picture
  * |[
- * gst-launch -v videotestsrc ! clockoverlay halign=right valign=bottom text="Edge City" shaded-background=true ! ffmpegcolorspace ! ximagesink
+ * gst-launch -v videotestsrc ! clockoverlay halign=right valign=bottom text="Edge City" shaded-background=true ! videoconvert ! ximagesink
  * ]| Another pipeline that displays the current time with some leading
  * text in the bottom right corner of the video picture, with the background
  * of the text being shaded in order to make it more legible on top of a
@@ -60,20 +60,8 @@ enum
   PROP_LAST
 };
 
-GST_BOILERPLATE (GstClockOverlay, gst_clock_overlay, GstTextOverlay,
-    GST_TYPE_TEXT_OVERLAY);
-
-static void
-gst_clock_overlay_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class, "Clock overlay",
-      "Filter/Editor/Video",
-      "Overlays the current clock time on a video stream",
-      "Tim-Philipp Müller <tim@centricular.net>");
-}
-
+#define gst_clock_overlay_parent_class parent_class
+G_DEFINE_TYPE (GstClockOverlay, gst_clock_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
 
 static void gst_clock_overlay_finalize (GObject * object);
 static void gst_clock_overlay_set_property (GObject * object, guint prop_id,
@@ -114,7 +102,8 @@ gst_clock_overlay_render_time (GstClockOverlay * overlay)
 
 /* Called with lock held */
 static gchar *
-gst_clock_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
+gst_clock_overlay_get_text (GstBaseTextOverlay * overlay,
+    GstBuffer * video_frame)
 {
   gchar *time_str, *txt, *ret;
   GstClockOverlay *clock_overlay = GST_CLOCK_OVERLAY (overlay);
@@ -145,17 +134,24 @@ static void
 gst_clock_overlay_class_init (GstClockOverlayClass * klass)
 {
   GObjectClass *gobject_class;
-  GstTextOverlayClass *gsttextoverlay_class;
+  GstElementClass *gstelement_class;
+  GstBaseTextOverlayClass *gsttextoverlay_class;
   PangoContext *context;
   PangoFontDescription *font_description;
 
   gobject_class = (GObjectClass *) klass;
-  gsttextoverlay_class = (GstTextOverlayClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gsttextoverlay_class = (GstBaseTextOverlayClass *) klass;
 
   gobject_class->finalize = gst_clock_overlay_finalize;
   gobject_class->set_property = gst_clock_overlay_set_property;
   gobject_class->get_property = gst_clock_overlay_get_property;
 
+  gst_element_class_set_details_simple (gstelement_class, "Clock overlay",
+      "Filter/Editor/Video",
+      "Overlays the current clock time on a video stream",
+      "Tim-Philipp Müller <tim@centricular.net>");
+
   gsttextoverlay_class->get_text = gst_clock_overlay_get_text;
 
   g_object_class_install_property (gobject_class, PROP_TIMEFORMAT,
@@ -163,8 +159,8 @@ gst_clock_overlay_class_init (GstClockOverlayClass * klass)
           "Format to use for time and date value, as in strftime.",
           DEFAULT_PROP_TIMEFORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  g_mutex_lock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
-  context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
+  g_mutex_lock (gsttextoverlay_class->pango_lock);
+  context = gsttextoverlay_class->pango_context;
 
   pango_context_set_language (context, pango_language_from_string ("en_US"));
   pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
@@ -178,7 +174,7 @@ gst_clock_overlay_class_init (GstClockOverlayClass * klass)
   pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
   pango_context_set_font_description (context, font_description);
   pango_font_description_free (font_description);
-  g_mutex_unlock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
+  g_mutex_unlock (gsttextoverlay_class->pango_lock);
 }
 
 
@@ -196,14 +192,14 @@ gst_clock_overlay_finalize (GObject * object)
 
 
 static void
-gst_clock_overlay_init (GstClockOverlay * overlay, GstClockOverlayClass * klass)
+gst_clock_overlay_init (GstClockOverlay * overlay)
 {
-  GstTextOverlay *textoverlay;
+  GstBaseTextOverlay *textoverlay;
 
-  textoverlay = GST_TEXT_OVERLAY (overlay);
+  textoverlay = GST_BASE_TEXT_OVERLAY (overlay);
 
-  textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
-  textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
+  textoverlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
+  textoverlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_LEFT;
 
   overlay->format = g_strdup (DEFAULT_PROP_TIMEFORMAT);
 }
index 15a82ed..09ca2d3 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __GST_CLOCK_OVERLAY_H__
 #define __GST_CLOCK_OVERLAY_H__
 
-#include "gsttextoverlay.h"
+#include "gstbasetextoverlay.h"
 
 G_BEGIN_DECLS
 
@@ -46,13 +46,13 @@ typedef struct _GstClockOverlayClass GstClockOverlayClass;
  * Opaque clockoverlay data structure.
  */
 struct _GstClockOverlay {
-  GstTextOverlay textoverlay;
+  GstBaseTextOverlay textoverlay;
   gchar         *format; /* as in strftime () */
   gchar         *text;
 };
 
 struct _GstClockOverlayClass {
-  GstTextOverlayClass parent_class;
+  GstBaseTextOverlayClass parent_class;
 };
 
 GType gst_clock_overlay_get_type (void);
index e3e3b56..9f8c7bf 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
  * Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
  * Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
+ * Copyright (C) <2011> Sebastian Dröge <sebastian.droege@collabora.co.uk>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -24,7 +25,7 @@
 
 /**
  * SECTION:element-textoverlay
- * @see_also: #GstTextRender, #GstClockOverlay, #GstTimeOverlay, #GstSubParse
+ * @see_also: #GstTextRender, #GstTextOverlay, #GstTimeOverlay, #GstSubParse
  *
  * This plugin renders text on top of a video stream. This can be either
  * static text or text from buffers received on the text sink pad, e.g.
  * </refsect2>
  */
 
-/* FIXME: alloc segment as part of instance struct */
-
 #ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gst/video/video.h>
-
-#include "gsttextoverlay.h"
-#include "gsttimeoverlay.h"
-#include "gstclockoverlay.h"
-#include "gsttextrender.h"
-#include <string.h>
-
-/* FIXME:
- *  - use proper strides and offset for I420
- *  - if text is wider than the video picture, it does not get
- *    clipped properly during blitting (if wrapping is disabled)
- *  - make 'shading_value' a property (or enum:  light/normal/dark/verydark)?
- */
-
-GST_DEBUG_CATEGORY (pango_debug);
-#define GST_CAT_DEFAULT pango_debug
-
-#define DEFAULT_PROP_TEXT      ""
-#define DEFAULT_PROP_SHADING   FALSE
-#define DEFAULT_PROP_SHADOW    TRUE
-#define DEFAULT_PROP_VALIGNMENT        GST_TEXT_OVERLAY_VALIGN_BASELINE
-#define DEFAULT_PROP_HALIGNMENT        GST_TEXT_OVERLAY_HALIGN_CENTER
-#define DEFAULT_PROP_VALIGN    "baseline"
-#define DEFAULT_PROP_HALIGN    "center"
-#define DEFAULT_PROP_XPAD      25
-#define DEFAULT_PROP_YPAD      25
-#define DEFAULT_PROP_DELTAX    0
-#define DEFAULT_PROP_DELTAY    0
-#define DEFAULT_PROP_XPOS       0.5
-#define DEFAULT_PROP_YPOS       0.5
-#define DEFAULT_PROP_WRAP_MODE  GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR
-#define DEFAULT_PROP_FONT_DESC ""
-#define DEFAULT_PROP_SILENT    FALSE
-#define DEFAULT_PROP_LINE_ALIGNMENT GST_TEXT_OVERLAY_LINE_ALIGN_CENTER
-#define DEFAULT_PROP_WAIT_TEXT TRUE
-#define DEFAULT_PROP_AUTO_ADJUST_SIZE TRUE
-#define DEFAULT_PROP_VERTICAL_RENDER  FALSE
-#define DEFAULT_PROP_COLOR      0xffffffff
-#define DEFAULT_PROP_OUTLINE_COLOR 0xff000000
-
-/* make a property of me */
-#define DEFAULT_SHADING_VALUE    -80
-
-#define MINIMUM_OUTLINE_OFFSET 1.0
-#define DEFAULT_SCALE_BASIS    640
-
-#define COMP_Y(ret, r, g, b) \
-{ \
-   ret = (int) (((19595 * r) >> 16) + ((38470 * g) >> 16) + ((7471 * b) >> 16)); \
-   ret = CLAMP (ret, 0, 255); \
-}
-
-#define COMP_U(ret, r, g, b) \
-{ \
-   ret = (int) (-((11059 * r) >> 16) - ((21709 * g) >> 16) + ((32768 * b) >> 16) + 128); \
-   ret = CLAMP (ret, 0, 255); \
-}
-
-#define COMP_V(ret, r, g, b) \
-{ \
-   ret = (int) (((32768 * r) >> 16) - ((27439 * g) >> 16) - ((5329 * b) >> 16) + 128); \
-   ret = CLAMP (ret, 0, 255); \
-}
-
-#define BLEND(ret, alpha, v0, v1) \
-{ \
-       ret = (v0 * alpha + v1 * (255 - alpha)) / 255; \
-}
-
-#define OVER(ret, alphaA, Ca, alphaB, Cb, alphaNew)    \
-{ \
-    gint _tmp; \
-    _tmp = (Ca * alphaA + Cb * alphaB * (255 - alphaA) / 255) / alphaNew; \
-    ret = CLAMP (_tmp, 0, 255); \
-}
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-# define CAIRO_ARGB_A 3
-# define CAIRO_ARGB_R 2
-# define CAIRO_ARGB_G 1
-# define CAIRO_ARGB_B 0
-#else
-# define CAIRO_ARGB_A 0
-# define CAIRO_ARGB_R 1
-# define CAIRO_ARGB_G 2
-# define CAIRO_ARGB_B 3
+#include "config.h"
 #endif
 
-enum
-{
-  PROP_0,
-  PROP_TEXT,
-  PROP_SHADING,
-  PROP_VALIGN,                  /* deprecated */
-  PROP_HALIGN,                  /* deprecated */
-  PROP_HALIGNMENT,
-  PROP_VALIGNMENT,
-  PROP_XPAD,
-  PROP_YPAD,
-  PROP_DELTAX,
-  PROP_DELTAY,
-  PROP_XPOS,
-  PROP_YPOS,
-  PROP_WRAP_MODE,
-  PROP_FONT_DESC,
-  PROP_SILENT,
-  PROP_LINE_ALIGNMENT,
-  PROP_WAIT_TEXT,
-  PROP_AUTO_ADJUST_SIZE,
-  PROP_VERTICAL_RENDER,
-  PROP_COLOR,
-  PROP_SHADOW,
-  PROP_OUTLINE_COLOR,
-  PROP_LAST
-};
-
-static GstStaticPadTemplate src_template_factory =
-    GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
-        GST_VIDEO_CAPS_RGBx ";"
-        GST_VIDEO_CAPS_xRGB ";"
-        GST_VIDEO_CAPS_xBGR ";"
-        GST_VIDEO_CAPS_RGBA ";"
-        GST_VIDEO_CAPS_BGRA ";"
-        GST_VIDEO_CAPS_ARGB ";"
-        GST_VIDEO_CAPS_ABGR ";"
-        GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}"))
-    );
-
-static GstStaticPadTemplate video_sink_template_factory =
-    GST_STATIC_PAD_TEMPLATE ("video_sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
-        GST_VIDEO_CAPS_RGBx ";"
-        GST_VIDEO_CAPS_xRGB ";"
-        GST_VIDEO_CAPS_xBGR ";"
-        GST_VIDEO_CAPS_RGBA ";"
-        GST_VIDEO_CAPS_BGRA ";"
-        GST_VIDEO_CAPS_ARGB ";"
-        GST_VIDEO_CAPS_ABGR ";"
-        GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}"))
-    );
+#include <gsttextoverlay.h>
 
 static GstStaticPadTemplate text_sink_template_factory =
     GST_STATIC_PAD_TEMPLATE ("text_sink",
@@ -238,2578 +92,23 @@ static GstStaticPadTemplate text_sink_template_factory =
     GST_STATIC_CAPS ("text/x-pango-markup; text/plain")
     );
 
-#define GST_TYPE_TEXT_OVERLAY_VALIGN (gst_text_overlay_valign_get_type())
-static GType
-gst_text_overlay_valign_get_type (void)
-{
-  static GType text_overlay_valign_type = 0;
-  static const GEnumValue text_overlay_valign[] = {
-    {GST_TEXT_OVERLAY_VALIGN_BASELINE, "baseline", "baseline"},
-    {GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
-    {GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
-    {GST_TEXT_OVERLAY_VALIGN_POS, "position", "position"},
-    {GST_TEXT_OVERLAY_VALIGN_CENTER, "center", "center"},
-    {0, NULL, NULL},
-  };
-
-  if (!text_overlay_valign_type) {
-    text_overlay_valign_type =
-        g_enum_register_static ("GstTextOverlayVAlign", text_overlay_valign);
-  }
-  return text_overlay_valign_type;
-}
-
-#define GST_TYPE_TEXT_OVERLAY_HALIGN (gst_text_overlay_halign_get_type())
-static GType
-gst_text_overlay_halign_get_type (void)
-{
-  static GType text_overlay_halign_type = 0;
-  static const GEnumValue text_overlay_halign[] = {
-    {GST_TEXT_OVERLAY_HALIGN_LEFT, "left", "left"},
-    {GST_TEXT_OVERLAY_HALIGN_CENTER, "center", "center"},
-    {GST_TEXT_OVERLAY_HALIGN_RIGHT, "right", "right"},
-    {GST_TEXT_OVERLAY_HALIGN_POS, "position", "position"},
-    {0, NULL, NULL},
-  };
-
-  if (!text_overlay_halign_type) {
-    text_overlay_halign_type =
-        g_enum_register_static ("GstTextOverlayHAlign", text_overlay_halign);
-  }
-  return text_overlay_halign_type;
-}
-
-
-#define GST_TYPE_TEXT_OVERLAY_WRAP_MODE (gst_text_overlay_wrap_mode_get_type())
-static GType
-gst_text_overlay_wrap_mode_get_type (void)
-{
-  static GType text_overlay_wrap_mode_type = 0;
-  static const GEnumValue text_overlay_wrap_mode[] = {
-    {GST_TEXT_OVERLAY_WRAP_MODE_NONE, "none", "none"},
-    {GST_TEXT_OVERLAY_WRAP_MODE_WORD, "word", "word"},
-    {GST_TEXT_OVERLAY_WRAP_MODE_CHAR, "char", "char"},
-    {GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR, "wordchar", "wordchar"},
-    {0, NULL, NULL},
-  };
-
-  if (!text_overlay_wrap_mode_type) {
-    text_overlay_wrap_mode_type =
-        g_enum_register_static ("GstTextOverlayWrapMode",
-        text_overlay_wrap_mode);
-  }
-  return text_overlay_wrap_mode_type;
-}
-
-#define GST_TYPE_TEXT_OVERLAY_LINE_ALIGN (gst_text_overlay_line_align_get_type())
-static GType
-gst_text_overlay_line_align_get_type (void)
-{
-  static GType text_overlay_line_align_type = 0;
-  static const GEnumValue text_overlay_line_align[] = {
-    {GST_TEXT_OVERLAY_LINE_ALIGN_LEFT, "left", "left"},
-    {GST_TEXT_OVERLAY_LINE_ALIGN_CENTER, "center", "center"},
-    {GST_TEXT_OVERLAY_LINE_ALIGN_RIGHT, "right", "right"},
-    {0, NULL, NULL}
-  };
-
-  if (!text_overlay_line_align_type) {
-    text_overlay_line_align_type =
-        g_enum_register_static ("GstTextOverlayLineAlign",
-        text_overlay_line_align);
-  }
-  return text_overlay_line_align_type;
-}
-
-#define GST_TEXT_OVERLAY_GET_COND(ov) (((GstTextOverlay *)ov)->cond)
-#define GST_TEXT_OVERLAY_WAIT(ov)     (g_cond_wait (GST_TEXT_OVERLAY_GET_COND (ov), GST_OBJECT_GET_LOCK (ov)))
-#define GST_TEXT_OVERLAY_SIGNAL(ov)   (g_cond_signal (GST_TEXT_OVERLAY_GET_COND (ov)))
-#define GST_TEXT_OVERLAY_BROADCAST(ov)(g_cond_broadcast (GST_TEXT_OVERLAY_GET_COND (ov)))
-
-static GstStateChangeReturn gst_text_overlay_change_state (GstElement * element,
-    GstStateChange transition);
-
-static GstCaps *gst_text_overlay_getcaps (GstPad * pad);
-static gboolean gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_text_overlay_setcaps_txt (GstPad * pad, GstCaps * caps);
-static gboolean gst_text_overlay_src_event (GstPad * pad, GstEvent * event);
-static gboolean gst_text_overlay_src_query (GstPad * pad, GstQuery * query);
-
-static gboolean gst_text_overlay_video_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_text_overlay_video_chain (GstPad * pad,
-    GstBuffer * buffer);
-static GstFlowReturn gst_text_overlay_video_bufferalloc (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buffer);
-
-static gboolean gst_text_overlay_text_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_text_overlay_text_chain (GstPad * pad,
-    GstBuffer * buffer);
-static GstPadLinkReturn gst_text_overlay_text_pad_link (GstPad * pad,
-    GstPad * peer);
-static void gst_text_overlay_text_pad_unlink (GstPad * pad);
-static void gst_text_overlay_pop_text (GstTextOverlay * overlay);
-static void gst_text_overlay_update_render_mode (GstTextOverlay * overlay);
-
-static void gst_text_overlay_finalize (GObject * object);
-static void gst_text_overlay_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_text_overlay_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-static void gst_text_overlay_adjust_values_with_fontdesc (GstTextOverlay *
-    overlay, PangoFontDescription * desc);
-
-GST_BOILERPLATE (GstTextOverlay, gst_text_overlay, GstElement,
-    GST_TYPE_ELEMENT);
+G_DEFINE_TYPE (GstTextOverlay, gst_text_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
 
 static void
-gst_text_overlay_base_init (gpointer g_class)
+gst_text_overlay_class_init (GstTextOverlayClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-  GstTextOverlayClass *klass = GST_TEXT_OVERLAY_CLASS (g_class);
-  PangoFontMap *fontmap;
+  GstElementClass *element_class = (GstElementClass *) klass;
 
   gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_template_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&video_sink_template_factory));
-
-  /* ugh */
-  if (!GST_IS_TIME_OVERLAY_CLASS (g_class) &&
-      !GST_IS_CLOCK_OVERLAY_CLASS (g_class)) {
-    gst_element_class_add_pad_template (element_class,
-        gst_static_pad_template_get (&text_sink_template_factory));
-  }
+      gst_static_pad_template_get (&text_sink_template_factory));
 
   gst_element_class_set_details_simple (element_class, "Text overlay",
       "Filter/Editor/Video",
       "Adds text strings on top of a video buffer",
       "David Schleef <ds@schleef.org>, " "Zeeshan Ali <zeeshan.ali@nokia.com>");
-
-  /* Only lock for the subclasses here, the base class
-   * doesn't have this mutex yet and it's not necessary
-   * here */
-  if (klass->pango_lock)
-    g_mutex_lock (klass->pango_lock);
-  fontmap = pango_cairo_font_map_get_default ();
-  klass->pango_context =
-      pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
-  if (klass->pango_lock)
-    g_mutex_unlock (klass->pango_lock);
-}
-
-static gchar *
-gst_text_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
-{
-  return g_strdup (overlay->default_text);
-}
-
-static void
-gst_text_overlay_class_init (GstTextOverlayClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  gobject_class->finalize = gst_text_overlay_finalize;
-  gobject_class->set_property = gst_text_overlay_set_property;
-  gobject_class->get_property = gst_text_overlay_get_property;
-
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_text_overlay_change_state);
-
-  klass->pango_lock = g_mutex_new ();
-
-  klass->get_text = gst_text_overlay_get_text;
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TEXT,
-      g_param_spec_string ("text", "text",
-          "Text to be display.", DEFAULT_PROP_TEXT,
-          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SHADING,
-      g_param_spec_boolean ("shaded-background", "shaded background",
-          "Whether to shade the background under the text area",
-          DEFAULT_PROP_SHADING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:shadow
-   *
-   * Whether to display a shadow of each letter under the text.
-   *
-   * Since: 0.10.35
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SHADOW,
-      g_param_spec_boolean ("shadow", "create shadow of text",
-          "Whether to create a shadow of the letters under the text",
-          DEFAULT_PROP_SHADOW, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGNMENT,
-      g_param_spec_enum ("valignment", "vertical alignment",
-          "Vertical alignment of the text", GST_TYPE_TEXT_OVERLAY_VALIGN,
-          DEFAULT_PROP_VALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
-      g_param_spec_enum ("halignment", "horizontal alignment",
-          "Horizontal alignment of the text", GST_TYPE_TEXT_OVERLAY_HALIGN,
-          DEFAULT_PROP_HALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGN,
-      g_param_spec_string ("valign", "vertical alignment",
-          "Vertical alignment of the text (deprecated; use valignment)",
-          DEFAULT_PROP_VALIGN, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGN,
-      g_param_spec_string ("halign", "horizontal alignment",
-          "Horizontal alignment of the text (deprecated; use halignment)",
-          DEFAULT_PROP_HALIGN, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPAD,
-      g_param_spec_int ("xpad", "horizontal paddding",
-          "Horizontal paddding when using left/right alignment", 0, G_MAXINT,
-          DEFAULT_PROP_XPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPAD,
-      g_param_spec_int ("ypad", "vertical padding",
-          "Vertical padding when using top/bottom alignment", 0, G_MAXINT,
-          DEFAULT_PROP_YPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAX,
-      g_param_spec_int ("deltax", "X position modifier",
-          "Shift X position to the left or to the right. Unit is pixels.",
-          G_MININT, G_MAXINT, DEFAULT_PROP_DELTAX,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAY,
-      g_param_spec_int ("deltay", "Y position modifier",
-          "Shift Y position up or down. Unit is pixels.", G_MININT, G_MAXINT,
-          DEFAULT_PROP_DELTAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:xpos
-   *
-   * Horizontal position of the rendered text when using positioned alignment.
-   *
-   * Since: 0.10.31
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPOS,
-      g_param_spec_double ("xpos", "horizontal position",
-          "Horizontal position when using position alignment", 0, 1.0,
-          DEFAULT_PROP_XPOS,
-          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:ypos
-   *
-   * Vertical position of the rendered text when using positioned alignment.
-   *
-   * Since: 0.10.31
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPOS,
-      g_param_spec_double ("ypos", "vertical position",
-          "Vertical position when using position alignment", 0, 1.0,
-          DEFAULT_PROP_YPOS,
-          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WRAP_MODE,
-      g_param_spec_enum ("wrap-mode", "wrap mode",
-          "Whether to wrap the text and if so how.",
-          GST_TYPE_TEXT_OVERLAY_WRAP_MODE, DEFAULT_PROP_WRAP_MODE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FONT_DESC,
-      g_param_spec_string ("font-desc", "font description",
-          "Pango font description of font to be used for rendering. "
-          "See documentation of pango_font_description_from_string "
-          "for syntax.", DEFAULT_PROP_FONT_DESC,
-          G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:color
-   *
-   * Color of the rendered text.
-   *
-   * Since: 0.10.31
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COLOR,
-      g_param_spec_uint ("color", "Color",
-          "Color to use for text (big-endian ARGB).", 0, G_MAXUINT32,
-          DEFAULT_PROP_COLOR,
-          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:outline-color
-   *
-   * Color of the outline of the rendered text.
-   *
-   * Since: 0.10.35
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_OUTLINE_COLOR,
-      g_param_spec_uint ("outline-color", "Text Outline Color",
-          "Color to use for outline the text (big-endian ARGB).", 0,
-          G_MAXUINT32, DEFAULT_PROP_OUTLINE_COLOR,
-          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-
-  /**
-   * GstTextOverlay:line-alignment
-   *
-   * Alignment of text lines relative to each other (for multi-line text)
-   *
-   * Since: 0.10.15
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LINE_ALIGNMENT,
-      g_param_spec_enum ("line-alignment", "line alignment",
-          "Alignment of text lines relative to each other.",
-          GST_TYPE_TEXT_OVERLAY_LINE_ALIGN, DEFAULT_PROP_LINE_ALIGNMENT,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:silent
-   *
-   * If set, no text is rendered. Useful to switch off text rendering
-   * temporarily without removing the textoverlay element from the pipeline.
-   *
-   * Since: 0.10.15
-   **/
-  /* FIXME 0.11: rename to "visible" or "text-visible" or "render-text" */
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SILENT,
-      g_param_spec_boolean ("silent", "silent",
-          "Whether to render the text string",
-          DEFAULT_PROP_SILENT,
-          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstTextOverlay:wait-text
-   *
-   * If set, the video will block until a subtitle is received on the text pad.
-   * If video and subtitles are sent in sync, like from the same demuxer, this
-   * property should be set.
-   *
-   * Since: 0.10.20
-   **/
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WAIT_TEXT,
-      g_param_spec_boolean ("wait-text", "Wait Text",
-          "Whether to wait for subtitles",
-          DEFAULT_PROP_WAIT_TEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass),
-      PROP_AUTO_ADJUST_SIZE, g_param_spec_boolean ("auto-resize", "auto resize",
-          "Automatically adjust font size to screen-size.",
-          DEFAULT_PROP_AUTO_ADJUST_SIZE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VERTICAL_RENDER,
-      g_param_spec_boolean ("vertical-render", "vertical render",
-          "Vertical Render.", DEFAULT_PROP_VERTICAL_RENDER,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_text_overlay_finalize (GObject * object)
-{
-  GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
-
-  g_free (overlay->default_text);
-
-  if (overlay->text_image) {
-    g_free (overlay->text_image);
-    overlay->text_image = NULL;
-  }
-
-  if (overlay->layout) {
-    g_object_unref (overlay->layout);
-    overlay->layout = NULL;
-  }
-
-  if (overlay->text_buffer) {
-    gst_buffer_unref (overlay->text_buffer);
-    overlay->text_buffer = NULL;
-  }
-
-  if (overlay->cond) {
-    g_cond_free (overlay->cond);
-    overlay->cond = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass)
-{
-  GstPadTemplate *template;
-  PangoFontDescription *desc;
-
-  /* video sink */
-  template = gst_static_pad_template_get (&video_sink_template_factory);
-  overlay->video_sinkpad = gst_pad_new_from_template (template, "video_sink");
-  gst_object_unref (template);
-  gst_pad_set_getcaps_function (overlay->video_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_getcaps));
-  gst_pad_set_setcaps_function (overlay->video_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_setcaps));
-  gst_pad_set_event_function (overlay->video_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_video_event));
-  gst_pad_set_chain_function (overlay->video_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_video_chain));
-  gst_pad_set_bufferalloc_function (overlay->video_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_video_bufferalloc));
-  gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad);
-
-  if (!GST_IS_TIME_OVERLAY_CLASS (klass) && !GST_IS_CLOCK_OVERLAY_CLASS (klass)) {
-    /* text sink */
-    template = gst_static_pad_template_get (&text_sink_template_factory);
-    overlay->text_sinkpad = gst_pad_new_from_template (template, "text_sink");
-    gst_object_unref (template);
-    gst_pad_set_setcaps_function (overlay->text_sinkpad,
-        GST_DEBUG_FUNCPTR (gst_text_overlay_setcaps_txt));
-    gst_pad_set_event_function (overlay->text_sinkpad,
-        GST_DEBUG_FUNCPTR (gst_text_overlay_text_event));
-    gst_pad_set_chain_function (overlay->text_sinkpad,
-        GST_DEBUG_FUNCPTR (gst_text_overlay_text_chain));
-    gst_pad_set_link_function (overlay->text_sinkpad,
-        GST_DEBUG_FUNCPTR (gst_text_overlay_text_pad_link));
-    gst_pad_set_unlink_function (overlay->text_sinkpad,
-        GST_DEBUG_FUNCPTR (gst_text_overlay_text_pad_unlink));
-    gst_element_add_pad (GST_ELEMENT (overlay), overlay->text_sinkpad);
-  }
-
-  /* (video) source */
-  template = gst_static_pad_template_get (&src_template_factory);
-  overlay->srcpad = gst_pad_new_from_template (template, "src");
-  gst_object_unref (template);
-  gst_pad_set_getcaps_function (overlay->srcpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_getcaps));
-  gst_pad_set_event_function (overlay->srcpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_src_event));
-  gst_pad_set_query_function (overlay->srcpad,
-      GST_DEBUG_FUNCPTR (gst_text_overlay_src_query));
-  gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
-
-  overlay->line_align = DEFAULT_PROP_LINE_ALIGNMENT;
-  g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-  overlay->layout =
-      pango_layout_new (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_context);
-  desc =
-      pango_context_get_font_description (GST_TEXT_OVERLAY_GET_CLASS
-      (overlay)->pango_context);
-  gst_text_overlay_adjust_values_with_fontdesc (overlay, desc);
-
-  overlay->color = DEFAULT_PROP_COLOR;
-  overlay->outline_color = DEFAULT_PROP_OUTLINE_COLOR;
-  overlay->halign = DEFAULT_PROP_HALIGNMENT;
-  overlay->valign = DEFAULT_PROP_VALIGNMENT;
-  overlay->xpad = DEFAULT_PROP_XPAD;
-  overlay->ypad = DEFAULT_PROP_YPAD;
-  overlay->deltax = DEFAULT_PROP_DELTAX;
-  overlay->deltay = DEFAULT_PROP_DELTAY;
-  overlay->xpos = DEFAULT_PROP_XPOS;
-  overlay->ypos = DEFAULT_PROP_YPOS;
-
-  overlay->wrap_mode = DEFAULT_PROP_WRAP_MODE;
-
-  overlay->want_shading = DEFAULT_PROP_SHADING;
-  overlay->want_shadow = DEFAULT_PROP_SHADOW;
-  overlay->shading_value = DEFAULT_SHADING_VALUE;
-  overlay->silent = DEFAULT_PROP_SILENT;
-  overlay->wait_text = DEFAULT_PROP_WAIT_TEXT;
-  overlay->auto_adjust_size = DEFAULT_PROP_AUTO_ADJUST_SIZE;
-
-  overlay->default_text = g_strdup (DEFAULT_PROP_TEXT);
-  overlay->need_render = TRUE;
-  overlay->text_image = NULL;
-  overlay->use_vertical_render = DEFAULT_PROP_VERTICAL_RENDER;
-  gst_text_overlay_update_render_mode (overlay);
-
-  overlay->fps_n = 0;
-  overlay->fps_d = 1;
-
-  overlay->text_buffer = NULL;
-  overlay->text_linked = FALSE;
-  overlay->cond = g_cond_new ();
-  gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
-  g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-}
-
-static void
-gst_text_overlay_update_wrap_mode (GstTextOverlay * overlay)
-{
-  if (overlay->wrap_mode == GST_TEXT_OVERLAY_WRAP_MODE_NONE) {
-    GST_DEBUG_OBJECT (overlay, "Set wrap mode NONE");
-    pango_layout_set_width (overlay->layout, -1);
-  } else {
-    int width;
-
-    if (overlay->auto_adjust_size) {
-      width = DEFAULT_SCALE_BASIS * PANGO_SCALE;
-      if (overlay->use_vertical_render) {
-        width = width * (overlay->height - overlay->ypad * 2) / overlay->width;
-      }
-    } else {
-      width =
-          (overlay->use_vertical_render ? overlay->height : overlay->width) *
-          PANGO_SCALE;
-    }
-
-    GST_DEBUG_OBJECT (overlay, "Set layout width %d", overlay->width);
-    GST_DEBUG_OBJECT (overlay, "Set wrap mode    %d", overlay->wrap_mode);
-    pango_layout_set_width (overlay->layout, width);
-    pango_layout_set_wrap (overlay->layout, (PangoWrapMode) overlay->wrap_mode);
-  }
-}
-
-static void
-gst_text_overlay_update_render_mode (GstTextOverlay * overlay)
-{
-  PangoMatrix matrix = PANGO_MATRIX_INIT;
-  PangoContext *context = pango_layout_get_context (overlay->layout);
-
-  if (overlay->use_vertical_render) {
-    pango_matrix_rotate (&matrix, -90);
-    pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO);
-    pango_context_set_matrix (context, &matrix);
-    pango_layout_set_alignment (overlay->layout, PANGO_ALIGN_LEFT);
-  } else {
-    pango_context_set_base_gravity (context, PANGO_GRAVITY_SOUTH);
-    pango_context_set_matrix (context, &matrix);
-    pango_layout_set_alignment (overlay->layout, overlay->line_align);
-  }
-}
-
-static gboolean
-gst_text_overlay_setcaps_txt (GstPad * pad, GstCaps * caps)
-{
-  GstTextOverlay *overlay;
-  GstStructure *structure;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  structure = gst_caps_get_structure (caps, 0);
-  overlay->have_pango_markup =
-      gst_structure_has_name (structure, "text/x-pango-markup");
-
-  gst_object_unref (overlay);
-
-  return TRUE;
-}
-
-/* FIXME: upstream nego (e.g. when the video window is resized) */
-
-static gboolean
-gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
-{
-  GstTextOverlay *overlay;
-  GstStructure *structure;
-  gboolean ret = FALSE;
-  const GValue *fps;
-
-  if (!GST_PAD_IS_SINK (pad))
-    return TRUE;
-
-  g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  overlay->width = 0;
-  overlay->height = 0;
-  structure = gst_caps_get_structure (caps, 0);
-  fps = gst_structure_get_value (structure, "framerate");
-
-  if (fps
-      && gst_video_format_parse_caps (caps, &overlay->format, &overlay->width,
-          &overlay->height)) {
-    ret = gst_pad_set_caps (overlay->srcpad, caps);
-  }
-
-  overlay->fps_n = gst_value_get_fraction_numerator (fps);
-  overlay->fps_d = gst_value_get_fraction_denominator (fps);
-
-  if (ret) {
-    GST_OBJECT_LOCK (overlay);
-    g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-    gst_text_overlay_update_wrap_mode (overlay);
-    g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-    GST_OBJECT_UNLOCK (overlay);
-  }
-
-  gst_object_unref (overlay);
-
-  return ret;
-}
-
-static void
-gst_text_overlay_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
-
-  GST_OBJECT_LOCK (overlay);
-  switch (prop_id) {
-    case PROP_TEXT:
-      g_free (overlay->default_text);
-      overlay->default_text = g_value_dup_string (value);
-      overlay->need_render = TRUE;
-      break;
-    case PROP_SHADING:
-      overlay->want_shading = g_value_get_boolean (value);
-      break;
-    case PROP_SHADOW:
-      overlay->want_shadow = g_value_get_boolean (value);
-      break;
-    case PROP_XPAD:
-      overlay->xpad = g_value_get_int (value);
-      break;
-    case PROP_YPAD:
-      overlay->ypad = g_value_get_int (value);
-      break;
-    case PROP_DELTAX:
-      overlay->deltax = g_value_get_int (value);
-      break;
-    case PROP_DELTAY:
-      overlay->deltay = g_value_get_int (value);
-      break;
-    case PROP_XPOS:
-      overlay->xpos = g_value_get_double (value);
-      break;
-    case PROP_YPOS:
-      overlay->ypos = g_value_get_double (value);
-      break;
-    case PROP_HALIGN:{
-      const gchar *s = g_value_get_string (value);
-
-      if (s && g_ascii_strcasecmp (s, "left") == 0)
-        overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
-      else if (s && g_ascii_strcasecmp (s, "center") == 0)
-        overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
-      else if (s && g_ascii_strcasecmp (s, "right") == 0)
-        overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
-      else
-        g_warning ("Invalid value '%s' for textoverlay property 'halign'",
-            GST_STR_NULL (s));
-      break;
-    }
-    case PROP_VALIGN:{
-      const gchar *s = g_value_get_string (value);
-
-      if (s && g_ascii_strcasecmp (s, "baseline") == 0)
-        overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
-      else if (s && g_ascii_strcasecmp (s, "bottom") == 0)
-        overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
-      else if (s && g_ascii_strcasecmp (s, "top") == 0)
-        overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
-      else
-        g_warning ("Invalid value '%s' for textoverlay property 'valign'",
-            GST_STR_NULL (s));
-      break;
-    }
-    case PROP_VALIGNMENT:
-      overlay->valign = g_value_get_enum (value);
-      break;
-    case PROP_HALIGNMENT:
-      overlay->halign = g_value_get_enum (value);
-      break;
-    case PROP_WRAP_MODE:
-      overlay->wrap_mode = g_value_get_enum (value);
-      g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      gst_text_overlay_update_wrap_mode (overlay);
-      g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      break;
-    case PROP_FONT_DESC:
-    {
-      PangoFontDescription *desc;
-      const gchar *fontdesc_str;
-
-      fontdesc_str = g_value_get_string (value);
-      g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      desc = pango_font_description_from_string (fontdesc_str);
-      if (desc) {
-        GST_LOG_OBJECT (overlay, "font description set: %s", fontdesc_str);
-        pango_layout_set_font_description (overlay->layout, desc);
-        gst_text_overlay_adjust_values_with_fontdesc (overlay, desc);
-        pango_font_description_free (desc);
-      } else {
-        GST_WARNING_OBJECT (overlay, "font description parse failed: %s",
-            fontdesc_str);
-      }
-      g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      break;
-    }
-    case PROP_COLOR:
-      overlay->color = g_value_get_uint (value);
-      break;
-    case PROP_OUTLINE_COLOR:
-      overlay->outline_color = g_value_get_uint (value);
-      break;
-    case PROP_SILENT:
-      overlay->silent = g_value_get_boolean (value);
-      break;
-    case PROP_LINE_ALIGNMENT:
-      overlay->line_align = g_value_get_enum (value);
-      g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      pango_layout_set_alignment (overlay->layout,
-          (PangoAlignment) overlay->line_align);
-      g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      break;
-    case PROP_WAIT_TEXT:
-      overlay->wait_text = g_value_get_boolean (value);
-      break;
-    case PROP_AUTO_ADJUST_SIZE:
-      overlay->auto_adjust_size = g_value_get_boolean (value);
-      overlay->need_render = TRUE;
-      break;
-    case PROP_VERTICAL_RENDER:
-      overlay->use_vertical_render = g_value_get_boolean (value);
-      g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      gst_text_overlay_update_render_mode (overlay);
-      g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-      overlay->need_render = TRUE;
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-
-  overlay->need_render = TRUE;
-  GST_OBJECT_UNLOCK (overlay);
-}
-
-static void
-gst_text_overlay_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
-
-  GST_OBJECT_LOCK (overlay);
-  switch (prop_id) {
-    case PROP_TEXT:
-      g_value_set_string (value, overlay->default_text);
-      break;
-    case PROP_SHADING:
-      g_value_set_boolean (value, overlay->want_shading);
-      break;
-    case PROP_SHADOW:
-      g_value_set_boolean (value, overlay->want_shadow);
-      break;
-    case PROP_XPAD:
-      g_value_set_int (value, overlay->xpad);
-      break;
-    case PROP_YPAD:
-      g_value_set_int (value, overlay->ypad);
-      break;
-    case PROP_DELTAX:
-      g_value_set_int (value, overlay->deltax);
-      break;
-    case PROP_DELTAY:
-      g_value_set_int (value, overlay->deltay);
-      break;
-    case PROP_XPOS:
-      g_value_set_double (value, overlay->xpos);
-      break;
-    case PROP_YPOS:
-      g_value_set_double (value, overlay->ypos);
-      break;
-    case PROP_VALIGNMENT:
-      g_value_set_enum (value, overlay->valign);
-      break;
-    case PROP_HALIGNMENT:
-      g_value_set_enum (value, overlay->halign);
-      break;
-    case PROP_WRAP_MODE:
-      g_value_set_enum (value, overlay->wrap_mode);
-      break;
-    case PROP_SILENT:
-      g_value_set_boolean (value, overlay->silent);
-      break;
-    case PROP_LINE_ALIGNMENT:
-      g_value_set_enum (value, overlay->line_align);
-      break;
-    case PROP_WAIT_TEXT:
-      g_value_set_boolean (value, overlay->wait_text);
-      break;
-    case PROP_AUTO_ADJUST_SIZE:
-      g_value_set_boolean (value, overlay->auto_adjust_size);
-      break;
-    case PROP_VERTICAL_RENDER:
-      g_value_set_boolean (value, overlay->use_vertical_render);
-      break;
-    case PROP_COLOR:
-      g_value_set_uint (value, overlay->color);
-      break;
-    case PROP_OUTLINE_COLOR:
-      g_value_set_uint (value, overlay->outline_color);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-
-  overlay->need_render = TRUE;
-  GST_OBJECT_UNLOCK (overlay);
-}
-
-static gboolean
-gst_text_overlay_src_query (GstPad * pad, GstQuery * query)
-{
-  gboolean ret = FALSE;
-  GstTextOverlay *overlay = NULL;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  ret = gst_pad_peer_query (overlay->video_sinkpad, query);
-
-  gst_object_unref (overlay);
-
-  return ret;
-}
-
-static gboolean
-gst_text_overlay_src_event (GstPad * pad, GstEvent * event)
-{
-  gboolean ret = FALSE;
-  GstTextOverlay *overlay = NULL;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_SEEK:{
-      GstSeekFlags flags;
-
-      /* We don't handle seek if we have not text pad */
-      if (!overlay->text_linked) {
-        GST_DEBUG_OBJECT (overlay, "seek received, pushing upstream");
-        ret = gst_pad_push_event (overlay->video_sinkpad, event);
-        goto beach;
-      }
-
-      GST_DEBUG_OBJECT (overlay, "seek received, driving from here");
-
-      gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
-
-      /* Flush downstream, only for flushing seek */
-      if (flags & GST_SEEK_FLAG_FLUSH)
-        gst_pad_push_event (overlay->srcpad, gst_event_new_flush_start ());
-
-      /* Mark ourself as flushing, unblock chains */
-      GST_OBJECT_LOCK (overlay);
-      overlay->video_flushing = TRUE;
-      overlay->text_flushing = TRUE;
-      gst_text_overlay_pop_text (overlay);
-      GST_OBJECT_UNLOCK (overlay);
-
-      /* Seek on each sink pad */
-      gst_event_ref (event);
-      ret = gst_pad_push_event (overlay->video_sinkpad, event);
-      if (ret) {
-        ret = gst_pad_push_event (overlay->text_sinkpad, event);
-      } else {
-        gst_event_unref (event);
-      }
-      break;
-    }
-    default:
-      if (overlay->text_linked) {
-        gst_event_ref (event);
-        ret = gst_pad_push_event (overlay->video_sinkpad, event);
-        gst_pad_push_event (overlay->text_sinkpad, event);
-      } else {
-        ret = gst_pad_push_event (overlay->video_sinkpad, event);
-      }
-      break;
-  }
-
-beach:
-  gst_object_unref (overlay);
-
-  return ret;
-}
-
-static GstCaps *
-gst_text_overlay_getcaps (GstPad * pad)
-{
-  GstTextOverlay *overlay;
-  GstPad *otherpad;
-  GstCaps *caps;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  if (pad == overlay->srcpad)
-    otherpad = overlay->video_sinkpad;
-  else
-    otherpad = overlay->srcpad;
-
-  /* we can do what the peer can */
-  caps = gst_pad_peer_get_caps (otherpad);
-  if (caps) {
-    GstCaps *temp;
-    const GstCaps *templ;
-
-    GST_DEBUG_OBJECT (pad, "peer caps  %" GST_PTR_FORMAT, caps);
-
-    /* filtered against our padtemplate */
-    templ = gst_pad_get_pad_template_caps (otherpad);
-    GST_DEBUG_OBJECT (pad, "our template  %" GST_PTR_FORMAT, templ);
-    temp = gst_caps_intersect (caps, templ);
-    GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp);
-    gst_caps_unref (caps);
-    /* this is what we can do */
-    caps = temp;
-  } else {
-    /* no peer, our padtemplate is enough then */
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
-  }
-
-  GST_DEBUG_OBJECT (overlay, "returning  %" GST_PTR_FORMAT, caps);
-
-  gst_object_unref (overlay);
-
-  return caps;
-}
-
-static void
-gst_text_overlay_adjust_values_with_fontdesc (GstTextOverlay * overlay,
-    PangoFontDescription * desc)
-{
-  gint font_size = pango_font_description_get_size (desc) / PANGO_SCALE;
-  overlay->shadow_offset = (double) (font_size) / 13.0;
-  overlay->outline_offset = (double) (font_size) / 15.0;
-  if (overlay->outline_offset < MINIMUM_OUTLINE_OFFSET)
-    overlay->outline_offset = MINIMUM_OUTLINE_OFFSET;
-}
-
-#define CAIRO_UNPREMULTIPLY(a,r,g,b) G_STMT_START { \
-  b = (a > 0) ? MIN ((b * 255 + a / 2) / a, 255) : 0; \
-  g = (a > 0) ? MIN ((g * 255 + a / 2) / a, 255) : 0; \
-  r = (a > 0) ? MIN ((r * 255 + a / 2) / a, 255) : 0; \
-} G_STMT_END
-
-static inline void
-gst_text_overlay_blit_1 (GstTextOverlay * overlay, guchar * dest, gint xpos,
-    gint ypos, guchar * text_image, guint dest_stride)
-{
-  gint i, j = 0;
-  gint x, y;
-  guchar r, g, b, a;
-  guchar *pimage;
-  guchar *py;
-  gint width = overlay->image_width;
-  gint height = overlay->image_height;
-
-  if (xpos < 0) {
-    xpos = 0;
-  }
-
-  if (xpos + width > overlay->width) {
-    width = overlay->width - xpos;
-  }
-
-  if (ypos + height > overlay->height) {
-    height = overlay->height - ypos;
-  }
-
-  dest += (ypos / 1) * dest_stride;
-
-  for (i = 0; i < height; i++) {
-    pimage = text_image + 4 * (i * overlay->image_width);
-    py = dest + i * dest_stride + xpos;
-    for (j = 0; j < width; j++) {
-      b = pimage[CAIRO_ARGB_B];
-      g = pimage[CAIRO_ARGB_G];
-      r = pimage[CAIRO_ARGB_R];
-      a = pimage[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a, r, g, b);
-
-      pimage += 4;
-      if (a == 0) {
-        py++;
-        continue;
-      }
-      COMP_Y (y, r, g, b);
-      x = *py;
-      BLEND (*py++, a, y, x);
-    }
-  }
-}
-
-static inline void
-gst_text_overlay_blit_sub2x2cbcr (GstTextOverlay * overlay,
-    guchar * destcb, guchar * destcr, gint xpos, gint ypos, guchar * text_image,
-    guint destcb_stride, guint destcr_stride, guint pix_stride)
-{
-  gint i, j;
-  gint x, cb, cr;
-  gushort r, g, b, a;
-  gushort r1, g1, b1, a1;
-  guchar *pimage1, *pimage2;
-  guchar *pcb, *pcr;
-  gint width = overlay->image_width - 2;
-  gint height = overlay->image_height - 2;
-
-  xpos *= pix_stride;
-
-  if (xpos < 0) {
-    xpos = 0;
-  }
-
-  if (xpos + width > overlay->width) {
-    width = overlay->width - xpos;
-  }
-
-  if (ypos + height > overlay->height) {
-    height = overlay->height - ypos;
-  }
-
-  destcb += (ypos / 2) * destcb_stride;
-  destcr += (ypos / 2) * destcr_stride;
-
-  for (i = 0; i < height; i += 2) {
-    pimage1 = text_image + 4 * (i * overlay->image_width);
-    pimage2 = pimage1 + 4 * overlay->image_width;
-    pcb = destcb + (i / 2) * destcb_stride + xpos / 2;
-    pcr = destcr + (i / 2) * destcr_stride + xpos / 2;
-    for (j = 0; j < width; j += 2) {
-      b = pimage1[CAIRO_ARGB_B];
-      g = pimage1[CAIRO_ARGB_G];
-      r = pimage1[CAIRO_ARGB_R];
-      a = pimage1[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a, r, g, b);
-      pimage1 += 4;
-
-      b1 = pimage1[CAIRO_ARGB_B];
-      g1 = pimage1[CAIRO_ARGB_G];
-      r1 = pimage1[CAIRO_ARGB_R];
-      a1 = pimage1[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
-      b += b1;
-      g += g1;
-      r += r1;
-      a += a1;
-      pimage1 += 4;
-
-      b1 = pimage2[CAIRO_ARGB_B];
-      g1 = pimage2[CAIRO_ARGB_G];
-      r1 = pimage2[CAIRO_ARGB_R];
-      a1 = pimage2[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
-      b += b1;
-      g += g1;
-      r += r1;
-      a += a1;
-      pimage2 += 4;
-
-      /* + 2 for rounding */
-      b1 = pimage2[CAIRO_ARGB_B];
-      g1 = pimage2[CAIRO_ARGB_G];
-      r1 = pimage2[CAIRO_ARGB_R];
-      a1 = pimage2[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
-      b += b1 + 2;
-      g += g1 + 2;
-      r += r1 + 2;
-      a += a1 + 2;
-      pimage2 += 4;
-
-      b /= 4;
-      g /= 4;
-      r /= 4;
-      a /= 4;
-
-      if (a == 0) {
-        pcb += pix_stride;
-        pcr += pix_stride;
-        continue;
-      }
-      COMP_U (cb, r, g, b);
-      COMP_V (cr, r, g, b);
-
-      x = *pcb;
-      BLEND (*pcb, a, cb, x);
-      x = *pcr;
-      BLEND (*pcr, a, cr, x);
-
-      pcb += pix_stride;
-      pcr += pix_stride;
-    }
-  }
-}
-
-static void
-gst_text_overlay_render_pangocairo (GstTextOverlay * overlay,
-    const gchar * string, gint textlen)
-{
-  cairo_t *cr;
-  cairo_surface_t *surface;
-  PangoRectangle ink_rect, logical_rect;
-  cairo_matrix_t cairo_matrix;
-  int width, height;
-  double scalef = 1.0;
-  double a, r, g, b;
-
-  g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-
-  if (overlay->auto_adjust_size) {
-    /* 640 pixel is default */
-    scalef = (double) (overlay->width) / DEFAULT_SCALE_BASIS;
-  }
-  pango_layout_set_width (overlay->layout, -1);
-  /* set text on pango layout */
-  pango_layout_set_markup (overlay->layout, string, textlen);
-
-  /* get subtitle image size */
-  pango_layout_get_pixel_extents (overlay->layout, &ink_rect, &logical_rect);
-
-  width = (logical_rect.width + overlay->shadow_offset) * scalef;
-
-  if (width + overlay->deltax >
-      (overlay->use_vertical_render ? overlay->height : overlay->width)) {
-    /*
-     * subtitle image width is larger then overlay width
-     * so rearrange overlay wrap mode.
-     */
-    gst_text_overlay_update_wrap_mode (overlay);
-    pango_layout_get_pixel_extents (overlay->layout, &ink_rect, &logical_rect);
-    width = overlay->width;
-  }
-
-  height =
-      (logical_rect.height + logical_rect.y + overlay->shadow_offset) * scalef;
-  if (height > overlay->height) {
-    height = overlay->height;
-  }
-  if (overlay->use_vertical_render) {
-    PangoRectangle rect;
-    PangoContext *context;
-    PangoMatrix matrix = PANGO_MATRIX_INIT;
-    int tmp;
-
-    context = pango_layout_get_context (overlay->layout);
-
-    pango_matrix_rotate (&matrix, -90);
-
-    rect.x = rect.y = 0;
-    rect.width = width;
-    rect.height = height;
-    pango_matrix_transform_pixel_rectangle (&matrix, &rect);
-    matrix.x0 = -rect.x;
-    matrix.y0 = -rect.y;
-
-    pango_context_set_matrix (context, &matrix);
-
-    cairo_matrix.xx = matrix.xx;
-    cairo_matrix.yx = matrix.yx;
-    cairo_matrix.xy = matrix.xy;
-    cairo_matrix.yy = matrix.yy;
-    cairo_matrix.x0 = matrix.x0;
-    cairo_matrix.y0 = matrix.y0;
-    cairo_matrix_scale (&cairo_matrix, scalef, scalef);
-
-    tmp = height;
-    height = width;
-    width = tmp;
-  } else {
-    cairo_matrix_init_scale (&cairo_matrix, scalef, scalef);
-  }
-
-  /* reallocate surface */
-  overlay->text_image = g_realloc (overlay->text_image, 4 * width * height);
-
-  surface = cairo_image_surface_create_for_data (overlay->text_image,
-      CAIRO_FORMAT_ARGB32, width, height, width * 4);
-  cr = cairo_create (surface);
-
-  /* clear surface */
-  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
-  cairo_paint (cr);
-
-  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-
-  if (overlay->want_shading)
-    cairo_paint_with_alpha (cr, overlay->shading_value);
-
-  /* apply transformations */
-  cairo_set_matrix (cr, &cairo_matrix);
-
-  /* FIXME: We use show_layout everywhere except for the surface
-   * because it's really faster and internally does all kinds of
-   * caching. Unfortunately we have to paint to a cairo path for
-   * the outline and this is slow. Once Pango supports user fonts
-   * we should use them, see
-   * https://bugzilla.gnome.org/show_bug.cgi?id=598695
-   *
-   * Idea would the be, to create a cairo user font that
-   * does shadow, outline, text painting in the
-   * render_glyph function.
-   */
-
-  /* draw shadow text */
-  if (overlay->want_shadow) {
-    cairo_save (cr);
-    cairo_translate (cr, overlay->shadow_offset, overlay->shadow_offset);
-    cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
-    pango_cairo_show_layout (cr, overlay->layout);
-    cairo_restore (cr);
-  }
-
-  a = (overlay->outline_color >> 24) & 0xff;
-  r = (overlay->outline_color >> 16) & 0xff;
-  g = (overlay->outline_color >> 8) & 0xff;
-  b = (overlay->outline_color >> 0) & 0xff;
-
-  /* draw outline text */
-  cairo_save (cr);
-  cairo_set_source_rgba (cr, r / 255.0, g / 255.0, b / 255.0, a / 255.0);
-  cairo_set_line_width (cr, overlay->outline_offset);
-  pango_cairo_layout_path (cr, overlay->layout);
-  cairo_stroke (cr);
-  cairo_restore (cr);
-
-  a = (overlay->color >> 24) & 0xff;
-  r = (overlay->color >> 16) & 0xff;
-  g = (overlay->color >> 8) & 0xff;
-  b = (overlay->color >> 0) & 0xff;
-
-  /* draw text */
-  cairo_save (cr);
-  cairo_set_source_rgba (cr, r / 255.0, g / 255.0, b / 255.0, a / 255.0);
-  pango_cairo_show_layout (cr, overlay->layout);
-  cairo_restore (cr);
-
-  cairo_destroy (cr);
-  cairo_surface_destroy (surface);
-  overlay->image_width = width;
-  overlay->image_height = height;
-  overlay->baseline_y = ink_rect.y;
-
-  g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
-}
-
-#define BOX_XPAD         6
-#define BOX_YPAD         6
-
-static inline void
-gst_text_overlay_shade_planar_Y (GstTextOverlay * overlay, guchar * dest,
-    gint x0, gint x1, gint y0, gint y1)
-{
-  gint i, j, dest_stride;
-
-  dest_stride = gst_video_format_get_row_stride (overlay->format, 0,
-      overlay->width);
-
-  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
-  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
-
-  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
-  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
-
-  for (i = y0; i < y1; ++i) {
-    for (j = x0; j < x1; ++j) {
-      gint y = dest[(i * dest_stride) + j] + overlay->shading_value;
-
-      dest[(i * dest_stride) + j] = CLAMP (y, 0, 255);
-    }
-  }
-}
-
-static inline void
-gst_text_overlay_shade_packed_Y (GstTextOverlay * overlay, guchar * dest,
-    gint x0, gint x1, gint y0, gint y1)
-{
-  gint i, j;
-  guint dest_stride, pixel_stride, component_offset;
-
-  dest_stride = gst_video_format_get_row_stride (overlay->format, 0,
-      overlay->width);
-  pixel_stride = gst_video_format_get_pixel_stride (overlay->format, 0);
-  component_offset =
-      gst_video_format_get_component_offset (overlay->format, 0, overlay->width,
-      overlay->height);
-
-  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
-  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
-
-  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
-  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
-
-  if (x0 != 0)
-    x0 = gst_video_format_get_component_width (overlay->format, 0, x0);
-  if (x1 != 0)
-    x1 = gst_video_format_get_component_width (overlay->format, 0, x1);
-
-  if (y0 != 0)
-    y0 = gst_video_format_get_component_height (overlay->format, 0, y0);
-  if (y1 != 0)
-    y1 = gst_video_format_get_component_height (overlay->format, 0, y1);
-
-  for (i = y0; i < y1; i++) {
-    for (j = x0; j < x1; j++) {
-      gint y;
-      gint y_pos;
-
-      y_pos = (i * dest_stride) + j * pixel_stride + component_offset;
-      y = dest[y_pos] + overlay->shading_value;
-
-      dest[y_pos] = CLAMP (y, 0, 255);
-    }
-  }
-}
-
-#define gst_text_overlay_shade_BGRx gst_text_overlay_shade_xRGB
-#define gst_text_overlay_shade_RGBx gst_text_overlay_shade_xRGB
-#define gst_text_overlay_shade_xBGR gst_text_overlay_shade_xRGB
-static inline void
-gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest,
-    gint x0, gint x1, gint y0, gint y1)
-{
-  gint i, j;
-
-  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
-  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
-
-  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
-  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
-
-  for (i = y0; i < y1; i++) {
-    for (j = x0; j < x1; j++) {
-      gint y, y_pos, k;
-
-      y_pos = (i * 4 * overlay->width) + j * 4;
-      for (k = 0; k < 4; k++) {
-        y = dest[y_pos + k] + overlay->shading_value;
-        dest[y_pos + k] = CLAMP (y, 0, 255);
-      }
-    }
-  }
-}
-
-#define ARGB_SHADE_FUNCTION(name, OFFSET)      \
-static inline void \
-gst_text_overlay_shade_##name (GstTextOverlay * overlay, guchar * dest, \
-gint x0, gint x1, gint y0, gint y1) \
-{ \
-  gint i, j;\
-  \
-  x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);\
-  x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);\
-  \
-  y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);\
-  y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);\
-  \
-  for (i = y0; i < y1; i++) {\
-    for (j = x0; j < x1; j++) {\
-      gint y, y_pos, k;\
-      y_pos = (i * 4 * overlay->width) + j * 4;\
-      for (k = OFFSET; k < 3+OFFSET; k++) {\
-        y = dest[y_pos + k] + overlay->shading_value;\
-        dest[y_pos + k] = CLAMP (y, 0, 255);\
-      }\
-    }\
-  }\
-}
-ARGB_SHADE_FUNCTION (ARGB, 1);
-ARGB_SHADE_FUNCTION (ABGR, 1);
-ARGB_SHADE_FUNCTION (RGBA, 0);
-ARGB_SHADE_FUNCTION (BGRA, 0);
-
-
-/* FIXME:
- *  - use proper strides and offset for I420
- *  - don't draw over the edge of the picture (try a longer
- *    text with a huge font size)
- */
-
-static inline void
-gst_text_overlay_blit_NV12_NV21 (GstTextOverlay * overlay,
-    guint8 * yuv_pixels, gint xpos, gint ypos)
-{
-  int y_stride, uv_stride;
-  int u_offset, v_offset;
-  int h, w;
-
-  /* because U/V is 2x2 subsampled, we need to round, either up or down,
-   * to a boundary of integer number of U/V pixels:
-   */
-  xpos = GST_ROUND_UP_2 (xpos);
-  ypos = GST_ROUND_UP_2 (ypos);
-
-  w = overlay->width;
-  h = overlay->height;
-
-  y_stride = gst_video_format_get_row_stride (overlay->format, 0, w);
-  uv_stride = gst_video_format_get_row_stride (overlay->format, 1, w);
-  u_offset = gst_video_format_get_component_offset (overlay->format, 1, w, h);
-  v_offset = gst_video_format_get_component_offset (overlay->format, 2, w, h);
-
-  gst_text_overlay_blit_1 (overlay, yuv_pixels, xpos, ypos, overlay->text_image,
-      y_stride);
-  gst_text_overlay_blit_sub2x2cbcr (overlay, yuv_pixels + u_offset,
-      yuv_pixels + v_offset, xpos, ypos, overlay->text_image, uv_stride,
-      uv_stride, 2);
-}
-
-static inline void
-gst_text_overlay_blit_I420 (GstTextOverlay * overlay,
-    guint8 * yuv_pixels, gint xpos, gint ypos)
-{
-  int y_stride, u_stride, v_stride;
-  int u_offset, v_offset;
-  int h, w;
-
-  /* because U/V is 2x2 subsampled, we need to round, either up or down,
-   * to a boundary of integer number of U/V pixels:
-   */
-  xpos = GST_ROUND_UP_2 (xpos);
-  ypos = GST_ROUND_UP_2 (ypos);
-
-  w = overlay->width;
-  h = overlay->height;
-
-  y_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0, w);
-  u_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 1, w);
-  v_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 2, w);
-  u_offset =
-      gst_video_format_get_component_offset (GST_VIDEO_FORMAT_I420, 1, w, h);
-  v_offset =
-      gst_video_format_get_component_offset (GST_VIDEO_FORMAT_I420, 2, w, h);
-
-  gst_text_overlay_blit_1 (overlay, yuv_pixels, xpos, ypos, overlay->text_image,
-      y_stride);
-  gst_text_overlay_blit_sub2x2cbcr (overlay, yuv_pixels + u_offset,
-      yuv_pixels + v_offset, xpos, ypos, overlay->text_image, u_stride,
-      v_stride, 1);
-}
-
-static inline void
-gst_text_overlay_blit_UYVY (GstTextOverlay * overlay,
-    guint8 * yuv_pixels, gint xpos, gint ypos)
-{
-  int a0, r0, g0, b0;
-  int a1, r1, g1, b1;
-  int y0, y1, u, v;
-  int i, j;
-  int h, w;
-  guchar *pimage, *dest;
-
-  /* because U/V is 2x horizontally subsampled, we need to round to a
-   * boundary of integer number of U/V pixels in x dimension:
-   */
-  xpos = GST_ROUND_UP_2 (xpos);
-
-  w = overlay->image_width - 2;
-  h = overlay->image_height - 2;
-
-  if (xpos < 0) {
-    xpos = 0;
-  }
-
-  if (xpos + w > overlay->width) {
-    w = overlay->width - xpos;
-  }
-
-  if (ypos + h > overlay->height) {
-    h = overlay->height - ypos;
-  }
-
-  for (i = 0; i < h; i++) {
-    pimage = overlay->text_image + i * overlay->image_width * 4;
-    dest = yuv_pixels + (i + ypos) * overlay->width * 2 + xpos * 2;
-    for (j = 0; j < w; j += 2) {
-      b0 = pimage[CAIRO_ARGB_B];
-      g0 = pimage[CAIRO_ARGB_G];
-      r0 = pimage[CAIRO_ARGB_R];
-      a0 = pimage[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a0, r0, g0, b0);
-      pimage += 4;
-
-      b1 = pimage[CAIRO_ARGB_B];
-      g1 = pimage[CAIRO_ARGB_G];
-      r1 = pimage[CAIRO_ARGB_R];
-      a1 = pimage[CAIRO_ARGB_A];
-      CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
-      pimage += 4;
-
-      a0 += a1 + 2;
-      a0 /= 2;
-      if (a0 == 0) {
-        dest += 4;
-        continue;
-      }
-
-      COMP_Y (y0, r0, g0, b0);
-      COMP_Y (y1, r1, g1, b1);
-
-      b0 += b1 + 2;
-      g0 += g1 + 2;
-      r0 += r1 + 2;
-
-      b0 /= 2;
-      g0 /= 2;
-      r0 /= 2;
-
-      COMP_U (u, r0, g0, b0);
-      COMP_V (v, r0, g0, b0);
-
-      BLEND (*dest, a0, u, *dest);
-      dest++;
-      BLEND (*dest, a0, y0, *dest);
-      dest++;
-      BLEND (*dest, a0, v, *dest);
-      dest++;
-      BLEND (*dest, a0, y1, *dest);
-      dest++;
-    }
-  }
-}
-
-static inline void
-gst_text_overlay_blit_AYUV (GstTextOverlay * overlay,
-    guint8 * rgb_pixels, gint xpos, gint ypos)
-{
-  int a, r, g, b, a1;
-  int y, u, v;
-  int i, j;
-  int h, w;
-  guchar *pimage, *dest;
-
-  w = overlay->image_width;
-  h = overlay->image_height;
-
-  if (xpos < 0) {
-    xpos = 0;
-  }
-
-  if (xpos + w > overlay->width) {
-    w = overlay->width - xpos;
-  }
-
-  if (ypos + h > overlay->height) {
-    h = overlay->height - ypos;
-  }
-
-  for (i = 0; i < h; i++) {
-    pimage = overlay->text_image + i * overlay->image_width * 4;
-    dest = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4;
-    for (j = 0; j < w; j++) {
-      a = pimage[CAIRO_ARGB_A];
-      b = pimage[CAIRO_ARGB_B];
-      g = pimage[CAIRO_ARGB_G];
-      r = pimage[CAIRO_ARGB_R];
-
-      CAIRO_UNPREMULTIPLY (a, r, g, b);
-
-      // convert background to yuv
-      COMP_Y (y, r, g, b);
-      COMP_U (u, r, g, b);
-      COMP_V (v, r, g, b);
-
-      // preform text "OVER" background alpha compositing
-      a1 = a + (dest[0] * (255 - a)) / 255 + 1; // add 1 to prevent divide by 0
-      OVER (dest[1], a, y, dest[0], dest[1], a1);
-      OVER (dest[2], a, u, dest[0], dest[2], a1);
-      OVER (dest[3], a, v, dest[0], dest[3], a1);
-      dest[0] = a1 - 1;         // remove the temporary 1 we added
-
-      pimage += 4;
-      dest += 4;
-    }
-  }
-}
-
-#define xRGB_BLIT_FUNCTION(name, R, G, B) \
-static inline void \
-gst_text_overlay_blit_##name (GstTextOverlay * overlay, \
-    guint8 * rgb_pixels, gint xpos, gint ypos) \
-{ \
-  int a, r, g, b; \
-  int i, j; \
-  int h, w; \
-  guchar *pimage, *dest; \
-  \
-  w = overlay->image_width; \
-  h = overlay->image_height; \
-  \
-  if (xpos < 0) { \
-    xpos = 0; \
-  } \
-  \
-  if (xpos + w > overlay->width) { \
-    w = overlay->width - xpos; \
-  } \
-  \
-  if (ypos + h > overlay->height) { \
-    h = overlay->height - ypos; \
-  } \
-  \
-  for (i = 0; i < h; i++) { \
-    pimage = overlay->text_image + i * overlay->image_width * 4; \
-    dest = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4; \
-    for (j = 0; j < w; j++) { \
-      a = pimage[CAIRO_ARGB_A]; \
-      b = pimage[CAIRO_ARGB_B]; \
-      g = pimage[CAIRO_ARGB_G]; \
-      r = pimage[CAIRO_ARGB_R]; \
-      CAIRO_UNPREMULTIPLY (a, r, g, b); \
-      b = (b*a + dest[B] * (255-a)) / 255; \
-      g = (g*a + dest[G] * (255-a)) / 255; \
-      r = (r*a + dest[R] * (255-a)) / 255; \
-      \
-      dest[B] = b; \
-      dest[G] = g; \
-      dest[R] = r; \
-      pimage += 4; \
-      dest += 4; \
-    } \
-  } \
-}
-xRGB_BLIT_FUNCTION (xRGB, 1, 2, 3);
-xRGB_BLIT_FUNCTION (BGRx, 2, 1, 0);
-xRGB_BLIT_FUNCTION (xBGR, 3, 2, 1);
-xRGB_BLIT_FUNCTION (RGBx, 0, 1, 2);
-
-#define ARGB_BLIT_FUNCTION(name, A, R, G, B)   \
-static inline void \
-gst_text_overlay_blit_##name (GstTextOverlay * overlay, \
-    guint8 * rgb_pixels, gint xpos, gint ypos) \
-{ \
-  int a, r, g, b, a1;                          \
-  int i, j; \
-  int h, w; \
-  guchar *pimage, *dest; \
-  \
-  w = overlay->image_width; \
-  h = overlay->image_height; \
-  \
-  if (xpos < 0) { \
-    xpos = 0; \
-  } \
-  \
-  if (xpos + w > overlay->width) { \
-    w = overlay->width - xpos; \
-  } \
-  \
-  if (ypos + h > overlay->height) { \
-    h = overlay->height - ypos; \
-  } \
-  \
-  for (i = 0; i < h; i++) { \
-    pimage = overlay->text_image + i * overlay->image_width * 4; \
-    dest = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4; \
-    for (j = 0; j < w; j++) { \
-      a = pimage[CAIRO_ARGB_A]; \
-      b = pimage[CAIRO_ARGB_B]; \
-      g = pimage[CAIRO_ARGB_G]; \
-      r = pimage[CAIRO_ARGB_R]; \
-      CAIRO_UNPREMULTIPLY (a, r, g, b); \
-      a1 = a + (dest[A] * (255 - a)) / 255 + 1; \
-      OVER (dest[R], a, r, dest[0], dest[R], a1); \
-      OVER (dest[G], a, g, dest[0], dest[G], a1); \
-      OVER (dest[B], a, b, dest[0], dest[B], a1); \
-      dest[A] = a1 - 1; \
-      pimage += 4; \
-      dest += 4; \
-    } \
-  } \
 }
-ARGB_BLIT_FUNCTION (RGBA, 3, 0, 1, 2);
-ARGB_BLIT_FUNCTION (BGRA, 3, 2, 1, 0);
-ARGB_BLIT_FUNCTION (ARGB, 0, 1, 2, 3);
-ARGB_BLIT_FUNCTION (ABGR, 0, 3, 2, 1);
 
 static void
-gst_text_overlay_render_text (GstTextOverlay * overlay,
-    const gchar * text, gint textlen)
+gst_text_overlay_init (GstTextOverlay * overlay)
 {
-  gchar *string;
-
-  if (!overlay->need_render) {
-    GST_DEBUG ("Using previously rendered text.");
-    return;
-  }
-
-  /* -1 is the whole string */
-  if (text != NULL && textlen < 0) {
-    textlen = strlen (text);
-  }
-
-  if (text != NULL) {
-    string = g_strndup (text, textlen);
-  } else {                      /* empty string */
-    string = g_strdup (" ");
-  }
-  g_strdelimit (string, "\r\t", ' ');
-  textlen = strlen (string);
-
-  /* FIXME: should we check for UTF-8 here? */
-
-  GST_DEBUG ("Rendering '%s'", string);
-  gst_text_overlay_render_pangocairo (overlay, string, textlen);
-
-  g_free (string);
-
-  overlay->need_render = FALSE;
 }
-
-static GstFlowReturn
-gst_text_overlay_push_frame (GstTextOverlay * overlay, GstBuffer * video_frame)
-{
-  gint xpos, ypos;
-  gint width, height;
-  GstTextOverlayVAlign valign;
-  GstTextOverlayHAlign halign;
-
-  width = overlay->image_width;
-  height = overlay->image_height;
-
-  video_frame = gst_buffer_make_writable (video_frame);
-
-  if (overlay->use_vertical_render)
-    halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
-  else
-    halign = overlay->halign;
-
-  switch (halign) {
-    case GST_TEXT_OVERLAY_HALIGN_LEFT:
-      xpos = overlay->xpad;
-      break;
-    case GST_TEXT_OVERLAY_HALIGN_CENTER:
-      xpos = (overlay->width - width) / 2;
-      break;
-    case GST_TEXT_OVERLAY_HALIGN_RIGHT:
-      xpos = overlay->width - width - overlay->xpad;
-      break;
-    case GST_TEXT_OVERLAY_HALIGN_POS:
-      xpos = (gint) (overlay->width * overlay->xpos) - width / 2;
-      xpos = CLAMP (xpos, 0, overlay->width - width);
-      if (xpos < 0)
-        xpos = 0;
-      break;
-    default:
-      xpos = 0;
-  }
-  xpos += overlay->deltax;
-
-  if (overlay->use_vertical_render)
-    valign = GST_TEXT_OVERLAY_VALIGN_TOP;
-  else
-    valign = overlay->valign;
-
-  switch (valign) {
-    case GST_TEXT_OVERLAY_VALIGN_BOTTOM:
-      ypos = overlay->height - height - overlay->ypad;
-      break;
-    case GST_TEXT_OVERLAY_VALIGN_BASELINE:
-      ypos = overlay->height - (height + overlay->ypad);
-      break;
-    case GST_TEXT_OVERLAY_VALIGN_TOP:
-      ypos = overlay->ypad;
-      break;
-    case GST_TEXT_OVERLAY_VALIGN_POS:
-      ypos = (gint) (overlay->height * overlay->ypos) - height / 2;
-      ypos = CLAMP (ypos, 0, overlay->height - height);
-      break;
-    case GST_TEXT_OVERLAY_VALIGN_CENTER:
-      ypos = (overlay->height - height) / 2;
-      break;
-    default:
-      ypos = overlay->ypad;
-      break;
-  }
-  ypos += overlay->deltay;
-
-  /* shaded background box */
-  if (overlay->want_shading) {
-    switch (overlay->format) {
-      case GST_VIDEO_FORMAT_I420:
-      case GST_VIDEO_FORMAT_NV12:
-      case GST_VIDEO_FORMAT_NV21:
-        gst_text_overlay_shade_planar_Y (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_AYUV:
-      case GST_VIDEO_FORMAT_UYVY:
-        gst_text_overlay_shade_packed_Y (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_xRGB:
-        gst_text_overlay_shade_xRGB (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_xBGR:
-        gst_text_overlay_shade_xBGR (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_BGRx:
-        gst_text_overlay_shade_BGRx (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_RGBx:
-        gst_text_overlay_shade_RGBx (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_ARGB:
-        gst_text_overlay_shade_ARGB (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_ABGR:
-        gst_text_overlay_shade_ABGR (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_RGBA:
-        gst_text_overlay_shade_RGBA (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      case GST_VIDEO_FORMAT_BGRA:
-        gst_text_overlay_shade_BGRA (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
-            ypos, ypos + overlay->image_height);
-        break;
-      default:
-        g_assert_not_reached ();
-    }
-  }
-
-  if (ypos < 0)
-    ypos = 0;
-
-  if (overlay->text_image) {
-    switch (overlay->format) {
-      case GST_VIDEO_FORMAT_I420:
-        gst_text_overlay_blit_I420 (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_NV12:
-      case GST_VIDEO_FORMAT_NV21:
-        gst_text_overlay_blit_NV12_NV21 (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_UYVY:
-        gst_text_overlay_blit_UYVY (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_AYUV:
-        gst_text_overlay_blit_AYUV (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_BGRx:
-        gst_text_overlay_blit_BGRx (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_xRGB:
-        gst_text_overlay_blit_xRGB (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_RGBx:
-        gst_text_overlay_blit_RGBx (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_xBGR:
-        gst_text_overlay_blit_xBGR (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_ARGB:
-        gst_text_overlay_blit_ARGB (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_ABGR:
-        gst_text_overlay_blit_ABGR (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_RGBA:
-        gst_text_overlay_blit_RGBA (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      case GST_VIDEO_FORMAT_BGRA:
-        gst_text_overlay_blit_BGRA (overlay,
-            GST_BUFFER_DATA (video_frame), xpos, ypos);
-        break;
-      default:
-        g_assert_not_reached ();
-    }
-  }
-  return gst_pad_push (overlay->srcpad, video_frame);
-}
-
-static GstPadLinkReturn
-gst_text_overlay_text_pad_link (GstPad * pad, GstPad * peer)
-{
-  GstTextOverlay *overlay;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  GST_DEBUG_OBJECT (overlay, "Text pad linked");
-
-  overlay->text_linked = TRUE;
-
-  gst_object_unref (overlay);
-
-  return GST_PAD_LINK_OK;
-}
-
-static void
-gst_text_overlay_text_pad_unlink (GstPad * pad)
-{
-  GstTextOverlay *overlay;
-
-  /* don't use gst_pad_get_parent() here, will deadlock */
-  overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
-
-  GST_DEBUG_OBJECT (overlay, "Text pad unlinked");
-
-  overlay->text_linked = FALSE;
-
-  gst_segment_init (&overlay->text_segment, GST_FORMAT_UNDEFINED);
-}
-
-static gboolean
-gst_text_overlay_text_event (GstPad * pad, GstEvent * event)
-{
-  gboolean ret = FALSE;
-  GstTextOverlay *overlay = NULL;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  GST_LOG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event));
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:{
-      GstFormat fmt;
-      gboolean update;
-      gdouble rate, applied_rate;
-      gint64 cur, stop, time;
-
-      overlay->text_eos = FALSE;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-          &fmt, &cur, &stop, &time);
-
-      if (fmt == GST_FORMAT_TIME) {
-        GST_OBJECT_LOCK (overlay);
-        gst_segment_set_newsegment_full (&overlay->text_segment, update, rate,
-            applied_rate, GST_FORMAT_TIME, cur, stop, time);
-        GST_DEBUG_OBJECT (overlay, "TEXT SEGMENT now: %" GST_SEGMENT_FORMAT,
-            &overlay->text_segment);
-        GST_OBJECT_UNLOCK (overlay);
-      } else {
-        GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
-            ("received non-TIME newsegment event on text input"));
-      }
-
-      gst_event_unref (event);
-      ret = TRUE;
-
-      /* wake up the video chain, it might be waiting for a text buffer or
-       * a text segment update */
-      GST_OBJECT_LOCK (overlay);
-      GST_TEXT_OVERLAY_BROADCAST (overlay);
-      GST_OBJECT_UNLOCK (overlay);
-      break;
-    }
-    case GST_EVENT_FLUSH_STOP:
-      GST_OBJECT_LOCK (overlay);
-      GST_INFO_OBJECT (overlay, "text flush stop");
-      overlay->text_flushing = FALSE;
-      overlay->text_eos = FALSE;
-      gst_text_overlay_pop_text (overlay);
-      gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
-      GST_OBJECT_UNLOCK (overlay);
-      gst_event_unref (event);
-      ret = TRUE;
-      break;
-    case GST_EVENT_FLUSH_START:
-      GST_OBJECT_LOCK (overlay);
-      GST_INFO_OBJECT (overlay, "text flush start");
-      overlay->text_flushing = TRUE;
-      GST_TEXT_OVERLAY_BROADCAST (overlay);
-      GST_OBJECT_UNLOCK (overlay);
-      gst_event_unref (event);
-      ret = TRUE;
-      break;
-    case GST_EVENT_EOS:
-      GST_OBJECT_LOCK (overlay);
-      overlay->text_eos = TRUE;
-      GST_INFO_OBJECT (overlay, "text EOS");
-      /* wake up the video chain, it might be waiting for a text buffer or
-       * a text segment update */
-      GST_TEXT_OVERLAY_BROADCAST (overlay);
-      GST_OBJECT_UNLOCK (overlay);
-      gst_event_unref (event);
-      ret = TRUE;
-      break;
-    default:
-      ret = gst_pad_event_default (pad, event);
-      break;
-  }
-
-  gst_object_unref (overlay);
-
-  return ret;
-}
-
-static gboolean
-gst_text_overlay_video_event (GstPad * pad, GstEvent * event)
-{
-  gboolean ret = FALSE;
-  GstTextOverlay *overlay = NULL;
-
-  overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
-  GST_DEBUG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event));
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
-    {
-      GstFormat format;
-      gdouble rate;
-      gint64 start, stop, time;
-      gboolean update;
-
-      GST_DEBUG_OBJECT (overlay, "received new segment");
-
-      gst_event_parse_new_segment (event, &update, &rate, &format, &start,
-          &stop, &time);
-
-      if (format == GST_FORMAT_TIME) {
-        GST_DEBUG_OBJECT (overlay, "VIDEO SEGMENT now: %" GST_SEGMENT_FORMAT,
-            &overlay->segment);
-
-        gst_segment_set_newsegment (&overlay->segment, update, rate, format,
-            start, stop, time);
-      } else {
-        GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
-            ("received non-TIME newsegment event on video input"));
-      }
-
-      ret = gst_pad_event_default (pad, event);
-      break;
-    }
-    case GST_EVENT_EOS:
-      GST_OBJECT_LOCK (overlay);
-      GST_INFO_OBJECT (overlay, "video EOS");
-      overlay->video_eos = TRUE;
-      GST_OBJECT_UNLOCK (overlay);
-      ret = gst_pad_event_default (pad, event);
-      break;
-    case GST_EVENT_FLUSH_START:
-      GST_OBJECT_LOCK (overlay);
-      GST_INFO_OBJECT (overlay, "video flush start");
-      overlay->video_flushing = TRUE;
-      GST_TEXT_OVERLAY_BROADCAST (overlay);
-      GST_OBJECT_UNLOCK (overlay);
-      ret = gst_pad_event_default (pad, event);
-      break;
-    case GST_EVENT_FLUSH_STOP:
-      GST_OBJECT_LOCK (overlay);
-      GST_INFO_OBJECT (overlay, "video flush stop");
-      overlay->video_flushing = FALSE;
-      overlay->video_eos = FALSE;
-      gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
-      GST_OBJECT_UNLOCK (overlay);
-      ret = gst_pad_event_default (pad, event);
-      break;
-    default:
-      ret = gst_pad_event_default (pad, event);
-      break;
-  }
-
-  gst_object_unref (overlay);
-
-  return ret;
-}
-
-static GstFlowReturn
-gst_text_overlay_video_bufferalloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buffer)
-{
-  GstTextOverlay *overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-  GstFlowReturn ret = GST_FLOW_WRONG_STATE;
-  GstPad *allocpad;
-
-  GST_OBJECT_LOCK (overlay);
-  allocpad = overlay->srcpad ? gst_object_ref (overlay->srcpad) : NULL;
-  GST_OBJECT_UNLOCK (overlay);
-
-  if (allocpad) {
-    ret = gst_pad_alloc_buffer (allocpad, offset, size, caps, buffer);
-    gst_object_unref (allocpad);
-  }
-
-  gst_object_unref (overlay);
-  return ret;
-}
-
-/* Called with lock held */
-static void
-gst_text_overlay_pop_text (GstTextOverlay * overlay)
-{
-  g_return_if_fail (GST_IS_TEXT_OVERLAY (overlay));
-
-  if (overlay->text_buffer) {
-    GST_DEBUG_OBJECT (overlay, "releasing text buffer %p",
-        overlay->text_buffer);
-    gst_buffer_unref (overlay->text_buffer);
-    overlay->text_buffer = NULL;
-  }
-
-  /* Let the text task know we used that buffer */
-  GST_TEXT_OVERLAY_BROADCAST (overlay);
-}
-
-/* We receive text buffers here. If they are out of segment we just ignore them.
-   If the buffer is in our segment we keep it internally except if another one
-   is already waiting here, in that case we wait that it gets kicked out */
-static GstFlowReturn
-gst_text_overlay_text_chain (GstPad * pad, GstBuffer * buffer)
-{
-  GstFlowReturn ret = GST_FLOW_OK;
-  GstTextOverlay *overlay = NULL;
-  gboolean in_seg = FALSE;
-  gint64 clip_start = 0, clip_stop = 0;
-
-  overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
-
-  GST_OBJECT_LOCK (overlay);
-
-  if (overlay->text_flushing) {
-    GST_OBJECT_UNLOCK (overlay);
-    ret = GST_FLOW_WRONG_STATE;
-    GST_LOG_OBJECT (overlay, "text flushing");
-    goto beach;
-  }
-
-  if (overlay->text_eos) {
-    GST_OBJECT_UNLOCK (overlay);
-    ret = GST_FLOW_UNEXPECTED;
-    GST_LOG_OBJECT (overlay, "text EOS");
-    goto beach;
-  }
-
-  GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT "  BUFFER: ts=%"
-      GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment,
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer) +
-          GST_BUFFER_DURATION (buffer)));
-
-  if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))) {
-    GstClockTime stop;
-
-    if (G_LIKELY (GST_BUFFER_DURATION_IS_VALID (buffer)))
-      stop = GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer);
-    else
-      stop = GST_CLOCK_TIME_NONE;
-
-    in_seg = gst_segment_clip (&overlay->text_segment, GST_FORMAT_TIME,
-        GST_BUFFER_TIMESTAMP (buffer), stop, &clip_start, &clip_stop);
-  } else {
-    in_seg = TRUE;
-  }
-
-  if (in_seg) {
-    if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
-      GST_BUFFER_TIMESTAMP (buffer) = clip_start;
-    else if (GST_BUFFER_DURATION_IS_VALID (buffer))
-      GST_BUFFER_DURATION (buffer) = clip_stop - clip_start;
-
-    if (overlay->text_buffer
-        && (!GST_BUFFER_TIMESTAMP_IS_VALID (overlay->text_buffer)
-            || !GST_BUFFER_DURATION_IS_VALID (overlay->text_buffer))) {
-      gst_text_overlay_pop_text (overlay);
-    } else {
-      /* Wait for the previous buffer to go away */
-      while (overlay->text_buffer != NULL) {
-        GST_DEBUG ("Pad %s:%s has a buffer queued, waiting",
-            GST_DEBUG_PAD_NAME (pad));
-        GST_TEXT_OVERLAY_WAIT (overlay);
-        GST_DEBUG ("Pad %s:%s resuming", GST_DEBUG_PAD_NAME (pad));
-        if (overlay->text_flushing) {
-          GST_OBJECT_UNLOCK (overlay);
-          ret = GST_FLOW_WRONG_STATE;
-          goto beach;
-        }
-      }
-    }
-
-    if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
-      gst_segment_set_last_stop (&overlay->text_segment, GST_FORMAT_TIME,
-          clip_start);
-
-    overlay->text_buffer = gst_buffer_ref (buffer);
-    /* That's a new text buffer we need to render */
-    overlay->need_render = TRUE;
-
-    /* in case the video chain is waiting for a text buffer, wake it up */
-    GST_TEXT_OVERLAY_BROADCAST (overlay);
-  }
-
-  GST_OBJECT_UNLOCK (overlay);
-
-beach:
-
-  gst_buffer_unref (buffer);
-  return ret;
-}
-
-static GstFlowReturn
-gst_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
-{
-  GstTextOverlayClass *klass;
-  GstTextOverlay *overlay;
-  GstFlowReturn ret = GST_FLOW_OK;
-  gboolean in_seg = FALSE;
-  gint64 start, stop, clip_start = 0, clip_stop = 0;
-  gchar *text = NULL;
-
-  overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
-  klass = GST_TEXT_OVERLAY_GET_CLASS (overlay);
-
-  if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
-    goto missing_timestamp;
-
-  /* ignore buffers that are outside of the current segment */
-  start = GST_BUFFER_TIMESTAMP (buffer);
-
-  if (!GST_BUFFER_DURATION_IS_VALID (buffer)) {
-    stop = GST_CLOCK_TIME_NONE;
-  } else {
-    stop = start + GST_BUFFER_DURATION (buffer);
-  }
-
-  GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT "  BUFFER: ts=%"
-      GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment,
-      GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
-
-  /* segment_clip() will adjust start unconditionally to segment_start if
-   * no stop time is provided, so handle this ourselves */
-  if (stop == GST_CLOCK_TIME_NONE && start < overlay->segment.start)
-    goto out_of_segment;
-
-  in_seg = gst_segment_clip (&overlay->segment, GST_FORMAT_TIME, start, stop,
-      &clip_start, &clip_stop);
-
-  if (!in_seg)
-    goto out_of_segment;
-
-  /* if the buffer is only partially in the segment, fix up stamps */
-  if (clip_start != start || (stop != -1 && clip_stop != stop)) {
-    GST_DEBUG_OBJECT (overlay, "clipping buffer timestamp/duration to segment");
-    buffer = gst_buffer_make_metadata_writable (buffer);
-    GST_BUFFER_TIMESTAMP (buffer) = clip_start;
-    if (stop != -1)
-      GST_BUFFER_DURATION (buffer) = clip_stop - clip_start;
-  }
-
-  /* now, after we've done the clipping, fix up end time if there's no
-   * duration (we only use those estimated values internally though, we
-   * don't want to set bogus values on the buffer itself) */
-  if (stop == -1) {
-    GstStructure *s;
-    gint fps_num, fps_denom;
-
-    s = gst_caps_get_structure (GST_PAD_CAPS (pad), 0);
-    if (gst_structure_get_fraction (s, "framerate", &fps_num, &fps_denom) &&
-        fps_num && fps_denom) {
-      GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate");
-      stop = start + gst_util_uint64_scale_int (GST_SECOND, fps_denom, fps_num);
-    } else {
-      GST_WARNING_OBJECT (overlay, "no duration, assuming minimal duration");
-      stop = start + 1;         /* we need to assume some interval */
-    }
-  }
-
-  gst_object_sync_values (G_OBJECT (overlay), GST_BUFFER_TIMESTAMP (buffer));
-
-wait_for_text_buf:
-
-  GST_OBJECT_LOCK (overlay);
-
-  if (overlay->video_flushing)
-    goto flushing;
-
-  if (overlay->video_eos)
-    goto have_eos;
-
-  if (overlay->silent) {
-    GST_OBJECT_UNLOCK (overlay);
-    ret = gst_pad_push (overlay->srcpad, buffer);
-
-    /* Update last_stop */
-    gst_segment_set_last_stop (&overlay->segment, GST_FORMAT_TIME, clip_start);
-
-    return ret;
-  }
-
-  /* Text pad not linked, rendering internal text */
-  if (!overlay->text_linked) {
-    if (klass->get_text) {
-      text = klass->get_text (overlay, buffer);
-    } else {
-      text = g_strdup (overlay->default_text);
-    }
-
-    GST_LOG_OBJECT (overlay, "Text pad not linked, rendering default "
-        "text: '%s'", GST_STR_NULL (text));
-
-    GST_OBJECT_UNLOCK (overlay);
-
-    if (text != NULL && *text != '\0') {
-      /* Render and push */
-      gst_text_overlay_render_text (overlay, text, -1);
-      ret = gst_text_overlay_push_frame (overlay, buffer);
-    } else {
-      /* Invalid or empty string */
-      ret = gst_pad_push (overlay->srcpad, buffer);
-    }
-  } else {
-    /* Text pad linked, check if we have a text buffer queued */
-    if (overlay->text_buffer) {
-      gboolean pop_text = FALSE, valid_text_time = TRUE;
-      GstClockTime text_start = GST_CLOCK_TIME_NONE;
-      GstClockTime text_end = GST_CLOCK_TIME_NONE;
-      GstClockTime text_running_time = GST_CLOCK_TIME_NONE;
-      GstClockTime text_running_time_end = GST_CLOCK_TIME_NONE;
-      GstClockTime vid_running_time, vid_running_time_end;
-
-      /* if the text buffer isn't stamped right, pop it off the
-       * queue and display it for the current video frame only */
-      if (!GST_BUFFER_TIMESTAMP_IS_VALID (overlay->text_buffer) ||
-          !GST_BUFFER_DURATION_IS_VALID (overlay->text_buffer)) {
-        GST_WARNING_OBJECT (overlay,
-            "Got text buffer with invalid timestamp or duration");
-        valid_text_time = FALSE;
-      } else {
-        text_start = GST_BUFFER_TIMESTAMP (overlay->text_buffer);
-        text_end = text_start + GST_BUFFER_DURATION (overlay->text_buffer);
-      }
-
-      vid_running_time =
-          gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
-          start);
-      vid_running_time_end =
-          gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
-          stop);
-
-      /* If timestamp and duration are valid */
-      if (valid_text_time) {
-        text_running_time =
-            gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
-            text_start);
-        text_running_time_end =
-            gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
-            text_end);
-      }
-
-      GST_LOG_OBJECT (overlay, "T: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (text_running_time),
-          GST_TIME_ARGS (text_running_time_end));
-      GST_LOG_OBJECT (overlay, "V: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (vid_running_time),
-          GST_TIME_ARGS (vid_running_time_end));
-
-      /* Text too old or in the future */
-      if (valid_text_time && text_running_time_end <= vid_running_time) {
-        /* text buffer too old, get rid of it and do nothing  */
-        GST_LOG_OBJECT (overlay, "text buffer too old, popping");
-        pop_text = FALSE;
-        gst_text_overlay_pop_text (overlay);
-        GST_OBJECT_UNLOCK (overlay);
-        goto wait_for_text_buf;
-      } else if (valid_text_time && vid_running_time_end <= text_running_time) {
-        GST_LOG_OBJECT (overlay, "text in future, pushing video buf");
-        GST_OBJECT_UNLOCK (overlay);
-        /* Push the video frame */
-        ret = gst_pad_push (overlay->srcpad, buffer);
-      } else {
-        gchar *in_text;
-        gsize in_size;
-
-        in_text = (gchar *) GST_BUFFER_DATA (overlay->text_buffer);
-        in_size = GST_BUFFER_SIZE (overlay->text_buffer);
-
-        /* g_markup_escape_text() absolutely requires valid UTF8 input, it
-         * might crash otherwise. We don't fall back on GST_SUBTITLE_ENCODING
-         * here on purpose, this is something that needs fixing upstream */
-        if (!g_utf8_validate (in_text, in_size, NULL)) {
-          const gchar *end = NULL;
-
-          GST_WARNING_OBJECT (overlay, "received invalid UTF-8");
-          in_text = g_strndup (in_text, in_size);
-          while (!g_utf8_validate (in_text, in_size, &end) && end)
-            *((gchar *) end) = '*';
-        }
-
-        /* Get the string */
-        if (overlay->have_pango_markup) {
-          text = g_strndup (in_text, in_size);
-        } else {
-          text = g_markup_escape_text (in_text, in_size);
-        }
-
-        if (text != NULL && *text != '\0') {
-          gint text_len = strlen (text);
-
-          while (text_len > 0 && (text[text_len - 1] == '\n' ||
-                  text[text_len - 1] == '\r')) {
-            --text_len;
-          }
-          GST_DEBUG_OBJECT (overlay, "Rendering text '%*s'", text_len, text);
-          gst_text_overlay_render_text (overlay, text, text_len);
-        } else {
-          GST_DEBUG_OBJECT (overlay, "No text to render (empty buffer)");
-          gst_text_overlay_render_text (overlay, " ", 1);
-        }
-
-        if (in_text != (gchar *) GST_BUFFER_DATA (overlay->text_buffer))
-          g_free (in_text);
-
-        GST_OBJECT_UNLOCK (overlay);
-        ret = gst_text_overlay_push_frame (overlay, buffer);
-
-        if (valid_text_time && text_running_time_end <= vid_running_time_end) {
-          GST_LOG_OBJECT (overlay, "text buffer not needed any longer");
-          pop_text = TRUE;
-        }
-      }
-      if (pop_text) {
-        GST_OBJECT_LOCK (overlay);
-        gst_text_overlay_pop_text (overlay);
-        GST_OBJECT_UNLOCK (overlay);
-      }
-    } else {
-      gboolean wait_for_text_buf = TRUE;
-
-      if (overlay->text_eos)
-        wait_for_text_buf = FALSE;
-
-      if (!overlay->wait_text)
-        wait_for_text_buf = FALSE;
-
-      /* Text pad linked, but no text buffer available - what now? */
-      if (overlay->text_segment.format == GST_FORMAT_TIME) {
-        GstClockTime text_start_running_time, text_last_stop_running_time;
-        GstClockTime vid_running_time;
-
-        vid_running_time =
-            gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
-            GST_BUFFER_TIMESTAMP (buffer));
-        text_start_running_time =
-            gst_segment_to_running_time (&overlay->text_segment,
-            GST_FORMAT_TIME, overlay->text_segment.start);
-        text_last_stop_running_time =
-            gst_segment_to_running_time (&overlay->text_segment,
-            GST_FORMAT_TIME, overlay->text_segment.last_stop);
-
-        if ((GST_CLOCK_TIME_IS_VALID (text_start_running_time) &&
-                vid_running_time < text_start_running_time) ||
-            (GST_CLOCK_TIME_IS_VALID (text_last_stop_running_time) &&
-                vid_running_time < text_last_stop_running_time)) {
-          wait_for_text_buf = FALSE;
-        }
-      }
-
-      if (wait_for_text_buf) {
-        GST_DEBUG_OBJECT (overlay, "no text buffer, need to wait for one");
-        GST_TEXT_OVERLAY_WAIT (overlay);
-        GST_DEBUG_OBJECT (overlay, "resuming");
-        GST_OBJECT_UNLOCK (overlay);
-        goto wait_for_text_buf;
-      } else {
-        GST_OBJECT_UNLOCK (overlay);
-        GST_LOG_OBJECT (overlay, "no need to wait for a text buffer");
-        ret = gst_pad_push (overlay->srcpad, buffer);
-      }
-    }
-  }
-
-  g_free (text);
-
-  /* Update last_stop */
-  gst_segment_set_last_stop (&overlay->segment, GST_FORMAT_TIME, clip_start);
-
-  return ret;
-
-missing_timestamp:
-  {
-    GST_WARNING_OBJECT (overlay, "buffer without timestamp, discarding");
-    gst_buffer_unref (buffer);
-    return GST_FLOW_OK;
-  }
-
-flushing:
-  {
-    GST_OBJECT_UNLOCK (overlay);
-    GST_DEBUG_OBJECT (overlay, "flushing, discarding buffer");
-    gst_buffer_unref (buffer);
-    return GST_FLOW_WRONG_STATE;
-  }
-have_eos:
-  {
-    GST_OBJECT_UNLOCK (overlay);
-    GST_DEBUG_OBJECT (overlay, "eos, discarding buffer");
-    gst_buffer_unref (buffer);
-    return GST_FLOW_UNEXPECTED;
-  }
-out_of_segment:
-  {
-    GST_DEBUG_OBJECT (overlay, "buffer out of segment, discarding");
-    gst_buffer_unref (buffer);
-    return GST_FLOW_OK;
-  }
-}
-
-static GstStateChangeReturn
-gst_text_overlay_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-  GstTextOverlay *overlay = GST_TEXT_OVERLAY (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      GST_OBJECT_LOCK (overlay);
-      overlay->text_flushing = TRUE;
-      overlay->video_flushing = TRUE;
-      /* pop_text will broadcast on the GCond and thus also make the video
-       * chain exit if it's waiting for a text buffer */
-      gst_text_overlay_pop_text (overlay);
-      GST_OBJECT_UNLOCK (overlay);
-      break;
-    default:
-      break;
-  }
-
-  ret = parent_class->change_state (element, transition);
-  if (ret == GST_STATE_CHANGE_FAILURE)
-    return ret;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      GST_OBJECT_LOCK (overlay);
-      overlay->text_flushing = FALSE;
-      overlay->video_flushing = FALSE;
-      overlay->video_eos = FALSE;
-      overlay->text_eos = FALSE;
-      gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
-      gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
-      GST_OBJECT_UNLOCK (overlay);
-      break;
-    default:
-      break;
-  }
-
-  return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  gst_controller_init (NULL, NULL);
-
-  if (!gst_element_register (plugin, "textoverlay", GST_RANK_NONE,
-          GST_TYPE_TEXT_OVERLAY) ||
-      !gst_element_register (plugin, "timeoverlay", GST_RANK_NONE,
-          GST_TYPE_TIME_OVERLAY) ||
-      !gst_element_register (plugin, "clockoverlay", GST_RANK_NONE,
-          GST_TYPE_CLOCK_OVERLAY) ||
-      !gst_element_register (plugin, "textrender", GST_RANK_NONE,
-          GST_TYPE_TEXT_RENDER)) {
-    return FALSE;
-  }
-
-  /*texttestsrc_plugin_init(module, plugin); */
-
-  GST_DEBUG_CATEGORY_INIT (pango_debug, "pango", 0, "Pango elements");
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
-    "pango", "Pango-based text rendering and overlay", plugin_init,
-    VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
index 73a26f0..c1dab86 100644 (file)
+/* GStreamer
+ * Copyright (C) 2011 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
 #ifndef __GST_TEXT_OVERLAY_H__
 #define __GST_TEXT_OVERLAY_H__
 
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/controller/gstcontroller.h>
-#include <pango/pangocairo.h>
+#include "gstbasetextoverlay.h"
 
 G_BEGIN_DECLS
 
-#define GST_TYPE_TEXT_OVERLAY            (gst_text_overlay_get_type())
-#define GST_TEXT_OVERLAY(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),\
-                                         GST_TYPE_TEXT_OVERLAY, GstTextOverlay))
-#define GST_TEXT_OVERLAY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),\
-                                         GST_TYPE_TEXT_OVERLAY,GstTextOverlayClass))
-#define GST_TEXT_OVERLAY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),\
-                                         GST_TYPE_TEXT_OVERLAY, GstTextOverlayClass))
-#define GST_IS_TEXT_OVERLAY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
-                                         GST_TYPE_TEXT_OVERLAY))
-#define GST_IS_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
-                                         GST_TYPE_TEXT_OVERLAY))
-
-typedef struct _GstTextOverlay      GstTextOverlay;
+#define GST_TYPE_TEXT_OVERLAY \
+  (gst_text_overlay_get_type())
+#define GST_TEXT_OVERLAY(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TEXT_OVERLAY,GstTextOverlay))
+#define GST_TEXT_OVERLAY_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TEXT_OVERLAY,GstTextOverlayClass))
+#define GST_IS_TEXT_OVERLAY(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TEXT_OVERLAY))
+#define GST_IS_TEXT_OVERLAY_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TEXT_OVERLAY))
+
+typedef struct _GstTextOverlay GstTextOverlay;
 typedef struct _GstTextOverlayClass GstTextOverlayClass;
 
 /**
- * GstTextOverlayVAlign:
- * @GST_TEXT_OVERLAY_VALIGN_BASELINE: draw text on the baseline
- * @GST_TEXT_OVERLAY_VALIGN_BOTTOM: draw text on the bottom
- * @GST_TEXT_OVERLAY_VALIGN_TOP: draw text on top
- * @GST_TEXT_OVERLAY_VALIGN_POS: draw text according to the #GstTextOverlay:ypos property
- * @GST_TEXT_OVERLAY_VALIGN_CENTER: draw text vertically centered
- *
- * Vertical alignment of the text.
- */
-typedef enum {
-    GST_TEXT_OVERLAY_VALIGN_BASELINE,
-    GST_TEXT_OVERLAY_VALIGN_BOTTOM,
-    GST_TEXT_OVERLAY_VALIGN_TOP,
-    GST_TEXT_OVERLAY_VALIGN_POS,
-    GST_TEXT_OVERLAY_VALIGN_CENTER
-} GstTextOverlayVAlign;
-
-/**
- * GstTextOverlayHAlign:
- * @GST_TEXT_OVERLAY_HALIGN_LEFT: align text left
- * @GST_TEXT_OVERLAY_HALIGN_CENTER: align text center
- * @GST_TEXT_OVERLAY_HALIGN_RIGHT: align text right
- * @GST_TEXT_OVERLAY_HALIGN_POS: position text according to the #GstTextOverlay:xpos property
- *
- * Horizontal alignment of the text.
- */
-/* FIXME 0.11: remove GST_TEXT_OVERLAY_HALIGN_UNUSED */
-typedef enum {
-    GST_TEXT_OVERLAY_HALIGN_LEFT,
-    GST_TEXT_OVERLAY_HALIGN_CENTER,
-    GST_TEXT_OVERLAY_HALIGN_RIGHT,
-    GST_TEXT_OVERLAY_HALIGN_UNUSED,
-    GST_TEXT_OVERLAY_HALIGN_POS
-} GstTextOverlayHAlign;
-
-/**
- * GstTextOverlayWrapMode:
- * @GST_TEXT_OVERLAY_WRAP_MODE_NONE: no wrapping
- * @GST_TEXT_OVERLAY_WRAP_MODE_WORD: do word wrapping
- * @GST_TEXT_OVERLAY_WRAP_MODE_CHAR: do char wrapping
- * @GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR: do word and char wrapping
- *
- * Whether to wrap the text and if so how.
- */
-typedef enum {
-    GST_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
-    GST_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
-    GST_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
-    GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
-} GstTextOverlayWrapMode;
-
-/**
- * GstTextOverlayLineAlign:
- * @GST_TEXT_OVERLAY_LINE_ALIGN_LEFT: lines are left-aligned
- * @GST_TEXT_OVERLAY_LINE_ALIGN_CENTER: lines are center-aligned
- * @GST_TEXT_OVERLAY_LINE_ALIGN_RIGHT: lines are right-aligned
- *
- * Alignment of text lines relative to each other
- */
-typedef enum {
-    GST_TEXT_OVERLAY_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
-    GST_TEXT_OVERLAY_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
-    GST_TEXT_OVERLAY_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
-} GstTextOverlayLineAlign;
-
-/**
  * GstTextOverlay:
  *
- * Opaque textoverlay object structure
+ * Opaque textoverlay data structure.
  */
 struct _GstTextOverlay {
-    GstElement               element;
-
-    GstPad                  *video_sinkpad;
-    GstPad                  *text_sinkpad;
-    GstPad                  *srcpad;
-
-    GstSegment               segment;
-    GstSegment               text_segment;
-    GstBuffer               *text_buffer;
-    gboolean                text_linked;
-    gboolean                video_flushing;
-    gboolean                video_eos;
-    gboolean                text_flushing;
-    gboolean                text_eos;
-
-    GCond                   *cond;  /* to signal removal of a queued text
-                                     * buffer, arrival of a text buffer,
-                                     * a text segment update, or a change
-                                     * in status (e.g. shutdown, flushing) */
-
-    gint                     width;
-    gint                     height;
-    gint                     fps_n;
-    gint                     fps_d;
-    GstVideoFormat           format;
-
-    GstTextOverlayVAlign     valign;
-    GstTextOverlayHAlign     halign;
-    GstTextOverlayWrapMode   wrap_mode;
-    GstTextOverlayLineAlign  line_align;
-
-    gint                     xpad;
-    gint                     ypad;
-    gint                     deltax;
-    gint                     deltay;
-    gdouble                  xpos;
-    gdouble                  ypos;
-    gchar                   *default_text;
-    gboolean                 want_shading;
-    gboolean                 silent;
-    gboolean                 wait_text;
-    guint                    color, outline_color;
-
-    PangoLayout             *layout;
-    gdouble                  shadow_offset;
-    gboolean                 want_shadow;
-    gdouble                  outline_offset;
-    guchar                  *text_image;
-    gint                     image_width;
-    gint                     image_height;
-    gint                     baseline_y;
-
-    gboolean                 auto_adjust_size;
-    gboolean                 need_render;
-
-    gint                     shading_value;  /* for timeoverlay subclass */
-
-    gboolean                 have_pango_markup;
-    gboolean                 use_vertical_render;
+  GstBaseTextOverlay parent;
 };
 
 struct _GstTextOverlayClass {
-    GstElementClass parent_class;
-
-    PangoContext *pango_context;
-    GMutex       *pango_lock;
-
-    gchar *     (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame);
+  GstBaseTextOverlayClass parent_class;
 };
 
-GType gst_text_overlay_get_type(void) G_GNUC_CONST;
+GType gst_text_overlay_get_type (void);
 
 G_END_DECLS
 
-#endif /* __GST_TEXT_OVERLAY_H */
+#endif /* __GST_TEXT_OVERLAY_H__ */
+
index e200758..a029acb 100644 (file)
@@ -86,12 +86,13 @@ enum
   PROP_FONT_DESC
 };
 
+#define VIDEO_FORMATS "{ AYUV, ARGB } "
 
 static GstStaticPadTemplate src_template_factory =
-    GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") ";" GST_VIDEO_CAPS_ARGB)
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (VIDEO_FORMATS))
     );
 
 static GstStaticPadTemplate sink_template_factory =
@@ -162,7 +163,8 @@ gst_text_render_line_align_get_type (void)
 static void gst_text_render_adjust_values_with_fontdesc (GstTextRender *
     render, PangoFontDescription * desc);
 
-GST_BOILERPLATE (GstTextRender, gst_text_render, GstElement, GST_TYPE_ELEMENT);
+#define gst_text_render_parent_class parent_class
+G_DEFINE_TYPE (GstTextRender, gst_text_render, GST_TYPE_ELEMENT);
 
 static void gst_text_render_finalize (GObject * object);
 static void gst_text_render_set_property (GObject * object,
@@ -171,29 +173,14 @@ static void gst_text_render_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
 static void
-gst_text_render_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_template_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_template_factory));
-
-  gst_element_class_set_details_simple (element_class, "Text renderer",
-      "Filter/Editor/Video",
-      "Renders a text string to an image bitmap",
-      "David Schleef <ds@schleef.org>, "
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-}
-
-static void
 gst_text_render_class_init (GstTextRenderClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   PangoFontMap *fontmap;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
 
   parent_class = g_type_class_peek_parent (klass);
 
@@ -201,6 +188,17 @@ gst_text_render_class_init (GstTextRenderClass * klass)
   gobject_class->set_property = gst_text_render_set_property;
   gobject_class->get_property = gst_text_render_get_property;
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sink_template_factory));
+
+  gst_element_class_set_details_simple (gstelement_class, "Text renderer",
+      "Filter/Editor/Video",
+      "Renders a text string to an image bitmap",
+      "David Schleef <ds@schleef.org>, "
+      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
+
   fontmap = pango_cairo_font_map_get_default ();
   klass->pango_context =
       pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
@@ -329,47 +327,52 @@ gst_text_render_check_argb (GstTextRender * render)
 
     /* Check if AYUV or ARGB is first */
     for (i = 0; i < n; i++) {
-      GstStructure *s = gst_caps_get_structure (peer_caps, i);
-      if (gst_structure_has_name (s, "video/x-raw-rgb") &&
-          gst_structure_has_field (s, "alpha_mask")) {
-        render->use_ARGB = TRUE;
-        break;
-      } else if (gst_structure_has_name (s, "video/x-raw-yuv")) {
-        guint fourcc;
-        if (gst_structure_get_fourcc (s, "format", &fourcc) &&
-            fourcc == GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')) {
-          render->use_ARGB = FALSE;
-          break;
-        }
-      }
+      GstStructure *s;
+      GstVideoFormat vformat;
+      const GstVideoFormatInfo *info;
+      const gchar *fmt;
+
+      s = gst_caps_get_structure (peer_caps, i);
+      if (!gst_structure_has_name (s, "video/x-raw"))
+        continue;
+
+      fmt = gst_structure_get_string (s, "format");
+      if (fmt == NULL)
+        continue;
+
+      vformat = gst_video_format_from_string (fmt);
+      info = gst_video_format_get_info (vformat);
+      if (info == NULL)
+        continue;
+
+      render->use_ARGB = GST_VIDEO_FORMAT_INFO_HAS_ALPHA (info);
     }
     gst_caps_unref (peer_caps);
   }
 }
 
 static gboolean
-gst_text_render_setcaps (GstPad * pad, GstCaps * caps)
+gst_text_render_src_setcaps (GstTextRender * render, GstCaps * caps)
 {
-  GstTextRender *render = GST_TEXT_RENDER (gst_pad_get_parent (pad));
   GstStructure *structure;
-  gboolean ret = FALSE;
+  gboolean ret;
   gint width = 0, height = 0;
 
   structure = gst_caps_get_structure (caps, 0);
   gst_structure_get_int (structure, "width", &width);
   gst_structure_get_int (structure, "height", &height);
 
-  GST_DEBUG ("Got caps %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (render, "Got caps %" GST_PTR_FORMAT, caps);
 
   if (width >= render->image_width && height >= render->image_height) {
     render->width = width;
     render->height = height;
-    ret = TRUE;
   }
 
   gst_text_render_check_argb (render);
 
-  gst_object_unref (render);
+  ret = gst_pad_push_event (render->srcpad, gst_event_new_caps (caps));
+
   return ret;
 }
 
@@ -467,14 +470,16 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
   GstTextRender *render;
   GstFlowReturn ret;
   GstBuffer *outbuf;
-  GstCaps *caps = NULL, *padcaps, *peercaps;
-  guint8 *data = GST_BUFFER_DATA (inbuf);
-  guint size = GST_BUFFER_SIZE (inbuf);
+  GstCaps *caps = NULL, *padcaps;
+  guint8 *data;
+  gsize size;
   gint n;
   gint xpos, ypos;
 
   render = GST_TEXT_RENDER (gst_pad_get_parent (pad));
 
+  data = gst_buffer_map (inbuf, &size, NULL, GST_MAP_READ);
+
   /* somehow pango barfs over "\0" buffers... */
   while (size > 0 &&
       (data[size - 1] == '\r' ||
@@ -483,17 +488,16 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
   }
 
   /* render text */
-  GST_DEBUG ("rendering '%*s'", size, data);
+  GST_DEBUG ("rendering '%*s'", (gint) size, data);
   pango_layout_set_markup (render->layout, (gchar *) data, size);
   gst_text_render_render_pangocairo (render);
+  gst_buffer_unmap (inbuf, data, size);
 
   gst_text_render_check_argb (render);
 
-  peercaps = gst_pad_peer_get_caps (render->srcpad);
-  padcaps = gst_pad_get_caps (render->srcpad);
-  caps = gst_caps_intersect (padcaps, peercaps);
+  padcaps = gst_pad_get_caps (render->srcpad, NULL);
+  caps = gst_pad_peer_get_caps (render->srcpad, padcaps);
   gst_caps_unref (padcaps);
-  gst_caps_unref (peercaps);
 
   if (!caps || gst_caps_is_empty (caps)) {
     GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL));
@@ -504,22 +508,17 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
   gst_caps_truncate (caps);
   gst_pad_fixate_caps (render->srcpad, caps);
 
-  if (!gst_pad_set_caps (render->srcpad, caps)) {
+  if (!gst_text_render_src_setcaps (render, caps)) {
     GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL));
     ret = GST_FLOW_ERROR;
     goto done;
   }
 
   GST_DEBUG ("Allocating buffer WxH = %dx%d", render->width, render->height);
-  ret =
-      gst_pad_alloc_buffer_and_set_caps (render->srcpad, GST_BUFFER_OFFSET_NONE,
-      render->width * render->height * 4, caps, &outbuf);
-
-  if (ret != GST_FLOW_OK)
-    goto done;
+  outbuf = gst_buffer_new_and_alloc (render->width * render->height * 4);
 
-  gst_buffer_copy_metadata (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS);
-  data = GST_BUFFER_DATA (outbuf);
+  gst_buffer_copy_into (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
+  data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_WRITE);
 
   if (render->use_ARGB) {
     memset (data, 0, render->width * render->height * 4);
@@ -568,6 +567,7 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
           render->width * 4);
     }
   }
+  gst_buffer_unmap (outbuf, data, size);
 
   ret = gst_pad_push (render->srcpad, outbuf);
 
@@ -593,7 +593,7 @@ gst_text_render_finalize (GObject * object)
 }
 
 static void
-gst_text_render_init (GstTextRender * render, GstTextRenderClass * klass)
+gst_text_render_init (GstTextRender * render)
 {
   GstPadTemplate *template;
 
@@ -611,8 +611,6 @@ gst_text_render_init (GstTextRender * render, GstTextRenderClass * klass)
   gst_object_unref (template);
   gst_pad_set_fixatecaps_function (render->srcpad,
       GST_DEBUG_FUNCPTR (gst_text_render_fixate_caps));
-  gst_pad_set_setcaps_function (render->srcpad,
-      GST_DEBUG_FUNCPTR (gst_text_render_setcaps));
 
   gst_element_add_pad (GST_ELEMENT (render), render->srcpad);
 
index 27fab92..3617361 100644 (file)
 
 /**
  * SECTION:element-timeoverlay
- * @see_also: #GstTextOverlay, #GstClockOverlay
+ * @see_also: #GstBaseTextOverlay, #GstClockOverlay
  *
  * This element overlays the buffer time stamps of a video stream on
  * top of itself. You can position the text and configure the font details
- * using the properties of the #GstTextOverlay class. By default, the
+ * using the properties of the #GstBaseTextOverlay class. By default, the
  * time stamp is displayed in the top left corner of the picture, with some
  * padding to the left and to the top.
  *
 
 #include <gsttimeoverlay.h>
 
-GST_BOILERPLATE (GstTimeOverlay, gst_time_overlay, GstTextOverlay,
-    GST_TYPE_TEXT_OVERLAY);
-
-static void
-gst_time_overlay_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class, "Time overlay",
-      "Filter/Editor/Video",
-      "Overlays buffer time stamps on a video stream",
-      "Tim-Philipp Müller <tim@centricular.net>");
-}
+#define gst_time_overlay_parent_class parent_class
+G_DEFINE_TYPE (GstTimeOverlay, gst_time_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
 
 static gchar *
 gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
@@ -82,7 +71,8 @@ gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
 
 /* Called with lock held */
 static gchar *
-gst_time_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
+gst_time_overlay_get_text (GstBaseTextOverlay * overlay,
+    GstBuffer * video_frame)
 {
   GstClockTime time = GST_BUFFER_TIMESTAMP (video_frame);
   gchar *time_str, *txt, *ret;
@@ -115,16 +105,23 @@ gst_time_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
 static void
 gst_time_overlay_class_init (GstTimeOverlayClass * klass)
 {
-  GstTextOverlayClass *gsttextoverlay_class;
+  GstElementClass *gstelement_class;
+  GstBaseTextOverlayClass *gsttextoverlay_class;
   PangoContext *context;
   PangoFontDescription *font_description;
 
-  gsttextoverlay_class = (GstTextOverlayClass *) klass;
+  gsttextoverlay_class = (GstBaseTextOverlayClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+
+  gst_element_class_set_details_simple (gstelement_class, "Time overlay",
+      "Filter/Editor/Video",
+      "Overlays buffer time stamps on a video stream",
+      "Tim-Philipp Müller <tim@centricular.net>");
 
   gsttextoverlay_class->get_text = gst_time_overlay_get_text;
 
-  g_mutex_lock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
-  context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
+  g_mutex_lock (gsttextoverlay_class->pango_lock);
+  context = gsttextoverlay_class->pango_context;
 
   pango_context_set_language (context, pango_language_from_string ("en_US"));
   pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
@@ -138,16 +135,16 @@ gst_time_overlay_class_init (GstTimeOverlayClass * klass)
   pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
   pango_context_set_font_description (context, font_description);
   pango_font_description_free (font_description);
-  g_mutex_unlock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
+  g_mutex_unlock (gsttextoverlay_class->pango_lock);
 }
 
 static void
-gst_time_overlay_init (GstTimeOverlay * overlay, GstTimeOverlayClass * klass)
+gst_time_overlay_init (GstTimeOverlay * overlay)
 {
-  GstTextOverlay *textoverlay;
+  GstBaseTextOverlay *textoverlay;
 
-  textoverlay = GST_TEXT_OVERLAY (overlay);
+  textoverlay = GST_BASE_TEXT_OVERLAY (overlay);
 
-  textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
-  textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
+  textoverlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
+  textoverlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_LEFT;
 }
index 5fbfba9..dbce8ff 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __GST_TIME_OVERLAY_H__
 #define __GST_TIME_OVERLAY_H__
 
-#include "gsttextoverlay.h"
+#include "gstbasetextoverlay.h"
 
 G_BEGIN_DECLS
 
@@ -46,11 +46,11 @@ typedef struct _GstTimeOverlayClass GstTimeOverlayClass;
  * Opaque timeoverlay data structure.
  */
 struct _GstTimeOverlay {
-  GstTextOverlay textoverlay;
+  GstBaseTextOverlay textoverlay;
 };
 
 struct _GstTimeOverlayClass {
-  GstTextOverlayClass parent_class;
+  GstBaseTextOverlayClass parent_class;
 };
 
 GType gst_time_overlay_get_type (void);
index 25d68db..65119e5 100644 (file)
@@ -44,6 +44,8 @@
 #include "gsttheoradec.h"
 #include <gst/tag/tag.h>
 #include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideopool.h>
 
 #define GST_CAT_DEFAULT theoradec_debug
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@@ -68,8 +70,8 @@ static GstStaticPadTemplate theora_dec_src_factory =
 GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv, "
-        "format = (fourcc) { I420, Y42B, Y444 }, "
+    GST_STATIC_CAPS ("video/x-raw, "
+        "format = (string) { I420, Y42B, Y444 }, "
         "framerate = (fraction) [0/1, MAX], "
         "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
     );
@@ -81,15 +83,16 @@ GST_STATIC_PAD_TEMPLATE ("sink",
     GST_STATIC_CAPS ("video/x-theora")
     );
 
-GST_BOILERPLATE (GstTheoraDec, gst_theora_dec, GstElement, GST_TYPE_ELEMENT);
+#define gst_theora_dec_parent_class parent_class
+G_DEFINE_TYPE (GstTheoraDec, gst_theora_dec, GST_TYPE_ELEMENT);
 
 static void theora_dec_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 static void theora_dec_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 
+static gboolean theora_dec_setcaps (GstTheoraDec * dec, GstCaps * caps);
 static gboolean theora_dec_sink_event (GstPad * pad, GstEvent * event);
-static gboolean theora_dec_setcaps (GstPad * pad, GstCaps * caps);
 static GstFlowReturn theora_dec_chain (GstPad * pad, GstBuffer * buffer);
 static GstStateChangeReturn theora_dec_change_state (GstElement * element,
     GstStateChange transition);
@@ -107,22 +110,6 @@ static const GstEventMask *theora_get_event_masks (GstPad * pad);
 #endif
 static const GstQueryType *theora_get_query_types (GstPad * pad);
 
-
-static void
-gst_theora_dec_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&theora_dec_src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&theora_dec_sink_factory));
-  gst_element_class_set_details_simple (element_class,
-      "Theora video decoder", "Codec/Decoder/Video",
-      "decode raw theora streams to raw YUV video",
-      "Benjamin Otte <otte@gnome.org>, Wim Taymans <wim@fluendo.com>");
-}
-
 static gboolean
 gst_theora_dec_ctl_is_supported (int req)
 {
@@ -188,18 +175,26 @@ gst_theora_dec_class_init (GstTheoraDecClass * klass)
             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   }
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&theora_dec_src_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&theora_dec_sink_factory));
+  gst_element_class_set_details_simple (gstelement_class,
+      "Theora video decoder", "Codec/Decoder/Video",
+      "decode raw theora streams to raw YUV video",
+      "Benjamin Otte <otte@gnome.org>, Wim Taymans <wim@fluendo.com>");
+
   gstelement_class->change_state = theora_dec_change_state;
 
   GST_DEBUG_CATEGORY_INIT (theoradec_debug, "theoradec", 0, "Theora decoder");
 }
 
 static void
-gst_theora_dec_init (GstTheoraDec * dec, GstTheoraDecClass * g_class)
+gst_theora_dec_init (GstTheoraDec * dec)
 {
   dec->sinkpad =
       gst_pad_new_from_static_template (&theora_dec_sink_factory, "sink");
   gst_pad_set_event_function (dec->sinkpad, theora_dec_sink_event);
-  gst_pad_set_setcaps_function (dec->sinkpad, theora_dec_setcaps);
   gst_pad_set_chain_function (dec->sinkpad, theora_dec_chain);
   gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
 
@@ -580,7 +575,7 @@ theora_dec_src_event (GstPad * pad, GstEvent * event)
       GstClockTimeDiff diff;
       GstClockTime timestamp;
 
-      gst_event_parse_qos (event, &proportion, &diff, &timestamp);
+      gst_event_parse_qos (event, NULL, &proportion, &diff, &timestamp);
 
       /* we cannot randomly skip frame decoding since we don't have
        * B frames. we can however use the timestamp and diff to not
@@ -634,29 +629,20 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_EOS:
       ret = gst_pad_push_event (dec->srcpad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      gboolean update;
-      GstFormat format;
-      gdouble rate, arate;
-      gint64 start, stop, time;
+      const GstSegment *segment;
 
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
+      gst_event_parse_segment (event, &segment);
 
       /* we need TIME format */
-      if (format != GST_FORMAT_TIME)
+      if (segment->format != GST_FORMAT_TIME)
         goto newseg_wrong_format;
 
-      GST_DEBUG_OBJECT (dec,
-          "newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
-          ", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
-          update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
-          GST_TIME_ARGS (time));
+      GST_DEBUG_OBJECT (dec, "segment: %" GST_SEGMENT_FORMAT, segment);
 
       /* now configure the values */
-      gst_segment_set_newsegment_full (&dec->segment, update,
-          rate, arate, format, start, stop, time);
+      gst_segment_copy_into (segment, &dec->segment);
       dec->seqnum = gst_event_get_seqnum (event);
 
       /* We don't forward this unless/until the decoder is initialised */
@@ -668,6 +654,15 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
       }
       break;
     }
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = theora_dec_setcaps (dec, caps);
+      gst_event_unref (event);
+      break;
+    }
     case GST_EVENT_TAG:
     {
       if (dec->have_header)
@@ -681,7 +676,7 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
       break;
     }
     default:
-      ret = gst_pad_push_event (dec->srcpad, event);
+      ret = gst_pad_event_default (pad, event);
       break;
   }
 done:
@@ -699,14 +694,11 @@ newseg_wrong_format:
 }
 
 static gboolean
-theora_dec_setcaps (GstPad * pad, GstCaps * caps)
+theora_dec_setcaps (GstTheoraDec * dec, GstCaps * caps)
 {
-  GstTheoraDec *dec;
   GstStructure *s;
   const GValue *codec_data;
 
-  dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
   s = gst_caps_get_structure (caps, 0);
 
   /* parse the par, this overrides the encoded par */
@@ -716,48 +708,50 @@ theora_dec_setcaps (GstPad * pad, GstCaps * caps)
   if ((codec_data = gst_structure_get_value (s, "codec_data"))) {
     if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
       GstBuffer *buffer;
-      guint8 *data;
-      guint size;
+      guint8 *data, *ptr;
+      gsize size, left;
       guint offset;
 
       buffer = gst_value_get_buffer (codec_data);
 
       offset = 0;
-      size = GST_BUFFER_SIZE (buffer);
-      data = GST_BUFFER_DATA (buffer);
+      data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+
+      ptr = data;
+      left = size;
 
-      while (size > 2) {
+      while (left > 2) {
         guint psize;
         GstBuffer *buf;
 
-        psize = (data[0] << 8) | data[1];
+        psize = (ptr[0] << 8) | ptr[1];
         /* skip header */
-        data += 2;
-        size -= 2;
+        ptr += 2;
+        left -= 2;
         offset += 2;
 
         /* make sure we don't read too much */
-        psize = MIN (psize, size);
+        psize = MIN (psize, left);
 
-        buf = gst_buffer_create_sub (buffer, offset, psize);
+        buf =
+            gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset, psize);
 
         /* first buffer is a discont buffer */
         if (offset == 2)
           GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
 
         /* now feed it to the decoder we can ignore the error */
-        theora_dec_chain (pad, buf);
+        theora_dec_chain (dec->sinkpad, buf);
 
         /* skip the data */
-        size -= psize;
-        data += psize;
+        left -= psize;
+        ptr += psize;
         offset += psize;
       }
+      gst_buffer_unmap (buffer, data, size);
     }
   }
 
-  gst_object_unref (dec);
-
   return TRUE;
 }
 
@@ -765,20 +759,13 @@ static GstFlowReturn
 theora_handle_comment_packet (GstTheoraDec * dec, ogg_packet * packet)
 {
   gchar *encoder = NULL;
-  GstBuffer *buf;
   GstTagList *list;
 
   GST_DEBUG_OBJECT (dec, "parsing comment packet");
 
-  buf = gst_buffer_new ();
-  GST_BUFFER_SIZE (buf) = packet->bytes;
-  GST_BUFFER_DATA (buf) = packet->packet;
-
   list =
-      gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\201theora", 7,
-      &encoder);
-
-  gst_buffer_unref (buf);
+      gst_tag_list_from_vorbiscomment (packet->packet, packet->bytes,
+      (guint8 *) "\201theora", 7, &encoder);
 
   if (!list) {
     GST_ERROR_OBJECT (dec, "couldn't decode comments");
@@ -805,13 +792,68 @@ theora_handle_comment_packet (GstTheoraDec * dec, ogg_packet * packet)
 }
 
 static GstFlowReturn
+theora_negotiate_pool (GstTheoraDec * dec, GstCaps * caps, GstVideoInfo * info)
+{
+  GstQuery *query;
+  GstBufferPool *pool = NULL;
+  guint size, min, max, prefix, alignment;
+  GstStructure *config;
+
+  /* find a pool for the negotiated caps now */
+  query = gst_query_new_allocation (caps, TRUE);
+
+  if (gst_pad_peer_query (dec->srcpad, query)) {
+    GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
+    /* we got configuration from our peer, parse them */
+    gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
+        &alignment, &pool);
+    size = MAX (size, info->size);
+  } else {
+    GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
+    size = info->size;
+    min = max = 0;
+    prefix = 0;
+    alignment = 0;
+  }
+
+  if (pool == NULL) {
+    /* we did not get a pool, make one ourselves then */
+    pool = gst_buffer_pool_new ();
+  }
+
+  if (dec->pool)
+    gst_object_unref (dec->pool);
+  dec->pool = pool;
+
+  config = gst_buffer_pool_get_config (pool);
+  gst_buffer_pool_config_set (config, caps, size, min, max, prefix, alignment);
+  /* just set the option, if the pool can support it we will transparently use
+   * it through the video info API. We could also see if the pool support this
+   * option and only activate it then. */
+  gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_META_VIDEO);
+
+  /* check if downstream supports cropping */
+  dec->use_cropping =
+      gst_query_has_allocation_meta (query, GST_META_API_VIDEO_CROP);
+
+  gst_buffer_pool_set_config (pool, config);
+  /* and activate */
+  gst_buffer_pool_set_active (pool, TRUE);
+
+  gst_query_unref (query);
+
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
 theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
 {
   GstCaps *caps;
+  GstVideoFormat format;
+  gint width, height;
   gint par_num, par_den;
   GstFlowReturn ret = GST_FLOW_OK;
   GList *walk;
-  guint32 fourcc;
 
   GST_DEBUG_OBJECT (dec, "fps %d/%d, PAR %d/%d",
       dec->info.fps_numerator, dec->info.fps_denominator,
@@ -846,23 +888,26 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
       dec->info.pic_width, dec->info.pic_height,
       dec->info.pic_x, dec->info.pic_y);
 
-  if (dec->info.pixel_fmt == TH_PF_420) {
-    dec->output_bpp = 12;       /* Average bits per pixel. */
-    fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
-  } else if (dec->info.pixel_fmt == TH_PF_422) {
-    dec->output_bpp = 16;
-    fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
-  } else if (dec->info.pixel_fmt == TH_PF_444) {
-    dec->output_bpp = 24;
-    fourcc = GST_MAKE_FOURCC ('Y', '4', '4', '4');
-  } else {
-    GST_ERROR_OBJECT (dec, "Invalid pixel format %d", dec->info.pixel_fmt);
-    return GST_FLOW_ERROR;
+  switch (dec->info.pixel_fmt) {
+    case TH_PF_444:
+      dec->output_bpp = 24;
+      format = GST_VIDEO_FORMAT_Y444;
+      break;
+    case TH_PF_420:
+      dec->output_bpp = 12;     /* Average bits per pixel. */
+      format = GST_VIDEO_FORMAT_I420;
+      break;
+    case TH_PF_422:
+      dec->output_bpp = 16;
+      format = GST_VIDEO_FORMAT_Y42B;
+      break;
+    default:
+      goto invalid_format;
   }
 
   if (dec->crop) {
-    dec->width = dec->info.pic_width;
-    dec->height = dec->info.pic_height;
+    width = dec->info.pic_width;
+    height = dec->info.pic_height;
     dec->offset_x = dec->info.pic_x;
     dec->offset_y = dec->info.pic_y;
     /* Ensure correct offsets in chroma for formats that need it
@@ -870,22 +915,20 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
      * so no need to handle them ourselves. */
     if (dec->offset_x & 1 && dec->info.pixel_fmt != TH_PF_444) {
       dec->offset_x--;
-      dec->width++;
     }
     if (dec->offset_y & 1 && dec->info.pixel_fmt == TH_PF_420) {
       dec->offset_y--;
-      dec->height++;
     }
   } else {
     /* no cropping, use the encoded dimensions */
-    dec->width = dec->info.frame_width;
-    dec->height = dec->info.frame_height;
+    width = dec->info.frame_width;
+    height = dec->info.frame_height;
     dec->offset_x = 0;
     dec->offset_y = 0;
   }
 
   GST_DEBUG_OBJECT (dec, "after fixup frame dimension %dx%d, offset %d:%d",
-      dec->width, dec->height, dec->offset_x, dec->offset_y);
+      width, height, dec->offset_x, dec->offset_y);
 
   /* done */
   dec->decoder = th_decode_alloc (&dec->info, dec->setup);
@@ -907,17 +950,22 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
     GST_WARNING_OBJECT (dec, "Could not enable BITS mode visualisation");
   }
 
-  caps = gst_caps_new_simple ("video/x-raw-yuv",
-      "format", GST_TYPE_FOURCC, fourcc,
-      "framerate", GST_TYPE_FRACTION,
-      dec->info.fps_numerator, dec->info.fps_denominator,
-      "pixel-aspect-ratio", GST_TYPE_FRACTION, par_num, par_den,
-      "width", G_TYPE_INT, dec->width, "height", G_TYPE_INT, dec->height,
-      "color-matrix", G_TYPE_STRING, "sdtv",
-      "chroma-site", G_TYPE_STRING, "jpeg", NULL);
+  gst_video_info_set_format (&dec->vinfo, format, width, height);
+  dec->vinfo.fps_n = dec->info.fps_numerator;
+  dec->vinfo.fps_d = dec->info.fps_denominator;
+  dec->vinfo.par_n = par_num;
+  dec->vinfo.par_d = par_den;
+  dec->vinfo.chroma_site = "jpeg";
+  dec->vinfo.color_matrix = "sdtv";
+
+  caps = gst_video_info_to_caps (&dec->vinfo);
   gst_pad_set_caps (dec->srcpad, caps);
   gst_caps_unref (caps);
 
+  /* negotiate a bufferpool */
+  if ((ret = theora_negotiate_pool (dec, caps, &dec->vinfo)) != GST_FLOW_OK)
+    goto no_bufferpool;
+
   dec->have_header = TRUE;
 
   if (dec->pendingevents) {
@@ -934,6 +982,17 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
   }
 
   return ret;
+
+  /* ERRORS */
+invalid_format:
+  {
+    GST_ERROR_OBJECT (dec, "Invalid pixel format %d", dec->info.pixel_fmt);
+    return GST_FLOW_ERROR;
+  }
+no_bufferpool:
+  {
+    return ret;
+  }
 }
 
 static GstFlowReturn
@@ -981,7 +1040,7 @@ clip_buffer (GstTheoraDec * dec, GstBuffer * buf)
 {
   gboolean res = TRUE;
   GstClockTime in_ts, in_dur, stop;
-  gint64 cstart, cstop;
+  guint64 cstart, cstop;
 
   in_ts = GST_BUFFER_TIMESTAMP (buf);
   in_dur = GST_BUFFER_DURATION (buf);
@@ -1052,57 +1111,96 @@ static GstFlowReturn
 theora_handle_image (GstTheoraDec * dec, th_ycbcr_buffer buf, GstBuffer ** out)
 {
   gint width, height, stride;
+  gint pic_width, pic_height;
   GstFlowReturn result;
-  int i, plane;
-  GstVideoFormat format;
+  int i, comp;
   guint8 *dest, *src;
+  GstVideoFrame frame;
+  GstMetaVideoCrop *crop;
+  gint offset_x, offset_y;
 
-  switch (dec->info.pixel_fmt) {
-    case TH_PF_444:
-      format = GST_VIDEO_FORMAT_Y444;
-      break;
-    case TH_PF_420:
-      format = GST_VIDEO_FORMAT_I420;
-      break;
-    case TH_PF_422:
-      format = GST_VIDEO_FORMAT_Y42B;
-      break;
-    default:
-      g_assert_not_reached ();
+  if (gst_pad_check_reconfigure (dec->srcpad)) {
+    GstCaps *caps;
+
+    caps = gst_pad_get_current_caps (dec->srcpad);
+    theora_negotiate_pool (dec, caps, &dec->vinfo);
+    gst_caps_unref (caps);
   }
 
-  result =
-      gst_pad_alloc_buffer_and_set_caps (dec->srcpad, GST_BUFFER_OFFSET_NONE,
-      gst_video_format_get_size (format, dec->width, dec->height),
-      GST_PAD_CAPS (dec->srcpad), out);
-  if (G_UNLIKELY (result != GST_FLOW_OK)) {
-    GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s",
-        gst_flow_get_name (result));
-    return result;
+  result = gst_buffer_pool_acquire_buffer (dec->pool, out, NULL);
+  if (G_UNLIKELY (result != GST_FLOW_OK))
+    goto no_buffer;
+
+  if (!gst_video_frame_map (&frame, &dec->vinfo, *out, GST_MAP_WRITE))
+    goto invalid_frame;
+
+  if (dec->crop && !dec->use_cropping) {
+    /* we need to crop the hard way */
+    offset_x = dec->info.pic_x;
+    offset_y = dec->info.pic_y;
+    pic_width = dec->info.pic_width;
+    pic_height = dec->info.pic_height;
+    /* Ensure correct offsets in chroma for formats that need it
+     * by rounding the offset. libtheora will add proper pixels,
+     * so no need to handle them ourselves. */
+    if (offset_x & 1 && dec->info.pixel_fmt != TH_PF_444)
+      offset_x--;
+    if (offset_y & 1 && dec->info.pixel_fmt == TH_PF_420)
+      offset_y--;
+  } else {
+    /* copy the whole frame */
+    offset_x = 0;
+    offset_y = 0;
+    pic_width = dec->info.frame_width;
+    pic_height = dec->info.frame_height;
+
+    if (dec->use_cropping) {
+      crop = gst_buffer_add_meta_video_crop (*out);
+      /* we can do things slightly more efficient when we know that
+       * downstream understands clipping */
+      crop->x = dec->info.pic_x;
+      crop->y = dec->info.pic_y;
+      crop->width = dec->info.pic_width;
+      crop->height = dec->info.pic_height;
+    }
   }
 
-  for (plane = 0; plane < 3; plane++) {
-    width = gst_video_format_get_component_width (format, plane, dec->width);
-    height = gst_video_format_get_component_height (format, plane, dec->height);
-    stride = gst_video_format_get_row_stride (format, plane, dec->width);
+  for (comp = 0; comp < 3; comp++) {
+    width =
+        GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (frame.info.finfo, comp, pic_width);
+    height =
+        GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (frame.info.finfo, comp, pic_height);
+    stride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp);
+    dest = GST_VIDEO_FRAME_COMP_DATA (&frame, comp);
 
-    dest =
-        GST_BUFFER_DATA (*out) + gst_video_format_get_component_offset (format,
-        plane, dec->width, dec->height);
-    src = buf[plane].data;
-    src += ((height == dec->height) ? dec->offset_y : dec->offset_y / 2)
-        * buf[plane].stride;
-    src += (width == dec->width) ? dec->offset_x : dec->offset_x / 2;
+    src = buf[comp].data;
+    src += ((height == pic_height) ? offset_y : offset_y / 2)
+        * buf[comp].stride;
+    src += (width == pic_width) ? offset_x : offset_x / 2;
 
     for (i = 0; i < height; i++) {
       memcpy (dest, src, width);
 
       dest += stride;
-      src += buf[plane].stride;
+      src += buf[comp].stride;
     }
   }
+  gst_video_frame_unmap (&frame);
 
   return GST_FLOW_OK;
+
+  /* ERRORS */
+no_buffer:
+  {
+    GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s",
+        gst_flow_get_name (result));
+    return result;
+  }
+invalid_frame:
+  {
+    GST_DEBUG_OBJECT (dec, "could not map video frame");
+    return GST_FLOW_ERROR;
+  }
 }
 
 static GstFlowReturn
@@ -1268,10 +1366,11 @@ theora_dec_decode_buffer (GstTheoraDec * dec, GstBuffer * buf)
   ogg_packet packet;
   GstFlowReturn result = GST_FLOW_OK;
   GstClockTime timestamp, duration;
+  gsize size;
 
   /* make ogg_packet out of the buffer */
-  packet.packet = GST_BUFFER_DATA (buf);
-  packet.bytes = GST_BUFFER_SIZE (buf);
+  packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  packet.bytes = size;
   packet.granulepos = -1;
   packet.packetno = 0;          /* we don't really care */
   packet.b_o_s = dec->have_header ? 0 : 1;
@@ -1299,8 +1398,9 @@ theora_dec_decode_buffer (GstTheoraDec * dec, GstBuffer * buf)
   } else {
     result = theora_handle_data_packet (dec, &packet, timestamp, duration);
   }
-
 done:
+  gst_buffer_unmap (buf, packet.packet, size);
+
   return result;
 }
 
@@ -1430,7 +1530,7 @@ theora_dec_chain_reverse (GstTheoraDec * dec, gboolean discont, GstBuffer * buf)
     GST_DEBUG_OBJECT (dec, "received discont,gathering buffers");
     while (dec->gather) {
       GstBuffer *gbuf;
-      guint8 *data;
+      guint8 data[1];
 
       gbuf = GST_BUFFER_CAST (dec->gather->data);
       /* remove from the gather list */
@@ -1439,17 +1539,18 @@ theora_dec_chain_reverse (GstTheoraDec * dec, gboolean discont, GstBuffer * buf)
       dec->decode = g_list_prepend (dec->decode, gbuf);
 
       /* if we copied a keyframe, flush and decode the decode queue */
-      data = GST_BUFFER_DATA (gbuf);
-      if (data && (data[0] & 0x40) == 0) {
-        GST_DEBUG_OBJECT (dec, "copied keyframe");
-        res = theora_dec_flush_decode (dec);
+      if (gst_buffer_extract (gbuf, 0, data, 1) == 1) {
+        if ((data[0] & 0x40) == 0) {
+          GST_DEBUG_OBJECT (dec, "copied keyframe");
+          res = theora_dec_flush_decode (dec);
+        }
       }
     }
   }
 
   /* add buffer to gather queue */
-  GST_DEBUG_OBJECT (dec, "gathering buffer %p, size %u", buf,
-      GST_BUFFER_SIZE (buf));
+  GST_DEBUG_OBJECT (dec, "gathering buffer %p, size %" G_GSIZE_FORMAT, buf,
+      gst_buffer_get_size (buf));
   dec->gather = g_list_prepend (dec->gather, buf);
 
   return res;
@@ -1521,7 +1622,7 @@ theora_dec_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
@@ -1534,6 +1635,11 @@ theora_dec_change_state (GstElement * element, GstStateChange transition)
       th_decode_free (dec->decoder);
       dec->decoder = NULL;
       gst_theora_dec_reset (dec);
+      if (dec->pool) {
+        gst_buffer_pool_set_active (dec->pool, FALSE);
+        gst_object_unref (dec->pool);
+        dec->pool = NULL;
+      }
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       break;
index f672211..720eb49 100644 (file)
@@ -27,6 +27,7 @@
 #include <gst/gst.h>
 #include <theora/theoradec.h>
 #include <string.h>
+#include <gst/video/video.h>
 
 G_BEGIN_DECLS
 
@@ -59,7 +60,6 @@ struct _GstTheoraDec
 
   /* theora decoder state */
   th_dec_ctx *decoder;
-  //theora_state state;
   th_setup_info *setup;
   th_info info;
   th_comment comment;
@@ -69,9 +69,12 @@ struct _GstTheoraDec
   GstClockTime last_timestamp;
   guint64 frame_nr;
   gboolean need_keyframe;
-  gint width, height;
+  GstVideoInfo vinfo;
+
   gint offset_x, offset_y;
   gint output_bpp;
+  GstBufferPool *pool;
+  gboolean use_cropping;
 
   /* telemetry debuging options */
   gint telemetry_mv;
index acc5bd6..29aa3f3 100644 (file)
@@ -61,7 +61,6 @@
 #include <stdlib.h>             /* free */
 
 #include <gst/tag/tag.h>
-#include <gst/video/video.h>
 
 #define GST_CAT_DEFAULT theoraenc_debug
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@@ -230,8 +229,8 @@ static GstStaticPadTemplate theora_enc_sink_factory =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv, "
-        "format = (fourcc) { I420, Y42B, Y444 }, "
+    GST_STATIC_CAPS ("video/x-raw, "
+        "format = (string) { I420, Y42B, Y444 }, "
         "framerate = (fraction) [1/MAX, MAX], "
         "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
     );
@@ -243,31 +242,19 @@ GST_STATIC_PAD_TEMPLATE ("src",
     GST_STATIC_CAPS ("video/x-theora")
     );
 
-static GstCaps *theora_enc_src_caps;
-
-static void
-_do_init (GType object_type)
-{
-  const GInterfaceInfo preset_interface_info = {
-    NULL,                       /* interface_init */
-    NULL,                       /* interface_finalize */
-    NULL                        /* interface_data */
-  };
+#define gst_theora_enc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstTheoraEnc, gst_theora_enc,
+    GST_TYPE_ELEMENT, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
 
-  g_type_add_interface_static (object_type, GST_TYPE_PRESET,
-      &preset_interface_info);
-}
-
-GST_BOILERPLATE_FULL (GstTheoraEnc, gst_theora_enc, GstElement,
-    GST_TYPE_ELEMENT, _do_init);
+static GstCaps *theora_enc_src_caps;
 
 static gboolean theora_enc_sink_event (GstPad * pad, GstEvent * event);
 static gboolean theora_enc_src_event (GstPad * pad, GstEvent * event);
 static GstFlowReturn theora_enc_chain (GstPad * pad, GstBuffer * buffer);
 static GstStateChangeReturn theora_enc_change_state (GstElement * element,
     GstStateChange transition);
-static GstCaps *theora_enc_sink_getcaps (GstPad * pad);
-static gboolean theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps);
+static GstCaps *theora_enc_sink_getcaps (GstPad * pad, GstCaps * filter);
+static gboolean theora_enc_sink_setcaps (GstTheoraEnc * enc, GstCaps * caps);
 static void theora_enc_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 static void theora_enc_set_property (GObject * object, guint prop_id,
@@ -280,21 +267,6 @@ static gboolean theora_enc_write_multipass_cache (GstTheoraEnc * enc,
 static char *theora_enc_get_supported_formats (void);
 
 static void
-gst_theora_enc_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&theora_enc_src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&theora_enc_sink_factory));
-  gst_element_class_set_details_simple (element_class,
-      "Theora video encoder", "Codec/Encoder/Video",
-      "encode raw YUV video to a theora stream",
-      "Wim Taymans <wim@fluendo.com>");
-}
-
-static void
 gst_theora_enc_class_init (GstTheoraEncClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
@@ -419,8 +391,17 @@ gst_theora_enc_class_init (GstTheoraEncClass * klass)
           THEORA_DEF_MULTIPASS_MODE,
           (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  caps_string = g_strdup_printf ("video/x-raw-yuv, "
-      "format = (fourcc) { %s }, "
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&theora_enc_src_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&theora_enc_sink_factory));
+  gst_element_class_set_details_simple (gstelement_class,
+      "Theora video encoder", "Codec/Encoder/Video",
+      "encode raw YUV video to a theora stream",
+      "Wim Taymans <wim@fluendo.com>");
+
+  caps_string = g_strdup_printf ("video/x-raw, "
+      "format = (string) { %s }, "
       "framerate = (fraction) [1/MAX, MAX], "
       "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]",
       theora_enc_get_supported_formats ());
@@ -431,14 +412,13 @@ gst_theora_enc_class_init (GstTheoraEncClass * klass)
 }
 
 static void
-gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class)
+gst_theora_enc_init (GstTheoraEnc * enc)
 {
   enc->sinkpad =
       gst_pad_new_from_static_template (&theora_enc_sink_factory, "sink");
   gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain);
   gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event);
   gst_pad_set_getcaps_function (enc->sinkpad, theora_enc_sink_getcaps);
-  gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps);
   gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
 
   enc->srcpad =
@@ -610,15 +590,15 @@ theora_enc_get_supported_formats (void)
 }
 
 static GstCaps *
-theora_enc_sink_getcaps (GstPad * pad)
+theora_enc_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstTheoraEnc *encoder;
   GstPad *peer;
   GstCaps *caps;
 
   /* If we already have caps return them */
-  if (GST_PAD_CAPS (pad))
-    return gst_caps_ref (GST_PAD_CAPS (pad));
+  if ((caps = gst_pad_get_current_caps (pad)) != NULL)
+    return caps;
 
   encoder = GST_THEORA_ENC (gst_pad_get_parent (pad));
   if (!encoder)
@@ -631,7 +611,7 @@ theora_enc_sink_getcaps (GstPad * pad)
     GstStructure *s;
     guint i, n;
 
-    peer_caps = gst_pad_get_caps (peer);
+    peer_caps = gst_pad_get_caps (peer, NULL);
 
     /* Translate peercaps to YUV */
     peer_caps = gst_caps_make_writable (peer_caps);
@@ -639,7 +619,7 @@ theora_enc_sink_getcaps (GstPad * pad)
     for (i = 0; i < n; i++) {
       s = gst_caps_get_structure (peer_caps, i);
 
-      gst_structure_set_name (s, "video/x-raw-yuv");
+      gst_structure_set_name (s, "video/x-raw");
       gst_structure_remove_field (s, "streamheader");
     }
 
@@ -656,61 +636,65 @@ theora_enc_sink_getcaps (GstPad * pad)
 
   gst_object_unref (encoder);
 
+  if (filter) {
+    GstCaps *intersection;
+
+    intersection =
+        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = intersection;
+  }
+
   return caps;
 }
 
 static gboolean
-theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
+theora_enc_sink_setcaps (GstTheoraEnc * enc, GstCaps * caps)
 {
-  GstStructure *structure = gst_caps_get_structure (caps, 0);
-  GstTheoraEnc *enc = GST_THEORA_ENC (gst_pad_get_parent (pad));
-  guint32 fourcc;
-  const GValue *par;
-  gint fps_n, fps_d;
-
-  gst_structure_get_fourcc (structure, "format", &fourcc);
-  gst_structure_get_int (structure, "width", &enc->width);
-  gst_structure_get_int (structure, "height", &enc->height);
-  gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d);
-  par = gst_structure_get_value (structure, "pixel-aspect-ratio");
+  GstVideoInfo info;
 
   th_info_clear (&enc->info);
   th_info_init (&enc->info);
+
+  if (!gst_video_info_from_caps (&info, caps))
+    goto invalid_caps;
+
+  enc->vinfo = info;
+
   /* Theora has a divisible-by-sixteen restriction for the encoded video size but
    * we can define a picture area using pic_width/pic_height */
-  enc->info.frame_width = GST_ROUND_UP_16 (enc->width);
-  enc->info.frame_height = GST_ROUND_UP_16 (enc->height);
-  enc->info.pic_width = enc->width;
-  enc->info.pic_height = enc->height;
-  switch (fourcc) {
-    case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+  enc->info.frame_width = GST_ROUND_UP_16 (info.width);
+  enc->info.frame_height = GST_ROUND_UP_16 (info.height);
+  enc->info.pic_width = info.width;
+  enc->info.pic_height = info.height;
+
+  switch (GST_VIDEO_INFO_FORMAT (&info)) {
+    case GST_VIDEO_FORMAT_I420:
       enc->info.pixel_fmt = TH_PF_420;
       break;
-    case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
+    case GST_VIDEO_FORMAT_Y42B:
       enc->info.pixel_fmt = TH_PF_422;
       break;
-    case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
+    case GST_VIDEO_FORMAT_Y444:
       enc->info.pixel_fmt = TH_PF_444;
       break;
     default:
       g_assert_not_reached ();
   }
 
-  enc->info.fps_numerator = enc->fps_n = fps_n;
-  enc->info.fps_denominator = enc->fps_d = fps_d;
-  if (par) {
-    enc->info.aspect_numerator = gst_value_get_fraction_numerator (par);
-    enc->par_n = gst_value_get_fraction_numerator (par);
-    enc->info.aspect_denominator = gst_value_get_fraction_denominator (par);
-    enc->par_d = gst_value_get_fraction_denominator (par);
-  } else {
-    /* setting them to 0 indicates that the decoder can chose a good aspect
-     * ratio, defaulting to 1/1 */
-    enc->info.aspect_numerator = 0;
-    enc->par_n = 1;
-    enc->info.aspect_denominator = 0;
-    enc->par_d = 1;
-  }
+  enc->info.fps_numerator = info.fps_n;
+  enc->info.fps_denominator = info.fps_d;
+
+  enc->info.aspect_numerator = info.par_n;
+  enc->info.aspect_denominator = info.par_d;
+#if 0
+  /* setting them to 0 indicates that the decoder can chose a good aspect
+   * ratio, defaulting to 1/1 */
+  enc->info.aspect_numerator = 0;
+  enc->par_n = 1;
+  enc->info.aspect_denominator = 0;
+  enc->par_d = 1;
+#endif
 
   enc->info.colorspace = TH_CS_UNSPECIFIED;
 
@@ -723,9 +707,14 @@ theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
   theora_enc_reset (enc);
   enc->initialised = TRUE;
 
-  gst_object_unref (enc);
-
   return TRUE;
+
+  /* ERRORS */
+invalid_caps:
+  {
+    GST_DEBUG_OBJECT (enc, "could not parse caps");
+    return FALSE;
+  }
 }
 
 static guint64
@@ -756,8 +745,7 @@ theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
     goto done;
   }
 
-  memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (enc->srcpad));
+  gst_buffer_fill (buf, 0, packet->packet, packet->bytes);
   /* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
    * time representation */
   GST_BUFFER_OFFSET_END (buf) =
@@ -794,7 +782,7 @@ theora_push_buffer (GstTheoraEnc * enc, GstBuffer * buffer)
 {
   GstFlowReturn ret;
 
-  enc->bytes_out += GST_BUFFER_SIZE (buffer);
+  enc->bytes_out += gst_buffer_get_size (buffer);
 
   ret = gst_pad_push (enc->srcpad, buffer);
 
@@ -867,7 +855,8 @@ theora_enc_force_keyframe (GstTheoraEnc * enc)
 
   theora_enc_reset (enc);
   enc->granulepos_offset =
-      gst_util_uint64_scale (next_ts, enc->fps_n, GST_SECOND * enc->fps_d);
+      gst_util_uint64_scale (next_ts, enc->vinfo.fps_n,
+      GST_SECOND * enc->vinfo.fps_d);
   enc->timestamp_offset = next_ts;
   enc->next_ts = 0;
 }
@@ -882,18 +871,18 @@ theora_enc_sink_event (GstPad * pad, GstEvent * event)
   enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_CAPS:
     {
-      gboolean update;
-      gdouble rate, applied_rate;
-      GstFormat format;
-      gint64 start, stop, time;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-          &format, &start, &stop, &time);
+      GstCaps *caps;
 
-      gst_segment_set_newsegment_full (&enc->segment, update, rate,
-          applied_rate, format, start, stop, time);
+      gst_event_parse_caps (event, &caps);
+      res = theora_enc_sink_setcaps (enc, caps);
+      gst_event_unref (event);
+      break;
+    }
+    case GST_EVENT_SEGMENT:
+    {
+      gst_event_copy_segment (event, &enc->segment);
 
       res = gst_pad_push_event (enc->srcpad, event);
       break;
@@ -1006,25 +995,10 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstClockTime timestamp,
 }
 
 static void
-theora_enc_init_buffer (th_ycbcr_buffer buf, th_info * info, guint8 * data)
+theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame)
 {
-  GstVideoFormat format;
   guint i;
 
-  switch (info->pixel_fmt) {
-    case TH_PF_444:
-      format = GST_VIDEO_FORMAT_Y444;
-      break;
-    case TH_PF_420:
-      format = GST_VIDEO_FORMAT_I420;
-      break;
-    case TH_PF_422:
-      format = GST_VIDEO_FORMAT_Y42B;
-      break;
-    default:
-      g_assert_not_reached ();
-  }
-
   /* According to Theora developer Timothy Terriberry, the Theora 
    * encoder will not use memory outside of pic_width/height, even when
    * the frame size is bigger. The values outside this region will be encoded
@@ -1033,16 +1007,10 @@ theora_enc_init_buffer (th_ycbcr_buffer buf, th_info * info, guint8 * data)
    * is perfectly ok, even though it does not strictly look ok.
    */
   for (i = 0; i < 3; i++) {
-    buf[i].width =
-        gst_video_format_get_component_width (format, i, info->frame_width);
-    buf[i].height =
-        gst_video_format_get_component_height (format, i, info->frame_height);
-
-    buf[i].data =
-        data + gst_video_format_get_component_offset (format, i,
-        info->pic_width, info->pic_height);
-    buf[i].stride =
-        gst_video_format_get_row_stride (format, i, info->pic_width);
+    buf[i].width = GST_VIDEO_FRAME_COMP_WIDTH (frame, i);
+    buf[i].height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, i);
+    buf[i].data = GST_VIDEO_FRAME_COMP_DATA (frame, i);
+    buf[i].stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, i);
   }
 }
 
@@ -1058,17 +1026,21 @@ theora_enc_read_multipass_cache (GstTheoraEnc * enc)
 
   while (!done) {
     if (gst_adapter_available (enc->multipass_cache_adapter) == 0) {
+      guint8 *data;
+      gsize size;
+
       cache_buf = gst_buffer_new_and_alloc (512);
+
+      data = gst_buffer_map (cache_buf, &size, NULL, GST_MAP_READ);
       stat = g_io_channel_read_chars (enc->multipass_cache_fd,
-          (gchar *) GST_BUFFER_DATA (cache_buf), GST_BUFFER_SIZE (cache_buf),
-          &bytes_read, NULL);
+          (gchar *) data, size, &bytes_read, NULL);
 
       if (bytes_read <= 0) {
+        gst_buffer_unmap (cache_buf, data, 0);
         gst_buffer_unref (cache_buf);
         break;
       } else {
-        GST_BUFFER_SIZE (cache_buf) = bytes_read;
-
+        gst_buffer_unmap (cache_buf, data, bytes_read);
         gst_adapter_push (enc->multipass_cache_adapter, cache_buf);
       }
     }
@@ -1078,11 +1050,13 @@ theora_enc_read_multipass_cache (GstTheoraEnc * enc)
     bytes_read =
         MIN (gst_adapter_available (enc->multipass_cache_adapter), 512);
 
-    cache_data = gst_adapter_peek (enc->multipass_cache_adapter, bytes_read);
+    cache_data = gst_adapter_map (enc->multipass_cache_adapter, bytes_read);
 
     bytes_consumed =
         th_encode_ctl (enc->encoder, TH_ENCCTL_2PASS_IN, (guint8 *) cache_data,
         bytes_read);
+    gst_adapter_unmap (enc->multipass_cache_adapter, 0);
+
     done = bytes_consumed <= 0;
     if (bytes_consumed > 0)
       gst_adapter_flush (enc->multipass_cache_adapter, bytes_consumed);
@@ -1151,14 +1125,16 @@ theora_enc_encode_and_push (GstTheoraEnc * enc, ogg_packet op,
   GstFlowReturn ret;
   th_ycbcr_buffer ycbcr;
   gint res;
+  GstVideoFrame frame;
 
-  theora_enc_init_buffer (ycbcr, &enc->info, GST_BUFFER_DATA (buffer));
+  gst_video_frame_map (&frame, &enc->vinfo, buffer, GST_MAP_READ);
+  theora_enc_init_buffer (ycbcr, &frame);
 
   if (theora_enc_is_discontinuous (enc, running_time, duration)) {
     theora_enc_reset (enc);
     enc->granulepos_offset =
-        gst_util_uint64_scale (running_time, enc->fps_n,
-        GST_SECOND * enc->fps_d);
+        gst_util_uint64_scale (running_time, enc->vinfo.fps_n,
+        GST_SECOND * enc->vinfo.fps_d);
     enc->timestamp_offset = running_time;
     enc->next_ts = 0;
     enc->next_discont = TRUE;
@@ -1198,6 +1174,9 @@ theora_enc_encode_and_push (GstTheoraEnc * enc, ogg_packet op,
     if (ret != GST_FLOW_OK)
       goto data_push;
   }
+
+done:
+  gst_video_frame_unmap (&frame);
   gst_buffer_unref (buffer);
 
   return ret;
@@ -1205,18 +1184,18 @@ theora_enc_encode_and_push (GstTheoraEnc * enc, ogg_packet op,
   /* ERRORS */
 multipass_read_failed:
   {
-    gst_buffer_unref (buffer);
-    return ret;
+    GST_DEBUG_OBJECT (enc, "multipass read failed");
+    goto done;
   }
 multipass_write_failed:
   {
-    gst_buffer_unref (buffer);
-    return ret;
+    GST_DEBUG_OBJECT (enc, "multipass write failed");
+    goto done;
   }
 data_push:
   {
-    gst_buffer_unref (buffer);
-    return ret;
+    GST_DEBUG_OBJECT (enc, "error pushing buffer: %s", gst_flow_get_name (ret));
+    goto done;
   }
 }
 
@@ -1338,16 +1317,14 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
 
     /* mark buffers and put on caps */
     caps = gst_caps_new_simple ("video/x-theora",
-        "width", G_TYPE_INT, enc->width,
-        "height", G_TYPE_INT, enc->height,
-        "framerate", GST_TYPE_FRACTION, enc->fps_n, enc->fps_d,
-        "pixel-aspect-ratio", GST_TYPE_FRACTION, enc->par_n, enc->par_d, NULL);
+        "width", G_TYPE_INT, enc->vinfo.width,
+        "height", G_TYPE_INT, enc->vinfo.height,
+        "framerate", GST_TYPE_FRACTION, enc->vinfo.fps_n, enc->vinfo.fps_d,
+        "pixel-aspect-ratio", GST_TYPE_FRACTION, enc->vinfo.par_n,
+        enc->vinfo.par_d, NULL);
     caps = theora_set_header_on_caps (caps, buffers);
     GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
     gst_pad_set_caps (enc->srcpad, caps);
-
-    g_slist_foreach (buffers, (GFunc) gst_buffer_set_caps, caps);
-
     gst_caps_unref (caps);
 
     /* push out the header buffers */
@@ -1362,8 +1339,8 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
     }
 
     enc->granulepos_offset =
-        gst_util_uint64_scale (running_time, enc->fps_n,
-        GST_SECOND * enc->fps_d);
+        gst_util_uint64_scale (running_time, enc->vinfo.fps_n,
+        GST_SECOND * enc->vinfo.fps_d);
     enc->timestamp_offset = running_time;
     enc->next_ts = 0;
   }
@@ -1444,7 +1421,7 @@ theora_enc_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
index 69d4050..8df35de 100644 (file)
@@ -24,6 +24,8 @@
 #include <gst/base/gstadapter.h>
 #include <theora/theoraenc.h>
 
+#include <gst/video/video.h>
+
 G_BEGIN_DECLS
 
 #define GST_TYPE_THEORA_ENC \
@@ -99,10 +101,8 @@ struct _GstTheoraEnc
   gint keyframe_freq;
   gint keyframe_force;
 
+  GstVideoInfo vinfo;
   gint info_width, info_height;
-  gint width, height;
-  gint fps_n, fps_d;
-  gint par_n, par_d;
   GstClockTime next_ts;
 
   GstClockTime expected_ts;
index 0ce68d9..25b046f 100644 (file)
@@ -85,8 +85,8 @@ enum
   PROP_SYNCHRONIZATION_POINTS
 };
 
-GST_BOILERPLATE (GstTheoraParse, gst_theora_parse, GstElement,
-    GST_TYPE_ELEMENT);
+#define gst_theora_parse_parent_class parent_class
+G_DEFINE_TYPE (GstTheoraParse, gst_theora_parse, GST_TYPE_ELEMENT);
 
 static void theora_parse_dispose (GObject * object);
 static void theora_parse_get_property (GObject * object, guint prop_id,
@@ -101,20 +101,6 @@ static gboolean theora_parse_sink_event (GstPad * pad, GstEvent * event);
 static gboolean theora_parse_src_query (GstPad * pad, GstQuery * query);
 
 static void
-gst_theora_parse_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&theora_parse_src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&theora_parse_sink_factory));
-  gst_element_class_set_details_simple (element_class,
-      "Theora video parser", "Codec/Parser/Video",
-      "parse raw theora streams", "Andy Wingo <wingo@pobox.com>");
-}
-
-static void
 gst_theora_parse_class_init (GstTheoraParseClass * klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -140,6 +126,15 @@ gst_theora_parse_class_init (GstTheoraParseClass * klass)
               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&theora_parse_src_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&theora_parse_sink_factory));
+  gst_element_class_set_details_simple (gstelement_class,
+      "Theora video parser", "Codec/Parser/Video",
+      "parse raw theora streams", "Andy Wingo <wingo@pobox.com>");
+
   gstelement_class->change_state = theora_parse_change_state;
 
   GST_DEBUG_CATEGORY_INIT (theoraparse_debug, "theoraparse", 0,
@@ -147,7 +142,7 @@ gst_theora_parse_class_init (GstTheoraParseClass * klass)
 }
 
 static void
-gst_theora_parse_init (GstTheoraParse * parse, GstTheoraParseClass * g_class)
+gst_theora_parse_init (GstTheoraParse * parse)
 {
   parse->sinkpad =
       gst_pad_new_from_static_template (&theora_parse_sink_factory, "sink");
@@ -267,7 +262,7 @@ theora_parse_set_header_on_caps (GstTheoraParse * parse, GstCaps * caps)
     if (bufs[i] == NULL)
       continue;
 
-    bufs[i] = gst_buffer_make_metadata_writable (bufs[i]);
+    bufs[i] = gst_buffer_make_writable (bufs[i]);
     GST_BUFFER_FLAG_SET (bufs[i], GST_BUFFER_FLAG_IN_CAPS);
 
     g_value_init (&value, GST_TYPE_BUFFER);
@@ -292,7 +287,7 @@ theora_parse_set_streamheader (GstTheoraParse * parse)
 
   g_assert (!parse->streamheader_received);
 
-  caps = gst_caps_make_writable (gst_pad_get_caps (parse->srcpad));
+  caps = gst_caps_make_writable (gst_pad_get_caps (parse->srcpad, NULL));
   theora_parse_set_header_on_caps (parse, caps);
   GST_DEBUG_OBJECT (parse, "here are the caps: %" GST_PTR_FORMAT, caps);
   gst_pad_set_caps (parse->srcpad, caps);
@@ -302,18 +297,20 @@ theora_parse_set_streamheader (GstTheoraParse * parse)
     ogg_packet packet;
     GstBuffer *buf;
     int ret;
+    gsize size;
 
     buf = parse->streamheader[i];
     if (buf == NULL)
       continue;
 
-    packet.packet = GST_BUFFER_DATA (buf);
-    packet.bytes = GST_BUFFER_SIZE (buf);
+    packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+    packet.bytes = size;
     packet.granulepos = GST_BUFFER_OFFSET_END (buf);
     packet.packetno = i + 1;
     packet.e_o_s = 0;
     packet.b_o_s = (i == 0);
     ret = th_decode_headerin (&parse->info, &parse->comment, &setup, &packet);
+    gst_buffer_unmap (buf, packet.packet, size);
     if (ret < 0) {
       GST_WARNING_OBJECT (parse, "Failed to decode Theora header %d: %d\n",
           i + 1, ret);
@@ -367,8 +364,6 @@ theora_parse_push_headers (GstTheoraParse * parse)
     GstBuffer *buf;
 
     if ((buf = parse->streamheader[i])) {
-      buf = gst_buffer_make_metadata_writable (buf);
-      gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
       gst_pad_push (parse->srcpad, buf);
       parse->streamheader[i] = NULL;
     }
@@ -435,11 +430,16 @@ parse_granulepos (GstTheoraParse * parse, gint64 granulepos,
 static gboolean
 is_keyframe (GstBuffer * buf)
 {
-  if (!GST_BUFFER_DATA (buf))
-    return FALSE;
-  if (!GST_BUFFER_SIZE (buf))
+  gsize size;
+  guint8 data[1];
+
+  size = gst_buffer_get_size (buf);
+  if (size == 0)
     return FALSE;
-  return ((GST_BUFFER_DATA (buf)[0] & 0x40) == 0);
+
+  gst_buffer_extract (buf, 0, data, 1);
+
+  return ((data[0] & 0x40) == 0);
 }
 
 static void
@@ -496,8 +496,6 @@ theora_parse_push_buffer (GstTheoraParse * parse, GstBuffer * buf,
   GST_BUFFER_TIMESTAMP (buf) = this_time;
   GST_BUFFER_DURATION (buf) = next_time - this_time;
 
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
   if (parse->times)
     theora_parse_munge_granulepos (parse, buf, keyframe, frame);
 
@@ -624,7 +622,7 @@ theora_parse_queue_buffer (GstTheoraParse * parse, GstBuffer * buf)
 {
   GstFlowReturn ret = GST_FLOW_OK;
 
-  buf = gst_buffer_make_metadata_writable (buf);
+  buf = gst_buffer_make_writable (buf);
 
   g_queue_push_tail (parse->buffer_queue, buf);
 
@@ -644,18 +642,20 @@ theora_parse_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstFlowReturn ret;
   GstTheoraParse *parse;
-  guint8 *data;
-  guint size;
+  guint8 *data, header;
+  gsize size;
   gboolean have_header;
 
   parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
 
-  data = GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer);
-
   have_header = FALSE;
+
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+  header = data[0];
+  gst_buffer_unmap (buffer, data, size);
+
   if (size >= 1) {
-    if (data[0] & 0x80)
+    if (header & 0x80)
       have_header = TRUE;
   }
 
@@ -663,8 +663,8 @@ theora_parse_chain (GstPad * pad, GstBuffer * buffer)
     if (parse->send_streamheader) {
       /* we need to collect the headers still */
       /* so put it on the streamheader list and return */
-      if (data[0] >= 0x80 && data[0] <= 0x82)
-        parse->streamheader[data[0] - 0x80] = buffer;
+      if (header >= 0x80 && header <= 0x82)
+        parse->streamheader[header - 0x80] = buffer;
     }
     ret = GST_FLOW_OK;
   } else {
@@ -910,7 +910,7 @@ theora_parse_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
index ee90661..db8b8c7 100644 (file)
@@ -64,8 +64,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
     GST_STATIC_CAPS ("audio/x-vorbis")
     );
 
-GST_BOILERPLATE (GST_VORBIS_DEC_GLIB_TYPE_NAME, gst_vorbis_dec, GstElement,
-    GST_TYPE_ELEMENT);
+#define gst_vorbis_dec_parent_class parent_class
+G_DEFINE_TYPE (GST_VORBIS_DEC_GLIB_TYPE_NAME, gst_vorbis_dec, GST_TYPE_ELEMENT);
 
 static void vorbis_dec_finalize (GObject * object);
 static gboolean vorbis_dec_sink_event (GstPad * pad, GstEvent * event);
@@ -86,30 +86,23 @@ static gboolean vorbis_dec_convert (GstPad * pad,
 static gboolean vorbis_dec_sink_query (GstPad * pad, GstQuery * query);
 
 static void
-gst_vorbis_dec_base_init (gpointer g_class)
+gst_vorbis_dec_class_init (GstVorbisDecClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-  GstPadTemplate *src_template, *sink_template;
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+
+  gobject_class->finalize = vorbis_dec_finalize;
 
-  src_template = gst_static_pad_template_get (&vorbis_dec_src_factory);
-  gst_element_class_add_pad_template (element_class, src_template);
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&vorbis_dec_src_factory));
 
-  sink_template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
-  gst_element_class_add_pad_template (element_class, sink_template);
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&vorbis_dec_sink_factory));
 
-  gst_element_class_set_details_simple (element_class,
+  gst_element_class_set_details_simple (gstelement_class,
       "Vorbis audio decoder", "Codec/Decoder/Audio",
       GST_VORBIS_DEC_DESCRIPTION,
       "Benjamin Otte <otte@gnome.org>, Chris Lord <chris@openedhand.com>");
-}
-
-static void
-gst_vorbis_dec_class_init (GstVorbisDecClass * klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
-  gobject_class->finalize = vorbis_dec_finalize;
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (vorbis_dec_change_state);
 }
@@ -128,7 +121,7 @@ vorbis_get_query_types (GstPad * pad)
 }
 
 static void
-gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
+gst_vorbis_dec_init (GstVorbisDec * dec)
 {
   dec->sinkpad = gst_pad_new_from_static_template (&vorbis_dec_sink_factory,
       "sink");
@@ -231,7 +224,7 @@ vorbis_dec_convert (GstPad * pad,
     case GST_FORMAT_TIME:
       switch (*dest_format) {
         case GST_FORMAT_BYTES:
-          scale = dec->width * dec->vi.channels;
+          scale = dec->info.bpf;
         case GST_FORMAT_DEFAULT:
           *dest_value =
               scale * gst_util_uint64_scale_int (src_value, dec->vi.rate,
@@ -244,7 +237,7 @@ vorbis_dec_convert (GstPad * pad,
     case GST_FORMAT_DEFAULT:
       switch (*dest_format) {
         case GST_FORMAT_BYTES:
-          *dest_value = src_value * dec->width * dec->vi.channels;
+          *dest_value = src_value * dec->info.bpf;
           break;
         case GST_FORMAT_TIME:
           *dest_value =
@@ -257,11 +250,11 @@ vorbis_dec_convert (GstPad * pad,
     case GST_FORMAT_BYTES:
       switch (*dest_format) {
         case GST_FORMAT_DEFAULT:
-          *dest_value = src_value / (dec->width * dec->vi.channels);
+          *dest_value = src_value / dec->info.bpf;
           break;
         case GST_FORMAT_TIME:
           *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
-              dec->vi.rate * dec->width * dec->vi.channels);
+              dec->vi.rate * dec->info.bpf);
           break;
         default:
           res = FALSE;
@@ -493,29 +486,20 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
       gst_vorbis_dec_reset (dec);
       ret = gst_pad_push_event (dec->srcpad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      GstFormat format;
-      gdouble rate, arate;
-      gint64 start, stop, time;
-      gboolean update;
+      const GstSegment *segment;
 
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
+      gst_event_parse_segment (event, &segment);
 
       /* we need time for now */
-      if (format != GST_FORMAT_TIME)
+      if (segment->format != GST_FORMAT_TIME)
         goto newseg_wrong_format;
 
-      GST_DEBUG_OBJECT (dec,
-          "newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
-          ", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
-          update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
-          GST_TIME_ARGS (time));
+      GST_DEBUG_OBJECT (dec, "segment: %" GST_SEGMENT_FORMAT, segment);
 
       /* now configure the values */
-      gst_segment_set_newsegment_full (&dec->segment, update,
-          rate, arate, format, start, stop, time);
+      gst_segment_copy_into (segment, &dec->segment);
       dec->seqnum = gst_event_get_seqnum (event);
 
       if (dec->initialized)
@@ -541,7 +525,7 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
       break;
     }
     default:
-      ret = gst_pad_push_event (dec->srcpad, event);
+      ret = gst_pad_event_default (pad, event);
       break;
   }
 done:
@@ -561,10 +545,13 @@ static GstFlowReturn
 vorbis_handle_identification_packet (GstVorbisDec * vd)
 {
   GstCaps *caps;
+  GstAudioInfo info;
   const GstAudioChannelPosition *pos = NULL;
-  gint width = GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH;
 
-  switch (vd->vi.channels) {
+  gst_audio_info_set_format (&info, GST_VORBIS_AUDIO_FORMAT, vd->vi.rate,
+      vd->vi.channels);
+
+  switch (info.channels) {
     case 1:
     case 2:
       /* nothing */
@@ -575,59 +562,27 @@ vorbis_handle_identification_packet (GstVorbisDec * vd)
     case 6:
     case 7:
     case 8:
-      pos = gst_vorbis_channel_positions[vd->vi.channels - 1];
+      pos = gst_vorbis_channel_positions[info.channels - 1];
       break;
-    default:{
-      gint i;
-      GstAudioChannelPosition *posn =
-          g_new (GstAudioChannelPosition, vd->vi.channels);
+    default:
+    {
+      gint i, max_pos = MAX (info.channels, 64);
 
-      GST_ELEMENT_WARNING (GST_ELEMENT (vd), STREAM, DECODE,
+      GST_ELEMENT_WARNING (vd, STREAM, DECODE,
           (NULL), ("Using NONE channel layout for more than 8 channels"));
-
-      for (i = 0; i < vd->vi.channels; i++)
-        posn[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
-
-      pos = posn;
+      for (i = 0; i < max_pos; i++)
+        info.position[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
     }
   }
 
-  /* negotiate width with downstream */
-  caps = gst_pad_get_allowed_caps (vd->srcpad);
-  if (caps) {
-    if (!gst_caps_is_empty (caps)) {
-      GstStructure *s;
-
-      s = gst_caps_get_structure (caps, 0);
-      /* template ensures 16 or 32 */
-      gst_structure_get_int (s, "width", &width);
-
-      GST_INFO_OBJECT (vd, "using %s with %d channels and %d bit audio depth",
-          gst_structure_get_name (s), vd->vi.channels, width);
-    }
-    gst_caps_unref (caps);
-  }
-  vd->width = width >> 3;
+  caps = gst_audio_info_to_caps (&info);
+  gst_pad_set_caps (vd->srcpad, caps);
+  gst_caps_unref (caps);
 
+  vd->info = info;
   /* select a copy_samples function, this way we can have specialized versions
    * for mono/stereo and avoid the depth switch in tremor case */
-  vd->copy_samples = get_copy_sample_func (vd->vi.channels, vd->width);
-
-  caps = gst_caps_copy (gst_pad_get_pad_template_caps (vd->srcpad));
-  gst_caps_set_simple (caps, "rate", G_TYPE_INT, vd->vi.rate,
-      "channels", G_TYPE_INT, vd->vi.channels,
-      "width", G_TYPE_INT, width, NULL);
-
-  if (pos) {
-    gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
-  }
-
-  if (vd->vi.channels > 8) {
-    g_free ((GstAudioChannelPosition *) pos);
-  }
-
-  gst_pad_set_caps (vd->srcpad, caps);
-  gst_caps_unref (caps);
+  vd->copy_samples = get_copy_sample_func (info.channels);
 
   return GST_FLOW_OK;
 }
@@ -638,16 +593,16 @@ vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
   guint bitrate = 0;
   gchar *encoder = NULL;
   GstTagList *list, *old_list;
-  GstBuffer *buf;
+  guint8 *data;
+  gsize size;
 
   GST_DEBUG_OBJECT (vd, "parsing comment packet");
 
-  buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = gst_ogg_packet_data (packet);
-  GST_BUFFER_SIZE (buf) = gst_ogg_packet_size (packet);
+  data = gst_ogg_packet_data (packet);
+  size = gst_ogg_packet_size (packet);
 
   list =
-      gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\003vorbis", 7,
+      gst_tag_list_from_vorbiscomment (data, size, (guint8 *) "\003vorbis", 7,
       &encoder);
 
   old_list = vd->taglist;
@@ -656,7 +611,6 @@ vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
   if (old_list)
     gst_tag_list_free (old_list);
   gst_tag_list_free (list);
-  gst_buffer_unref (buf);
 
   if (!vd->taglist) {
     GST_ERROR_OBJECT (vd, "couldn't decode comments");
@@ -809,7 +763,7 @@ vorbis_dec_push_forward (GstVorbisDec * dec, GstBuffer * buf)
 
   /* clip */
   if (!(buf = gst_audio_buffer_clip (buf, &dec->segment, dec->vi.rate,
-              dec->vi.channels * dec->width))) {
+              dec->info.bpf))) {
     GST_LOG_OBJECT (dec, "clipped buffer");
     return GST_FLOW_OK;
   }
@@ -873,15 +827,14 @@ static GstFlowReturn
 vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
     GstClockTime timestamp, GstClockTime duration)
 {
-#ifdef USE_TREMOLO
-  vorbis_sample_t *pcm;
-#else
+#ifndef USE_TREMOLO
   vorbis_sample_t **pcm;
 #endif
   guint sample_count;
   GstBuffer *out = NULL;
   GstFlowReturn result;
-  gint size;
+  guint8 *data;
+  gsize size;
 
   if (G_UNLIKELY (!vd->initialized))
     goto not_initialized;
@@ -915,21 +868,17 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
 #endif
     goto done;
 
-  size = sample_count * vd->vi.channels * vd->width;
-  GST_LOG_OBJECT (vd, "%d samples ready for reading, size %d", sample_count,
-      size);
+  size = sample_count * vd->info.bpf;
+  GST_LOG_OBJECT (vd, "%d samples ready for reading, size %" G_GSIZE_FORMAT,
+      sample_count, size);
 
   /* alloc buffer for it */
-  result =
-      gst_pad_alloc_buffer_and_set_caps (vd->srcpad, GST_BUFFER_OFFSET_NONE,
-      size, GST_PAD_CAPS (vd->srcpad), &out);
-  if (G_UNLIKELY (result != GST_FLOW_OK))
-    goto done;
+  out = gst_buffer_new_and_alloc (size);
 
+  data = gst_buffer_map (out, NULL, NULL, GST_MAP_WRITE);
   /* get samples ready for reading now, should be sample_count */
 #ifdef USE_TREMOLO
-  pcm = GST_BUFFER_DATA (out);
-  if (G_UNLIKELY ((vorbis_dsp_pcmout (&vd->vd, pcm,
+  if (G_UNLIKELY ((vorbis_dsp_pcmout (&vd->vd, data,
                   sample_count)) != sample_count))
 #else
   if (G_UNLIKELY ((vorbis_synthesis_pcmout (&vd->vd, &pcm)) != sample_count))
@@ -938,12 +887,12 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
 
 #ifndef USE_TREMOLO
   /* copy samples in buffer */
-  vd->copy_samples ((vorbis_sample_t *) GST_BUFFER_DATA (out), pcm,
-      sample_count, vd->vi.channels, vd->width);
+  vd->copy_samples ((vorbis_sample_t *) data, pcm,
+      sample_count, vd->info.channels);
 #endif
 
-  GST_LOG_OBJECT (vd, "setting output size to %d", size);
-  GST_BUFFER_SIZE (out) = size;
+  GST_LOG_OBJECT (vd, "setting output size to %" G_GSIZE_FORMAT, size);
+  gst_buffer_unmap (out, data, size);
 
   /* this should not overflow */
   if (duration == -1)
@@ -1002,11 +951,16 @@ vorbis_dec_handle_header_buffer (GstVorbisDec * vd, GstBuffer * buffer)
 {
   ogg_packet *packet;
   ogg_packet_wrapper packet_wrapper;
+  GstFlowReturn ret;
 
-  gst_ogg_packet_wrapper_from_buffer (&packet_wrapper, buffer);
+  gst_ogg_packet_wrapper_map (&packet_wrapper, buffer);
   packet = gst_ogg_packet_from_wrapper (&packet_wrapper);
 
-  return vorbis_handle_header_packet (vd, packet);
+  ret = vorbis_handle_header_packet (vd, packet);
+
+  gst_ogg_packet_wrapper_unmap (&packet_wrapper, buffer);
+
+  return ret;
 }
 
 
@@ -1015,56 +969,71 @@ static GstFlowReturn
 vorbis_dec_handle_header_caps (GstVorbisDec * vd, GstBuffer * buffer)
 {
   GstFlowReturn result = GST_FLOW_OK;
-  GstCaps *caps = GST_PAD_CAPS (vd->sinkpad);
-  GstStructure *s = gst_caps_get_structure (caps, 0);
-  const GValue *array = gst_structure_get_value (s, "streamheader");
-
-  if (array && (gst_value_array_get_size (array) >= MIN_NUM_HEADERS)) {
-    const GValue *value = NULL;
-    GstBuffer *buf = NULL;
-
-    /* initial header */
-    value = gst_value_array_get_value (array, 0);
-    buf = gst_value_get_buffer (value);
-    if (!buf)
-      goto null_buffer;
-    result = vorbis_dec_handle_header_buffer (vd, buf);
-
-    /* comment header */
-    if (result == GST_FLOW_OK) {
-      value = gst_value_array_get_value (array, 1);
-      buf = gst_value_get_buffer (value);
-      if (!buf)
-        goto null_buffer;
-      result = vorbis_dec_handle_header_buffer (vd, buf);
-    }
+  GstCaps *caps;
+  GstStructure *s;
+  const GValue *array;
+  const GValue *value = NULL;
+  GstBuffer *buf = NULL;
 
-    /* bitstream codebook header */
-    if (result == GST_FLOW_OK) {
-      value = gst_value_array_get_value (array, 2);
-      buf = gst_value_get_buffer (value);
-      if (!buf)
-        goto null_buffer;
-      result = vorbis_dec_handle_header_buffer (vd, buf);
-    }
-  } else
+  if ((caps = gst_pad_get_current_caps (vd->sinkpad)) == NULL)
+    goto no_caps;
+
+  if ((s = gst_caps_get_structure (caps, 0)) == NULL)
+    goto no_caps;
+
+  array = gst_structure_get_value (s, "streamheader");
+
+  if (array == NULL || (gst_value_array_get_size (array) < MIN_NUM_HEADERS))
     goto array_error;
 
-done:
-  return (result != GST_FLOW_OK ? GST_FLOW_NOT_NEGOTIATED : GST_FLOW_OK);
+  /* initial header */
+  value = gst_value_array_get_value (array, 0);
+  buf = gst_value_get_buffer (value);
+  if (!buf)
+    goto null_buffer;
+  result = vorbis_dec_handle_header_buffer (vd, buf);
+  if (result != GST_FLOW_OK)
+    goto buffer_error;
+
+  /* comment header */
+  value = gst_value_array_get_value (array, 1);
+  buf = gst_value_get_buffer (value);
+  if (!buf)
+    goto null_buffer;
+  result = vorbis_dec_handle_header_buffer (vd, buf);
+  if (result != GST_FLOW_OK)
+    goto buffer_error;
+
+  /* bitstream codebook header */
+  value = gst_value_array_get_value (array, 2);
+  buf = gst_value_get_buffer (value);
+  if (!buf)
+    goto null_buffer;
+  result = vorbis_dec_handle_header_buffer (vd, buf);
+  if (result != GST_FLOW_OK)
+    goto buffer_error;
+
+  return result;
 
+no_caps:
+  {
+    GST_WARNING_OBJECT (vd, "no caps negotiated");
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
 array_error:
   {
     GST_WARNING_OBJECT (vd, "streamheader array not found");
-    result = GST_FLOW_ERROR;
-    goto done;
+    return GST_FLOW_NOT_NEGOTIATED;
   }
-
 null_buffer:
   {
     GST_WARNING_OBJECT (vd, "streamheader with null buffer received");
-    result = GST_FLOW_ERROR;
-    goto done;
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+buffer_error:
+  {
+    GST_WARNING_OBJECT (vd, "error handling buffer");
+    return GST_FLOW_NOT_NEGOTIATED;
   }
 }
 
@@ -1076,7 +1045,7 @@ vorbis_dec_decode_buffer (GstVorbisDec * vd, GstBuffer * buffer)
   GstFlowReturn result = GST_FLOW_OK;
 
   /* make ogg_packet out of the buffer */
-  gst_ogg_packet_wrapper_from_buffer (&packet_wrapper, buffer);
+  gst_ogg_packet_wrapper_map (&packet_wrapper, buffer);
   packet = gst_ogg_packet_from_wrapper (&packet_wrapper);
   /* set some more stuff */
   packet->granulepos = -1;
@@ -1119,6 +1088,8 @@ vorbis_dec_decode_buffer (GstVorbisDec * vd, GstBuffer * buffer)
   }
 
 done:
+  gst_ogg_packet_wrapper_unmap (&packet_wrapper, buffer);
+
   return result;
 
 empty_buffer:
@@ -1281,8 +1252,9 @@ vorbis_dec_chain_reverse (GstVorbisDec * vd, gboolean discont, GstBuffer * buf)
 
   if (G_LIKELY (buf)) {
     GST_DEBUG_OBJECT (vd,
-        "gathering buffer %p of size %u, time %" GST_TIME_FORMAT
-        ", dur %" GST_TIME_FORMAT, buf, GST_BUFFER_SIZE (buf),
+        "gathering buffer %p of size %" G_GSIZE_FORMAT
+        ", time %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT,
+        buf, gst_buffer_get_size (buf),
         GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
 
@@ -1358,7 +1330,7 @@ vorbis_dec_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  res = parent_class->change_state (element, transition);
+  res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
index 04e4677..d122a0e 100644 (file)
@@ -65,7 +65,7 @@ struct _GstVorbisDec {
 #endif
 
   gboolean          initialized;
-  guint             width;
+  GstAudioInfo      info;
 
   /* list of buffers that need timestamps */
   GList            *queued;
index 1ddce38..66a2ee3 100644 (file)
  * is allowed, downstream elements are supposed to clip */
 static void
 copy_samples_m (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
-    gint channels, gint width)
+    gint channels)
 {
   memcpy (out, in[0], samples * sizeof (float));
 }
 
 static void
 copy_samples_s (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
-    gint channels, gint width)
+    gint channels)
 {
 #ifdef GST_VORBIS_DEC_SEQUENTIAL
   memcpy (out, in[0], samples * sizeof (float));
@@ -59,7 +59,7 @@ copy_samples_s (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
 
 static void
 copy_samples (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
-    gint channels, gint width)
+    gint channels)
 {
 #ifdef GST_VORBIS_DEC_SEQUENTIAL
   gint i;
@@ -80,12 +80,10 @@ copy_samples (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
 }
 
 CopySampleFunc
-get_copy_sample_func (gint channels, gint width)
+get_copy_sample_func (gint channels)
 {
   CopySampleFunc f = NULL;
 
-  g_assert (width == 4);
-
   switch (channels) {
     case 1:
       f = copy_samples_m;
@@ -131,50 +129,8 @@ CLIP_TO_15 (ogg_int32_t x)
 #endif
 
 static void
-copy_samples_32_m (vorbis_sample_t * _out, vorbis_sample_t ** _in,
-    guint samples, gint channels, gint width)
-{
-  gint32 *out = (gint32 *) _out;
-  ogg_int32_t **in = (ogg_int32_t **) _in;
-  gint j;
-
-  for (j = 0; j < samples; j++) {
-    *out++ = CLIP_TO_15 (in[0][j] >> 9);
-  }
-}
-
-static void
-copy_samples_32_s (vorbis_sample_t * _out, vorbis_sample_t ** _in,
-    guint samples, gint channels, gint width)
-{
-  gint32 *out = (gint32 *) _out;
-  ogg_int32_t **in = (ogg_int32_t **) _in;
-  gint j;
-
-  for (j = 0; j < samples; j++) {
-    *out++ = CLIP_TO_15 (in[0][j] >> 9);
-    *out++ = CLIP_TO_15 (in[1][j] >> 9);
-  }
-}
-
-static void
-copy_samples_32 (vorbis_sample_t * _out, vorbis_sample_t ** _in, guint samples,
-    gint channels, gint width)
-{
-  gint32 *out = (gint32 *) _out;
-  ogg_int32_t **in = (ogg_int32_t **) _in;
-  gint i, j;
-
-  for (j = 0; j < samples; j++) {
-    for (i = 0; i < channels; i++) {
-      *out++ = CLIP_TO_15 (in[i][j] >> 9);
-    }
-  }
-}
-
-static void
 copy_samples_16_m (vorbis_sample_t * _out, vorbis_sample_t ** _in,
-    guint samples, gint channels, gint width)
+    guint samples, gint channels)
 {
   gint16 *out = (gint16 *) _out;
   ogg_int32_t **in = (ogg_int32_t **) _in;
@@ -187,7 +143,7 @@ copy_samples_16_m (vorbis_sample_t * _out, vorbis_sample_t ** _in,
 
 static void
 copy_samples_16_s (vorbis_sample_t * _out, vorbis_sample_t ** _in,
-    guint samples, gint channels, gint width)
+    guint samples, gint channels)
 {
   gint16 *out = (gint16 *) _out;
   ogg_int32_t **in = (ogg_int32_t **) _in;
@@ -201,7 +157,7 @@ copy_samples_16_s (vorbis_sample_t * _out, vorbis_sample_t ** _in,
 
 static void
 copy_samples_16 (vorbis_sample_t * _out, vorbis_sample_t ** _in, guint samples,
-    gint channels, gint width)
+    gint channels)
 {
   gint16 *out = (gint16 *) _out;
   ogg_int32_t **in = (ogg_int32_t **) _in;
@@ -215,36 +171,20 @@ copy_samples_16 (vorbis_sample_t * _out, vorbis_sample_t ** _in, guint samples,
 }
 
 CopySampleFunc
-get_copy_sample_func (gint channels, gint width)
+get_copy_sample_func (gint channels)
 {
   CopySampleFunc f = NULL;
 
-  if (width == 4) {
-    switch (channels) {
-      case 1:
-        f = copy_samples_32_m;
-        break;
-      case 2:
-        f = copy_samples_32_s;
-        break;
-      default:
-        f = copy_samples_32;
-        break;
-    }
-  } else if (width == 2) {
-    switch (channels) {
-      case 1:
-        f = copy_samples_16_m;
-        break;
-      case 2:
-        f = copy_samples_16_s;
-        break;
-      default:
-        f = copy_samples_16;
-        break;
-    }
-  } else {
-    g_assert_not_reached ();
+  switch (channels) {
+    case 1:
+      f = copy_samples_16_m;
+      break;
+    case 2:
+      f = copy_samples_16_s;
+      break;
+    default:
+      f = copy_samples_16;
+      break;
   }
   return f;
 }
index ca00af9..fd41643 100644 (file)
@@ -26,6 +26,7 @@
 #define __GST_VORBIS_DEC_LIB_H__
 
 #include <gst/gst.h>
+#include <gst/audio/audio.h>
 
 #ifndef TREMOR
 
@@ -36,12 +37,19 @@ typedef ogg_packet                     ogg_packet_wrapper;
 
 #define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to float audio"
 
-#define GST_VORBIS_DEC_SRC_CAPS \
-    GST_STATIC_CAPS ("audio/x-raw-float, " \
-        "rate = (int) [ 1, MAX ], " \
-        "channels = (int) [ 1, 256 ], " \
-        "endianness = (int) BYTE_ORDER, " \
-        "width = (int) 32")
+#define GST_VORBIS_AUDIO_FORMAT     GST_AUDIO_FORMAT_F32
+
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+#define GST_VORBIS_AUDIO_FORMAT_STR "F32_BE"
+#else
+#define GST_VORBIS_AUDIO_FORMAT_STR "F32_LE"
+#endif
+
+#define GST_VORBIS_DEC_SRC_CAPS       \
+    GST_STATIC_CAPS ("audio/x-raw, "  \
+        "format = (string)" GST_VORBIS_AUDIO_FORMAT_STR ", "     \
+        "rate = (int) [ 1, MAX ], "   \
+        "channels = (int) [ 1, 256 ]")
 
 #define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH           (32)
 
@@ -60,10 +68,18 @@ gst_ogg_packet_size (ogg_packet * p)
 }
 
 static inline void
-gst_ogg_packet_wrapper_from_buffer (ogg_packet * packet, GstBuffer * buffer)
+gst_ogg_packet_wrapper_map (ogg_packet * packet, GstBuffer * buffer)
+{
+  gsize size;
+
+  packet->packet = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+  packet->bytes = size;
+}
+
+static inline void
+gst_ogg_packet_wrapper_unmap (ogg_packet * packet, GstBuffer * buffer)
 {
-  packet->packet = GST_BUFFER_DATA (buffer);
-  packet->bytes = GST_BUFFER_SIZE (buffer);
+  gst_buffer_unmap (buffer, packet->packet, packet->bytes);
 }
 
 static inline ogg_packet *
@@ -93,16 +109,19 @@ struct _ogg_packet_wrapper {
 
 #define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to integer audio"
 
-#define GST_VORBIS_DEC_SRC_CAPS \
-    GST_STATIC_CAPS ("audio/x-raw-int, "   \
-        "rate = (int) [ 1, MAX ], "        \
-        "channels = (int) [ 1, 6 ], "      \
-        "endianness = (int) BYTE_ORDER, "  \
-        "width = (int) { 16, 32 }, "       \
-        "depth = (int) 16, "               \
-        "signed = (boolean) true")
+#define GST_VORBIS_AUDIO_FORMAT GST_AUDIO_FORMAT_S16
+
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+#define GST_VORBIS_AUDIO_FORMAT_STR "S16_BE"
+#else
+#define GST_VORBIS_AUDIO_FORMAT_STR "S16_LE"
+#endif
 
-#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH           (16)
+#define GST_VORBIS_DEC_SRC_CAPS        \
+    GST_STATIC_CAPS ("audio/x-raw, "   \
+        "format = (string) " GST_VORBIS_AUDIO_FORMAT_STR ", "      \
+        "rate = (int) [ 1, MAX ], "    \
+        "channels = (int) [ 1, 6 ]")
 
 /* we need a different type name here */
 #define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstIVorbisDec
@@ -127,14 +146,15 @@ gst_ogg_packet_size (ogg_packet * p)
 }
 
 static inline void
-gst_ogg_packet_wrapper_from_buffer (ogg_packet_wrapper * packet,
+gst_ogg_packet_wrapper_map (ogg_packet_wrapper * packet,
     GstBuffer * buffer)
 {
   ogg_reference *ref = &packet->ref;
   ogg_buffer *buf = &packet->buf;
+  gsize size;
 
-  buf->data = GST_BUFFER_DATA (buffer);
-  buf->size = GST_BUFFER_SIZE (buffer);
+  buf->data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+  buf->size = size;
   buf->refcount = 1;
   buf->ptr.owner = NULL;
   buf->ptr.next = NULL;
@@ -148,6 +168,16 @@ gst_ogg_packet_wrapper_from_buffer (ogg_packet_wrapper * packet,
   packet->packet.bytes = ref->length;
 }
 
+static inline void
+gst_ogg_packet_wrapper_unmap (ogg_packet_wrapper * packet,
+    GstBuffer * buffer)
+{
+  ogg_reference *ref = &packet->ref;
+  ogg_buffer *buf = &packet->buf;
+
+  gst_buffer_unmap (buffer, buf->data, buf->size);
+}
+
 static inline ogg_packet *
 gst_ogg_packet_from_wrapper (ogg_packet_wrapper * packet)
 {
@@ -157,8 +187,8 @@ gst_ogg_packet_from_wrapper (ogg_packet_wrapper * packet)
 #endif
 
 typedef void (*CopySampleFunc)(vorbis_sample_t *out, vorbis_sample_t **in,
-                           guint samples, gint channels, gint width);
+                           guint samples, gint channels);
 
-CopySampleFunc get_copy_sample_func (gint channels, gint width);
+CopySampleFunc get_copy_sample_func (gint channels);
 
 #endif /* __GST_VORBIS_DEC_LIB_H__ */
index 9cdf484..f5ff3d3 100644 (file)
@@ -63,10 +63,9 @@ static GstStaticPadTemplate vorbis_enc_sink_factory =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-float, "
-        "rate = (int) [ 1, 200000 ], "
-        "channels = (int) [ 1, 256 ], " "endianness = (int) BYTE_ORDER, "
-        "width = (int) 32")
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " GST_AUDIO_NE (F32) ", "
+        "rate = (int) [ 1, 200000 ], " "channels = (int) [ 1, 256 ]")
     );
 
 static GstStaticPadTemplate vorbis_enc_src_factory =
@@ -132,8 +131,9 @@ static GstStateChangeReturn gst_vorbis_enc_change_state (GstElement * element,
     GstStateChange transition);
 static void gst_vorbis_enc_add_interfaces (GType vorbisenc_type);
 
-GST_BOILERPLATE_FULL (GstVorbisEnc, gst_vorbis_enc, GstElement,
-    GST_TYPE_ELEMENT, gst_vorbis_enc_add_interfaces);
+#define gst_vorbis_enc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstVorbisEnc, gst_vorbis_enc,
+    GST_TYPE_ELEMENT, gst_vorbis_enc_add_interfaces (g_define_type_id));
 
 static void
 gst_vorbis_enc_add_interfaces (GType vorbisenc_type)
@@ -147,24 +147,6 @@ gst_vorbis_enc_add_interfaces (GType vorbisenc_type)
 }
 
 static void
-gst_vorbis_enc_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-  GstPadTemplate *src_template, *sink_template;
-
-
-  src_template = gst_static_pad_template_get (&vorbis_enc_src_factory);
-  gst_element_class_add_pad_template (element_class, src_template);
-
-  sink_template = gst_static_pad_template_get (&vorbis_enc_sink_factory);
-  gst_element_class_add_pad_template (element_class, sink_template);
-  gst_element_class_set_details_simple (element_class,
-      "Vorbis audio encoder", "Codec/Encoder/Audio",
-      "Encodes audio in Vorbis format",
-      "Monty <monty@xiph.org>, " "Wim Taymans <wim@fluendo.com>");
-}
-
-static void
 gst_vorbis_enc_class_init (GstVorbisEncClass * klass)
 {
   GObjectClass *gobject_class;
@@ -208,6 +190,15 @@ gst_vorbis_enc_class_init (GstVorbisEncClass * klass)
           "The last status message", NULL,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&vorbis_enc_src_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&vorbis_enc_sink_factory));
+  gst_element_class_set_details_simple (gstelement_class,
+      "Vorbis audio encoder", "Codec/Encoder/Audio",
+      "Encodes audio in Vorbis format",
+      "Monty <monty@xiph.org>, " "Wim Taymans <wim@fluendo.com>");
+
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_vorbis_enc_change_state);
 }
@@ -231,17 +222,15 @@ gst_vorbis_enc_generate_sink_caps (void)
   GstCaps *caps = gst_caps_new_empty ();
   int i, c;
 
-  gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
+  gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw",
+          "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
           "rate", GST_TYPE_INT_RANGE, 1, 200000,
-          "channels", G_TYPE_INT, 1,
-          "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
-          NULL));
+          "channels", G_TYPE_INT, 1, NULL));
 
-  gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
+  gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw",
+          "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
           "rate", GST_TYPE_INT_RANGE, 1, 200000,
-          "channels", G_TYPE_INT, 2,
-          "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
-          NULL));
+          "channels", G_TYPE_INT, 2, NULL));
 
   for (i = 3; i <= 8; i++) {
     GValue chanpos = { 0 };
@@ -257,43 +246,43 @@ gst_vorbis_enc_generate_sink_caps (void)
     }
     g_value_unset (&pos);
 
-    structure = gst_structure_new ("audio/x-raw-float",
-        "rate", GST_TYPE_INT_RANGE, 1, 200000,
-        "channels", G_TYPE_INT, i,
-        "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
+    structure = gst_structure_new ("audio/x-raw",
+        "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
+        "rate", GST_TYPE_INT_RANGE, 1, 200000, "channels", G_TYPE_INT, i, NULL);
     gst_structure_set_value (structure, "channel-positions", &chanpos);
     g_value_unset (&chanpos);
 
     gst_caps_append_structure (caps, structure);
   }
 
-  gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
+  gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw",
+          "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
           "rate", GST_TYPE_INT_RANGE, 1, 200000,
-          "channels", GST_TYPE_INT_RANGE, 9, 256,
-          "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
-          NULL));
+          "channels", GST_TYPE_INT_RANGE, 9, 256, NULL));
 
   return caps;
 }
 
 static GstCaps *
-gst_vorbis_enc_sink_getcaps (GstPad * pad)
+gst_vorbis_enc_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstVorbisEnc *vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
 
   if (vorbisenc->sinkcaps == NULL)
     vorbisenc->sinkcaps = gst_vorbis_enc_generate_sink_caps ();
 
-  return gst_caps_ref (vorbisenc->sinkcaps);
+  if (filter)
+    return gst_caps_intersect_full (filter, vorbisenc->sinkcaps,
+        GST_CAPS_INTERSECT_FIRST);
+  else
+    return gst_caps_ref (vorbisenc->sinkcaps);
 }
 
 static gboolean
-gst_vorbis_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_vorbis_enc_sink_setcaps (GstVorbisEnc * vorbisenc, GstCaps * caps)
 {
-  GstVorbisEnc *vorbisenc;
   GstStructure *structure;
 
-  vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
   vorbisenc->setup = FALSE;
 
   structure = gst_caps_get_structure (caps, 0);
@@ -310,7 +299,7 @@ gst_vorbis_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
 
 static gboolean
 gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
-    gint64 src_value, GstFormat dest_format, gint64 * dest_value)
+    gint64 src_value, GstFormat dest_format, gint64 * dest_value)
 {
   gboolean res = TRUE;
   GstVorbisEnc *vorbisenc;
@@ -328,7 +317,7 @@ gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
 
   switch (src_format) {
     case GST_FORMAT_BYTES:
-      switch (*dest_format) {
+      switch (dest_format) {
         case GST_FORMAT_TIME:
           *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND, avg);
           break;
@@ -337,7 +326,7 @@ gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
       }
       break;
     case GST_FORMAT_TIME:
-      switch (*dest_format) {
+      switch (dest_format) {
         case GST_FORMAT_BYTES:
           *dest_value = gst_util_uint64_scale_int (src_value, avg, GST_SECOND);
           break;
@@ -454,45 +443,47 @@ gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
   GstPad *peerpad;
 
   vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
-  peerpad = gst_pad_get_peer (GST_PAD (vorbisenc->sinkpad));
+  peerpad = gst_pad_get_peer (vorbisenc->sinkpad);
 
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_POSITION:
     {
-      GstFormat fmt, req_fmt;
+      GstFormat req_fmt;
       gint64 pos, val;
 
       gst_query_parse_position (query, &req_fmt, NULL);
-      if ((res = gst_pad_query_position (peerpad, &req_fmt, &val))) {
+      if ((res = gst_pad_query_position (peerpad, req_fmt, &val))) {
         gst_query_set_position (query, req_fmt, val);
         break;
       }
 
-      fmt = GST_FORMAT_TIME;
-      if (!(res = gst_pad_query_position (peerpad, &fmt, &pos)))
+      if (!(res = gst_pad_query_position (peerpad, GST_FORMAT_TIME, &pos)))
         break;
 
-      if ((res = gst_pad_query_convert (peerpad, fmt, pos, &req_fmt, &val))) {
+      if ((res =
+              gst_pad_query_convert (peerpad, GST_FORMAT_TIME, pos, req_fmt,
+                  &val))) {
         gst_query_set_position (query, req_fmt, val);
       }
       break;
     }
     case GST_QUERY_DURATION:
     {
-      GstFormat fmt, req_fmt;
+      GstFormat req_fmt;
       gint64 dur, val;
 
       gst_query_parse_duration (query, &req_fmt, NULL);
-      if ((res = gst_pad_query_duration (peerpad, &req_fmt, &val))) {
+      if ((res = gst_pad_query_duration (peerpad, req_fmt, &val))) {
         gst_query_set_duration (query, req_fmt, val);
         break;
       }
 
-      fmt = GST_FORMAT_TIME;
-      if (!(res = gst_pad_query_duration (peerpad, &fmt, &dur)))
+      if (!(res = gst_pad_query_duration (peerpad, GST_FORMAT_TIME, &dur)))
         break;
 
-      if ((res = gst_pad_query_convert (peerpad, fmt, dur, &req_fmt, &val))) {
+      if ((res =
+              gst_pad_query_convert (peerpad, GST_FORMAT_TIME, dur, req_fmt,
+                  &val))) {
         gst_query_set_duration (query, req_fmt, val);
       }
       break;
@@ -504,7 +495,7 @@ gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
 
       gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
       if (!(res =
-              gst_vorbis_enc_convert_src (pad, src_fmt, src_val, &dest_fmt,
+              gst_vorbis_enc_convert_src (pad, src_fmt, src_val, dest_fmt,
                   &dest_val)))
         goto error;
       gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
@@ -570,7 +561,7 @@ error:
 }
 
 static void
-gst_vorbis_enc_init (GstVorbisEnc * vorbisenc, GstVorbisEncClass * klass)
+gst_vorbis_enc_init (GstVorbisEnc * vorbisenc)
 {
   vorbisenc->sinkpad =
       gst_pad_new_from_static_template (&vorbis_enc_sink_factory, "sink");
@@ -578,8 +569,6 @@ gst_vorbis_enc_init (GstVorbisEnc * vorbisenc, GstVorbisEncClass * klass)
       GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_event));
   gst_pad_set_chain_function (vorbisenc->sinkpad,
       GST_DEBUG_FUNCPTR (gst_vorbis_enc_chain));
-  gst_pad_set_setcaps_function (vorbisenc->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_setcaps));
   gst_pad_set_getcaps_function (vorbisenc->sinkpad,
       GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_getcaps));
   gst_pad_set_query_function (vorbisenc->sinkpad,
@@ -826,7 +815,7 @@ gst_vorbis_enc_buffer_from_packet (GstVorbisEnc * vorbisenc,
   GstBuffer *outbuf;
 
   outbuf = gst_buffer_new_and_alloc (packet->bytes);
-  memcpy (GST_BUFFER_DATA (outbuf), packet->packet, packet->bytes);
+  gst_buffer_fill (outbuf, 0, packet->packet, packet->bytes);
   /* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
    * time representation */
   GST_BUFFER_OFFSET_END (outbuf) = packet->granulepos +
@@ -838,8 +827,7 @@ gst_vorbis_enc_buffer_from_packet (GstVorbisEnc * vorbisenc,
   /* update the next timestamp, taking granulepos_offset and subgranule offset
    * into account */
   vorbisenc->next_ts =
-      granulepos_to_timestamp_offset (vorbisenc, packet->granulepos) +
-      vorbisenc->initial_ts;
+      granulepos_to_timestamp_offset (vorbisenc, packet->granulepos);
   GST_BUFFER_DURATION (outbuf) =
       vorbisenc->next_ts - GST_BUFFER_TIMESTAMP (outbuf);
 
@@ -848,10 +836,8 @@ gst_vorbis_enc_buffer_from_packet (GstVorbisEnc * vorbisenc,
     vorbisenc->next_discont = FALSE;
   }
 
-  gst_buffer_set_caps (outbuf, vorbisenc->srccaps);
-
-  GST_LOG_OBJECT (vorbisenc, "encoded buffer of %d bytes",
-      GST_BUFFER_SIZE (outbuf));
+  GST_LOG_OBJECT (vorbisenc, "encoded buffer of %" G_GSIZE_FORMAT " bytes",
+      gst_buffer_get_size (outbuf));
   return outbuf;
 }
 
@@ -864,16 +850,14 @@ gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
   GstBuffer *outbuf;
 
   outbuf = gst_buffer_new_and_alloc (packet->bytes);
-  memcpy (GST_BUFFER_DATA (outbuf), packet->packet, packet->bytes);
+  gst_buffer_fill (outbuf, 0, packet->packet, packet->bytes);
   GST_BUFFER_OFFSET (outbuf) = vorbisenc->bytes_out;
   GST_BUFFER_OFFSET_END (outbuf) = 0;
   GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
   GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
 
-  gst_buffer_set_caps (outbuf, vorbisenc->srccaps);
-
-  GST_DEBUG ("created header packet buffer, %d bytes",
-      GST_BUFFER_SIZE (outbuf));
+  GST_DEBUG ("created header packet buffer, %" G_GSIZE_FORMAT " bytes",
+      gst_buffer_get_size (outbuf));
   return outbuf;
 }
 
@@ -881,7 +865,7 @@ gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
 static GstFlowReturn
 gst_vorbis_enc_push_buffer (GstVorbisEnc * vorbisenc, GstBuffer * buffer)
 {
-  vorbisenc->bytes_out += GST_BUFFER_SIZE (buffer);
+  vorbisenc->bytes_out += gst_buffer_get_size (buffer);
 
   GST_DEBUG_OBJECT (vorbisenc,
       "Pushing buffer with GP %" G_GINT64_FORMAT ", ts %" GST_TIME_FORMAT,
@@ -955,6 +939,15 @@ gst_vorbis_enc_sink_event (GstPad * pad, GstEvent * event)
   vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      res = gst_vorbis_enc_sink_setcaps (vorbisenc, caps);
+      gst_event_unref (event);
+      break;
+    }
     case GST_EVENT_EOS:
       /* Tell the library we're at end of stream so that it can handle
        * the last frame and mark end of stream in the output properly */
@@ -975,23 +968,14 @@ gst_vorbis_enc_sink_event (GstPad * pad, GstEvent * event)
       }
       res = gst_pad_push_event (vorbisenc->srcpad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      gboolean update;
-      gdouble rate, applied_rate;
-      GstFormat format;
-      gint64 start, stop, position;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-          &format, &start, &stop, &position);
-      if (format == GST_FORMAT_TIME) {
-        gst_segment_set_newsegment (&vorbisenc->segment, update, rate, format,
-            start, stop, position);
-        if (vorbisenc->initial_ts == GST_CLOCK_TIME_NONE) {
-          GST_DEBUG_OBJECT (vorbisenc, "Initial segment %" GST_SEGMENT_FORMAT,
-              &vorbisenc->segment);
-          vorbisenc->initial_ts = start;
-        }
+      const GstSegment *segment;
+
+      gst_event_parse_segment (event, &segment);
+
+      if (segment->format == GST_FORMAT_TIME) {
+        gst_segment_copy_into (segment, &vorbisenc->segment);
       }
     }
       /* fall through */
@@ -1008,6 +992,10 @@ gst_vorbis_enc_buffer_check_discontinuous (GstVorbisEnc * vorbisenc,
 {
   gboolean ret = FALSE;
 
+  GST_DEBUG_OBJECT (vorbisenc, "exp %" GST_TIME_FORMAT " time %" GST_TIME_FORMAT
+      "dur %" GST_TIME_FORMAT, GST_TIME_ARGS (vorbisenc->expected_ts),
+      GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration));
+
   if (timestamp != GST_CLOCK_TIME_NONE &&
       vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
       timestamp + duration != vorbisenc->expected_ts) {
@@ -1038,7 +1026,7 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstVorbisEnc *vorbisenc;
   GstFlowReturn ret = GST_FLOW_OK;
-  gfloat *data;
+  gfloat *data, *ptr;
   gulong size;
   gulong i, j;
   float **vorbis_buffer;
@@ -1046,6 +1034,7 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
   gboolean first = FALSE;
   GstClockTime timestamp = GST_CLOCK_TIME_NONE;
   GstClockTime running_time = GST_CLOCK_TIME_NONE;
+  gsize bsize;
 
   vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
 
@@ -1061,9 +1050,9 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
   running_time =
       gst_segment_to_running_time (&vorbisenc->segment, GST_FORMAT_TIME,
       GST_BUFFER_TIMESTAMP (buffer));
-  timestamp = running_time + vorbisenc->initial_ts;
-  GST_DEBUG_OBJECT (vorbisenc, "Initial ts is %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (vorbisenc->initial_ts));
+  timestamp = running_time;
+  GST_DEBUG_OBJECT (vorbisenc, " timestamp %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (timestamp));
   if (!vorbisenc->header_sent) {
     /* Vorbis streams begin with three headers; the initial header (with
        most of the codec setup parameters) which is mandated by the Ogg
@@ -1101,10 +1090,6 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
     GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
     gst_pad_set_caps (vorbisenc->srcpad, caps);
 
-    gst_buffer_set_caps (buf1, caps);
-    gst_buffer_set_caps (buf2, caps);
-    gst_buffer_set_caps (buf3, caps);
-
     /* push out buffers */
     /* push_buffer takes the reference even for failure */
     if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf1)) != GST_FLOW_OK)
@@ -1126,8 +1111,7 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
         (running_time, vorbisenc->frequency, GST_SECOND);
     vorbisenc->subgranule_offset = 0;
     vorbisenc->subgranule_offset =
-        (vorbisenc->next_ts - vorbisenc->initial_ts) -
-        granulepos_to_timestamp_offset (vorbisenc, 0);
+        vorbisenc->next_ts - granulepos_to_timestamp_offset (vorbisenc, 0);
 
     vorbisenc->header_sent = TRUE;
     first = TRUE;
@@ -1137,22 +1121,24 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
       timestamp < vorbisenc->expected_ts) {
     guint64 diff = vorbisenc->expected_ts - timestamp;
     guint64 diff_bytes;
+    gsize size;
 
     GST_WARNING_OBJECT (vorbisenc, "Buffer is older than previous "
         "timestamp + duration (%" GST_TIME_FORMAT "< %" GST_TIME_FORMAT
         "), cannot handle. Clipping buffer.",
         GST_TIME_ARGS (timestamp), GST_TIME_ARGS (vorbisenc->expected_ts));
 
+    size = gst_buffer_get_size (buffer);
+
     diff_bytes =
         GST_CLOCK_TIME_TO_FRAMES (diff,
         vorbisenc->frequency) * vorbisenc->channels * sizeof (gfloat);
-    if (diff_bytes >= GST_BUFFER_SIZE (buffer)) {
+    if (diff_bytes >= size) {
       gst_buffer_unref (buffer);
       return GST_FLOW_OK;
     }
-    buffer = gst_buffer_make_metadata_writable (buffer);
-    GST_BUFFER_DATA (buffer) += diff_bytes;
-    GST_BUFFER_SIZE (buffer) -= diff_bytes;
+    buffer = gst_buffer_make_writable (buffer);
+    gst_buffer_resize (buffer, diff_bytes, size - diff_bytes);
 
     GST_BUFFER_TIMESTAMP (buffer) += diff;
     if (GST_BUFFER_DURATION_IS_VALID (buffer))
@@ -1187,14 +1173,17 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
   }
 
   /* Sending zero samples to libvorbis marks EOS, so we mustn't do that */
-  if (GST_BUFFER_SIZE (buffer) == 0) {
+  data = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_WRITE);
+  if (bsize == 0) {
+    gst_buffer_unmap (buffer, data, bsize);
     gst_buffer_unref (buffer);
     return GST_FLOW_OK;
   }
 
   /* data to encode */
-  data = (gfloat *) GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer) / (vorbisenc->channels * sizeof (float));
+  size = bsize / (vorbisenc->channels * sizeof (float));
+
+  ptr = data;
 
   /* expose the buffer to submit data */
   vorbis_buffer = vorbis_analysis_buffer (&vorbisenc->vd, size);
@@ -1202,12 +1191,13 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
   /* deinterleave samples, write the buffer data */
   for (i = 0; i < size; i++) {
     for (j = 0; j < vorbisenc->channels; j++) {
-      vorbis_buffer[j][i] = *data++;
+      vorbis_buffer[j][i] = *ptr++;
     }
   }
 
   /* tell the library how much we actually submitted */
   vorbis_analysis_wrote (&vorbisenc->vd, size);
+  gst_buffer_unmap (buffer, data, bsize);
 
   GST_LOG_OBJECT (vorbisenc, "wrote %lu samples to vorbis", size);
 
@@ -1392,7 +1382,6 @@ gst_vorbis_enc_change_state (GstElement * element, GstStateChange transition)
       vorbisenc->next_discont = FALSE;
       vorbisenc->header_sent = FALSE;
       gst_segment_init (&vorbisenc->segment, GST_FORMAT_TIME);
-      vorbisenc->initial_ts = GST_CLOCK_TIME_NONE;
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       break;
index 9375a16..840f2bd 100644 (file)
@@ -81,7 +81,6 @@ struct _GstVorbisEnc {
   guint64          granulepos_offset;
   gint64           subgranule_offset;
   GstSegment       segment;
-  GstClockTime     initial_ts;
 
   GstTagList *     tags;
 
index 53fd7b1..f3fccfd 100644 (file)
@@ -72,8 +72,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
     GST_STATIC_CAPS ("audio/x-vorbis")
     );
 
-GST_BOILERPLATE (GstVorbisParse, gst_vorbis_parse, GstElement,
-    GST_TYPE_ELEMENT);
+#define gst_vorbis_parse_parent_class parent_class
+G_DEFINE_TYPE (GstVorbisParse, gst_vorbis_parse, GST_TYPE_ELEMENT);
 
 static GstFlowReturn vorbis_parse_chain (GstPad * pad, GstBuffer * buffer);
 static GstStateChangeReturn vorbis_parse_change_state (GstElement * element,
@@ -87,32 +87,26 @@ static GstFlowReturn vorbis_parse_parse_packet (GstVorbisParse * parse,
     GstBuffer * buf);
 
 static void
-gst_vorbis_parse_base_init (gpointer g_class)
+gst_vorbis_parse_class_init (GstVorbisParseClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+
+  gstelement_class->change_state = vorbis_parse_change_state;
 
-  gst_element_class_add_pad_template (element_class,
+  gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&vorbis_parse_src_factory));
-  gst_element_class_add_pad_template (element_class,
+  gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&vorbis_parse_sink_factory));
-  gst_element_class_set_details_simple (element_class,
+  gst_element_class_set_details_simple (gstelement_class,
       "VorbisParse", "Codec/Parser/Audio",
       "parse raw vorbis streams",
       "Thomas Vander Stichele <thomas at apestaart dot org>");
-}
-
-static void
-gst_vorbis_parse_class_init (GstVorbisParseClass * klass)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
-  gstelement_class->change_state = vorbis_parse_change_state;
 
   klass->parse_packet = GST_DEBUG_FUNCPTR (vorbis_parse_parse_packet);
 }
 
 static void
-gst_vorbis_parse_init (GstVorbisParse * parse, GstVorbisParseClass * g_class)
+gst_vorbis_parse_init (GstVorbisParse * parse)
 {
   parse->sinkpad =
       gst_pad_new_from_static_template (&vorbis_parse_sink_factory, "sink");
@@ -191,57 +185,55 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
   GstCaps *caps;
   GstBuffer *outbuf, *outbuf1, *outbuf2, *outbuf3;
   ogg_packet packet;
+  gsize size;
 
   /* get the headers into the caps, passing them to vorbis as we go */
-  caps = gst_caps_make_writable (gst_pad_get_caps (parse->srcpad));
+  caps = gst_caps_make_writable (gst_pad_get_caps (parse->srcpad, NULL));
   vorbis_parse_set_header_on_caps (parse, caps);
   GST_DEBUG_OBJECT (parse, "here are the caps: %" GST_PTR_FORMAT, caps);
   gst_pad_set_caps (parse->srcpad, caps);
   gst_caps_unref (caps);
 
   outbuf = GST_BUFFER_CAST (parse->streamheader->data);
-  packet.packet = GST_BUFFER_DATA (outbuf);
-  packet.bytes = GST_BUFFER_SIZE (outbuf);
+  packet.packet = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READ);
+  packet.bytes = size;
   packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
   packet.packetno = 1;
   packet.e_o_s = 0;
   packet.b_o_s = 1;
   vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
+  gst_buffer_unmap (outbuf, packet.packet, size);
   parse->sample_rate = parse->vi.rate;
   outbuf1 = outbuf;
 
   outbuf = GST_BUFFER_CAST (parse->streamheader->next->data);
-  packet.packet = GST_BUFFER_DATA (outbuf);
-  packet.bytes = GST_BUFFER_SIZE (outbuf);
+  packet.packet = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READ);
+  packet.bytes = size;
   packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
   packet.packetno = 2;
   packet.e_o_s = 0;
   packet.b_o_s = 0;
   vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
+  gst_buffer_unmap (outbuf, packet.packet, size);
   outbuf2 = outbuf;
 
   outbuf = GST_BUFFER_CAST (parse->streamheader->next->next->data);
-  packet.packet = GST_BUFFER_DATA (outbuf);
-  packet.bytes = GST_BUFFER_SIZE (outbuf);
+  packet.packet = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READ);
+  packet.bytes = size;
   packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
   packet.packetno = 3;
   packet.e_o_s = 0;
   packet.b_o_s = 0;
   vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
+  gst_buffer_unmap (outbuf, packet.packet, size);
   outbuf3 = outbuf;
 
   /* first process queued events */
   vorbis_parse_drain_event_queue (parse);
 
   /* push out buffers, ignoring return value... */
-  outbuf1 = gst_buffer_make_metadata_writable (outbuf1);
-  gst_buffer_set_caps (outbuf1, GST_PAD_CAPS (parse->srcpad));
   gst_pad_push (parse->srcpad, outbuf1);
-  outbuf2 = gst_buffer_make_metadata_writable (outbuf2);
-  gst_buffer_set_caps (outbuf2, GST_PAD_CAPS (parse->srcpad));
   gst_pad_push (parse->srcpad, outbuf2);
-  outbuf3 = gst_buffer_make_metadata_writable (outbuf3);
-  gst_buffer_set_caps (outbuf3, GST_PAD_CAPS (parse->srcpad));
   gst_pad_push (parse->srcpad, outbuf3);
 
   g_list_free (parse->streamheader);
@@ -280,8 +272,6 @@ vorbis_parse_push_buffer (GstVorbisParse * parse, GstBuffer * buf,
   GST_BUFFER_TIMESTAMP (buf) =
       GST_BUFFER_OFFSET (buf) - GST_BUFFER_DURATION (buf);
 
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
   return gst_pad_push (parse->srcpad, buf);
 }
 
@@ -358,16 +348,18 @@ vorbis_parse_queue_buffer (GstVorbisParse * parse, GstBuffer * buf)
   GstFlowReturn ret = GST_FLOW_OK;
   long blocksize;
   ogg_packet packet;
+  gsize size;
 
-  buf = gst_buffer_make_metadata_writable (buf);
+  buf = gst_buffer_make_writable (buf);
 
-  packet.packet = GST_BUFFER_DATA (buf);
-  packet.bytes = GST_BUFFER_SIZE (buf);
+  packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  packet.bytes = size;
   packet.granulepos = GST_BUFFER_OFFSET_END (buf);
   packet.packetno = parse->packetno + parse->buffer_queue->length;
   packet.e_o_s = 0;
 
   blocksize = vorbis_packet_blocksize (&parse->vi, &packet);
+  gst_buffer_unmap (buf, packet.packet, size);
 
   /* temporarily store the sample count in OFFSET -- we overwrite this later */
 
@@ -391,19 +383,18 @@ vorbis_parse_parse_packet (GstVorbisParse * parse, GstBuffer * buf)
 {
   GstFlowReturn ret;
   guint8 *data;
-  guint size;
+  gsize size;
   gboolean have_header;
 
-  data = GST_BUFFER_DATA (buf);
-  size = GST_BUFFER_SIZE (buf);
-
   parse->packetno++;
 
   have_header = FALSE;
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
   if (size >= 1) {
     if (data[0] >= 0x01 && data[0] <= 0x05)
       have_header = TRUE;
   }
+  gst_buffer_unmap (buf, data, size);
 
   if (have_header) {
     if (!parse->streamheader_sent) {
@@ -650,7 +641,7 @@ vorbis_parse_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
index 8a2db41..60dc485 100644 (file)
@@ -63,41 +63,25 @@ GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
 static GstFlowReturn gst_vorbis_tag_parse_packet (GstVorbisParse * parse,
     GstBuffer * buffer);
 
-#define _do_init(type)                                                          \
-  G_STMT_START{                                                                 \
-    static const GInterfaceInfo tag_setter_info = {                             \
-      NULL,                                                                     \
-      NULL,                                                                     \
-      NULL                                                                      \
-    };                                                                          \
-    g_type_add_interface_static (type, GST_TYPE_TAG_SETTER,                     \
-                                 &tag_setter_info);                             \
-  }G_STMT_END
-
-GST_BOILERPLATE_FULL (GstVorbisTag, gst_vorbis_tag, GstVorbisParse,
-    GST_TYPE_VORBIS_PARSE, _do_init);
-
+#define gst_vorbis_tag_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstVorbisTag, gst_vorbis_tag,
+    GST_TYPE_VORBIS_PARSE, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
 
 static void
-gst_vorbis_tag_base_init (gpointer g_class)
+gst_vorbis_tag_class_init (GstVorbisTagClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  GstVorbisParseClass *vorbisparse_class = GST_VORBIS_PARSE_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
   gst_element_class_set_details_simple (element_class,
       "VorbisTag", "Formatter/Metadata",
       "Retags vorbis streams", "James Livingston <doclivingston@gmail.com>");
-}
-
-static void
-gst_vorbis_tag_class_init (GstVorbisTagClass * klass)
-{
-  GstVorbisParseClass *vorbisparse_class = GST_VORBIS_PARSE_CLASS (klass);
 
   vorbisparse_class->parse_packet = gst_vorbis_tag_parse_packet;
 }
 
 static void
-gst_vorbis_tag_init (GstVorbisTag * tagger, GstVorbisTagClass * g_class)
+gst_vorbis_tag_init (GstVorbisTag * tagger)
 {
   /* nothing to do */
 }
@@ -111,9 +95,17 @@ gst_vorbis_tag_parse_packet (GstVorbisParse * parse, GstBuffer * buffer)
   GstVorbisTag *tagger;
   gchar *encoder = NULL;
   GstBuffer *new_buf;
+  guint8 *data;
+  gsize size;
+  gboolean do_parse = FALSE;
 
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
   /* just pass everything except the comments packet */
-  if (GST_BUFFER_SIZE (buffer) >= 1 && GST_BUFFER_DATA (buffer)[0] != 0x03) {
+  if (size >= 1 && data[0] != 0x03)
+    do_parse = TRUE;
+  gst_buffer_unmap (buffer, data, size);
+
+  if (do_parse) {
     return GST_VORBIS_PARSE_CLASS (parent_class)->parse_packet (parse, buffer);
   }
 
@@ -132,7 +124,7 @@ gst_vorbis_tag_parse_packet (GstVorbisParse * parse, GstBuffer * buffer)
   new_buf =
       gst_tag_list_to_vorbiscomment_buffer (new_tags, (guint8 *) "\003vorbis",
       7, encoder);
-  gst_buffer_copy_metadata (new_buf, buffer, GST_BUFFER_COPY_TIMESTAMPS);
+  gst_buffer_copy_into (new_buf, buffer, GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
 
   gst_tag_list_free (new_tags);
   g_free (encoder);
index bbd3df7..85c72fb 100644 (file)
@@ -14,7 +14,7 @@ BUILT_SOURCES = $(built_sources) $(built_headers)
 nodist_libgstapp_@GST_MAJORMINOR@_la_SOURCES = \
              $(built_sources)
 
-libgstapp_@GST_MAJORMINOR@_la_SOURCES = gstappsrc.c gstappbuffer.c gstappsink.c 
+libgstapp_@GST_MAJORMINOR@_la_SOURCES = gstappsrc.c gstappsink.c 
 libgstapp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
        $(GST_BASE_CFLAGS) $(GST_CFLAGS)
 libgstapp_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS)
@@ -24,7 +24,6 @@ libgstapp_@GST_MAJORMINOR@_la_LIBTOOLFLAGS = --tag=disable-static
 libgstapp_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/app
 libgstapp_@GST_MAJORMINOR@include_HEADERS = \
        gstappsrc.h \
-       gstappbuffer.h \
        gstappsink.h
 
 CLEANFILES = $(BUILT_SOURCES)
@@ -46,6 +45,7 @@ GstApp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstapp-@GST_MAJORMINOR@
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                -I$(top_builddir)/gst-libs \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
diff --git a/gst-libs/gst/app/gstappbuffer.c b/gst-libs/gst/app/gstappbuffer.c
deleted file mode 100644 (file)
index 2fa72bb..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-#include <string.h>
-
-#include "gstappbuffer.h"
-
-static void gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class);
-static void gst_app_buffer_class_init (gpointer g_class, gpointer class_data);
-static void gst_app_buffer_finalize (GstAppBuffer * buffer);
-
-static GstBufferClass *parent_class;
-
-GType
-gst_app_buffer_get_type (void)
-{
-  static volatile gsize app_buffer_type = 0;
-
-  if (g_once_init_enter (&app_buffer_type)) {
-    static const GTypeInfo app_buffer_info = {
-      sizeof (GstBufferClass),
-      NULL,
-      NULL,
-      gst_app_buffer_class_init,
-      NULL,
-      NULL,
-      sizeof (GstAppBuffer),
-      0,
-      (GInstanceInitFunc) gst_app_buffer_init,
-      NULL
-    };
-    GType tmp = g_type_register_static (GST_TYPE_BUFFER, "GstAppBuffer",
-        &app_buffer_info, 0);
-    g_once_init_leave (&app_buffer_type, tmp);
-  }
-
-  return (GType) app_buffer_type;
-}
-
-static void
-gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class)
-{
-
-}
-
-static void
-gst_app_buffer_class_init (gpointer g_class, gpointer class_data)
-{
-  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
-  mini_object_class->finalize =
-      (GstMiniObjectFinalizeFunction) gst_app_buffer_finalize;
-
-  parent_class = g_type_class_peek_parent (g_class);
-}
-
-static void
-gst_app_buffer_finalize (GstAppBuffer * buffer)
-{
-  g_return_if_fail (buffer != NULL);
-  g_return_if_fail (GST_IS_APP_BUFFER (buffer));
-
-  if (buffer->finalize) {
-    buffer->finalize (buffer->priv);
-  }
-
-  GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (buffer));
-}
-
-GstBuffer *
-gst_app_buffer_new (void *data, int length,
-    GstAppBufferFinalizeFunc finalize, void *priv)
-{
-  GstAppBuffer *buffer;
-
-  buffer = (GstAppBuffer *) gst_mini_object_new (GST_TYPE_APP_BUFFER);
-
-  GST_BUFFER_DATA (buffer) = data;
-  GST_BUFFER_SIZE (buffer) = length;
-
-  buffer->finalize = finalize;
-  buffer->priv = priv;
-
-  return GST_BUFFER (buffer);
-}
diff --git a/gst-libs/gst/app/gstappbuffer.h b/gst-libs/gst/app/gstappbuffer.h
deleted file mode 100644 (file)
index 532f2ae..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GST_APP_BUFFER_H_
-#define _GST_APP_BUFFER_H_
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_APP_BUFFER \
-  (gst_app_buffer_get_type())
-#define GST_APP_BUFFER(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_BUFFER,GstAppBuffer))
-#define GST_APP_BUFFER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_BUFFER,GstAppBufferClass))
-#define GST_IS_APP_BUFFER(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_BUFFER))
-#define GST_IS_APP_BUFFER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_BUFFER))
-
-typedef struct _GstAppBuffer GstAppBuffer;
-typedef struct _GstAppBufferClass GstAppBufferClass;
-typedef void (*GstAppBufferFinalizeFunc) (void *priv);
-
-struct _GstAppBuffer
-{
-  GstBuffer buffer;
-
-  /*< private >*/
-  GstAppBufferFinalizeFunc finalize;
-  void *priv;
-};
-
-struct _GstAppBufferClass
-{
-  GstBufferClass buffer_class;
-};
-
-GType gst_app_buffer_get_type(void);
-
-GstBuffer *gst_app_buffer_new (void *data, int length,
-    GstAppBufferFinalizeFunc finalize, void *priv);
-
-G_END_DECLS
-
-#endif
-
index 39e3def..4f1ee68 100644 (file)
@@ -164,25 +164,15 @@ static GstFlowReturn gst_app_sink_render (GstBaseSink * psink,
     GstBuffer * buffer);
 static GstFlowReturn gst_app_sink_render_list (GstBaseSink * psink,
     GstBufferList * list);
-static GstCaps *gst_app_sink_getcaps (GstBaseSink * psink);
+static GstCaps *gst_app_sink_getcaps (GstBaseSink * psink, GstCaps * filter);
 static GstMiniObject *gst_app_sink_pull_object (GstAppSink * appsink);
 
 static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 };
 
-static void
-_do_init (GType filesrc_type)
-{
-  static const GInterfaceInfo urihandler_info = {
-    gst_app_sink_uri_handler_init,
-    NULL,
-    NULL
-  };
-  g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
-      &urihandler_info);
-}
-
-GST_BOILERPLATE_FULL (GstAppSink, gst_app_sink, GstBaseSink, GST_TYPE_BASE_SINK,
-    _do_init);
+#define gst_app_sink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAppSink, gst_app_sink, GST_TYPE_BASE_SINK,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
+        gst_app_sink_uri_handler_init));
 
 /* Can't use glib-genmarshal for this, as it doesn't know how to handle
  * GstMiniObject-based types, which are a new fundamental type */
@@ -219,26 +209,14 @@ gst_app_marshal_BUFFER__VOID (GClosure * closure,
 }
 
 static void
-gst_app_sink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
-
-  gst_element_class_set_details_simple (element_class, "AppSink",
-      "Generic/Sink", "Allow the application to get access to raw buffer",
-      "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_app_sink_template));
-}
-
-static void
 gst_app_sink_class_init (GstAppSinkClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *element_class = (GstElementClass *) klass;
   GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
+
   gobject_class->dispose = gst_app_sink_dispose;
   gobject_class->finalize = gst_app_sink_finalize;
 
@@ -425,6 +403,13 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
           pull_buffer_list), NULL, NULL, gst_app_marshal_BUFFER__VOID,
       GST_TYPE_BUFFER_LIST, 0, G_TYPE_NONE);
 
+  gst_element_class_set_details_simple (element_class, "AppSink",
+      "Generic/Sink", "Allow the application to get access to raw buffer",
+      "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_app_sink_template));
+
   basesink_class->unlock = gst_app_sink_unlock_start;
   basesink_class->unlock_stop = gst_app_sink_unlock_stop;
   basesink_class->start = gst_app_sink_start;
@@ -443,7 +428,7 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
 }
 
 static void
-gst_app_sink_init (GstAppSink * appsink, GstAppSinkClass * klass)
+gst_app_sink_init (GstAppSink * appsink)
 {
   GstAppSinkPrivate *priv;
 
@@ -817,10 +802,10 @@ gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer)
 static GstFlowReturn
 gst_app_sink_render_list (GstBaseSink * sink, GstBufferList * list)
 {
-  GstBufferListIterator *it;
   GstFlowReturn flow;
   GstAppSink *appsink;
-  GstBuffer *group;
+  GstBuffer *buffer;
+  guint i, len;
 
   appsink = GST_APP_SINK_CAST (sink);
 
@@ -831,42 +816,33 @@ gst_app_sink_render_list (GstBaseSink * sink, GstBufferList * list)
    * then and push them one-by-one */
   GST_INFO_OBJECT (sink, "chaining each group in list as a merged buffer");
 
-  it = gst_buffer_list_iterate (list);
+  len = gst_buffer_list_len (list);
 
-  if (gst_buffer_list_iterator_next_group (it)) {
-    do {
-      group = gst_buffer_list_iterator_merge_group (it);
-      if (group == NULL) {
-        group = gst_buffer_new ();
-        GST_DEBUG_OBJECT (sink, "chaining empty group");
-      } else {
-        GST_DEBUG_OBJECT (sink, "chaining group");
-      }
-      flow = gst_app_sink_render (sink, group);
-      gst_buffer_unref (group);
-    } while (flow == GST_FLOW_OK && gst_buffer_list_iterator_next_group (it));
-  } else {
-    GST_DEBUG_OBJECT (sink, "chaining empty group");
-    group = gst_buffer_new ();
-    flow = gst_app_sink_render (sink, group);
-    gst_buffer_unref (group);
+  flow = GST_FLOW_OK;
+  for (i = 0; i < len; i++) {
+    buffer = gst_buffer_list_get (list, i);
+    flow = gst_app_sink_render (sink, buffer);
+    if (flow != GST_FLOW_OK)
+      break;
   }
 
-  gst_buffer_list_iterator_free (it);
-
   return flow;
 }
 
 static GstCaps *
-gst_app_sink_getcaps (GstBaseSink * psink)
+gst_app_sink_getcaps (GstBaseSink * psink, GstCaps * filter)
 {
   GstCaps *caps;
   GstAppSink *appsink = GST_APP_SINK_CAST (psink);
   GstAppSinkPrivate *priv = appsink->priv;
 
   GST_OBJECT_LOCK (appsink);
-  if ((caps = priv->caps))
-    gst_caps_ref (caps);
+  if ((caps = priv->caps)) {
+    if (filter)
+      caps = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    else
+      gst_caps_ref (caps);
+  }
   GST_DEBUG_OBJECT (appsink, "got caps %" GST_PTR_FORMAT, caps);
   GST_OBJECT_UNLOCK (appsink);
 
@@ -1383,13 +1359,13 @@ gst_app_sink_set_callbacks (GstAppSink * appsink,
 /*** GSTURIHANDLER INTERFACE *************************************************/
 
 static GstURIType
-gst_app_sink_uri_get_type (void)
+gst_app_sink_uri_get_type (GType type)
 {
   return GST_URI_SINK;
 }
 
 static gchar **
-gst_app_sink_uri_get_protocols (void)
+gst_app_sink_uri_get_protocols (GType type)
 {
   static gchar *protocols[] = { (char *) "appsink", NULL };
 
index fb72c29..1a6a0cd 100644 (file)
@@ -225,7 +225,6 @@ static gboolean gst_app_src_unlock (GstBaseSrc * bsrc);
 static gboolean gst_app_src_unlock_stop (GstBaseSrc * bsrc);
 static gboolean gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment);
 static gboolean gst_app_src_is_seekable (GstBaseSrc * src);
-static gboolean gst_app_src_check_get_range (GstBaseSrc * src);
 static gboolean gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size);
 static gboolean gst_app_src_query (GstBaseSrc * src, GstQuery * query);
 
@@ -234,42 +233,19 @@ static GstFlowReturn gst_app_src_push_buffer_action (GstAppSrc * appsrc,
 
 static guint gst_app_src_signals[LAST_SIGNAL] = { 0 };
 
-static void
-_do_init (GType filesrc_type)
-{
-  static const GInterfaceInfo urihandler_info = {
-    gst_app_src_uri_handler_init,
-    NULL,
-    NULL
-  };
-  g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
-      &urihandler_info);
-}
-
-GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC,
-    _do_init);
-
-static void
-gst_app_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
-
-  gst_element_class_set_details_simple (element_class, "AppSrc",
-      "Generic/Source", "Allow the application to feed buffers to a pipeline",
-      "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_app_src_template));
-}
+#define gst_app_src_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAppSrc, gst_app_src, GST_TYPE_BASE_SRC,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_app_src_uri_handler_init));
 
 static void
 gst_app_src_class_init (GstAppSrcClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *element_class = (GstElementClass *) klass;
   GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass;
 
+  GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
+
   gobject_class->dispose = gst_app_src_dispose;
   gobject_class->finalize = gst_app_src_finalize;
 
@@ -483,6 +459,13 @@ gst_app_src_class_init (GstAppSrcClass * klass)
           end_of_stream), NULL, NULL, __gst_app_marshal_ENUM__VOID,
       GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
 
+  gst_element_class_set_details_simple (element_class, "AppSrc",
+      "Generic/Source", "Allow the application to feed buffers to a pipeline",
+      "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_app_src_template));
+
   basesrc_class->create = gst_app_src_create;
   basesrc_class->start = gst_app_src_start;
   basesrc_class->stop = gst_app_src_stop;
@@ -490,7 +473,6 @@ gst_app_src_class_init (GstAppSrcClass * klass)
   basesrc_class->unlock_stop = gst_app_src_unlock_stop;
   basesrc_class->do_seek = gst_app_src_do_seek;
   basesrc_class->is_seekable = gst_app_src_is_seekable;
-  basesrc_class->check_get_range = gst_app_src_check_get_range;
   basesrc_class->get_size = gst_app_src_do_get_size;
   basesrc_class->get_size = gst_app_src_do_get_size;
   basesrc_class->query = gst_app_src_query;
@@ -502,7 +484,7 @@ gst_app_src_class_init (GstAppSrcClass * klass)
 }
 
 static void
-gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass)
+gst_app_src_init (GstAppSrc * appsrc)
 {
   GstAppSrcPrivate *priv;
 
@@ -766,24 +748,6 @@ gst_app_src_is_seekable (GstBaseSrc * src)
 }
 
 static gboolean
-gst_app_src_check_get_range (GstBaseSrc * src)
-{
-  GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
-  GstAppSrcPrivate *priv = appsrc->priv;
-  gboolean res = FALSE;
-
-  switch (priv->stream_type) {
-    case GST_APP_STREAM_TYPE_STREAM:
-    case GST_APP_STREAM_TYPE_SEEKABLE:
-      break;
-    case GST_APP_STREAM_TYPE_RANDOM_ACCESS:
-      res = TRUE;
-      break;
-  }
-  return res;
-}
-
-static gboolean
 gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size)
 {
   GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
@@ -820,6 +784,22 @@ gst_app_src_query (GstBaseSrc * src, GstQuery * query)
       gst_query_set_latency (query, live, min, max);
       break;
     }
+    case GST_QUERY_SCHEDULING:
+    {
+      gboolean pull_mode = FALSE;
+
+      switch (priv->stream_type) {
+        case GST_APP_STREAM_TYPE_STREAM:
+        case GST_APP_STREAM_TYPE_SEEKABLE:
+          break;
+        case GST_APP_STREAM_TYPE_RANDOM_ACCESS:
+          pull_mode = TRUE;
+          break;
+      }
+      gst_query_set_scheduling (query, pull_mode, TRUE, FALSE, 1, -1, 1);
+      res = TRUE;
+      break;
+    }
     default:
       res = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
       break;
@@ -837,7 +817,7 @@ gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment)
   gint64 desired_position;
   gboolean res = FALSE;
 
-  desired_position = segment->last_stop;
+  desired_position = segment->position;
 
   GST_DEBUG_OBJECT (appsrc, "seeking to %" G_GINT64_FORMAT ", format %s",
       desired_position, gst_format_get_name (segment->format));
@@ -935,7 +915,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
     GST_DEBUG_OBJECT (appsrc,
         "Size changed from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT,
         bsrc->segment.duration, priv->size);
-    gst_segment_set_duration (&bsrc->segment, GST_FORMAT_BYTES, priv->size);
+    bsrc->segment.duration = priv->size;
     GST_OBJECT_UNLOCK (appsrc);
 
     gst_element_post_message (GST_ELEMENT (appsrc),
@@ -973,7 +953,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
       guint buf_size;
 
       *buf = g_queue_pop_head (priv->queue);
-      buf_size = GST_BUFFER_SIZE (*buf);
+      buf_size = gst_buffer_get_size (*buf);
 
       GST_DEBUG_OBJECT (appsrc, "we have buffer %p of size %u", *buf, buf_size);
 
@@ -982,10 +962,6 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
       /* only update the offset when in random_access mode */
       if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS)
         priv->offset += buf_size;
-      if (caps) {
-        *buf = gst_buffer_make_metadata_writable (*buf);
-        gst_buffer_set_caps (*buf, caps);
-      }
 
       /* signal that we removed an item */
       g_cond_broadcast (priv->cond);
@@ -1477,7 +1453,7 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer,
   if (!steal_ref)
     gst_buffer_ref (buffer);
   g_queue_push_tail (priv->queue, buffer);
-  priv->queued_bytes += GST_BUFFER_SIZE (buffer);
+  priv->queued_bytes += gst_buffer_get_size (buffer);
   g_cond_broadcast (priv->cond);
   g_mutex_unlock (priv->mutex);
 
@@ -1630,13 +1606,13 @@ gst_app_src_set_callbacks (GstAppSrc * appsrc,
 /*** GSTURIHANDLER INTERFACE *************************************************/
 
 static GstURIType
-gst_app_src_uri_get_type (void)
+gst_app_src_uri_get_type (GType type)
 {
   return GST_URI_SRC;
 }
 
 static gchar **
-gst_app_src_uri_get_protocols (void)
+gst_app_src_uri_get_protocols (GType type)
 {
   static gchar *protocols[] = { (char *) "appsrc", NULL };
 
index 62f7b15..bf38ead 100644 (file)
@@ -69,7 +69,9 @@ GstAudio-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstaudio-@GST_MAJORMI
                GST_PLUGIN_SYSTEM_PATH="" GST_PLUGIN_PATH="" GST_REGISTRY_UPDATE=no \
                $(INTROSPECTION_SCANNER) -v --namespace GstAudio \
                --nsversion=@GST_MAJORMINOR@ \
+               --warn-all \
                --strip-prefix=Gst \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                -I$(top_builddir)/gst-libs \
                $(gir_cincludes) \
index bf99a52..0f647c6 100644 (file)
 #  include "config.h"
 #endif
 
+#include <string.h>
+
 #include "audio.h"
 #include "audio-enumtypes.h"
 
 #include <gst/gststructure.h>
 
+#define SINT (GST_AUDIO_FORMAT_FLAG_INTEGER | GST_AUDIO_FORMAT_FLAG_SIGNED)
+#define UINT (GST_AUDIO_FORMAT_FLAG_INTEGER)
+
+#define MAKE_FORMAT(str,flags,end,width,depth,silent) \
+  { GST_AUDIO_FORMAT_ ##str, G_STRINGIFY(str), flags, end, width, depth, silent }
+
+#define SILENT_0       { 0, 0, 0, 0, 0, 0, 0, 0 }
+#define SILENT_U8      { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }
+#define SILENT_U16_LE  { 0x00, 0x80,  0x00, 0x80,  0x00, 0x80,  0x00, 0x80 }
+#define SILENT_U16_BE  { 0x80, 0x00,  0x80, 0x00,  0x80, 0x00,  0x80, 0x00 }
+#define SILENT_U24_LE  { 0x00, 0x00, 0x80, 0x00,  0x00, 0x00, 0x80, 0x00 }
+#define SILENT_U24_BE  { 0x00, 0x80, 0x00, 0x00,  0x00, 0x80, 0x00, 0x00 }
+#define SILENT_U32_LE  { 0x00, 0x00, 0x00, 0x80,  0x00, 0x00, 0x00, 0x80 }
+#define SILENT_U32_BE  { 0x80, 0x00, 0x00, 0x00,  0x80, 0x00, 0x00, 0x00 }
+#define SILENT_U24_3LE { 0x00, 0x00, 0x80,  0x00, 0x00, 0x80 }
+#define SILENT_U24_3BE { 0x80, 0x00, 0x00,  0x80, 0x00, 0x00 }
+#define SILENT_U20_3LE { 0x00, 0x00, 0x08,  0x00, 0x00, 0x08 }
+#define SILENT_U20_3BE { 0x08, 0x00, 0x00,  0x08, 0x00, 0x00 }
+#define SILENT_U18_3LE { 0x00, 0x00, 0x02,  0x00, 0x00, 0x02 }
+#define SILENT_U18_3BE { 0x02, 0x00, 0x00,  0x02, 0x00, 0x00 }
+
+static GstAudioFormatInfo formats[] = {
+  {GST_AUDIO_FORMAT_UNKNOWN, "UNKNOWN", 0, 0, 0, 0},
+  /* 8 bit */
+  MAKE_FORMAT (S8, SINT, 0, 8, 8, SILENT_0),
+  MAKE_FORMAT (U8, UINT, 0, 8, 8, SILENT_U8),
+  /* 16 bit */
+  MAKE_FORMAT (S16_LE, SINT, G_LITTLE_ENDIAN, 16, 16, SILENT_0),
+  MAKE_FORMAT (S16_BE, SINT, G_BIG_ENDIAN, 16, 16, SILENT_0),
+  MAKE_FORMAT (U16_LE, UINT, G_LITTLE_ENDIAN, 16, 16, SILENT_U16_LE),
+  MAKE_FORMAT (U16_BE, UINT, G_BIG_ENDIAN, 16, 16, SILENT_U16_BE),
+  /* 24 bit in low 3 bytes of 32 bits */
+  MAKE_FORMAT (S24_LE, SINT, G_LITTLE_ENDIAN, 32, 24, SILENT_0),
+  MAKE_FORMAT (S24_BE, SINT, G_BIG_ENDIAN, 32, 24, SILENT_0),
+  MAKE_FORMAT (U24_LE, UINT, G_LITTLE_ENDIAN, 32, 24, SILENT_U24_LE),
+  MAKE_FORMAT (U24_BE, UINT, G_BIG_ENDIAN, 32, 24, SILENT_U24_BE),
+  /* 32 bit */
+  MAKE_FORMAT (S32_LE, SINT, G_LITTLE_ENDIAN, 32, 32, SILENT_0),
+  MAKE_FORMAT (S32_BE, SINT, G_BIG_ENDIAN, 32, 32, SILENT_0),
+  MAKE_FORMAT (U32_LE, UINT, G_LITTLE_ENDIAN, 32, 32, SILENT_U32_LE),
+  MAKE_FORMAT (U32_BE, UINT, G_BIG_ENDIAN, 32, 32, SILENT_U32_BE),
+  /* 24 bit in 3 bytes */
+  MAKE_FORMAT (S24_3LE, SINT, G_LITTLE_ENDIAN, 24, 24, SILENT_0),
+  MAKE_FORMAT (S24_3BE, SINT, G_BIG_ENDIAN, 24, 24, SILENT_0),
+  MAKE_FORMAT (U24_3LE, UINT, G_LITTLE_ENDIAN, 24, 24, SILENT_U24_3LE),
+  MAKE_FORMAT (U24_3BE, UINT, G_BIG_ENDIAN, 24, 24, SILENT_U24_3BE),
+  /* 20 bit in 3 bytes */
+  MAKE_FORMAT (S20_3LE, SINT, G_LITTLE_ENDIAN, 24, 20, SILENT_0),
+  MAKE_FORMAT (S20_3BE, SINT, G_BIG_ENDIAN, 24, 20, SILENT_0),
+  MAKE_FORMAT (U20_3LE, UINT, G_LITTLE_ENDIAN, 24, 20, SILENT_U20_3LE),
+  MAKE_FORMAT (U20_3BE, UINT, G_BIG_ENDIAN, 24, 20, SILENT_U20_3BE),
+  /* 18 bit in 3 bytes */
+  MAKE_FORMAT (S18_3LE, SINT, G_LITTLE_ENDIAN, 24, 18, SILENT_0),
+  MAKE_FORMAT (S18_3BE, SINT, G_BIG_ENDIAN, 24, 18, SILENT_0),
+  MAKE_FORMAT (U18_3LE, UINT, G_LITTLE_ENDIAN, 24, 18, SILENT_U18_3LE),
+  MAKE_FORMAT (U18_3BE, UINT, G_BIG_ENDIAN, 24, 18, SILENT_U18_3BE),
+  /* float */
+  MAKE_FORMAT (F32_LE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 32, 32,
+      SILENT_0),
+  MAKE_FORMAT (F32_BE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 32, 32,
+      SILENT_0),
+  MAKE_FORMAT (F64_LE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 64, 64,
+      SILENT_0),
+  MAKE_FORMAT (F64_BE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 64, 64,
+      SILENT_0)
+};
+
 /**
- * gst_audio_frame_byte_size:
- * @pad: the #GstPad to get the caps from
+ * gst_audio_format_build_int:
+ * @sign: signed or unsigned format
+ * @endianness: G_LITTLE_ENDIAN or G_BIG_ENDIAN
+ * @width: amount of bits used per sample
+ * @depth: amount of used bits in @width
  *
- * Calculate byte size of an audio frame.
+ * Construct a #GstAudioFormat with given parameters.
  *
- * Returns: the byte size, or 0 if there was an error
+ * Returns: a #GstAudioFormat or GST_AUDIO_FORMAT_UNKNOWN when no audio format
+ * exists with the given parameters.
  */
-int
-gst_audio_frame_byte_size (GstPad * pad)
+GstAudioFormat
+gst_audio_format_build_integer (gboolean sign, gint endianness,
+    gint width, gint depth)
 {
-  /* FIXME: this should be moved closer to the gstreamer core
-   * and be implemented for every mime type IMO
-   */
-
-  int width = 0;
-  int channels = 0;
-  const GstCaps *caps = NULL;
-  GstStructure *structure;
-
-  /* get caps of pad */
-  caps = GST_PAD_CAPS (pad);
-
-  if (caps == NULL) {
-    /* ERROR: could not get caps of pad */
-    g_warning ("gstaudio: could not get caps of pad %s:%s\n",
-        GST_DEBUG_PAD_NAME (pad));
-    return 0;
+  gint i, e;
+
+  for (i = 0; i < G_N_ELEMENTS (formats); i++) {
+    GstAudioFormatInfo *finfo = &formats[i];
+
+    /* must be int */
+    if (!GST_AUDIO_FORMAT_INFO_IS_INTEGER (finfo))
+      continue;
+    /* width and depth must match */
+    if (width != GST_AUDIO_FORMAT_INFO_WIDTH (finfo))
+      continue;
+    if (depth != GST_AUDIO_FORMAT_INFO_DEPTH (finfo))
+      continue;
+    /* if there is endianness, it must match */
+    e = GST_AUDIO_FORMAT_INFO_ENDIANNESS (finfo);
+    if (e && e != endianness)
+      continue;
+    /* check sign */
+    if (sign && !GST_AUDIO_FORMAT_INFO_IS_SIGNED (finfo))
+      continue;
+
+    return GST_AUDIO_FORMAT_INFO_FORMAT (finfo);
   }
+  return GST_AUDIO_FORMAT_UNKNOWN;
+}
 
-  structure = gst_caps_get_structure (caps, 0);
+/**
+ * gst_audio_format_from_string:
+ * @format: a format string
+ *
+ * Convert the @format string to its #GstAudioFormat.
+ *
+ * Returns: the #GstAudioFormat for @format or GST_AUDIO_FORMAT_UNKNOWN when the
+ * string is not a known format.
+ */
+GstAudioFormat
+gst_audio_format_from_string (const gchar * format)
+{
+  guint i;
 
-  gst_structure_get_int (structure, "width", &width);
-  gst_structure_get_int (structure, "channels", &channels);
-  return (width / 8) * channels;
+  for (i = 0; i < G_N_ELEMENTS (formats); i++) {
+    if (strcmp (GST_AUDIO_FORMAT_INFO_NAME (&formats[i]), format) == 0)
+      return GST_AUDIO_FORMAT_INFO_FORMAT (&formats[i]);
+  }
+  return GST_AUDIO_FORMAT_UNKNOWN;
+}
+
+const gchar *
+gst_audio_format_to_string (GstAudioFormat format)
+{
+  g_return_val_if_fail (format != GST_AUDIO_FORMAT_UNKNOWN, NULL);
+
+  if (format >= G_N_ELEMENTS (formats))
+    return NULL;
+
+  return GST_AUDIO_FORMAT_INFO_NAME (&formats[format]);
 }
 
 /**
- * gst_audio_frame_length:
- * @pad: the #GstPad to get the caps from
- * @buf: the #GstBuffer
+ * gst_audio_format_get_info:
+ * @format: a #GstAudioFormat
  *
- * Calculate length of buffer in frames.
+ * Get the #GstAudioFormatInfo for @format
  *
- * Returns: 0 if there's an error, or the number of frames if everything's ok
+ * Returns: The #GstAudioFormatInfo for @format.
  */
-long
-gst_audio_frame_length (GstPad * pad, GstBuffer * buf)
+const GstAudioFormatInfo *
+gst_audio_format_get_info (GstAudioFormat format)
 {
-  /* FIXME: this should be moved closer to the gstreamer core
-   * and be implemented for every mime type IMO
-   */
-  int frame_byte_size = 0;
-
-  frame_byte_size = gst_audio_frame_byte_size (pad);
-  if (frame_byte_size == 0)
-    /* error */
-    return 0;
-  /* FIXME: this function assumes the buffer size to be a whole multiple
-   *        of the frame byte size
-   */
-  return GST_BUFFER_SIZE (buf) / frame_byte_size;
+  g_return_val_if_fail (format != GST_AUDIO_FORMAT_UNKNOWN, NULL);
+  g_return_val_if_fail (format < G_N_ELEMENTS (formats), NULL);
+
+  return &formats[format];
 }
 
 /**
- * gst_audio_duration_from_pad_buffer:
- * @pad: the #GstPad to get the caps from
- * @buf: the #GstBuffer
+ * gst_audio_format_fill_silence:
+ * @info: a #GstAudioFormatInfo
+ * @dest: a destination to fill
+ * @length: the length to fill
  *
- * Calculate length in nanoseconds of audio buffer @buf based on capabilities of
- * @pad.
- *
- * Returns: the length.
+ * Fill @length bytes in @dest with silence samples for @info.
  */
-GstClockTime
-gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf)
+void
+gst_audio_format_fill_silence (const GstAudioFormatInfo * info,
+    gpointer dest, gsize length)
 {
-  long bytes = 0;
-  int width = 0;
-  int channels = 0;
-  int rate = 0;
-
-  GstClockTime length;
-
-  const GstCaps *caps = NULL;
-  GstStructure *structure;
-
-  g_assert (GST_IS_BUFFER (buf));
-  /* get caps of pad */
-  caps = GST_PAD_CAPS (pad);
-  if (caps == NULL) {
-    /* ERROR: could not get caps of pad */
-    g_warning ("gstaudio: could not get caps of pad %s:%s\n",
-        GST_DEBUG_PAD_NAME (pad));
-    length = GST_CLOCK_TIME_NONE;
+  guint8 *dptr = dest;
+
+  g_return_if_fail (info != NULL);
+  g_return_if_fail (dest != NULL);
+
+  if (info->flags & GST_AUDIO_FORMAT_FLAG_FLOAT ||
+      info->flags & GST_AUDIO_FORMAT_FLAG_SIGNED) {
+    /* float or signed always 0 */
+    memset (dest, 0, length);
   } else {
-    structure = gst_caps_get_structure (caps, 0);
-    bytes = GST_BUFFER_SIZE (buf);
-    gst_structure_get_int (structure, "width", &width);
-    gst_structure_get_int (structure, "channels", &channels);
-    gst_structure_get_int (structure, "rate", &rate);
-
-    g_assert (bytes != 0);
-    g_assert (width != 0);
-    g_assert (channels != 0);
-    g_assert (rate != 0);
-    length = (bytes * 8 * GST_SECOND) / (rate * channels * width);
+    gint i, j, bps = info->width >> 3;
+
+    switch (bps) {
+      case 1:
+        memset (dest, info->silence[0], length);
+        break;
+      default:
+        for (i = 0; i < length; i += bps) {
+          for (j = 0; j < bps; j++)
+            *dptr++ = info->silence[j];
+        }
+        break;
+    }
   }
-  return length;
 }
 
+
 /**
- * gst_audio_is_buffer_framed:
- * @pad: the #GstPad to get the caps from
- * @buf: the #GstBuffer
+ * gst_audio_info_init:
+ * @info: a #GstAudioInfo
  *
- * Check if the buffer size is a whole multiple of the frame size.
- *
- * Returns: %TRUE if buffer size is multiple.
+ * Initialize @info with default values.
  */
-gboolean
-gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf)
+void
+gst_audio_info_init (GstAudioInfo * info)
 {
-  if (GST_BUFFER_SIZE (buf) % gst_audio_frame_byte_size (pad) == 0)
-    return TRUE;
-  else
-    return FALSE;
+  g_return_if_fail (info != NULL);
+
+  memset (info, 0, sizeof (GstAudioInfo));
 }
 
-/* _getcaps helper functions
- * sets structure fields to default for audio type
- * flag determines which structure fields to set to default
- * keep these functions in sync with the templates in audio.h
+/**
+ * gst_audio_info_set_format:
+ * @info: a #GstAudioInfo
+ * @format: the format
+ * @rate: the samplerate
+ * @channels: the number of channels
+ *
+ * Set the default info for the audio info of @format and @rate and @channels.
  */
+void
+gst_audio_info_set_format (GstAudioInfo * info, GstAudioFormat format,
+    gint rate, gint channels)
+{
+  const GstAudioFormatInfo *finfo;
+
+  g_return_if_fail (info != NULL);
+  g_return_if_fail (format != GST_AUDIO_FORMAT_UNKNOWN);
+
+  finfo = &formats[format];
+
+  info->flags = 0;
+  info->finfo = finfo;
+  info->rate = rate;
+  info->channels = channels;
+  info->bpf = (finfo->width * channels) / 8;
+}
 
-/* private helper function
- * sets a list on the structure
- * pass in structure, fieldname for the list, type of the list values,
- * number of list values, and each of the values, terminating with NULL
+/**
+ * gst_audio_info_from_caps:
+ * @info: a #GstAudioInfo
+ * @caps: a #GstCaps
+ *
+ * Parse @caps and update @info.
+ *
+ * Returns: TRUE if @caps could be parsed
  */
-static void
-_gst_audio_structure_set_list (GstStructure * structure,
-    const gchar * fieldname, GType type, int number, ...)
+gboolean
+gst_audio_info_from_caps (GstAudioInfo * info, const GstCaps * caps)
 {
-  va_list varargs;
-  GValue value = { 0 };
-  GArray *array;
-  int j;
+  GstStructure *str;
+  const gchar *s;
+  GstAudioFormat format;
+  gint rate, channels;
+  const GValue *pos_val_arr, *pos_val_entry;
+  gint i;
 
-  g_return_if_fail (structure != NULL);
+  g_return_val_if_fail (info != NULL, FALSE);
+  g_return_val_if_fail (caps != NULL, FALSE);
+  g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
 
-  g_value_init (&value, GST_TYPE_LIST);
-  array = g_value_peek_pointer (&value);
+  GST_DEBUG ("parsing caps %" GST_PTR_FORMAT, caps);
 
-  va_start (varargs, number);
+  str = gst_caps_get_structure (caps, 0);
 
-  for (j = 0; j < number; ++j) {
-    int i;
-    gboolean b;
+  if (!gst_structure_has_name (str, "audio/x-raw"))
+    goto wrong_name;
 
-    GValue list_value = { 0 };
+  if (!(s = gst_structure_get_string (str, "format")))
+    goto no_format;
 
-    switch (type) {
-      case G_TYPE_INT:
-        i = va_arg (varargs, int);
+  format = gst_audio_format_from_string (s);
+  if (format == GST_AUDIO_FORMAT_UNKNOWN)
+    goto unknown_format;
 
-        g_value_init (&list_value, G_TYPE_INT);
-        g_value_set_int (&list_value, i);
-        break;
-      case G_TYPE_BOOLEAN:
-        b = va_arg (varargs, gboolean);
-        g_value_init (&list_value, G_TYPE_BOOLEAN);
-        g_value_set_boolean (&list_value, b);
-        break;
-      default:
-        g_warning
-            ("_gst_audio_structure_set_list: LIST of given type not implemented.");
+  if (!gst_structure_get_int (str, "rate", &rate))
+    goto no_rate;
+  if (!gst_structure_get_int (str, "channels", &channels))
+    goto no_channels;
+
+  gst_audio_info_set_format (info, format, rate, channels);
+
+  pos_val_arr = gst_structure_get_value (str, "channel-positions");
+  if (pos_val_arr) {
+    guint max_pos = MAX (channels, 64);
+    for (i = 0; i < max_pos; i++) {
+      pos_val_entry = gst_value_array_get_value (pos_val_arr, i);
+      info->position[i] = g_value_get_enum (pos_val_entry);
     }
-    g_array_append_val (array, list_value);
+  } else {
+    info->flags |= GST_AUDIO_FLAG_UNPOSITIONED;
+  }
+
+  return TRUE;
 
+  /* ERROR */
+wrong_name:
+  {
+    GST_ERROR ("wrong name, expected audio/x-raw");
+    return FALSE;
+  }
+no_format:
+  {
+    GST_ERROR ("no format given");
+    return FALSE;
+  }
+unknown_format:
+  {
+    GST_ERROR ("unknown format given");
+    return FALSE;
+  }
+no_rate:
+  {
+    GST_ERROR ("no rate property given");
+    return FALSE;
+  }
+no_channels:
+  {
+    GST_ERROR ("no channels property given");
+    return FALSE;
   }
-  gst_structure_set_value (structure, fieldname, &value);
-  va_end (varargs);
 }
 
 /**
- * gst_audio_structure_set_int:
- * @structure: a #GstStructure
- * @flag: a set of #GstAudioFieldFlag
+ * gst_audio_info_to_caps:
+ * @info: a #GstAudioInfo
  *
- * Do not use anymore.
+ * Convert the values of @info into a #GstCaps.
  *
- * Deprecated: use gst_structure_set()
+ * Returns: (transfer full): the new #GstCaps containing the
+ *          info of @info.
  */
-#ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-typedef enum
+GstCaps *
+gst_audio_info_to_caps (GstAudioInfo * info)
 {
-  GST_AUDIO_FIELD_RATE = (1 << 0),
-  GST_AUDIO_FIELD_CHANNELS = (1 << 1),
-  GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
-  GST_AUDIO_FIELD_WIDTH = (1 << 3),
-  GST_AUDIO_FIELD_DEPTH = (1 << 4),
-  GST_AUDIO_FIELD_SIGNED = (1 << 5),
-} GstAudioFieldFlag;
-void
-gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag);
-#endif /* GST_DISABLE_DEPRECATED */
+  GstCaps *caps;
+  const gchar *format;
+
+  g_return_val_if_fail (info != NULL, NULL);
+  g_return_val_if_fail (info->finfo != NULL, NULL);
+  g_return_val_if_fail (info->finfo->format != GST_AUDIO_FORMAT_UNKNOWN, NULL);
+
+  format = gst_audio_format_to_string (info->finfo->format);
+  g_return_val_if_fail (format != NULL, NULL);
+
+  caps = gst_caps_new_simple ("audio/x-raw",
+      "format", G_TYPE_STRING, format,
+      "rate", G_TYPE_INT, info->rate,
+      "channels", G_TYPE_INT, info->channels, NULL);
+
+  if (info->channels > 2) {
+    GValue pos_val_arr = { 0 }
+    , pos_val_entry = {
+    0};
+    gint i, max_pos;
+    GstStructure *str;
+
+    /* build gvaluearray from positions */
+    g_value_init (&pos_val_arr, GST_TYPE_ARRAY);
+    g_value_init (&pos_val_entry, GST_TYPE_AUDIO_CHANNEL_POSITION);
+    max_pos = MAX (info->channels, 64);
+    for (i = 0; i < max_pos; i++) {
+      g_value_set_enum (&pos_val_entry, info->position[i]);
+      gst_value_array_append_value (&pos_val_arr, &pos_val_entry);
+    }
+    g_value_unset (&pos_val_entry);
 
-void
-gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag)
-{
-  /* was added here:
-   * http://webcvs.freedesktop.org/gstreamer/gst-plugins-base/gst-libs/gst/audio/audio.c?r1=1.16&r2=1.17
-   * but it is not used
-   */
-  if (flag & GST_AUDIO_FIELD_RATE)
-    gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        NULL);
-  if (flag & GST_AUDIO_FIELD_CHANNELS)
-    gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        NULL);
-  if (flag & GST_AUDIO_FIELD_ENDIANNESS)
-    _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2,
-        G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
-  if (flag & GST_AUDIO_FIELD_WIDTH)
-    _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32,
-        NULL);
-  if (flag & GST_AUDIO_FIELD_DEPTH)
-    gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
-  if (flag & GST_AUDIO_FIELD_SIGNED)
-    _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE,
-        FALSE, NULL);
+    /* add to structure */
+    str = gst_caps_get_structure (caps, 0);
+    gst_structure_set_value (str, "channel-positions", &pos_val_arr);
+    g_value_unset (&pos_val_arr);
+  }
+
+  return caps;
 }
-#endif /* GST_REMOVE_DEPRECATED */
 
 /**
  * gst_audio_buffer_clip:
  * @buffer: The buffer to clip.
- * @segment: Segment in %GST_FORMAT_TIME or %GST_FORMAT_DEFAULT to which the buffer should be clipped.
+ * @segment: Segment in %GST_FORMAT_TIME or %GST_FORMAT_DEFAULT to which
+ *           the buffer should be clipped.
  * @rate: sample rate.
- * @frame_size: size of one audio frame in bytes.
+ * @bpf: size of one audio frame in bytes. This is the size of one sample
+ * * channels.
  *
  * Clip the the buffer to the given %GstSegment.
  *
- * After calling this function the caller does not own a reference to 
+ * After calling this function the caller does not own a reference to
  * @buffer anymore.
  *
  * Returns: %NULL if the buffer is completely outside the configured segment,
  * otherwise the clipped buffer is returned.
  *
  * If the buffer has no timestamp, it is assumed to be inside the segment and
- * is not clipped 
+ * is not clipped
  *
  * Since: 0.10.14
  */
 GstBuffer *
 gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
-    gint frame_size)
+    gint bpf)
 {
   GstBuffer *ret;
   GstClockTime timestamp = GST_CLOCK_TIME_NONE, duration = GST_CLOCK_TIME_NONE;
   guint64 offset = GST_BUFFER_OFFSET_NONE, offset_end = GST_BUFFER_OFFSET_NONE;
-  guint8 *data;
-  guint size;
-
+  gsize trim, size;
   gboolean change_duration = TRUE, change_offset = TRUE, change_offset_end =
       TRUE;
 
@@ -313,15 +455,16 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
    * Calculate the missing values for the calculations,
    * they won't be changed later though. */
 
-  data = GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer);
+  trim = 0;
+  size = gst_buffer_get_size (buffer);
 
   timestamp = GST_BUFFER_TIMESTAMP (buffer);
+  GST_DEBUG ("timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp));
   if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
     duration = GST_BUFFER_DURATION (buffer);
   } else {
     change_duration = FALSE;
-    duration = gst_util_uint64_scale (size / frame_size, GST_SECOND, rate);
+    duration = gst_util_uint64_scale (size / bpf, GST_SECOND, rate);
   }
 
   if (GST_BUFFER_OFFSET_IS_VALID (buffer)) {
@@ -335,13 +478,13 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
     offset_end = GST_BUFFER_OFFSET_END (buffer);
   } else {
     change_offset_end = FALSE;
-    offset_end = offset + size / frame_size;
+    offset_end = offset + size / bpf;
   }
 
   if (segment->format == GST_FORMAT_TIME) {
     /* Handle clipping for GST_FORMAT_TIME */
 
-    gint64 start, stop, cstart, cstop, diff;
+    guint64 start, stop, cstart, cstop, diff;
 
     start = timestamp;
     stop = timestamp + duration;
@@ -359,8 +502,8 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
         diff = gst_util_uint64_scale (diff, rate, GST_SECOND);
         if (change_offset)
           offset += diff;
-        data += diff * frame_size;
-        size -= diff * frame_size;
+        trim += diff * bpf;
+        size -= diff * bpf;
       }
 
       diff = stop - cstop;
@@ -371,7 +514,7 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
         diff = gst_util_uint64_scale (diff, rate, GST_SECOND);
         if (change_offset_end)
           offset_end -= diff;
-        size -= diff * frame_size;
+        size -= diff * bpf;
       }
     } else {
       gst_buffer_unref (buffer);
@@ -379,7 +522,7 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
     }
   } else {
     /* Handle clipping for GST_FORMAT_DEFAULT */
-    gint64 start, stop, cstart, cstop, diff;
+    guint64 start, stop, cstart, cstop, diff;
 
     g_return_val_if_fail (GST_BUFFER_OFFSET_IS_VALID (buffer), buffer);
 
@@ -398,8 +541,8 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
         if (change_duration)
           duration -= gst_util_uint64_scale (diff, GST_SECOND, rate);
 
-        data += diff * frame_size;
-        size -= diff * frame_size;
+        trim += diff * bpf;
+        size -= diff * bpf;
       }
 
       diff = stop - cstop;
@@ -409,7 +552,7 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
         if (change_duration)
           duration -= gst_util_uint64_scale (diff, GST_SECOND, rate);
 
-        size -= diff * frame_size;
+        size -= diff * bpf;
       }
     } else {
       gst_buffer_unref (buffer);
@@ -417,12 +560,13 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
     }
   }
 
-  /* Get a metadata writable buffer and apply all changes */
-  ret = gst_buffer_make_metadata_writable (buffer);
+  /* Get a writable buffer and apply all changes */
+  GST_DEBUG ("trim %" G_GSIZE_FORMAT " size %" G_GSIZE_FORMAT, trim, size);
+  ret = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, trim, size);
+  gst_buffer_unref (buffer);
 
+  GST_DEBUG ("timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp));
   GST_BUFFER_TIMESTAMP (ret) = timestamp;
-  GST_BUFFER_SIZE (ret) = size;
-  GST_BUFFER_DATA (ret) = data;
 
   if (change_duration)
     GST_BUFFER_DURATION (ret) = duration;
index 43bf594..e60312d 100644 (file)
@@ -1,6 +1,7 @@
 /* GStreamer
  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
  * Library       <2001> Thomas Vander Stichele <thomas@apestaart.org>
+ *               <2011> Wim Taymans <wim.taymans@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
 #ifndef __GST_AUDIO_AUDIO_H__
 #define __GST_AUDIO_AUDIO_H__
 
+#include <gst/audio/multichannel.h>
+
 G_BEGIN_DECLS
 
-/* For people that are looking at this source: the purpose of these defines is
- * to make GstCaps a bit easier, in that you don't have to know all of the
- * properties that need to be defined. you can just use these macros. currently
- * (8/01) the only plugins that use these are the passthrough, speed, volume,
- * adder, and [de]interleave plugins. These are for convenience only, and do not
- * specify the 'limits' of GStreamer. you might also use these definitions as a
- * base for making your own caps, if need be.
+/**
+ * GstAudioFormat:
+ * @GST_AUDIO_FORMAT_UNKNOWN: unknown audio format
+ * @GST_AUDIO_FORMAT_S8: sample
+ * @GST_AUDIO_FORMAT_U8: sample
+ * @GST_AUDIO_FORMAT_S16_LE: sample
+ * @GST_AUDIO_FORMAT_S16_BE: sample
+ * @GST_AUDIO_FORMAT_U16_LE: sample
+ * @GST_AUDIO_FORMAT_U16_BE: sample
+ * @GST_AUDIO_FORMAT_S24_LE: sample
+ * @GST_AUDIO_FORMAT_S24_BE: sample
+ * @GST_AUDIO_FORMAT_U24_LE: sample
+ * @GST_AUDIO_FORMAT_U24_BE: sample
+ * @GST_AUDIO_FORMAT_S32_LE: sample
+ * @GST_AUDIO_FORMAT_S32_BE: sample
+ * @GST_AUDIO_FORMAT_U32_LE: sample
+ * @GST_AUDIO_FORMAT_U32_BE: sample
+ * @GST_AUDIO_FORMAT_S24_3LE: sample
+ * @GST_AUDIO_FORMAT_S24_3BE: sample
+ * @GST_AUDIO_FORMAT_U24_3LE: sample
+ * @GST_AUDIO_FORMAT_U24_3BE: sample
+ * @GST_AUDIO_FORMAT_S20_3LE: sample
+ * @GST_AUDIO_FORMAT_S20_3BE: sample
+ * @GST_AUDIO_FORMAT_U20_3LE: sample
+ * @GST_AUDIO_FORMAT_U20_3BE: sample
+ * @GST_AUDIO_FORMAT_S18_3LE: sample
+ * @GST_AUDIO_FORMAT_S18_3BE: sample
+ * @GST_AUDIO_FORMAT_U18_3LE: sample
+ * @GST_AUDIO_FORMAT_U18_3BE: sample
+ * @GST_AUDIO_FORMAT_F32_LE: sample
+ * @GST_AUDIO_FORMAT_F32_BE: sample
+ * @GST_AUDIO_FORMAT_F64_LE: sample
+ * @GST_AUDIO_FORMAT_F64_BE: sample
  *
- * For example, to make a source pad that can output streams of either mono
- * float or any channel int:
+ * Enum value describing the most common audio formats.
+ */
+typedef enum {
+  GST_AUDIO_FORMAT_UNKNOWN,
+  /* 8 bit */
+  GST_AUDIO_FORMAT_S8,
+  GST_AUDIO_FORMAT_U8,
+  /* 16 bit */
+  GST_AUDIO_FORMAT_S16_LE,
+  GST_AUDIO_FORMAT_S16_BE,
+  GST_AUDIO_FORMAT_U16_LE,
+  GST_AUDIO_FORMAT_U16_BE,
+  /* 24 bit in low 3 bytes of 32 bits*/
+  GST_AUDIO_FORMAT_S24_LE,
+  GST_AUDIO_FORMAT_S24_BE,
+  GST_AUDIO_FORMAT_U24_LE,
+  GST_AUDIO_FORMAT_U24_BE,
+  /* 32 bit */
+  GST_AUDIO_FORMAT_S32_LE,
+  GST_AUDIO_FORMAT_S32_BE,
+  GST_AUDIO_FORMAT_U32_LE,
+  GST_AUDIO_FORMAT_U32_BE,
+  /* 24 bit in 3 bytes*/
+  GST_AUDIO_FORMAT_S24_3LE,
+  GST_AUDIO_FORMAT_S24_3BE,
+  GST_AUDIO_FORMAT_U24_3LE,
+  GST_AUDIO_FORMAT_U24_3BE,
+  /* 20 bit in 3 bytes*/
+  GST_AUDIO_FORMAT_S20_3LE,
+  GST_AUDIO_FORMAT_S20_3BE,
+  GST_AUDIO_FORMAT_U20_3LE,
+  GST_AUDIO_FORMAT_U20_3BE,
+  /* 18 bit in 3 bytes*/
+  GST_AUDIO_FORMAT_S18_3LE,
+  GST_AUDIO_FORMAT_S18_3BE,
+  GST_AUDIO_FORMAT_U18_3LE,
+  GST_AUDIO_FORMAT_U18_3BE,
+  /* float */
+  GST_AUDIO_FORMAT_F32_LE,
+  GST_AUDIO_FORMAT_F32_BE,
+  GST_AUDIO_FORMAT_F64_LE,
+  GST_AUDIO_FORMAT_F64_BE,
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+  GST_AUDIO_FORMAT_S16 = GST_AUDIO_FORMAT_S16_BE,
+  GST_AUDIO_FORMAT_U16 = GST_AUDIO_FORMAT_U16_BE,
+  GST_AUDIO_FORMAT_S24 = GST_AUDIO_FORMAT_S24_BE,
+  GST_AUDIO_FORMAT_U24 = GST_AUDIO_FORMAT_U24_BE,
+  GST_AUDIO_FORMAT_S32 = GST_AUDIO_FORMAT_S32_BE,
+  GST_AUDIO_FORMAT_U32 = GST_AUDIO_FORMAT_U32_BE,
+  GST_AUDIO_FORMAT_S24_3 = GST_AUDIO_FORMAT_S24_3BE,
+  GST_AUDIO_FORMAT_U24_3 = GST_AUDIO_FORMAT_U24_3BE,
+  GST_AUDIO_FORMAT_S20_3 = GST_AUDIO_FORMAT_S20_3BE,
+  GST_AUDIO_FORMAT_U20_3 = GST_AUDIO_FORMAT_U20_3BE,
+  GST_AUDIO_FORMAT_S18_3 = GST_AUDIO_FORMAT_S18_3BE,
+  GST_AUDIO_FORMAT_U18_3 = GST_AUDIO_FORMAT_U18_3BE,
+  GST_AUDIO_FORMAT_F32 = GST_AUDIO_FORMAT_F32_BE,
+  GST_AUDIO_FORMAT_F64 = GST_AUDIO_FORMAT_F64_BE
+#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
+  GST_AUDIO_FORMAT_S16 = GST_AUDIO_FORMAT_S16_LE,
+  GST_AUDIO_FORMAT_U16 = GST_AUDIO_FORMAT_U16_LE,
+  GST_AUDIO_FORMAT_S24 = GST_AUDIO_FORMAT_S24_LE,
+  GST_AUDIO_FORMAT_U24 = GST_AUDIO_FORMAT_U24_LE,
+  GST_AUDIO_FORMAT_S32 = GST_AUDIO_FORMAT_S32_LE,
+  GST_AUDIO_FORMAT_U32 = GST_AUDIO_FORMAT_U32_LE,
+  GST_AUDIO_FORMAT_S24_3 = GST_AUDIO_FORMAT_S24_3LE,
+  GST_AUDIO_FORMAT_U24_3 = GST_AUDIO_FORMAT_U24_3LE,
+  GST_AUDIO_FORMAT_S20_3 = GST_AUDIO_FORMAT_S20_3LE,
+  GST_AUDIO_FORMAT_U20_3 = GST_AUDIO_FORMAT_U20_3LE,
+  GST_AUDIO_FORMAT_S18_3 = GST_AUDIO_FORMAT_S18_3LE,
+  GST_AUDIO_FORMAT_U18_3 = GST_AUDIO_FORMAT_U18_3LE,
+  GST_AUDIO_FORMAT_F32 = GST_AUDIO_FORMAT_F32_LE,
+  GST_AUDIO_FORMAT_F64 = GST_AUDIO_FORMAT_F64_LE
+#endif
+} GstAudioFormat;
+
+typedef struct _GstAudioFormatInfo GstAudioFormatInfo;
+typedef struct _GstAudioInfo GstAudioInfo;
+
+/**
+ * GstAudioFormatFlags:
+ * @GST_AUDIO_FORMAT_FLAG_INTEGER: integer samples
+ * @GST_AUDIO_FORMAT_FLAG_FLOAT: float samples
+ * @GST_AUDIO_FORMAT_FLAG_SIGNED: signed samples
+ * @GST_AUDIO_FORMAT_FLAG_COMPLEX: complex layout
  *
- *  template = gst_pad_template_new
- *    ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- *    gst_caps_append(gst_caps_new ("sink_int",  "audio/x-raw-int",
- *                                  GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
- *                    gst_caps_new ("sink_float", "audio/x-raw-float",
- *                                  GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS)),
- *    NULL);
+ * The different audio flags that a format info can have.
+ */
+typedef enum
+{
+  GST_AUDIO_FORMAT_FLAG_INTEGER  = (1 << 0),
+  GST_AUDIO_FORMAT_FLAG_FLOAT    = (1 << 1),
+  GST_AUDIO_FORMAT_FLAG_SIGNED   = (1 << 2),
+  GST_AUDIO_FORMAT_FLAG_COMPLEX  = (1 << 4)
+} GstAudioFormatFlags;
+
+/**
+ * GstAudioFormatUnpack:
+ * @info: a #GstAudioFormatInfo
+ * @dest: a destination array
+ * @data: pointer to the audio data
+ * @length: the amount of samples to unpack.
  *
- *  sinkpad = gst_pad_new_from_template(template, "sink");
+ * Unpacks @length samples from the given data of format @info.
+ * The samples will be unpacked into @dest which each channel
+ * interleaved. @dest should at least be big enough to hold @length *
+ * channels * unpack_size bytes.
+ */
+typedef void (*GstAudioFormatUnpack)         (GstAudioFormatInfo *info, gpointer dest,
+                                              const gpointer data, gint length);
+/**
+ * GstAudioFormatPack:
+ * @info: a #GstAudioFormatInfo
+ * @src: a source array
+ * @data: pointer to the destination data
+ * @length: the amount of samples to pack.
  *
- * Andy Wingo, 18 August 2001
- * Thomas, 6 September 2002 */
+ * Packs @length samples from @src to the data array in format @info.
+ * The samples from source have each channel interleaved
+ * and will be packed into @data.
+ */
+typedef void (*GstAudioFormatPack)           (GstAudioFormatInfo *info, const gpointer src,
+                                              gpointer data, gint length);
 
-/* conversion macros */
 /**
- * GST_FRAMES_TO_CLOCK_TIME:
- * @frames: sample frames
- * @rate: sampling rate
- * 
- * Calculate clocktime from sample @frames and @rate.
+ * GstAudioFormatInfo:
+ * @format: #GstAudioFormat
+ * @name: string representation of the format
+ * @flags: #GstAudioFormatFlags
+ * @endianness: the endianness
+ * @width: amount of bits used for one sample
+ * @depth: amount of valid bits in @width
+ * @silence: @width/8 bytes with 1 silent sample
+ * @unpack_size: number of bytes for the unpack functions
+ * @unpack_func: function to unpack samples
+ * @pack_func: function to pack samples
+ *
+ * Information for an audio format.
  */
-#define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
-  ((GstClockTime) gst_util_uint64_scale_round (frames, GST_SECOND, rate))
+struct _GstAudioFormatInfo {
+  GstAudioFormat format;
+  const gchar *name;
+  GstAudioFormatFlags flags;
+  gint endianness;
+  gint width;
+  gint depth;
+  guint8 silence[8];
+  guint unpack_size;
+  GstAudioFormatUnpack unpack_func;
+  GstAudioFormatPack pack_func;
+};
 
+#define GST_AUDIO_FORMAT_INFO_FORMAT(info)       ((info)->format)
+#define GST_AUDIO_FORMAT_INFO_NAME(info)         ((info)->name)
+#define GST_AUDIO_FORMAT_INFO_FLAGS(info)        ((info)->flags)
+
+#define GST_AUDIO_FORMAT_INFO_IS_INTEGER(info)   ((info)->flags & GST_AUDIO_FORMAT_FLAG_INTEGER)
+#define GST_AUDIO_FORMAT_INFO_IS_FLOAT(info)     ((info)->flags & GST_AUDIO_FORMAT_FLAG_FLOAT)
+#define GST_AUDIO_FORMAT_INFO_IS_SIGNED(info)    ((info)->flags & GST_AUDIO_FORMAT_FLAG_SIGNED)
+
+#define GST_AUDIO_FORMAT_INFO_ENDIANNESS(info)   ((info)->endianness)
+#define GST_AUDIO_FORMAT_INFO_IS_LE(info)        ((info)->endianness == G_LITTLE_ENDIAN)
+#define GST_AUDIO_FORMAT_INFO_IS_BE(info)        ((info)->endianness == G_BIG_ENDIAN)
+#define GST_AUDIO_FORMAT_INFO_WIDTH(info)        ((info)->width)
+#define GST_AUDIO_FORMAT_INFO_DEPTH(info)        ((info)->depth)
+
+
+GstAudioFormat gst_audio_format_build_integer    (gboolean sign, gint endianness,
+                                                  gint width, gint depth) G_GNUC_CONST;
+
+GstAudioFormat gst_audio_format_from_string      (const gchar *format) G_GNUC_CONST;
+const gchar *  gst_audio_format_to_string        (GstAudioFormat format) G_GNUC_CONST;
+
+const GstAudioFormatInfo *
+               gst_audio_format_get_info         (GstAudioFormat format) G_GNUC_CONST;
+
+void           gst_audio_format_fill_silence     (const GstAudioFormatInfo *info,
+                                                  gpointer dest, gsize length);
 /**
- * GST_CLOCK_TIME_TO_FRAMES:
- * @clocktime: clock time
- * @rate: sampling rate
- * 
- * Calculate frames from @clocktime and sample @rate.
+ * GstAudioFlags:
+ * @GST_AUDIO_FLAG_NONE: no valid flag
+ * @GST_AUDIO_FLAG_UNPOSITIONED: unpositioned audio layout, position array
+ *     contains the default layout.
+ *
+ * Extra audio flags
  */
-#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
-  gst_util_uint64_scale_round (clocktime, rate, GST_SECOND)
+typedef enum {
+  GST_AUDIO_FLAG_NONE         = 0,
+  GST_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
+} GstAudioFlags;
+
+/**
+ * GstAudioInfo:
+ * @finfo: the format info of the audio
+ * @flags: additional audio flags
+ * @rate: the audio sample rate
+ * @channels: the number of channels
+ * @bpf: the number of bytes for one frame, this is the size of one
+ *         sample * @channels
+ * @positions: the positions for each channel
+ *
+ * Information describing audio properties. This information can be filled
+ * in from GstCaps with gst_audio_info_from_caps().
+ *
+ * Use the provided macros to access the info in this structure.
+ */
+struct _GstAudioInfo {
+  const GstAudioFormatInfo *finfo;
+  GstAudioFlags             flags;
+  gint                      rate;
+  gint                      channels;
+  gint                      bpf;
+  GstAudioChannelPosition   position[64];
+};
+
+#define GST_AUDIO_INFO_FORMAT(i)             (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))
+#define GST_AUDIO_INFO_NAME(i)               (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))
+#define GST_AUDIO_INFO_WIDTH(i)              (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))
+#define GST_AUDIO_INFO_DEPTH(i)              (GST_AUDIO_FORMAT_INFO_DEPTH((i)->finfo))
+#define GST_AUDIO_INFO_BPS(info)             (GST_AUDIO_INFO_DEPTH(info) >> 3)
+
+#define GST_AUDIO_INFO_FLAGS(info)           ((info)->flags)
+#define GST_AUDIO_INFO_IS_UNPOSITIONED(info) ((info)->flags & GST_AUDIO_FLAG_UNPOSITIONED)
+
+#define GST_AUDIO_INFO_RATE(info)            ((info)->rate)
+#define GST_AUDIO_INFO_CHANNELS(info)        ((info)->channels)
+#define GST_AUDIO_INFO_BPF(info)             ((info)->bpf)
+#define GST_AUDIO_INFO_POSITION(info,c)      ((info)->position[c])
+
+void         gst_audio_info_init        (GstAudioInfo *info);
+void         gst_audio_info_set_format  (GstAudioInfo *info, GstAudioFormat format,
+                                         gint rate, gint channels);
+
+gboolean     gst_audio_info_from_caps   (GstAudioInfo *info, const GstCaps *caps);
+GstCaps *    gst_audio_info_to_caps     (GstAudioInfo *info);
+
+
+#define GST_AUDIO_RATE_RANGE "(int) [ 1, max ]"
+#define GST_AUDIO_CHANNELS_RANGE "(int) [ 1, max ]"
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define GST_AUDIO_NE(s) G_STRINGIFY(s)"_LE"
+# define GST_AUDIO_OE(s) G_STRINGIFY(s)"_BE"
+#else
+# define GST_AUDIO_NE(s) G_STRINGIFY(s)"_BE"
+# define GST_AUDIO_OE(s) G_STRINGIFY(s)"_LE"
+#endif
+
+#define GST_AUDIO_FORMATS_ALL " { S8, U8, " \
+    "S16_LE, S16_BE, U16_LE, U16_BE, " \
+    "S24_LE, S24_BE, U24_LE, U24_BE, " \
+    "S32_LE, S32_BE, U32_LE, U32_BE, " \
+    "S24_3LE, S24_3BE, U24_3LE, U24_3BE, " \
+    "S20_3LE, S20_3BE, U20_3LE, U20_3BE, " \
+    "S18_3LE, S18_3BE, U18_3LE, U18_3BE, " \
+    "F32_LE, F32_BE, F64_LE, F64_BE }"
+
+/**
+ * GST_AUDIO_CAPS_MAKE:
+ * @format: string format that describes the pixel layout, as string
+ *     (e.g. "S16_LE", "S8", etc.)
+ *
+ * Generic caps string for audio, for use in pad templates.
+ */
+#define GST_AUDIO_CAPS_MAKE(format)                                    \
+    "audio/x-raw, "                                                    \
+    "format = (string) " format ", "                                   \
+    "rate = " GST_AUDIO_RATE_RANGE ", "                                \
+    "channels = " GST_AUDIO_CHANNELS_RANGE
 
 /**
  * GST_AUDIO_DEF_RATE:
- * 
+ *
  * Standard sampling rate used in consumer audio.
  */
 #define GST_AUDIO_DEF_RATE 44100
-
 /**
- * GST_AUDIO_INT_PAD_TEMPLATE_CAPS:
- * 
- * Template caps for integer audio. Can be used when defining a 
- * #GstStaticPadTemplate
+ * GST_AUDIO_DEF_CHANNELS:
+ *
+ * Standard number of channels used in consumer audio.
  */
-#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \
-  "audio/x-raw-int, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) [ 1, MAX ], " \
-  "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-  "width = (int) { 8, 16, 24, 32 }, " \
-  "depth = (int) [ 1, 32 ], " \
-  "signed = (boolean) { true, false }"
-
+#define GST_AUDIO_DEF_CHANNELS 2
 /**
- * GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS:
- * 
- * Template caps for 16bit integer stereo audio in native byte-order.
- * Can be used when defining a #GstStaticPadTemplate
+ * GST_AUDIO_DEF_FORMAT:
+ *
+ * Standard format used in consumer audio.
  */
-#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \
-  "audio/x-raw-int, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) 2, " \
-  "endianness = (int) BYTE_ORDER, " \
-  "width = (int) 16, " \
-  "depth = (int) 16, " \
-  "signed = (boolean) true"
+#define GST_AUDIO_DEF_FORMAT "S16_LE"
 
+/* conversion macros */
 /**
- * GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS:
- * 
- * Template caps for float audio. Can be used when defining a 
- * #GstStaticPadTemplate
+ * GST_FRAMES_TO_CLOCK_TIME:
+ * @frames: sample frames
+ * @rate: sampling rate
+ *
+ * Calculate clocktime from sample @frames and @rate.
  */
-#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \
-  "audio/x-raw-float, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) [ 1, MAX ], " \
-  "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \
-  "width = (int) { 32, 64 }"
+#define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
+  ((GstClockTime) gst_util_uint64_scale_round (frames, GST_SECOND, rate))
 
 /**
- * GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS:
- * 
- * Template caps for 32bit float mono audio in native byte-order.
- * Can be used when defining a #GstStaticPadTemplate
+ * GST_CLOCK_TIME_TO_FRAMES:
+ * @clocktime: clock time
+ * @rate: sampling rate
+ *
+ * Calculate frames from @clocktime and sample @rate.
  */
-#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \
-  "audio/x-raw-float, " \
-  "width = (int) 32, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) 1, " \
-  "endianness = (int) BYTE_ORDER"
+#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
+  gst_util_uint64_scale_round (clocktime, rate, GST_SECOND)
 
 /*
  * this library defines and implements some helper functions for audio
  * handling
  */
 
-/* get byte size of audio frame (based on caps of pad */
-int      gst_audio_frame_byte_size      (GstPad* pad);
-
-/* get length in frames of buffer */
-long     gst_audio_frame_length         (GstPad* pad, GstBuffer* buf);
-
-GstClockTime gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf);
-
-/* check if the buffer size is a whole multiple of the frame size */
-gboolean gst_audio_is_buffer_framed     (GstPad* pad, GstBuffer* buf);
-
-/* functions useful for _getcaps functions */
-/**
- * GstAudioFieldFlag:
- * @GST_AUDIO_FIELD_RATE: add rate field to caps
- * @GST_AUDIO_FIELD_CHANNELS: add channels field to caps
- * @GST_AUDIO_FIELD_ENDIANNESS: add endianness field to caps
- * @GST_AUDIO_FIELD_WIDTH: add width field to caps
- * @GST_AUDIO_FIELD_DEPTH: add depth field to caps
- * @GST_AUDIO_FIELD_SIGNED: add signed field to caps
- *
- * Do not use anymore.
- *
- * Deprecated: use gst_structure_set() directly
- */
-#ifndef GST_DISABLE_DEPRECATED
-typedef enum {
-  GST_AUDIO_FIELD_RATE          = (1 << 0),
-  GST_AUDIO_FIELD_CHANNELS      = (1 << 1),
-  GST_AUDIO_FIELD_ENDIANNESS    = (1 << 2),
-  GST_AUDIO_FIELD_WIDTH         = (1 << 3),
-  GST_AUDIO_FIELD_DEPTH         = (1 << 4),
-  GST_AUDIO_FIELD_SIGNED        = (1 << 5)
-} GstAudioFieldFlag;
-#endif
-
-#ifndef GST_DISABLE_DEPRECATED
-void gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag);
-#endif /* GST_DISABLE_DEPRECATED */
-
-GstBuffer *gst_audio_buffer_clip (GstBuffer *buffer, GstSegment *segment, gint rate, gint frame_size);
+GstBuffer *    gst_audio_buffer_clip     (GstBuffer *buffer, GstSegment *segment,
+                                          gint rate, gint bpf);
 
 G_END_DECLS
 
index 9d6e485..44879e3 100644 (file)
@@ -102,7 +102,7 @@ gst_audio_clock_init (GstAudioClock * clock)
 {
   GST_DEBUG_OBJECT (clock, "init");
   clock->last_time = 0;
-  clock->abidata.ABI.time_offset = 0;
+  clock->time_offset = 0;
   GST_OBJECT_FLAG_SET (clock, GST_CLOCK_FLAG_CAN_SET_MASTER);
 }
 
@@ -111,9 +111,9 @@ gst_audio_clock_dispose (GObject * object)
 {
   GstAudioClock *clock = GST_AUDIO_CLOCK (object);
 
-  if (clock->abidata.ABI.destroy_notify && clock->user_data)
-    clock->abidata.ABI.destroy_notify (clock->user_data);
-  clock->abidata.ABI.destroy_notify = NULL;
+  if (clock->destroy_notify && clock->user_data)
+    clock->destroy_notify (clock->user_data);
+  clock->destroy_notify = NULL;
   clock->user_data = NULL;
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
@@ -168,7 +168,7 @@ gst_audio_clock_new_full (const gchar * name, GstAudioClockGetTimeFunc func,
 
   aclock->func = func;
   aclock->user_data = user_data;
-  aclock->abidata.ABI.destroy_notify = destroy_notify;
+  aclock->destroy_notify = destroy_notify;
 
   return (GstClock *) aclock;
 }
@@ -193,7 +193,7 @@ gst_audio_clock_reset (GstAudioClock * clock, GstClockTime time)
   else
     time_offset = -(time - clock->last_time);
 
-  clock->abidata.ABI.time_offset = time_offset;
+  clock->time_offset = time_offset;
 
   GST_DEBUG_OBJECT (clock,
       "reset clock to %" GST_TIME_FORMAT ", last %" GST_TIME_FORMAT ", offset %"
@@ -219,7 +219,7 @@ gst_audio_clock_get_internal_time (GstClock * clock)
   if (result == GST_CLOCK_TIME_NONE) {
     result = aclock->last_time;
   } else {
-    result += aclock->abidata.ABI.time_offset;
+    result += aclock->time_offset;
     /* clock must be increasing */
     if (aclock->last_time < result)
       aclock->last_time = result;
@@ -256,7 +256,7 @@ gst_audio_clock_get_time (GstClock * clock)
   result = aclock->func (clock, aclock->user_data);
   if (result == GST_CLOCK_TIME_NONE) {
     GST_DEBUG_OBJECT (clock, "no time, reuse last");
-    result = aclock->last_time - aclock->abidata.ABI.time_offset;
+    result = aclock->last_time - aclock->time_offset;
   }
 
   GST_DEBUG_OBJECT (clock,
@@ -285,7 +285,7 @@ gst_audio_clock_adjust (GstClock * clock, GstClockTime time)
 
   aclock = GST_AUDIO_CLOCK_CAST (clock);
 
-  result = time + aclock->abidata.ABI.time_offset;
+  result = time + aclock->time_offset;
 
   return result;
 }
index 906c802..cd96dc0 100644 (file)
@@ -68,19 +68,14 @@ struct _GstAudioClock {
 
   /*< protected >*/
   GstAudioClockGetTimeFunc func;
-  gpointer user_data;
-
-  GstClockTime last_time;
+  gpointer                 user_data;
+  GDestroyNotify           destroy_notify;
 
   /*< private >*/
-  union {
-    struct {
-      GstClockTimeDiff   time_offset;
-      GDestroyNotify     destroy_notify;
-    } ABI;
-    /* adding + 0 to mark ABI change to be undone later */
-    gpointer _gst_reserved[GST_PADDING + 0];
-  } abidata;
+  GstClockTime             last_time;
+  GstClockTimeDiff         time_offset;
+
+  gpointer _gst_reserved[GST_PADDING];
 };
 
 struct _GstAudioClockClass {
index fcdf725..6ef6de9 100644 (file)
@@ -29,7 +29,7 @@
  * #GstAudioFilter will parse the input format for you (with error checking)
  * before calling your setup function. Also, elements deriving from
  * #GstAudioFilter may use gst_audio_filter_class_add_pad_templates() from
- * their base_init function to easily configure the set of caps/formats that
+ * their class_init function to easily configure the set of caps/formats that
  * the element is able to handle.
  *
  * Derived classes should override the #GstAudioFilterClass.setup() and
@@ -58,7 +58,7 @@ static GstStateChangeReturn gst_audio_filter_change_state (GstElement * element,
 static gboolean gst_audio_filter_set_caps (GstBaseTransform * btrans,
     GstCaps * incaps, GstCaps * outcaps);
 static gboolean gst_audio_filter_get_unit_size (GstBaseTransform * btrans,
-    GstCaps * caps, guint * size);
+    GstCaps * caps, gsize * size);
 
 #define do_init G_STMT_START { \
     GST_DEBUG_CATEGORY_INIT (audiofilter_dbg, "audiofilter", 0, "audiofilter"); \
@@ -78,12 +78,6 @@ gst_audio_filter_class_init (GstAudioFilterClass * klass)
   basetrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_filter_set_caps);
   basetrans_class->get_unit_size =
       GST_DEBUG_FUNCPTR (gst_audio_filter_get_unit_size);
-
-  /* FIXME: Ref the GstRingerBuffer class to get it's debug category
-   * initialized. gst_ring_buffer_parse_caps () which we use later
-   * uses this debug category.
-   */
-  g_type_class_ref (GST_TYPE_RING_BUFFER);
 }
 
 static void
@@ -103,9 +97,7 @@ gst_audio_filter_change_state (GstElement * element, GstStateChange transition)
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
-      memset (&filter->format, 0, sizeof (GstRingBufferSpec));
-      /* to make gst_buffer_spec_parse_caps() happy */
-      filter->format.latency_time = GST_SECOND;
+      gst_audio_info_init (&filter->info);
       break;
     default:
       break;
@@ -120,7 +112,7 @@ gst_audio_filter_change_state (GstElement * element, GstStateChange transition)
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
     case GST_STATE_CHANGE_READY_TO_NULL:
-      gst_caps_replace (&filter->format.caps, NULL);
+      gst_audio_info_init (&filter->info);
       break;
     default:
       break;
@@ -139,22 +131,27 @@ gst_audio_filter_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
 
   GST_LOG_OBJECT (filter, "caps: %" GST_PTR_FORMAT, incaps);
 
-  if (!gst_ring_buffer_parse_caps (&filter->format, incaps)) {
-    GST_WARNING_OBJECT (filter, "couldn't parse %" GST_PTR_FORMAT, incaps);
-    return FALSE;
-  }
+  if (!gst_audio_info_from_caps (&filter->info, incaps))
+    goto invalid_format;
 
   klass = GST_AUDIO_FILTER_CLASS_CAST (G_OBJECT_GET_CLASS (filter));
 
   if (klass->setup)
-    ret = klass->setup (filter, &filter->format);
+    ret = klass->setup (filter, &filter->info);
 
   return ret;
+
+  /* ERROR */
+invalid_format:
+  {
+    GST_WARNING_OBJECT (filter, "couldn't parse %" GST_PTR_FORMAT, incaps);
+    return FALSE;
+  }
 }
 
 static gboolean
 gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
-    guint * size)
+    gsize * size)
 {
   GstStructure *structure;
   gboolean ret = TRUE;
@@ -179,13 +176,13 @@ gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
  * Convenience function to add pad templates to this element class, with
  * @allowed_caps as the caps that can be handled.
  *
- * This function is usually used from within a GObject base_init function.
+ * This function is usually used from within a GObject class_init function.
  *
  * Since: 0.10.12
  */
 void
 gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
-    const GstCaps * allowed_caps)
+    GstCaps * allowed_caps)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
   GstPadTemplate *pad_template;
@@ -194,12 +191,10 @@ gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
   g_return_if_fail (GST_IS_CAPS (allowed_caps));
 
   pad_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
-      gst_caps_copy (allowed_caps));
+      allowed_caps);
   gst_element_class_add_pad_template (element_class, pad_template);
-  gst_object_unref (pad_template);
 
   pad_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
-      gst_caps_copy (allowed_caps));
+      allowed_caps);
   gst_element_class_add_pad_template (element_class, pad_template);
-  gst_object_unref (pad_template);
 }
index 2fe5da5..dfa75e1 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <gst/gst.h>
 #include <gst/base/gstbasetransform.h>
-#include <gst/audio/gstringbuffer.h>
+#include <gst/audio/audio.h>
 
 G_BEGIN_DECLS
 
@@ -56,12 +56,20 @@ struct _GstAudioFilter {
   GstBaseTransform basetransform;
 
   /*< protected >*/
-  GstRingBufferSpec format;   /* currently configured format */
+  GstAudioInfo info;   /* currently configured format */
 
   /*< private >*/
   gpointer _gst_reserved[GST_PADDING];
 };
 
+#define GST_AUDIO_FILTER_INFO(filter)     (&GST_AUDIO_FILTER_CAST(filter)->info)
+
+#define GST_AUDIO_FILTER_FORMAT(filter)   (GST_AUDIO_INFO_FORMAT(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_RATE(filter)     (GST_AUDIO_INFO_RATE(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_CHANNELS(filter) (GST_AUDIO_INFO_CHANNELS(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_BPF(filter)      (GST_AUDIO_INFO_BPF(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_BPS(filter)      (GST_AUDIO_INFO_BPS(GST_AUDIO_FILTER_INFO(filter)))
+
 /**
  * GstAudioFilterClass:
  * @basetransformclass: parent class
@@ -78,7 +86,7 @@ struct _GstAudioFilterClass {
   GstBaseTransformClass basetransformclass;
 
   /* virtual function, called whenever the format changes */
-  gboolean  (*setup) (GstAudioFilter * filter, GstRingBufferSpec * format);
+  gboolean  (*setup) (GstAudioFilter * filter, const GstAudioInfo * info);
 
   /*< private >*/
   gpointer _gst_reserved[GST_PADDING];
@@ -87,7 +95,7 @@ struct _GstAudioFilterClass {
 GType   gst_audio_filter_get_type (void);
 
 void    gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
-                                                  const GstCaps       * allowed_caps);
+                                                  GstCaps             * allowed_caps);
 
 G_END_DECLS
 
index 9ad787b..5742d28 100644 (file)
@@ -114,9 +114,9 @@ gst_audio_iec61937_frame_size (const GstRingBufferSpec * spec)
 
       if (version == 1 && layer == 1)
         frames = 384;
-      else if (version == 2 && layer == 1 && spec->rate < 32000)
+      else if (version == 2 && layer == 1 && spec->info.rate < 32000)
         frames = 768;
-      else if (version == 2 && layer == 1 && spec->rate < 32000)
+      else if (version == 2 && layer == 1 && spec->info.rate < 32000)
         frames = 2304;
       else
         frames = 1152;
@@ -271,13 +271,13 @@ gst_audio_iec61937_payload (const guint8 * src, guint src_n, guint8 * dst,
       if (version == 1 && layer == 1)
         dst[five] = 0x04;
       else if ((version == 1 && (layer == 2 || layer == 3)) ||
-          (version == 2 && spec->rate >= 32000))
+          (version == 2 && spec->info.rate >= 32000))
         dst[five] = 0x05;
-      else if (version == 2 && layer == 1 && spec->rate < 32000)
+      else if (version == 2 && layer == 1 && spec->info.rate < 32000)
         dst[five] = 0x08;
-      else if (version == 2 && layer == 2 && spec->rate < 32000)
+      else if (version == 2 && layer == 2 && spec->info.rate < 32000)
         dst[five] = 0x09;
-      else if (version == 2 && layer == 3 && spec->rate < 32000)
+      else if (version == 2 && layer == 3 && spec->info.rate < 32000)
         dst[five] = 0x0A;
       else
         g_return_val_if_reached (FALSE);
index ce919af..68e7c99 100644 (file)
@@ -191,7 +191,7 @@ gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
       GST_DEBUG_FUNCPTR (gst_audioringbuffer_activate);
 }
 
-typedef guint (*WriteFunc) (GstAudioSink * sink, gpointer data, guint length);
+typedef gint (*WriteFunc) (GstAudioSink * sink, gpointer data, guint length);
 
 /* this internal thread does nothing else but write samples to the audio device.
  * It will write each segment in the ringbuffer and will update the play
@@ -394,8 +394,8 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
   /* set latency to one more segment as we need some headroom */
   spec->seglatency = spec->segtotal + 1;
 
-  buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
-  memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
+  buf->size = spec->segtotal * spec->segsize;
+  buf->memory = g_malloc0 (buf->size);
 
   return TRUE;
 
@@ -468,8 +468,8 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
   csink = GST_AUDIO_SINK_GET_CLASS (sink);
 
   /* free the buffer */
-  gst_buffer_unref (buf->data);
-  buf->data = NULL;
+  g_free (buf->memory);
+  buf->memory = NULL;
 
   if (csink->unprepare)
     result = csink->unprepare (sink);
@@ -574,21 +574,16 @@ enum
   ARG_0,
 };
 
-#define _do_init(bla) \
+#define _do_init \
     GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element");
-
-GST_BOILERPLATE_FULL (GstAudioSink, gst_audio_sink, GstBaseAudioSink,
+#define gst_audio_sink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink,
     GST_TYPE_BASE_AUDIO_SINK, _do_init);
 
 static GstRingBuffer *gst_audio_sink_create_ringbuffer (GstBaseAudioSink *
     sink);
 
 static void
-gst_audio_sink_base_init (gpointer g_class)
-{
-}
-
-static void
 gst_audio_sink_class_init (GstAudioSinkClass * klass)
 {
   GstBaseAudioSinkClass *gstbaseaudiosink_class;
@@ -602,7 +597,7 @@ gst_audio_sink_class_init (GstAudioSinkClass * klass)
 }
 
 static void
-gst_audio_sink_init (GstAudioSink * audiosink, GstAudioSinkClass * g_class)
+gst_audio_sink_init (GstAudioSink * audiosink)
 {
 }
 
index 83a4e95..71fe5e4 100644 (file)
@@ -83,9 +83,7 @@ struct _GstAudioSinkClass {
   /* close the device */
   gboolean (*close)     (GstAudioSink *sink);
   /* write samples to the device */
-  /* FIXME 0.11: change return value to gint, as most implementation use that
-   * already anyway */
-  guint    (*write)     (GstAudioSink *sink, gpointer data, guint length);
+  gint     (*write)     (GstAudioSink *sink, gpointer data, guint length);
   /* get number of samples queued in the device */
   guint    (*delay)     (GstAudioSink *sink);
   /* reset the audio device, unblock from a write */
index d7a6b54..57864d1 100644 (file)
@@ -376,8 +376,8 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
   if (!result)
     goto could_not_open;
 
-  buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
-  memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
+  buf->size = spec->segtotal * spec->segsize;
+  buf->memory = g_malloc0 (buf->size);
 
   abuf = GST_AUDIORING_BUFFER (buf);
   abuf->running = TRUE;
@@ -418,8 +418,8 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
   GST_OBJECT_LOCK (buf);
 
   /* free the buffer */
-  gst_buffer_unref (buf->data);
-  buf->data = NULL;
+  g_free (buf->memory);
+  buf->memory = NULL;
 
   if (csrc->unprepare)
     result = csrc->unprepare (src);
@@ -488,20 +488,15 @@ enum
   ARG_0,
 };
 
-#define _do_init(bla) \
+#define _do_init \
     GST_DEBUG_CATEGORY_INIT (gst_audio_src_debug, "audiosrc", 0, "audiosrc element");
-
-GST_BOILERPLATE_FULL (GstAudioSrc, gst_audio_src, GstBaseAudioSrc,
+#define gst_audio_src_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAudioSrc, gst_audio_src,
     GST_TYPE_BASE_AUDIO_SRC, _do_init);
 
 static GstRingBuffer *gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src);
 
 static void
-gst_audio_src_base_init (gpointer g_class)
-{
-}
-
-static void
 gst_audio_src_class_init (GstAudioSrcClass * klass)
 {
   GstBaseAudioSrcClass *gstbaseaudiosrc_class;
@@ -515,7 +510,7 @@ gst_audio_src_class_init (GstAudioSrcClass * klass)
 }
 
 static void
-gst_audio_src_init (GstAudioSrc * audiosrc, GstAudioSrcClass * g_class)
+gst_audio_src_init (GstAudioSrc * audiosrc)
 {
 }
 
index 6dafb4b..45b66a6 100644 (file)
@@ -57,7 +57,6 @@ struct _GstBaseAudioSinkPrivate
 
   GstClockTime eos_time;
 
-  gboolean do_time_offset;
   /* number of microseconds we alow timestamps or clock slaving to drift
    * before resyncing */
   guint64 drift_tolerance;
@@ -119,10 +118,10 @@ gst_base_audio_sink_slave_method_get_type (void)
 }
 
 
-#define _do_init(bla) \
+#define _do_init \
     GST_DEBUG_CATEGORY_INIT (gst_base_audio_sink_debug, "baseaudiosink", 0, "baseaudiosink element");
-
-GST_BOILERPLATE_FULL (GstBaseAudioSink, gst_base_audio_sink, GstBaseSink,
+#define gst_base_audio_sink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSink, gst_base_audio_sink,
     GST_TYPE_BASE_SINK, _do_init);
 
 static void gst_base_audio_sink_dispose (GObject * object);
@@ -132,8 +131,10 @@ static void gst_base_audio_sink_set_property (GObject * object, guint prop_id,
 static void gst_base_audio_sink_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
+#if 0
 static GstStateChangeReturn gst_base_audio_sink_async_play (GstBaseSink *
     basesink);
+#endif
 static GstStateChangeReturn gst_base_audio_sink_change_state (GstElement *
     element, GstStateChange transition);
 static gboolean gst_base_audio_sink_activate_pull (GstBaseSink * basesink,
@@ -159,17 +160,13 @@ static gboolean gst_base_audio_sink_setcaps (GstBaseSink * bsink,
     GstCaps * caps);
 static void gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps);
 
-static gboolean gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query);
+static gboolean gst_base_audio_sink_query_pad (GstBaseSink * bsink,
+    GstQuery * query);
 
 
 /* static guint gst_base_audio_sink_signals[LAST_SIGNAL] = { 0 }; */
 
 static void
-gst_base_audio_sink_base_init (gpointer g_class)
-{
-}
-
-static void
 gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
 {
   GObjectClass *gobject_class;
@@ -235,13 +232,16 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
 
   gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_base_audio_sink_event);
   gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_base_audio_sink_preroll);
+  gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_sink_query_pad);
   gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_base_audio_sink_render);
   gstbasesink_class->get_times =
       GST_DEBUG_FUNCPTR (gst_base_audio_sink_get_times);
   gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_base_audio_sink_setcaps);
   gstbasesink_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_sink_fixate);
+#if 0
   gstbasesink_class->async_play =
       GST_DEBUG_FUNCPTR (gst_base_audio_sink_async_play);
+#endif
   gstbasesink_class->activate_pull =
       GST_DEBUG_FUNCPTR (gst_base_audio_sink_activate_pull);
 
@@ -253,10 +253,8 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
 }
 
 static void
-gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink,
-    GstBaseAudioSinkClass * g_class)
+gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink)
 {
-  GstPluginFeature *feature;
   GstBaseSink *basesink;
 
   baseaudiosink->priv = GST_BASE_AUDIO_SINK_GET_PRIVATE (baseaudiosink);
@@ -275,29 +273,6 @@ gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink,
   basesink->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
 
   gst_base_sink_set_last_buffer_enabled (basesink, FALSE);
-
-  /* install some custom pad_query functions */
-  gst_pad_set_query_function (GST_BASE_SINK_PAD (baseaudiosink),
-      GST_DEBUG_FUNCPTR (gst_base_audio_sink_query_pad));
-
-  baseaudiosink->priv->do_time_offset = TRUE;
-
-  /* check the factory, pulsesink < 0.10.17 does the timestamp offset itself so
-   * we should not do ourselves */
-  feature =
-      GST_PLUGIN_FEATURE_CAST (GST_ELEMENT_CLASS (g_class)->elementfactory);
-  GST_DEBUG ("created from factory %p", feature);
-
-  /* HACK for old pulsesink that did the time_offset themselves */
-  if (feature) {
-    if (strcmp (gst_plugin_feature_get_name (feature), "pulsesink") == 0) {
-      if (!gst_plugin_feature_check_version (feature, 0, 10, 17)) {
-        /* we're dealing with an old pulsesink, we need to disable time corection */
-        GST_DEBUG ("disable time offset");
-        baseaudiosink->priv->do_time_offset = FALSE;
-      }
-    }
-  }
 }
 
 static void
@@ -361,12 +336,12 @@ clock_disabled:
 }
 
 static gboolean
-gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query)
+gst_base_audio_sink_query_pad (GstBaseSink * bsink, GstQuery * query)
 {
   gboolean res = FALSE;
   GstBaseAudioSink *basesink;
 
-  basesink = GST_BASE_AUDIO_SINK (gst_pad_get_parent (pad));
+  basesink = GST_BASE_AUDIO_SINK (bsink);
 
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_CONVERT:
@@ -374,7 +349,7 @@ gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query)
       GstFormat src_fmt, dest_fmt;
       gint64 src_val, dest_val;
 
-      GST_LOG_OBJECT (pad, "query convert");
+      GST_LOG_OBJECT (basesink, "query convert");
 
       if (basesink->ringbuffer) {
         gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
@@ -387,11 +362,9 @@ gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query)
       break;
     }
     default:
+      res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
       break;
   }
-
-  gst_object_unref (basesink);
-
   return res;
 }
 
@@ -422,7 +395,7 @@ gst_base_audio_sink_query (GstElement * element, GstQuery * query)
           GstRingBufferSpec *spec;
 
           GST_OBJECT_LOCK (basesink);
-          if (!basesink->ringbuffer || !basesink->ringbuffer->spec.rate) {
+          if (!basesink->ringbuffer || !basesink->ringbuffer->spec.info.rate) {
             GST_OBJECT_UNLOCK (basesink);
 
             GST_DEBUG_OBJECT (basesink,
@@ -436,7 +409,7 @@ gst_base_audio_sink_query (GstElement * element, GstQuery * query)
 
           base_latency =
               gst_util_uint64_scale_int (spec->seglatency * spec->segsize,
-              GST_SECOND, spec->rate * spec->bytes_per_sample);
+              GST_SECOND, spec->info.rate * spec->info.bpf);
           GST_OBJECT_UNLOCK (basesink);
 
           /* we cannot go lower than the buffer size and the min peer latency */
@@ -497,7 +470,7 @@ gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink)
   guint delay;
   GstClockTime result;
 
-  if (sink->ringbuffer == NULL || sink->ringbuffer->spec.rate == 0)
+  if (sink->ringbuffer == NULL || sink->ringbuffer->spec.info.rate == 0)
     return GST_CLOCK_TIME_NONE;
 
   /* our processed samples are always increasing */
@@ -513,7 +486,7 @@ gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink)
     samples = 0;
 
   result = gst_util_uint64_scale_int (samples, GST_SECOND,
-      sink->ringbuffer->spec.rate);
+      sink->ringbuffer->spec.info.rate);
 
   GST_DEBUG_OBJECT (sink,
       "processed samples: raw %" G_GUINT64_FORMAT ", delay %u, real %"
@@ -740,7 +713,10 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 
   GST_DEBUG_OBJECT (sink, "release old ringbuffer");
 
-  /* get current time, updates the last_time */
+  /* get current time, updates the last_time. When the subclass has a clock that
+   * restarts from 0 when a new format is negotiated, it will call
+   * gst_audio_clock_reset() which will use this last_time to create an offset
+   * so that time from the clock keeps on increasing monotonically. */
   now = gst_clock_get_time (sink->provided_clock);
 
   GST_DEBUG_OBJECT (sink, "time was %" GST_TIME_FORMAT, GST_TIME_ARGS (now));
@@ -780,7 +756,7 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   /* calculate actual latency and buffer times.
    * FIXME: In 0.11, store the latency_time internally in ns */
   spec->latency_time = gst_util_uint64_scale (spec->segsize,
-      (GST_SECOND / GST_USECOND), spec->rate * spec->bytes_per_sample);
+      (GST_SECOND / GST_USECOND), spec->info.rate * spec->info.bpf);
 
   spec->buffer_time = spec->segtotal * spec->latency_time;
 
@@ -845,12 +821,12 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
 {
   if (!sink->ringbuffer)
     return TRUE;
-  if (!sink->ringbuffer->spec.rate)
+  if (!sink->ringbuffer->spec.info.rate)
     return TRUE;
 
   /* if PLAYING is interrupted,
    * arrange to have clock running when going to PLAYING again */
-  g_atomic_int_set (&sink->abidata.ABI.eos_rendering, 1);
+  g_atomic_int_set (&sink->eos_rendering, 1);
 
   /* need to start playback before we can drain, but only when
    * we have successfully negotiated a format and thus acquired the
@@ -869,7 +845,7 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
 
     GST_DEBUG_OBJECT (sink, "drained audio");
   }
-  g_atomic_int_set (&sink->abidata.ABI.eos_rendering, 0);
+  g_atomic_int_set (&sink->eos_rendering, 0);
   return TRUE;
 }
 
@@ -895,17 +871,6 @@ gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event)
       /* now wait till we played everything */
       gst_base_audio_sink_drain (sink);
       break;
-    case GST_EVENT_NEWSEGMENT:
-    {
-      gdouble rate;
-
-      /* we only need the rate */
-      gst_event_parse_new_segment_full (event, NULL, &rate, NULL, NULL,
-          NULL, NULL, NULL);
-
-      GST_DEBUG_OBJECT (sink, "new segment rate of %f", rate);
-      break;
-    }
     default:
       break;
   }
@@ -1101,7 +1066,7 @@ gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
     cexternal = cexternal > mdrift ? cexternal - mdrift : 0;
     sink->priv->avg_skew -= mdrift;
 
-    driftsamples = (sink->ringbuffer->spec.rate * mdrift) / GST_SECOND;
+    driftsamples = (sink->ringbuffer->spec.info.rate * mdrift) / GST_SECOND;
     last_align = sink->priv->last_align;
 
     /* if we were aligning in the wrong direction or we aligned more than what we
@@ -1123,7 +1088,7 @@ gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
     cexternal += mdrift;
     sink->priv->avg_skew += mdrift;
 
-    driftsamples = (sink->ringbuffer->spec.rate * mdrift) / GST_SECOND;
+    driftsamples = (sink->ringbuffer->spec.info.rate * mdrift) / GST_SECOND;
     last_align = sink->priv->last_align;
 
     /* if we were aligning in the wrong direction or we aligned more than what we
@@ -1343,6 +1308,7 @@ gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink,
   gint64 samples_done = segdone * ringbuf->samples_per_seg;
   gint64 headroom = sample_offset - samples_done;
   gboolean allow_align = TRUE;
+  gint rate;
 
   /* now try to align the sample to the previous one, first see how big the
    * difference is. */
@@ -1351,9 +1317,11 @@ gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink,
   else
     diff = sink->next_sample - sample_offset;
 
+  rate = GST_AUDIO_INFO_RATE (&ringbuf->spec.info);
+
   /* calculate the max allowed drift in units of samples. By default this is
    * 20ms and should be anough to compensate for timestamp rounding errors. */
-  maxdrift = (ringbuf->spec.rate * sink->priv->drift_tolerance) / GST_MSECOND;
+  maxdrift = (rate * sink->priv->drift_tolerance) / GST_MSECOND;
 
   /* calc align with previous sample */
   align = sink->next_sample - sample_offset;
@@ -1368,8 +1336,7 @@ gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink,
         G_GINT64_FORMAT, align, maxdrift);
   } else {
     /* calculate sample diff in seconds for error message */
-    gint64 diff_s = gst_util_uint64_scale_int (diff, GST_SECOND,
-        ringbuf->spec.rate);
+    gint64 diff_s = gst_util_uint64_scale_int (diff, GST_SECOND, rate);
     /* timestamps drifted apart from previous samples too much, we need to
      * resync. We log this as an element warning. */
     GST_WARNING_OBJECT (sink,
@@ -1391,11 +1358,13 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   GstBaseAudioSinkClass *bclass;
   GstBaseAudioSink *sink;
   GstRingBuffer *ringbuf;
-  gint64 diff, align, ctime, cstop;
+  gint64 diff, align;
+  guint64 ctime, cstop;
+  gsize offset;
   guint8 *data;
-  guint size;
+  gsize size;
   guint samples, written;
-  gint bps;
+  gint bpf, rate;
   gint accum;
   gint out_samples;
   GstClockTime base_time, render_delay, latency;
@@ -1442,13 +1411,14 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
     buf = out;
   }
 
-  bps = ringbuf->spec.bytes_per_sample;
+  bpf = GST_AUDIO_INFO_BPF (&ringbuf->spec.info);
+  rate = GST_AUDIO_INFO_RATE (&ringbuf->spec.info);
 
-  size = GST_BUFFER_SIZE (buf);
-  if (G_UNLIKELY (size % bps) != 0)
+  size = gst_buffer_get_size (buf);
+  if (G_UNLIKELY (size % bpf) != 0)
     goto wrong_size;
 
-  samples = size / bps;
+  samples = size / bpf;
   out_samples = samples;
 
   in_offset = GST_BUFFER_OFFSET (buf);
@@ -1459,16 +1429,15 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
       GST_TIME_FORMAT ", samples %u", GST_TIME_ARGS (time), in_offset,
       GST_TIME_ARGS (bsink->segment.start), samples);
 
-  data = GST_BUFFER_DATA (buf);
+  offset = 0;
 
   /* if not valid timestamp or we can't clip or sync, try to play
    * sample ASAP */
   if (!GST_CLOCK_TIME_IS_VALID (time)) {
     render_start = gst_base_audio_sink_get_offset (sink);
     render_stop = render_start + samples;
-    GST_DEBUG_OBJECT (sink,
-        "Buffer of size %u has no time. Using render_start=%" G_GUINT64_FORMAT,
-        GST_BUFFER_SIZE (buf), render_start);
+    GST_DEBUG_OBJECT (sink, "Buffer of size %" G_GSIZE_FORMAT " has no time."
+        " Using render_start=%" G_GUINT64_FORMAT, size, render_start);
     /* we don't have a start so we don't know stop either */
     stop = -1;
     goto no_sync;
@@ -1476,8 +1445,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
 
   /* let's calc stop based on the number of samples in the buffer instead
    * of trusting the DURATION */
-  stop = time + gst_util_uint64_scale_int (samples, GST_SECOND,
-      ringbuf->spec.rate);
+  stop = time + gst_util_uint64_scale_int (samples, GST_SECOND, rate);
 
   /* prepare the clipping segment. Since we will be subtracting ts-offset and
    * device-delay later we scale the start and stop with those values so that we
@@ -1518,17 +1486,17 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   diff = ctime - time;
   if (diff > 0) {
     /* bring clipped time to samples */
-    diff = gst_util_uint64_scale_int (diff, ringbuf->spec.rate, GST_SECOND);
+    diff = gst_util_uint64_scale_int (diff, rate, GST_SECOND);
     GST_DEBUG_OBJECT (sink, "clipping start to %" GST_TIME_FORMAT " %"
         G_GUINT64_FORMAT " samples", GST_TIME_ARGS (ctime), diff);
     samples -= diff;
-    data += diff * bps;
+    offset += diff * bpf;
     time = ctime;
   }
   diff = stop - cstop;
   if (diff > 0) {
     /* bring clipped time to samples */
-    diff = gst_util_uint64_scale_int (diff, ringbuf->spec.rate, GST_SECOND);
+    diff = gst_util_uint64_scale_int (diff, rate, GST_SECOND);
     GST_DEBUG_OBJECT (sink, "clipping stop to %" GST_TIME_FORMAT " %"
         G_GUINT64_FORMAT " samples", GST_TIME_ARGS (cstop), diff);
     samples -= diff;
@@ -1603,20 +1571,17 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
       GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
 
   /* bring to position in the ringbuffer */
-  if (sink->priv->do_time_offset) {
-    time_offset =
-        GST_AUDIO_CLOCK_CAST (sink->provided_clock)->abidata.ABI.time_offset;
-    GST_DEBUG_OBJECT (sink,
-        "time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
-    if (render_start > time_offset)
-      render_start -= time_offset;
-    else
-      render_start = 0;
-    if (render_stop > time_offset)
-      render_stop -= time_offset;
-    else
-      render_stop = 0;
-  }
+  time_offset = GST_AUDIO_CLOCK_CAST (sink->provided_clock)->time_offset;
+  GST_DEBUG_OBJECT (sink,
+      "time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
+  if (render_start > time_offset)
+    render_start -= time_offset;
+  else
+    render_start = 0;
+  if (render_stop > time_offset)
+    render_stop -= time_offset;
+  else
+    render_stop = 0;
 
   /* in some clock slaving cases, all late samples end up at 0 first,
    * and subsequent ones align with that until threshold exceeded,
@@ -1625,10 +1590,8 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
     goto too_late;
 
   /* and bring the time to the rate corrected offset in the buffer */
-  render_start = gst_util_uint64_scale_int (render_start,
-      ringbuf->spec.rate, GST_SECOND);
-  render_stop = gst_util_uint64_scale_int (render_stop,
-      ringbuf->spec.rate, GST_SECOND);
+  render_start = gst_util_uint64_scale_int (render_start, rate, GST_SECOND);
+  render_stop = gst_util_uint64_scale_int (render_stop, rate, GST_SECOND);
 
   /* positive playback rate, first sample is render_start, negative rate, first
    * sample is render_stop. When no rate conversion is active, render exactly
@@ -1686,10 +1649,11 @@ no_sync:
   /* we need to accumulate over different runs for when we get interrupted */
   accum = 0;
   align_next = TRUE;
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
   do {
     written =
-        gst_ring_buffer_commit_full (ringbuf, &sample_offset, data, samples,
-        out_samples, &accum);
+        gst_ring_buffer_commit_full (ringbuf, &sample_offset, data + offset,
+        samples, out_samples, &accum);
 
     GST_DEBUG_OBJECT (sink, "wrote %u of %u", written, samples);
     /* if we wrote all, we're done */
@@ -1713,8 +1677,9 @@ no_sync:
       break;
 
     samples -= written;
-    data += written * bps;
+    offset += written * bpf;
   } while (TRUE);
+  gst_buffer_unmap (buf, data, size);
 
   if (align_next)
     sink->next_sample = sample_offset;
@@ -1779,6 +1744,7 @@ stopping:
   {
     GST_DEBUG_OBJECT (sink, "preroll got interrupted: %d (%s)", ret,
         gst_flow_get_name (ret));
+    gst_buffer_unmap (buf, data, size);
     goto done;
   }
 sync_latency_failed:
@@ -1822,6 +1788,7 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
   GstBaseAudioSink *sink;
   GstBuffer *buf;
   GstFlowReturn ret;
+  gsize size;
 
   basesink = GST_BASE_SINK (user_data);
   sink = GST_BASE_AUDIO_SINK (user_data);
@@ -1830,10 +1797,10 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
 
   /* would be nice to arrange for pad_alloc_buffer to return data -- as it is we
      will copy twice, once into data, once into DMA */
-  GST_LOG_OBJECT (basesink, "pulling %d bytes offset %" G_GUINT64_FORMAT
+  GST_LOG_OBJECT (basesink, "pulling %u bytes offset %" G_GUINT64_FORMAT
       " to fill audio buffer", len, basesink->offset);
   ret =
-      gst_pad_pull_range (basesink->sinkpad, basesink->segment.last_stop, len,
+      gst_pad_pull_range (basesink->sinkpad, basesink->segment.position, len,
       &buf);
 
   if (ret != GST_FLOW_OK) {
@@ -1843,7 +1810,7 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
       goto error;
   }
 
-  GST_PAD_PREROLL_LOCK (basesink->sinkpad);
+  GST_BASE_SINK_PREROLL_LOCK (basesink);
   if (basesink->flushing)
     goto flushing;
 
@@ -1852,17 +1819,19 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
   if (ret != GST_FLOW_OK)
     goto preroll_error;
 
-  if (len != GST_BUFFER_SIZE (buf)) {
+  size = gst_buffer_get_size (buf);
+
+  if (len != size) {
     GST_INFO_OBJECT (basesink,
-        "got different size than requested from sink pad: %u != %u", len,
-        GST_BUFFER_SIZE (buf));
-    len = MIN (GST_BUFFER_SIZE (buf), len);
+        "got different size than requested from sink pad: %u"
+        " != %" G_GSIZE_FORMAT, len, size);
+    len = MIN (size, len);
   }
 
-  basesink->segment.last_stop += len;
+  basesink->segment.position += len;
 
-  memcpy (data, GST_BUFFER_DATA (buf), len);
-  GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
+  gst_buffer_extract (buf, 0, data, len);
+  GST_BASE_SINK_PREROLL_UNLOCK (basesink);
 
   GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
 
@@ -1892,7 +1861,7 @@ flushing:
   {
     GST_DEBUG_OBJECT (sink, "we are flushing");
     gst_ring_buffer_pause (rbuf);
-    GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
+    GST_BASE_SINK_PREROLL_UNLOCK (basesink);
     GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
     return;
   }
@@ -1900,7 +1869,7 @@ preroll_error:
   {
     GST_DEBUG_OBJECT (sink, "error %s", gst_flow_get_name (ret));
     gst_ring_buffer_pause (rbuf);
-    GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
+    GST_BASE_SINK_PREROLL_UNLOCK (basesink);
     GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
     return;
   }
@@ -1928,6 +1897,7 @@ gst_base_audio_sink_activate_pull (GstBaseSink * basesink, gboolean active)
   return ret;
 }
 
+#if 0
 /* should be called with the LOCK */
 static GstStateChangeReturn
 gst_base_audio_sink_async_play (GstBaseSink * basesink)
@@ -1946,6 +1916,7 @@ gst_base_audio_sink_async_play (GstBaseSink * basesink)
 
   return GST_STATE_CHANGE_SUCCESS;
 }
+#endif
 
 static GstStateChangeReturn
 gst_base_audio_sink_change_state (GstElement * element,
@@ -1992,7 +1963,7 @@ gst_base_audio_sink_change_state (GstElement * element,
 
       gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
       if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL ||
-          g_atomic_int_get (&sink->abidata.ABI.eos_rendering) || eos) {
+          g_atomic_int_get (&sink->eos_rendering) || eos) {
         /* we always start the ringbuffer in pull mode immediatly */
         /* sync rendering on eos needs running clock,
          * and others need running clock when finished rendering eos */
index 95c0774..0511a0f 100644 (file)
@@ -124,17 +124,13 @@ struct _GstBaseAudioSink {
   gboolean       provide_clock;
   GstClock      *provided_clock;
 
+  /* with g_atomic_; currently rendering eos */
+  gboolean       eos_rendering;
+
   /*< private >*/
   GstBaseAudioSinkPrivate *priv;
 
-  union {
-    struct {
-      /*< protected >*/
-      /* with g_atomic_; currently rendering eos */
-      gboolean   eos_rendering;
-    } ABI;
-    gpointer _gst_reserved[GST_PADDING - 1];
-  } abidata;
+  gpointer _gst_reserved[GST_PADDING];
 };
 
 /**
@@ -158,9 +154,8 @@ struct _GstBaseAudioSinkClass {
   /* subclass payloader */
   GstBuffer*     (*payload)            (GstBaseAudioSink *sink,
                                         GstBuffer        *buffer);
-
   /*< private >*/
-  gpointer _gst_reserved[GST_PADDING - 1];
+  gpointer _gst_reserved[GST_PADDING];
 };
 
 GType gst_base_audio_sink_get_type(void);
index 7c7ec93..23c8987 100644 (file)
@@ -119,8 +119,9 @@ _do_init (GType type)
 #endif /* ENABLE_NLS */
 }
 
-GST_BOILERPLATE_FULL (GstBaseAudioSrc, gst_base_audio_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, _do_init);
+#define gst_base_audio_src_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSrc, gst_base_audio_src, GST_TYPE_PUSH_SRC,
+    _do_init (g_define_type_id));
 
 static void gst_base_audio_src_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -137,7 +138,6 @@ static GstClockTime gst_base_audio_src_get_time (GstClock * clock,
 
 static GstFlowReturn gst_base_audio_src_create (GstBaseSrc * bsrc,
     guint64 offset, guint length, GstBuffer ** buf);
-static gboolean gst_base_audio_src_check_get_range (GstBaseSrc * bsrc);
 
 static gboolean gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event);
 static void gst_base_audio_src_get_times (GstBaseSrc * bsrc,
@@ -149,11 +149,6 @@ static void gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
 /* static guint gst_base_audio_src_signals[LAST_SIGNAL] = { 0 }; */
 
 static void
-gst_base_audio_src_base_init (gpointer g_class)
-{
-}
-
-static void
 gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
 {
   GObjectClass *gobject_class;
@@ -230,8 +225,6 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
   gstbasesrc_class->get_times =
       GST_DEBUG_FUNCPTR (gst_base_audio_src_get_times);
   gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_base_audio_src_create);
-  gstbasesrc_class->check_get_range =
-      GST_DEBUG_FUNCPTR (gst_base_audio_src_check_get_range);
   gstbasesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_src_fixate);
 
   /* ref class from a thread-safe context to work around missing bit of
@@ -241,8 +234,7 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
 }
 
 static void
-gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc,
-    GstBaseAudioSrcClass * g_class)
+gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc)
 {
   baseaudiosrc->priv = GST_BASE_AUDIO_SRC_GET_PRIVATE (baseaudiosrc);
 
@@ -331,7 +323,8 @@ gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src)
   guint delay;
   GstClockTime result;
 
-  if (G_UNLIKELY (src->ringbuffer == NULL || src->ringbuffer->spec.rate == 0))
+  if (G_UNLIKELY (src->ringbuffer == NULL
+          || src->ringbuffer->spec.info.rate == 0))
     return GST_CLOCK_TIME_NONE;
 
   raw = samples = gst_ring_buffer_samples_done (src->ringbuffer);
@@ -343,7 +336,7 @@ gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src)
   samples += delay;
 
   result = gst_util_uint64_scale_int (samples, GST_SECOND,
-      src->ringbuffer->spec.rate);
+      src->ringbuffer->spec.info.rate);
 
   GST_DEBUG_OBJECT (src,
       "processed samples: raw %" G_GUINT64_FORMAT ", delay %u, real %"
@@ -353,16 +346,6 @@ gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src)
   return result;
 }
 
-static gboolean
-gst_base_audio_src_check_get_range (GstBaseSrc * bsrc)
-{
-  /* we allow limited pull base operation of which the details
-   * will eventually exposed in an as of yet non-existing query.
-   * Basically pulling can be done on any number of bytes as long
-   * as the offset is -1 or sequentially increasing. */
-  return TRUE;
-}
-
 /**
  * gst_base_audio_src_set_provide_clock:
  * @src: a #GstBaseAudioSrc
@@ -527,26 +510,16 @@ static void
 gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 {
   GstStructure *s;
-  gint width, depth;
 
   s = gst_caps_get_structure (caps, 0);
 
   /* fields for all formats */
-  gst_structure_fixate_field_nearest_int (s, "rate", 44100);
-  gst_structure_fixate_field_nearest_int (s, "channels", 2);
-  gst_structure_fixate_field_nearest_int (s, "width", 16);
-
-  /* fields for int */
-  if (gst_structure_has_field (s, "depth")) {
-    gst_structure_get_int (s, "width", &width);
-    /* round width to nearest multiple of 8 for the depth */
-    depth = GST_ROUND_UP_8 (width);
-    gst_structure_fixate_field_nearest_int (s, "depth", depth);
-  }
-  if (gst_structure_has_field (s, "signed"))
-    gst_structure_fixate_field_boolean (s, "signed", TRUE);
-  if (gst_structure_has_field (s, "endianness"))
-    gst_structure_fixate_field_nearest_int (s, "endianness", G_BYTE_ORDER);
+  gst_structure_fixate_field_nearest_int (s, "rate", GST_AUDIO_DEF_RATE);
+  gst_structure_fixate_field_nearest_int (s, "channels",
+      GST_AUDIO_DEF_CHANNELS);
+  gst_structure_fixate_field_string (s, "format", GST_AUDIO_DEF_FORMAT);
+
+  GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 }
 
 static gboolean
@@ -554,6 +527,7 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
 {
   GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
   GstRingBufferSpec *spec;
+  gint bpf, rate;
 
   spec = &src->ringbuffer->spec;
 
@@ -561,15 +535,16 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
   spec->latency_time = src->latency_time;
 
   GST_OBJECT_LOCK (src);
-  if (!gst_ring_buffer_parse_caps (spec, caps))
-  {
+  if (!gst_ring_buffer_parse_caps (spec, caps)) {
     GST_OBJECT_UNLOCK (src);
     goto parse_error;
   }
 
+  bpf = GST_AUDIO_INFO_BPF (&spec->info);
+  rate = GST_AUDIO_INFO_RATE (&spec->info);
+
   /* calculate suggested segsize and segtotal */
-  spec->segsize =
-      spec->rate * spec->bytes_per_sample * spec->latency_time / GST_MSECOND;
+  spec->segsize = rate * bpf * spec->latency_time / GST_MSECOND;
   spec->segtotal = spec->buffer_time / spec->latency_time;
 
   GST_OBJECT_UNLOCK (src);
@@ -586,11 +561,9 @@ gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
     goto acquire_error;
 
   /* calculate actual latency and buffer times */
-  spec->latency_time =
-      spec->segsize * GST_MSECOND / (spec->rate * spec->bytes_per_sample);
+  spec->latency_time = spec->segsize * GST_MSECOND / (rate * bpf);
   spec->buffer_time =
-      spec->segtotal * spec->segsize * GST_MSECOND / (spec->rate *
-      spec->bytes_per_sample);
+      spec->segtotal * spec->segsize * GST_MSECOND / (rate * bpf);
 
   gst_ring_buffer_debug_spec_buff (spec);
 
@@ -633,24 +606,26 @@ gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query)
     {
       GstClockTime min_latency, max_latency;
       GstRingBufferSpec *spec;
+      gint bpf, rate;
 
       GST_OBJECT_LOCK (src);
       if (G_UNLIKELY (src->ringbuffer == NULL
-              || src->ringbuffer->spec.rate == 0)) {
+              || src->ringbuffer->spec.info.rate == 0)) {
         GST_OBJECT_UNLOCK (src);
         goto done;
       }
 
       spec = &src->ringbuffer->spec;
+      rate = GST_AUDIO_INFO_RATE (&spec->info);
+      bpf = GST_AUDIO_INFO_BPF (&spec->info);
 
       /* we have at least 1 segment of latency */
       min_latency =
-          gst_util_uint64_scale_int (spec->segsize, GST_SECOND,
-          spec->rate * spec->bytes_per_sample);
+          gst_util_uint64_scale_int (spec->segsize, GST_SECOND, rate * bpf);
       /* we cannot delay more than the buffersize else we lose data */
       max_latency =
           gst_util_uint64_scale_int (spec->segtotal * spec->segsize, GST_SECOND,
-          spec->rate * spec->bytes_per_sample);
+          rate * bpf);
       GST_OBJECT_UNLOCK (src);
 
       GST_DEBUG_OBJECT (src,
@@ -664,6 +639,17 @@ gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query)
       res = TRUE;
       break;
     }
+    case GST_QUERY_SCHEDULING:
+    {
+      /* we allow limited pull base operation of which the details
+       * will eventually exposed in an as of yet non-existing query.
+       * Basically pulling can be done on any number of bytes as long
+       * as the offset is -1 or sequentially increasing. */
+      gst_query_set_scheduling (query, TRUE, FALSE, TRUE, 1, -1, 1);
+
+      res = TRUE;
+      break;
+    }
     default:
       res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
       break;
@@ -757,12 +743,13 @@ static GstFlowReturn
 gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
     GstBuffer ** outbuf)
 {
+  GstFlowReturn ret;
   GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
   GstBuffer *buf;
-  guchar *data;
+  guchar *data, *ptr;
   guint samples, total_samples;
   guint64 sample;
-  gint bps;
+  gint bpf, rate;
   GstRingBuffer *ringbuffer;
   GstRingBufferSpec *spec;
   guint read;
@@ -775,18 +762,19 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
   if (G_UNLIKELY (!gst_ring_buffer_is_acquired (ringbuffer)))
     goto wrong_state;
 
-  bps = spec->bytes_per_sample;
+  bpf = GST_AUDIO_INFO_BPF (&spec->info);
+  rate = GST_AUDIO_INFO_RATE (&spec->info);
 
   if ((length == 0 && bsrc->blocksize == 0) || length == -1)
     /* no length given, use the default segment size */
     length = spec->segsize;
   else
     /* make sure we round down to an integral number of samples */
-    length -= length % bps;
+    length -= length % bpf;
 
   /* figure out the offset in the ringbuffer */
   if (G_UNLIKELY (offset != -1)) {
-    sample = offset / bps;
+    sample = offset / bpf;
     /* if a specific offset was given it must be the next sequential
      * offset we expect or we fail for now. */
     if (src->next_sample != -1 && sample != src->next_sample)
@@ -797,17 +785,20 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
     sample = gst_base_audio_src_get_offset (src);
   }
 
-  GST_DEBUG_OBJECT (src, "reading from sample %" G_GUINT64_FORMAT, sample);
+  GST_DEBUG_OBJECT (src, "reading from sample %" G_GUINT64_FORMAT " length %u",
+      sample, length);
 
   /* get the number of samples to read */
-  total_samples = samples = length / bps;
+  total_samples = samples = length / bpf;
 
-  /* FIXME, using a bufferpool would be nice here */
-  buf = gst_buffer_new_and_alloc (length);
-  data = GST_BUFFER_DATA (buf);
+  /* use the basesrc allocation code to use bufferpools or custom allocators */
+  ret = GST_BASE_SRC_CLASS (parent_class)->alloc (bsrc, offset, length, &buf);
+  if (G_UNLIKELY (ret != GST_FLOW_OK))
+    goto alloc_failed;
 
+  data = ptr = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
   do {
-    read = gst_ring_buffer_read (ringbuffer, sample, data, samples);
+    read = gst_ring_buffer_read (ringbuffer, sample, ptr, samples);
     GST_DEBUG_OBJECT (src, "read %u of %u", read, samples);
     /* if we read all, we're done */
     if (read == samples)
@@ -823,8 +814,9 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
     /* read next samples */
     sample += read;
     samples -= read;
-    data += read * bps;
+    ptr += read * bpf;
   } while (TRUE);
+  gst_buffer_unmap (buf, data, length);
 
   /* mark discontinuity if needed */
   if (G_UNLIKELY (sample != src->next_sample) && src->next_sample != -1) {
@@ -842,9 +834,9 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
   src->next_sample = sample + samples;
 
   /* get the normal timestamp to get the duration. */
-  timestamp = gst_util_uint64_scale_int (sample, GST_SECOND, spec->rate);
+  timestamp = gst_util_uint64_scale_int (sample, GST_SECOND, rate);
   duration = gst_util_uint64_scale_int (src->next_sample, GST_SECOND,
-      spec->rate) - timestamp;
+      rate) - timestamp;
 
   GST_OBJECT_LOCK (src);
   if (!(clock = GST_ELEMENT_CLOCK (src)))
@@ -891,7 +883,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
 
         /* the running_time converted to a sample (relative to the ringbuffer) */
         running_time_sample =
-            gst_util_uint64_scale_int (running_time, spec->rate, GST_SECOND);
+            gst_util_uint64_scale_int (running_time, rate, GST_SECOND);
 
         /* the segmentnr corrensponding to running_time, round down */
         running_time_segment = running_time_sample / sps;
@@ -945,8 +937,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
           new_sample = ((guint64) new_read_segment) * sps;
 
           /* and get the relative time to this -> our new timestamp */
-          timestamp =
-              gst_util_uint64_scale_int (new_sample, GST_SECOND, spec->rate);
+          timestamp = gst_util_uint64_scale_int (new_sample, GST_SECOND, rate);
 
           /* we update the next sample accordingly */
           src->next_sample = new_sample + samples;
@@ -975,8 +966,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
           timestamp = 0;
 
         /* subtract latency */
-        latency =
-            gst_util_uint64_scale_int (total_samples, GST_SECOND, spec->rate);
+        latency = gst_util_uint64_scale_int (total_samples, GST_SECOND, rate);
         if (timestamp > latency)
           timestamp -= latency;
         else
@@ -1033,6 +1023,11 @@ wrong_offset:
             G_GUINT64_FORMAT " was given", offset));
     return GST_FLOW_ERROR;
   }
+alloc_failed:
+  {
+    GST_DEBUG_OBJECT (src, "alloc failed: %s", gst_flow_get_name (ret));
+    return ret;
+  }
 stopped:
   {
     gst_buffer_unref (buf);
index 87df45b..cb18f76 100644 (file)
@@ -85,7 +85,7 @@ gst_ring_buffer_init (GstRingBuffer * ringbuffer)
   ringbuffer->cond = g_cond_new ();
   ringbuffer->waiting = 0;
   ringbuffer->empty_seg = NULL;
-  ringbuffer->abidata.ABI.flushing = TRUE;
+  ringbuffer->flushing = TRUE;
 }
 
 static void
@@ -111,95 +111,9 @@ gst_ring_buffer_finalize (GObject * object)
       (ringbuffer));
 }
 
-typedef struct
-{
-  const GstBufferFormat format;
-  const guint8 silence[4];
-} FormatDef;
-
-static const FormatDef linear_defs[4 * 2 * 2] = {
-  {GST_S8, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S8, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U8, {0x80, 0x80, 0x80, 0x80}},
-  {GST_U8, {0x80, 0x80, 0x80, 0x80}},
-  {GST_S16_LE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S16_BE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U16_LE, {0x00, 0x80, 0x00, 0x80}},
-  {GST_U16_BE, {0x80, 0x00, 0x80, 0x00}},
-  {GST_S24_LE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S24_BE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U24_LE, {0x00, 0x00, 0x80, 0x00}},
-  {GST_U24_BE, {0x80, 0x00, 0x00, 0x00}},
-  {GST_S32_LE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S32_BE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U32_LE, {0x00, 0x00, 0x00, 0x80}},
-  {GST_U32_BE, {0x80, 0x00, 0x00, 0x00}}
-};
-
-static const FormatDef linear24_defs[3 * 2 * 2] = {
-  {GST_S24_3LE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S24_3BE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U24_3LE, {0x00, 0x00, 0x80, 0x00}},
-  {GST_U24_3BE, {0x80, 0x00, 0x00, 0x00}},
-  {GST_S20_3LE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S20_3BE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U20_3LE, {0x00, 0x00, 0x08, 0x00}},
-  {GST_U20_3BE, {0x08, 0x00, 0x00, 0x00}},
-  {GST_S18_3LE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_S18_3BE, {0x00, 0x00, 0x00, 0x00}},
-  {GST_U18_3LE, {0x00, 0x00, 0x02, 0x00}},
-  {GST_U18_3BE, {0x02, 0x00, 0x00, 0x00}}
-};
-
-static const FormatDef *
-build_linear_format (int depth, int width, int unsignd, int big_endian)
-{
-  const FormatDef *formats;
-
-  if (width == 24) {
-    switch (depth) {
-      case 24:
-        formats = &linear24_defs[0];
-        break;
-      case 20:
-        formats = &linear24_defs[4];
-        break;
-      case 18:
-        formats = &linear24_defs[8];
-        break;
-      default:
-        return NULL;
-    }
-  } else {
-    switch (depth) {
-      case 8:
-        formats = &linear_defs[0];
-        break;
-      case 16:
-        formats = &linear_defs[4];
-        break;
-      case 24:
-        formats = &linear_defs[8];
-        break;
-      case 32:
-        formats = &linear_defs[12];
-        break;
-      default:
-        return NULL;
-    }
-  }
-  if (unsignd)
-    formats += 2;
-  if (big_endian)
-    formats += 1;
-
-  return formats;
-}
-
 #ifndef GST_DISABLE_GST_DEBUG
 static const gchar *format_type_names[] = {
-  "linear",
-  "float",
+  "raw",
   "mu law",
   "a law",
   "ima adpcm",
@@ -210,49 +124,6 @@ static const gchar *format_type_names[] = {
   "eac3",
   "dts"
 };
-
-static const gchar *format_names[] = {
-  "unknown",
-  "s8",
-  "u8",
-  "s16_le",
-  "s16_be",
-  "u16_le",
-  "u16_be",
-  "s24_le",
-  "s24_be",
-  "u24_le",
-  "u24_be",
-  "s32_le",
-  "s32_be",
-  "u32_le",
-  "u32_be",
-  "s24_3le",
-  "s24_3be",
-  "u24_3le",
-  "u24_3be",
-  "s20_3le",
-  "s20_3be",
-  "u20_3le",
-  "u20_3be",
-  "s18_3le",
-  "s18_3be",
-  "u18_3le",
-  "u18_3be",
-  "float32_le",
-  "float32_be",
-  "float64_le",
-  "float64_be",
-  "mu_law",
-  "a_law",
-  "ima_adpcm",
-  "mpeg",
-  "gsm",
-  "iec958",
-  "ac3",
-  "eac3",
-  "dts"
-};
 #endif
 
 /**
@@ -264,15 +135,15 @@ static const gchar *format_names[] = {
 void
 gst_ring_buffer_debug_spec_caps (GstRingBufferSpec * spec)
 {
+#if 0
   gint i, bytes;
+#endif
 
   GST_DEBUG ("spec caps: %p %" GST_PTR_FORMAT, spec->caps, spec->caps);
   GST_DEBUG ("parsed caps: type:         %d, '%s'", spec->type,
       format_type_names[spec->type]);
-  GST_DEBUG ("parsed caps: format:       %d, '%s'", spec->format,
-      format_names[spec->format]);
+#if 0
   GST_DEBUG ("parsed caps: width:        %d", spec->width);
-  GST_DEBUG ("parsed caps: depth:        %d", spec->depth);
   GST_DEBUG ("parsed caps: sign:         %d", spec->sign);
   GST_DEBUG ("parsed caps: bigend:       %d", spec->bigend);
   GST_DEBUG ("parsed caps: rate:         %d", spec->rate);
@@ -282,6 +153,7 @@ gst_ring_buffer_debug_spec_caps (GstRingBufferSpec * spec)
   for (i = 0; i < bytes; i++) {
     GST_DEBUG ("silence byte %d: %02x", i, spec->silence_sample[i]);
   }
+#endif
 }
 
 /**
@@ -293,6 +165,8 @@ gst_ring_buffer_debug_spec_caps (GstRingBufferSpec * spec)
 void
 gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec)
 {
+  gint bpf = GST_AUDIO_INFO_BPF (&spec->info);
+
   GST_DEBUG ("acquire ringbuffer: buffer time: %" G_GINT64_FORMAT " usec",
       spec->buffer_time);
   GST_DEBUG ("acquire ringbuffer: latency time: %" G_GINT64_FORMAT " usec",
@@ -300,10 +174,9 @@ gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec)
   GST_DEBUG ("acquire ringbuffer: total segments: %d", spec->segtotal);
   GST_DEBUG ("acquire ringbuffer: latency segments: %d", spec->seglatency);
   GST_DEBUG ("acquire ringbuffer: segment size: %d bytes = %d samples",
-      spec->segsize, spec->segsize / spec->bytes_per_sample);
+      spec->segsize, spec->segsize / bpf);
   GST_DEBUG ("acquire ringbuffer: buffer size: %d bytes = %d samples",
-      spec->segsize * spec->segtotal,
-      spec->segsize * spec->segtotal / spec->bytes_per_sample);
+      spec->segsize * spec->segtotal, spec->segsize * spec->segtotal / bpf);
 }
 
 /**
@@ -321,160 +194,77 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
   const gchar *mimetype;
   GstStructure *structure;
   gint i;
+  GstAudioInfo info;
 
   structure = gst_caps_get_structure (caps, 0);
+  gst_audio_info_init (&info);
 
   /* we have to differentiate between int and float formats */
   mimetype = gst_structure_get_name (structure);
 
-  if (g_str_equal (mimetype, "audio/x-raw-int")) {
-    gint endianness;
-    const FormatDef *def;
-    gint j, bytes;
-
-    spec->type = GST_BUFTYPE_LINEAR;
-
-    /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
-            gst_structure_get_int (structure, "channels", &spec->channels) &&
-            gst_structure_get_int (structure, "width", &spec->width) &&
-            gst_structure_get_int (structure, "depth", &spec->depth) &&
-            gst_structure_get_boolean (structure, "signed", &spec->sign)))
-      goto parse_error;
-
-    /* extract endianness if needed */
-    if (spec->width > 8) {
-      if (!gst_structure_get_int (structure, "endianness", &endianness))
-        goto parse_error;
-    } else {
-      endianness = G_BYTE_ORDER;
-    }
-
-    spec->bigend = endianness == G_LITTLE_ENDIAN ? FALSE : TRUE;
-
-    def = build_linear_format (spec->depth, spec->width, spec->sign ? 0 : 1,
-        spec->bigend ? 1 : 0);
-
-    if (def == NULL)
-      goto parse_error;
-
-    spec->format = def->format;
-
-    bytes = spec->width >> 3;
-
-    for (i = 0; i < spec->channels; i++) {
-      for (j = 0; j < bytes; j++) {
-        spec->silence_sample[i * bytes + j] = def->silence[j];
-      }
-    }
-  } else if (g_str_equal (mimetype, "audio/x-raw-float")) {
-
-    spec->type = GST_BUFTYPE_FLOAT;
-
-    /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
-            gst_structure_get_int (structure, "channels", &spec->channels) &&
-            gst_structure_get_int (structure, "width", &spec->width)))
+  if (g_str_equal (mimetype, "audio/x-raw")) {
+    if (!gst_audio_info_from_caps (&info, caps))
       goto parse_error;
 
-    /* match layout to format wrt to endianness */
-    switch (spec->width) {
-      case 32:
-        spec->format =
-            G_BYTE_ORDER == G_LITTLE_ENDIAN ? GST_FLOAT32_LE : GST_FLOAT32_BE;
-        break;
-      case 64:
-        spec->format =
-            G_BYTE_ORDER == G_LITTLE_ENDIAN ? GST_FLOAT64_LE : GST_FLOAT64_BE;
-        break;
-      default:
-        goto parse_error;
-    }
-    /* float silence is all zeros.. */
-    memset (spec->silence_sample, 0, 32);
+    spec->type = GST_BUFTYPE_RAW;
   } else if (g_str_equal (mimetype, "audio/x-alaw")) {
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
-            gst_structure_get_int (structure, "channels", &spec->channels)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate) &&
+            gst_structure_get_int (structure, "channels", &info.channels)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_A_LAW;
-    spec->format = GST_A_LAW;
-    spec->width = 8;
-    spec->depth = 8;
-    for (i = 0; i < spec->channels; i++)
-      spec->silence_sample[i] = 0xd5;
+    spec->info.bpf = info.channels;
   } else if (g_str_equal (mimetype, "audio/x-mulaw")) {
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
-            gst_structure_get_int (structure, "channels", &spec->channels)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate) &&
+            gst_structure_get_int (structure, "channels", &info.channels)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_MU_LAW;
-    spec->format = GST_MU_LAW;
-    spec->width = 8;
-    spec->depth = 8;
-    for (i = 0; i < spec->channels; i++)
-      spec->silence_sample[i] = 0xff;
+    spec->info.bpf = info.channels;
   } else if (g_str_equal (mimetype, "audio/x-iec958")) {
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_IEC958;
-    spec->format = GST_IEC958;
-    spec->width = 16;
-    spec->depth = 16;
-    spec->channels = 2;
+    spec->info.bpf = 4;
   } else if (g_str_equal (mimetype, "audio/x-ac3")) {
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_AC3;
-    spec->format = GST_AC3;
-    spec->width = 16;
-    spec->depth = 16;
-    spec->channels = 2;
+    spec->info.bpf = 4;
   } else if (g_str_equal (mimetype, "audio/x-eac3")) {
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_EAC3;
-    spec->format = GST_EAC3;
-    spec->width = 64;
-    spec->depth = 64;
-    spec->channels = 2;
+    spec->info.bpf = 16;
   } else if (g_str_equal (mimetype, "audio/x-dts")) {
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_DTS;
-    spec->format = GST_DTS;
-    spec->width = 16;
-    spec->depth = 16;
-    spec->channels = 2;
+    spec->info.bpf = 4;
   } else if (g_str_equal (mimetype, "audio/mpeg") &&
       gst_structure_get_int (structure, "mpegaudioversion", &i) &&
       (i == 1 || i == 2)) {
     /* Now we know this is MPEG-1 or MPEG-2 (non AAC) */
     /* extract the needed information from the cap */
-    if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
+    if (!(gst_structure_get_int (structure, "rate", &info.rate)))
       goto parse_error;
 
     spec->type = GST_BUFTYPE_MPEG;
-    spec->format = GST_MPEG;
-    spec->width = 16;
-    spec->depth = 16;
-    spec->channels = 2;
+    spec->info.bpf = 4;
   } else {
     goto parse_error;
   }
 
-  spec->bytes_per_sample = (spec->width >> 3) * spec->channels;
-
   gst_caps_replace (&spec->caps, caps);
 
   g_return_val_if_fail (spec->latency_time != 0, FALSE);
@@ -482,10 +272,10 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
   /* calculate suggested segsize and segtotal. segsize should be one unit
    * of 'latency_time' samples, scaling for the fact that latency_time is
    * currently stored in microseconds (FIXME: in 0.11) */
-  spec->segsize = gst_util_uint64_scale (spec->rate * spec->bytes_per_sample,
+  spec->segsize = gst_util_uint64_scale (info.rate * info.bpf,
       spec->latency_time, GST_SECOND / GST_USECOND);
   /* Round to an integer number of samples */
-  spec->segsize -= spec->segsize % spec->bytes_per_sample;
+  spec->segsize -= spec->segsize % info.bpf;
 
   spec->segtotal = spec->buffer_time / spec->latency_time;
   /* leave the latency undefined now, implementations can change it but if it's
@@ -495,6 +285,8 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
   gst_ring_buffer_debug_spec_caps (spec);
   gst_ring_buffer_debug_spec_buff (spec);
 
+  spec->info = info;
+
   return TRUE;
 
   /* ERRORS */
@@ -525,7 +317,7 @@ gst_ring_buffer_convert (GstRingBuffer * buf,
     GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val)
 {
   gboolean res = TRUE;
-  gint bps, rate;
+  gint bpf, rate;
 
   GST_DEBUG ("converting value %" G_GINT64_FORMAT " from %s (%d) to %s (%d)",
       src_val, gst_format_get_name (src_fmt), src_fmt,
@@ -538,12 +330,12 @@ gst_ring_buffer_convert (GstRingBuffer * buf,
 
   /* get important info */
   GST_OBJECT_LOCK (buf);
-  bps = buf->spec.bytes_per_sample;
-  rate = buf->spec.rate;
+  bpf = GST_AUDIO_INFO_BPF (&buf->spec.info);
+  rate = GST_AUDIO_INFO_RATE (&buf->spec.info);
   GST_OBJECT_UNLOCK (buf);
 
-  if (bps == 0 || rate == 0) {
-    GST_DEBUG ("no rate or bps configured");
+  if (bpf == 0 || rate == 0) {
+    GST_DEBUG ("no rate or bpf configured");
     res = FALSE;
     goto done;
   }
@@ -552,11 +344,11 @@ gst_ring_buffer_convert (GstRingBuffer * buf,
     case GST_FORMAT_BYTES:
       switch (dest_fmt) {
         case GST_FORMAT_TIME:
-          *dest_val = gst_util_uint64_scale_int (src_val / bps, GST_SECOND,
+          *dest_val = gst_util_uint64_scale_int (src_val / bpf, GST_SECOND,
               rate);
           break;
         case GST_FORMAT_DEFAULT:
-          *dest_val = src_val / bps;
+          *dest_val = src_val / bpf;
           break;
         default:
           res = FALSE;
@@ -569,7 +361,7 @@ gst_ring_buffer_convert (GstRingBuffer * buf,
           *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, rate);
           break;
         case GST_FORMAT_BYTES:
-          *dest_val = src_val * bps;
+          *dest_val = src_val * bpf;
           break;
         default:
           res = FALSE;
@@ -583,7 +375,7 @@ gst_ring_buffer_convert (GstRingBuffer * buf,
           break;
         case GST_FORMAT_BYTES:
           *dest_val = gst_util_uint64_scale_int (src_val, rate, GST_SECOND);
-          *dest_val *= bps;
+          *dest_val *= bpf;
           break;
         default:
           res = FALSE;
@@ -794,8 +586,7 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
 {
   gboolean res = FALSE;
   GstRingBufferClass *rclass;
-  gint i, j;
-  gint segsize, bps;
+  gint segsize, bpf;
 
   g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
 
@@ -817,8 +608,8 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
   if (G_UNLIKELY (!res))
     goto acquire_failed;
 
-  if (G_UNLIKELY ((bps = buf->spec.bytes_per_sample) == 0))
-    goto invalid_bps;
+  if (G_UNLIKELY ((bpf = buf->spec.info.bpf) == 0))
+    goto invalid_bpf;
 
   /* if the seglatency was overwritten with something else than -1, use it, else
    * assume segtotal as the latency */
@@ -827,18 +618,18 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
 
   segsize = buf->spec.segsize;
 
-  buf->samples_per_seg = segsize / bps;
+  buf->samples_per_seg = segsize / bpf;
 
   /* create an empty segment */
   g_free (buf->empty_seg);
   buf->empty_seg = g_malloc (segsize);
 
-  /* FIXME, we only have 32 silence samples, which might not be enough to
-   * represent silence in all channels */
-  bps = MIN (bps, 32);
-  for (i = 0, j = 0; i < segsize; i++) {
-    buf->empty_seg[i] = buf->spec.silence_sample[j];
-    j = (j + 1) % bps;
+  if (buf->spec.type == GST_BUFTYPE_RAW) {
+    gst_audio_format_fill_silence (buf->spec.info.finfo, buf->empty_seg,
+        segsize);
+  } else {
+    /* FIXME, non-raw formats get 0 as the empty sample */
+    memset (buf->empty_seg, 0, segsize);
   }
   GST_DEBUG_OBJECT (buf, "acquired device");
 
@@ -867,10 +658,10 @@ acquire_failed:
     GST_DEBUG_OBJECT (buf, "failed to acquire device");
     goto done;
   }
-invalid_bps:
+invalid_bpf:
   {
     g_warning
-        ("invalid bytes_per_sample from acquire ringbuffer %p, fix the element",
+        ("invalid bytes_per_frame from acquire ringbuffer %p, fix the element",
         buf);
     buf->acquired = FALSE;
     res = FALSE;
@@ -996,7 +787,7 @@ gst_ring_buffer_activate (GstRingBuffer * buf, gboolean active)
   if (G_UNLIKELY (active && !buf->acquired))
     goto not_acquired;
 
-  if (G_UNLIKELY (buf->abidata.ABI.active == active))
+  if (G_UNLIKELY (buf->active == active))
     goto was_active;
 
   rclass = GST_RING_BUFFER_GET_CLASS (buf);
@@ -1010,7 +801,7 @@ gst_ring_buffer_activate (GstRingBuffer * buf, gboolean active)
   if (G_UNLIKELY (!res))
     goto activate_failed;
 
-  buf->abidata.ABI.active = active;
+  buf->active = active;
 
 done:
   GST_OBJECT_UNLOCK (buf);
@@ -1058,7 +849,7 @@ gst_ring_buffer_is_active (GstRingBuffer * buf)
   g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
 
   GST_OBJECT_LOCK (buf);
-  res = buf->abidata.ABI.active;
+  res = buf->active;
   GST_OBJECT_UNLOCK (buf);
 
   return res;
@@ -1080,7 +871,7 @@ gst_ring_buffer_set_flushing (GstRingBuffer * buf, gboolean flushing)
   g_return_if_fail (GST_IS_RING_BUFFER (buf));
 
   GST_OBJECT_LOCK (buf);
-  buf->abidata.ABI.flushing = flushing;
+  buf->flushing = flushing;
 
   if (flushing) {
     gst_ring_buffer_pause_unlocked (buf);
@@ -1112,13 +903,13 @@ gst_ring_buffer_start (GstRingBuffer * buf)
   GST_DEBUG_OBJECT (buf, "starting ringbuffer");
 
   GST_OBJECT_LOCK (buf);
-  if (G_UNLIKELY (buf->abidata.ABI.flushing))
+  if (G_UNLIKELY (buf->flushing))
     goto flushing;
 
   if (G_UNLIKELY (!buf->acquired))
     goto not_acquired;
 
-  if (G_UNLIKELY (g_atomic_int_get (&buf->abidata.ABI.may_start) == FALSE))
+  if (G_UNLIKELY (g_atomic_int_get (&buf->may_start) == FALSE))
     goto may_not_start;
 
   /* if stopped, set to started */
@@ -1239,7 +1030,7 @@ gst_ring_buffer_pause (GstRingBuffer * buf)
   g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
 
   GST_OBJECT_LOCK (buf);
-  if (G_UNLIKELY (buf->abidata.ABI.flushing))
+  if (G_UNLIKELY (buf->flushing))
     goto flushing;
 
   if (G_UNLIKELY (!buf->acquired))
@@ -1483,7 +1274,7 @@ wait_segment (GstRingBuffer * buf)
   if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
           GST_RING_BUFFER_STATE_STARTED)) {
     /* see if we are allowed to start it */
-    if (G_UNLIKELY (g_atomic_int_get (&buf->abidata.ABI.may_start) == FALSE))
+    if (G_UNLIKELY (g_atomic_int_get (&buf->may_start) == FALSE))
       goto no_start;
 
     GST_DEBUG_OBJECT (buf, "start!");
@@ -1498,7 +1289,7 @@ wait_segment (GstRingBuffer * buf)
 
   /* take lock first, then update our waiting flag */
   GST_OBJECT_LOCK (buf);
-  if (G_UNLIKELY (buf->abidata.ABI.flushing))
+  if (G_UNLIKELY (buf->flushing))
     goto flushing;
 
   if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
@@ -1510,7 +1301,7 @@ wait_segment (GstRingBuffer * buf)
       GST_DEBUG_OBJECT (buf, "waiting..");
       GST_RING_BUFFER_WAIT (buf);
 
-      if (G_UNLIKELY (buf->abidata.ABI.flushing))
+      if (G_UNLIKELY (buf->flushing))
         goto flushing;
 
       if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
@@ -1547,12 +1338,12 @@ no_start:
 #define FWD_SAMPLES(s,se,d,de)                 \
 G_STMT_START {                                 \
   /* no rate conversion */                     \
-  guint towrite = MIN (se + bps - s, de - d);  \
+  guint towrite = MIN (se + bpf - s, de - d);  \
   /* simple copy */                            \
   if (!skip)                                   \
     memcpy (d, s, towrite);                    \
-  in_samples -= towrite / bps;                 \
-  out_samples -= towrite / bps;                        \
+  in_samples -= towrite / bpf;                 \
+  out_samples -= towrite / bpf;                        \
   s += towrite;                                        \
   GST_DEBUG ("copy %u bytes", towrite);                \
 } G_STMT_END
@@ -1563,16 +1354,16 @@ G_STMT_START {                                  \
   guint8 *sb = s, *db = d;                     \
   while (s <= se && d < de) {                  \
     if (!skip)                                 \
-      memcpy (d, s, bps);                      \
-    s += bps;                                  \
+      memcpy (d, s, bpf);                      \
+    s += bpf;                                  \
     *accum += outr;                            \
     if ((*accum << 1) >= inr) {                        \
       *accum -= inr;                           \
-      d += bps;                                        \
+      d += bpf;                                        \
     }                                          \
   }                                            \
-  in_samples -= (s - sb)/bps;                  \
-  out_samples -= (d - db)/bps;                 \
+  in_samples -= (s - sb)/bpf;                  \
+  out_samples -= (d - db)/bpf;                 \
   GST_DEBUG ("fwd_up end %d/%d",*accum,*toprocess);    \
 } G_STMT_END
 
@@ -1582,16 +1373,16 @@ G_STMT_START {                                  \
   guint8 *sb = s, *db = d;                     \
   while (s <= se && d < de) {                  \
     if (!skip)                                 \
-      memcpy (d, s, bps);                      \
-    d += bps;                                  \
+      memcpy (d, s, bpf);                      \
+    d += bpf;                                  \
     *accum += inr;                             \
     if ((*accum << 1) >= outr) {               \
       *accum -= outr;                          \
-      s += bps;                                        \
+      s += bpf;                                        \
     }                                          \
   }                                            \
-  in_samples -= (s - sb)/bps;                  \
-  out_samples -= (d - db)/bps;                 \
+  in_samples -= (s - sb)/bpf;                  \
+  out_samples -= (d - db)/bpf;                 \
   GST_DEBUG ("fwd_down end %d/%d",*accum,*toprocess);  \
 } G_STMT_END
 
@@ -1600,16 +1391,16 @@ G_STMT_START {                                  \
   guint8 *sb = se, *db = d;                    \
   while (s <= se && d < de) {                  \
     if (!skip)                                 \
-      memcpy (d, se, bps);                     \
-    se -= bps;                                 \
+      memcpy (d, se, bpf);                     \
+    se -= bpf;                                 \
     *accum += outr;                            \
     while (d < de && (*accum << 1) >= inr) {   \
       *accum -= inr;                           \
-      d += bps;                                        \
+      d += bpf;                                        \
     }                                          \
   }                                            \
-  in_samples -= (sb - se)/bps;                 \
-  out_samples -= (d - db)/bps;                 \
+  in_samples -= (sb - se)/bpf;                 \
+  out_samples -= (d - db)/bpf;                 \
   GST_DEBUG ("rev_up end %d/%d",*accum,*toprocess);    \
 } G_STMT_END
 
@@ -1618,16 +1409,16 @@ G_STMT_START {                                  \
   guint8 *sb = se, *db = d;                    \
   while (s <= se && d < de) {                  \
     if (!skip)                                 \
-      memcpy (d, se, bps);                     \
-    d += bps;                                  \
+      memcpy (d, se, bpf);                     \
+    d += bpf;                                  \
     *accum += inr;                             \
     while (s <= se && (*accum << 1) >= outr) { \
       *accum -= outr;                          \
-      se -= bps;                               \
+      se -= bpf;                               \
     }                                          \
   }                                            \
-  in_samples -= (sb - se)/bps;                 \
-  out_samples -= (d - db)/bps;                 \
+  in_samples -= (sb - se)/bpf;                 \
+  out_samples -= (d - db)/bpf;                 \
   GST_DEBUG ("rev_down end %d/%d",*accum,*toprocess);  \
 } G_STMT_END
 
@@ -1636,20 +1427,20 @@ default_commit (GstRingBuffer * buf, guint64 * sample,
     guchar * data, gint in_samples, gint out_samples, gint * accum)
 {
   gint segdone;
-  gint segsize, segtotal, bps, sps;
+  gint segsize, segtotal, bpf, sps;
   guint8 *dest, *data_end;
   gint writeseg, sampleoff;
   gint *toprocess;
   gint inr, outr;
   gboolean reverse;
 
-  g_return_val_if_fail (buf->data != NULL, -1);
+  g_return_val_if_fail (buf->memory != NULL, -1);
   g_return_val_if_fail (data != NULL, -1);
 
-  dest = GST_BUFFER_DATA (buf->data);
+  dest = buf->memory;
   segsize = buf->spec.segsize;
   segtotal = buf->spec.segtotal;
-  bps = buf->spec.bytes_per_sample;
+  bpf = buf->spec.info.bpf;
   sps = buf->samples_per_seg;
 
   reverse = out_samples < 0;
@@ -1665,12 +1456,12 @@ default_commit (GstRingBuffer * buf, guint64 * sample,
 
   /* data_end points to the last sample we have to write, not past it. This is
    * needed to properly handle reverse playback: it points to the last sample. */
-  data_end = data + (bps * inr);
+  data_end = data + (bpf * inr);
 
   /* figure out the segment and the offset inside the segment where
    * the first sample should be written. */
   writeseg = *sample / sps;
-  sampleoff = (*sample % sps) * bps;
+  sampleoff = (*sample % sps) * bpf;
 
   /* write out all samples */
   while (*toprocess > 0) {
@@ -1714,11 +1505,11 @@ default_commit (GstRingBuffer * buf, guint64 * sample,
 
     /* we can write now */
     ws = writeseg % segtotal;
-    avail = MIN (segsize - sampleoff, bps * out_samples);
+    avail = MIN (segsize - sampleoff, bpf * out_samples);
 
     d = dest + (ws * segsize) + sampleoff;
     d_end = d + avail;
-    *sample += avail / bps;
+    *sample += avail / bpf;
 
     GST_DEBUG_OBJECT (buf, "write @%p seg %d, sps %d, off %d, avail %d",
         dest + ws * segsize, ws, sps, sampleoff, avail);
@@ -1747,10 +1538,10 @@ default_commit (GstRingBuffer * buf, guint64 * sample,
     sampleoff = 0;
   }
   /* we consumed all samples here */
-  data = data_end + bps;
+  data = data_end + bpf;
 
 done:
-  return inr - ((data_end - data) / bps);
+  return inr - ((data_end - data) / bpf);
 
   /* ERRORS */
 not_started:
@@ -1867,18 +1658,18 @@ gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
     guint len)
 {
   gint segdone;
-  gint segsize, segtotal, bps, sps;
+  gint segsize, segtotal, bpf, sps;
   guint8 *dest;
   guint to_read;
 
   g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1);
-  g_return_val_if_fail (buf->data != NULL, -1);
+  g_return_val_if_fail (buf->memory != NULL, -1);
   g_return_val_if_fail (data != NULL, -1);
 
-  dest = GST_BUFFER_DATA (buf->data);
+  dest = buf->memory;
   segsize = buf->spec.segsize;
   segtotal = buf->spec.segtotal;
-  bps = buf->spec.bytes_per_sample;
+  bpf = buf->spec.info.bpf;
   sps = buf->samples_per_seg;
 
   to_read = len;
@@ -1913,7 +1704,7 @@ gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
       if (G_UNLIKELY (diff >= segtotal)) {
         /* pretend we read an empty segment. */
         sampleslen = MIN (sps, to_read);
-        memcpy (data, buf->empty_seg, sampleslen * bps);
+        memcpy (data, buf->empty_seg, sampleslen * bpf);
         goto next;
       }
 
@@ -1934,13 +1725,13 @@ gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
     GST_DEBUG_OBJECT (buf, "read @%p seg %d, off %d, sampleslen %d",
         dest + readseg * segsize, readseg, sampleoff, sampleslen);
 
-    memcpy (data, dest + (readseg * segsize) + (sampleoff * bps),
-        (sampleslen * bps));
+    memcpy (data, dest + (readseg * segsize) + (sampleoff * bpf),
+        (sampleslen * bpf));
 
   next:
     to_read -= sampleslen;
     sample += sampleslen;
-    data += sampleslen * bps;
+    data += sampleslen * bpf;
   }
 
   return len - to_read;
@@ -1982,12 +1773,12 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
       return FALSE;
   }
 
-  g_return_val_if_fail (buf->data != NULL, FALSE);
+  g_return_val_if_fail (buf->memory != NULL, FALSE);
   g_return_val_if_fail (segment != NULL, FALSE);
   g_return_val_if_fail (readptr != NULL, FALSE);
   g_return_val_if_fail (len != NULL, FALSE);
 
-  data = GST_BUFFER_DATA (buf->data);
+  data = buf->memory;
 
   /* get the position of the pointer */
   segdone = g_atomic_int_get (&buf->segdone);
@@ -2054,7 +1845,7 @@ gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
   g_return_if_fail (GST_IS_RING_BUFFER (buf));
 
   /* no data means it's already cleared */
-  if (G_UNLIKELY (buf->data == NULL))
+  if (G_UNLIKELY (buf->memory == NULL))
     return;
 
   /* no empty_seg means it's not opened */
@@ -2063,7 +1854,7 @@ gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
 
   segment %= buf->spec.segtotal;
 
-  data = GST_BUFFER_DATA (buf->data);
+  data = buf->memory;
   data += segment * buf->spec.segsize;
 
   GST_LOG ("clear segment %d @%p", segment, data);
@@ -2089,5 +1880,5 @@ gst_ring_buffer_may_start (GstRingBuffer * buf, gboolean allowed)
   g_return_if_fail (GST_IS_RING_BUFFER (buf));
 
   GST_LOG_OBJECT (buf, "may start: %d", allowed);
-  g_atomic_int_set (&buf->abidata.ABI.may_start, allowed);
+  g_atomic_int_set (&buf->may_start, allowed);
 }
index b09863c..76e61c3 100644 (file)
@@ -24,6 +24,7 @@
 #define __GST_RING_BUFFER_H__
 
 #include <gst/gst.h>
+#include <gst/audio/audio.h>
 
 G_BEGIN_DECLS
 
@@ -83,8 +84,7 @@ typedef enum {
 
 /**
  * GstBufferFormatType:
- * @GST_BUFTYPE_LINEAR: samples in linear PCM
- * @GST_BUFTYPE_FLOAT: samples in float
+ * @GST_BUFTYPE_RAW: samples in linear or float
  * @GST_BUFTYPE_MU_LAW: samples in mulaw
  * @GST_BUFTYPE_A_LAW: samples in alaw
  * @GST_BUFTYPE_IMA_ADPCM: samples in ima adpcm
@@ -101,8 +101,7 @@ typedef enum {
  */
 typedef enum
 {
-  GST_BUFTYPE_LINEAR,
-  GST_BUFTYPE_FLOAT,
+  GST_BUFTYPE_RAW,
   GST_BUFTYPE_MU_LAW,
   GST_BUFTYPE_A_LAW,
   GST_BUFTYPE_IMA_ADPCM,
@@ -117,107 +116,6 @@ typedef enum
 } GstBufferFormatType;
 
 /**
- * GstBufferFormat:
- * @GST_UNKNOWN: unspecified
- * @GST_S8: integer signed 8 bit
- * @GST_U8: integer unsigned 8 bit
- * @GST_S16_LE: integer signed 16 bit little endian
- * @GST_S16_BE: integer signed 16 bit big endian
- * @GST_U16_LE: integer unsigned 16 bit little endian
- * @GST_U16_BE: integer unsigned 16 bit big endian
- * @GST_S24_LE: integer signed 24 bit little endian
- * @GST_S24_BE: integer signed 24 bit big endian
- * @GST_U24_LE: integer unsigned 24 bit little endian
- * @GST_U24_BE: integer unsigned 24 bit big endian
- * @GST_S32_LE: integer signed 32 bit little endian
- * @GST_S32_BE: integer signed 32 bit big endian
- * @GST_U32_LE: integer unsigned 32 bit little endian
- * @GST_U32_BE: integer unsigned 32 bit big endian
- * @GST_S24_3LE: integer signed 24 bit little endian packed in 3 bytes
- * @GST_S24_3BE: integer signed 24 bit big endian packed in 3 bytes
- * @GST_U24_3LE: integer unsigned 24 bit little endian packed in 3 bytes
- * @GST_U24_3BE: integer unsigned 24 bit big endian packed in 3 bytes
- * @GST_S20_3LE: integer signed 20 bit little endian packed in 3 bytes
- * @GST_S20_3BE: integer signed 20 bit big endian packed in 3 bytes
- * @GST_U20_3LE: integer unsigned 20 bit little endian packed in 3 bytes
- * @GST_U20_3BE: integer unsigned 20 bit big endian packed in 3 bytes
- * @GST_S18_3LE: integer signed 18 bit little endian packed in 3 bytes
- * @GST_S18_3BE: integer signed 18 bit big endian packed in 3 bytes
- * @GST_U18_3LE: integer unsigned 18 bit little endian packed in 3 bytes
- * @GST_U18_3BE: integer unsigned 18 bit big endian packed in 3 bytes
- * @GST_FLOAT32_LE: floating 32 bit little endian
- * @GST_FLOAT32_BE: floating 32 bit big endian
- * @GST_FLOAT64_LE: floating 64 bit little endian
- * @GST_FLOAT64_BE: floating 64 bit big endian
- * @GST_MU_LAW: mu-law
- * @GST_A_LAW: a-law
- * @GST_IMA_ADPCM: ima adpcm
- * @GST_MPEG: mpeg audio (but not aac)
- * @GST_GSM: gsm
- * @GST_IEC958: IEC958 frames
- * @GST_AC3: ac3
- * @GST_EAC3: eac3
- * @GST_DTS: dts
- * @GST_MPEG2_AAC: mpeg-2 aac
- * @GST_MPEG4_AAC: mpeg-4 aac
- *
- * The detailed format of the samples in the ringbuffer.
- */
-typedef enum
-{
-  GST_UNKNOWN,
-
-  GST_S8,
-  GST_U8,
-
-  GST_S16_LE,
-  GST_S16_BE,
-  GST_U16_LE,
-  GST_U16_BE,
-
-  GST_S24_LE,
-  GST_S24_BE,
-  GST_U24_LE,
-  GST_U24_BE,
-
-  GST_S32_LE,
-  GST_S32_BE,
-  GST_U32_LE,
-  GST_U32_BE,
-
-  GST_S24_3LE,
-  GST_S24_3BE,
-  GST_U24_3LE,
-  GST_U24_3BE,
-  GST_S20_3LE,
-  GST_S20_3BE,
-  GST_U20_3LE,
-  GST_U20_3BE,
-  GST_S18_3LE,
-  GST_S18_3BE,
-  GST_U18_3LE,
-  GST_U18_3BE,
-
-  GST_FLOAT32_LE,
-  GST_FLOAT32_BE,
-
-  GST_FLOAT64_LE,
-  GST_FLOAT64_BE,
-
-  GST_MU_LAW,
-  GST_A_LAW,
-  GST_IMA_ADPCM,
-  GST_MPEG,
-  GST_GSM,
-  GST_IEC958,
-  GST_AC3,
-  GST_EAC3,
-  GST_DTS,
-  GST_MPEG2_AAC,
-  GST_MPEG4_AAC,
-} GstBufferFormat;
-
-/**
  * GstRingBufferSpec:
  * @caps: The caps that generated the Spec.
  * @type: the sample type
@@ -246,14 +144,8 @@ struct _GstRingBufferSpec
   GstCaps  *caps;               /* the caps of the buffer */
 
   /* in/out */
-  GstBufferFormatType   type;
-  GstBufferFormat format;
-  gboolean  sign;
-  gboolean  bigend;
-  gint      width;
-  gint      depth;
-  gint      rate;
-  gint      channels;
+  GstBufferFormatType type;
+  GstAudioInfo        info;
 
   guint64  latency_time;        /* the required/actual latency time, this is the
                                 * actual the size of one segment and the
@@ -268,17 +160,12 @@ struct _GstRingBufferSpec
                                 * number of segments of @segsize and should be
                                 * chosen so that it matches buffer_time as
                                 * close as possible. */
-  /* out */
-  gint     bytes_per_sample;    /* number of bytes of one sample */
-  guint8   silence_sample[32];  /* bytes representing silence */
-
   /* ABI added 0.10.20 */
   gint     seglatency;          /* number of segments queued in the lower
                                 * level device, defaults to segtotal. */
 
   /*< private >*/
-  /* gpointer _gst_reserved[GST_PADDING]; */
-  guint8 _gst_reserved[(sizeof (gpointer) * GST_PADDING) - sizeof (gint)];
+  gpointer _gst_reserved[GST_PADDING];
 };
 
 #define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond)
@@ -310,7 +197,8 @@ struct _GstRingBuffer {
   GCond                 *cond;
   gboolean               open;
   gboolean               acquired;
-  GstBuffer             *data;
+  guint8                *memory;
+  gsize                  size;
   GstRingBufferSpec      spec;
   GstRingBufferSegState *segstate;
   gint                   samples_per_seg;
@@ -326,17 +214,13 @@ struct _GstRingBuffer {
   GstRingBufferCallback  callback;
   gpointer               cb_data;
 
+  gboolean               flushing;
+  /* ATOMIC */
+  gint                   may_start;
+  gboolean               active;
+
   /*< private >*/
-  union {
-    struct {
-      gboolean           flushing;
-      /* ATOMIC */
-      gint               may_start;
-      gboolean           active;
-    } ABI;
-    /* adding + 0 to mark ABI change to be undone later */
-    gpointer _gst_reserved[GST_PADDING + 0];
-  } abidata;
+  gpointer _gst_reserved[GST_PADDING + 0];
 };
 
 /**
index 94cdde3..ba912d9 100644 (file)
@@ -178,8 +178,8 @@ element_factory_rank_compare_func (gconstpointer a, gconstpointer b)
 
   /* make order chosen in the end more determinable */
   if (rank_a == rank_b) {
-    const gchar *name_a = GST_PLUGIN_FEATURE_NAME (GST_PLUGIN_FEATURE (a));
-    const gchar *name_b = GST_PLUGIN_FEATURE_NAME (GST_PLUGIN_FEATURE (b));
+    const gchar *name_a = GST_OBJECT_NAME (GST_PLUGIN_FEATURE (a));
+    const gchar *name_b = GST_OBJECT_NAME (GST_PLUGIN_FEATURE (b));
 
     return g_ascii_strcasecmp (name_a, name_b);
   }
index bd26f1c..388adcd 100644 (file)
@@ -231,13 +231,9 @@ GstAudioChannelPosition *
 gst_audio_get_channel_positions (GstStructure * str)
 {
   GstAudioChannelPosition *pos;
-
   gint channels, n;
-
   const GValue *pos_val_arr, *pos_val_entry;
-
   gboolean res;
-
   GType t;
 
   /* get number of channels, general type checkups */
index 3a3efe3..6f28d37 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __GST_AUDIO_MULTICHANNEL_H__
 #define __GST_AUDIO_MULTICHANNEL_H__
 
-#include <gst/audio/audio.h>
+#include <gst/gst.h>
 #include <gst/audio/audio-enumtypes.h>
 
 G_BEGIN_DECLS
index 26706f4..c72a62c 100644 (file)
@@ -29,6 +29,7 @@ GstCdda-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstcdda-@GST_MAJORMINO
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                --add-include-path=$(builddir)/../tag \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_MAJORMINOR@` \
index e753a56..47c82ee 100644 (file)
@@ -114,6 +114,8 @@ enum
   ARG_TOC_BIAS
 };
 
+static void gst_cdda_base_src_uri_handler_init (gpointer g_iface,
+    gpointer iface_data);
 static void gst_cdda_base_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 static void gst_cdda_base_src_set_property (GObject * object, guint prop_id,
@@ -125,7 +127,6 @@ static gboolean gst_cdda_base_src_handle_event (GstBaseSrc * basesrc,
     GstEvent * event);
 static gboolean gst_cdda_base_src_do_seek (GstBaseSrc * basesrc,
     GstSegment * segment);
-static void gst_cdda_base_src_setup_interfaces (GType type);
 static gboolean gst_cdda_base_src_start (GstBaseSrc * basesrc);
 static gboolean gst_cdda_base_src_stop (GstBaseSrc * basesrc);
 static GstFlowReturn gst_cdda_base_src_create (GstPushSrc * pushsrc,
@@ -135,8 +136,10 @@ static void gst_cdda_base_src_update_duration (GstCddaBaseSrc * src);
 static void gst_cdda_base_src_set_index (GstElement * src, GstIndex * index);
 static GstIndex *gst_cdda_base_src_get_index (GstElement * src);
 
-GST_BOILERPLATE_FULL (GstCddaBaseSrc, gst_cdda_base_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_cdda_base_src_setup_interfaces);
+#define gst_cdda_base_src_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstCddaBaseSrc, gst_cdda_base_src, GST_TYPE_PUSH_SRC,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
+        gst_cdda_base_src_uri_handler_init));
 
 #define SRC_CAPS \
   "audio/x-raw-int, "               \
@@ -177,12 +180,20 @@ gst_cdda_base_src_mode_get_type (void)
 }
 
 static void
-gst_cdda_base_src_base_init (gpointer g_class)
+gst_cdda_base_src_class_init (GstCddaBaseSrcClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  GstElementClass *element_class;
+  GstPushSrcClass *pushsrc_class;
+  GstBaseSrcClass *basesrc_class;
+  GObjectClass *gobject_class;
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_cdda_base_src_src_template));
+  gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
+  basesrc_class = (GstBaseSrcClass *) klass;
+  pushsrc_class = (GstPushSrcClass *) klass;
+
+  GST_DEBUG_CATEGORY_INIT (gst_cdda_base_src_debug, "cddabasesrc", 0,
+      "CDDA Base Source");
 
   /* our very own formats */
   track_format = gst_format_register ("track", "CD track");
@@ -196,23 +207,6 @@ gst_cdda_base_src_base_init (gpointer g_class)
   gst_tag_register (GST_TAG_CDDA_TRACK_TAGS, GST_TAG_FLAG_META, GST_TYPE_TAG_LIST, "track-tags", "CDDA taglist for one track", gst_tag_merge_use_first);        ///////////// FIXME: right function??? ///////
 #endif
 
-  GST_DEBUG_CATEGORY_INIT (gst_cdda_base_src_debug, "cddabasesrc", 0,
-      "CDDA Base Source");
-}
-
-static void
-gst_cdda_base_src_class_init (GstCddaBaseSrcClass * klass)
-{
-  GstElementClass *element_class;
-  GstPushSrcClass *pushsrc_class;
-  GstBaseSrcClass *basesrc_class;
-  GObjectClass *gobject_class;
-
-  gobject_class = (GObjectClass *) klass;
-  element_class = (GstElementClass *) klass;
-  basesrc_class = (GstBaseSrcClass *) klass;
-  pushsrc_class = (GstPushSrcClass *) klass;
-
   gobject_class->set_property = gst_cdda_base_src_set_property;
   gobject_class->get_property = gst_cdda_base_src_get_property;
   gobject_class->finalize = gst_cdda_base_src_finalize;
@@ -247,6 +241,9 @@ gst_cdda_base_src_class_init (GstCddaBaseSrcClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 #endif
 
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_cdda_base_src_src_template));
+
   element_class->set_index = GST_DEBUG_FUNCPTR (gst_cdda_base_src_set_index);
   element_class->get_index = GST_DEBUG_FUNCPTR (gst_cdda_base_src_get_index);
 
@@ -262,7 +259,7 @@ gst_cdda_base_src_class_init (GstCddaBaseSrcClass * klass)
 }
 
 static void
-gst_cdda_base_src_init (GstCddaBaseSrc * src, GstCddaBaseSrcClass * klass)
+gst_cdda_base_src_init (GstCddaBaseSrc * src)
 {
   gst_pad_set_query_type_function (GST_BASE_SRC_PAD (src),
       GST_DEBUG_FUNCPTR (gst_cdda_base_src_get_query_types));
@@ -914,13 +911,13 @@ gst_cdda_base_src_handle_event (GstBaseSrc * basesrc, GstEvent * event)
 }
 
 static GstURIType
-gst_cdda_base_src_uri_get_type (void)
+gst_cdda_base_src_uri_get_type (GType type)
 {
   return GST_URI_SRC;
 }
 
 static gchar **
-gst_cdda_base_src_uri_get_protocols (void)
+gst_cdda_base_src_uri_get_protocols (GType type)
 {
   static gchar *protocols[] = { (char *) "cdda", NULL };
 
@@ -1035,18 +1032,6 @@ gst_cdda_base_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
   iface->get_protocols = gst_cdda_base_src_uri_get_protocols;
 }
 
-static void
-gst_cdda_base_src_setup_interfaces (GType type)
-{
-  static const GInterfaceInfo urihandler_info = {
-    gst_cdda_base_src_uri_handler_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
-}
-
 /**
  * gst_cdda_base_src_add_track:
  * @src: a #GstCddaBaseSrc
@@ -1095,24 +1080,20 @@ static void
 gst_cdda_base_src_update_duration (GstCddaBaseSrc * src)
 {
   GstBaseSrc *basesrc;
-  GstFormat format;
-  gint64 duration;
+  gint64 dur;
 
   basesrc = GST_BASE_SRC (src);
 
-  format = GST_FORMAT_TIME;
-  if (gst_pad_query_duration (GST_BASE_SRC_PAD (src), &format, &duration)) {
-    gst_segment_set_duration (&basesrc->segment, GST_FORMAT_TIME, duration);
-  } else {
-    gst_segment_set_duration (&basesrc->segment, GST_FORMAT_TIME, -1);
-    duration = GST_CLOCK_TIME_NONE;
+  if (!gst_pad_query_duration (GST_BASE_SRC_PAD (src), GST_FORMAT_TIME, &dur)) {
+    dur = GST_CLOCK_TIME_NONE;
   }
+  basesrc->segment.duration = dur;
 
   gst_element_post_message (GST_ELEMENT (src),
       gst_message_new_duration (GST_OBJECT (src), GST_FORMAT_TIME, -1));
 
   GST_LOG_OBJECT (src, "duration updated to %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (duration));
+      GST_TIME_ARGS (dur));
 }
 
 #define CD_MSF_OFFSET 150
@@ -1574,7 +1555,6 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
   GstCddaBaseSrcClass *klass = GST_CDDA_BASE_SRC_GET_CLASS (pushsrc);
   GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (pushsrc);
   GstBuffer *buf;
-  GstFormat format;
   gboolean eos;
 
   GstClockTime position = GST_CLOCK_TIME_NONE;
@@ -1628,18 +1608,15 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
     return GST_FLOW_ERROR;
   }
 
-  if (GST_BUFFER_CAPS (buf) == NULL) {
-    gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
-  }
-
-  format = GST_FORMAT_TIME;
-  if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &qry_position)) {
+  if (gst_pad_query_position (GST_BASE_SRC_PAD (src), GST_FORMAT_TIME,
+          &qry_position)) {
     gint64 next_ts = 0;
 
     position = (GstClockTime) qry_position;
 
     ++src->cur_sector;
-    if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &next_ts)) {
+    if (gst_pad_query_position (GST_BASE_SRC_PAD (src), GST_FORMAT_TIME,
+            &next_ts)) {
       duration = (GstClockTime) (next_ts - qry_position);
     }
     --src->cur_sector;
@@ -1647,7 +1624,7 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
 
   /* fallback duration: 4 bytes per sample, 44100 samples per second */
   if (duration == GST_CLOCK_TIME_NONE) {
-    duration = gst_util_uint64_scale_int (GST_BUFFER_SIZE (buf) >> 2,
+    duration = gst_util_uint64_scale_int (gst_buffer_get_size (buf) >> 2,
         GST_SECOND, 44100);
   }
 
index 68606a5..27cdaec 100644 (file)
@@ -58,6 +58,7 @@ GstFft-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstfft-@GST_MAJORMINOR@
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
                --library=libgstfft-@GST_MAJORMINOR@.la \
                --include=Gst-@GST_MAJORMINOR@ \
index a51b029..a661a03 100644 (file)
@@ -15,7 +15,7 @@ headers_interfaces =          \
        tunernorm.h             \
        tunerchannel.h          \
        videoorientation.h      \
-       xoverlay.h
+       videooverlay.h
 
 # variables used for enum/marshal generation
 glib_enum_headers = $(headers_interfaces)
@@ -50,7 +50,7 @@ libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES = \
        tunernorm.c             \
        tunerchannel.c          \
        videoorientation.c      \
-       xoverlay.c
+       videooverlay.c
 
 nodist_libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES =  \
        $(built_sources)                                \
@@ -87,6 +87,7 @@ GstInterfaces-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstinterfaces-@G
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                -I$(top_builddir)/gst-libs \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
index 60268ac..9f6e07e 100644 (file)
  * </refsect2>
  */
 
+/* FIXME 0.11: check if we need to add API for sometimes-supportedness
+ * (aka making up for GstImplementsInterface removal) */
+
+/* FIXME 0.11: replace signals with messages (+ make API thread-safe) */
+
 enum
 {
   VALUE_CHANGED,
@@ -71,8 +76,6 @@ gst_color_balance_get_type (void)
 
     gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE,
         "GstColorBalance", &gst_color_balance_info, 0);
-    g_type_interface_add_prerequisite (gst_color_balance_type,
-        GST_TYPE_IMPLEMENTS_INTERFACE);
   }
 
   return gst_color_balance_type;
index 62771b5..896b6b6 100644 (file)
 
 G_BEGIN_DECLS
 
+/* FIXME 0.11: remove all CLASS bits, this is an interface */
 #define GST_TYPE_COLOR_BALANCE \
   (gst_color_balance_get_type ())
 #define GST_COLOR_BALANCE(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, \
-                                                 GstColorBalance))
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, GstColorBalance))
 #define GST_COLOR_BALANCE_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE, \
                             GstColorBalanceClass))
 #define GST_IS_COLOR_BALANCE(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE))
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE))
 #define GST_IS_COLOR_BALANCE_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE))
 #define GST_COLOR_BALANCE_GET_CLASS(inst) \
index 0c6abf0..23b707e 100644 (file)
@@ -50,6 +50,9 @@
  * macro (in C) and the mixer API can be used.
  */
 
+/* FIXME 0.11: check if we need to add API for sometimes-supportedness
+ * (aka making up for GstImplementsInterface removal) */
+
 #ifndef GST_DISABLE_DEPRECATED
 enum
 {
@@ -86,8 +89,6 @@ gst_mixer_get_type (void)
 
     gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
         "GstMixer", &gst_mixer_info, 0);
-    g_type_interface_add_prerequisite (gst_mixer_type,
-        GST_TYPE_IMPLEMENTS_INTERFACE);
   }
 
   return gst_mixer_type;
index 71c8f75..ca7f301 100644 (file)
 
 G_BEGIN_DECLS
 
+/* FIXME 0.11: remove all CLASS bits, this is an interface */
+
 #define GST_TYPE_MIXER \
   (gst_mixer_get_type ())
 #define GST_MIXER(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
 #define GST_MIXER_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
 #define GST_IS_MIXER(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
 #define GST_IS_MIXER_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
 #define GST_MIXER_GET_CLASS(inst) \
index 2df4a7b..207bc07 100644 (file)
@@ -237,7 +237,7 @@ gst_navigation_query_new_commands (void)
 
   structure = gst_structure_new (GST_NAVIGATION_QUERY_NAME,
       "type", G_TYPE_STRING, "commands", NULL);
-  query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
+  query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
 
   return query;
 }
@@ -283,7 +283,7 @@ gst_navigation_query_set_commands (GstQuery * query, gint n_cmds, ...)
   }
   va_end (ap);
 
-  structure = gst_query_get_structure (query);
+  structure = gst_query_writable_structure (query);
   gst_structure_set_value (structure, "commands", &list);
 
   g_value_unset (&list);
@@ -314,7 +314,7 @@ gst_navigation_query_set_commandsv (GstQuery * query, gint n_cmds,
   for (i = 0; i < n_cmds; i++) {
     gst_query_list_add_command (&list, cmds[i]);
   }
-  structure = gst_query_get_structure (query);
+  structure = gst_query_writable_structure (query);
   gst_structure_set_value (structure, "commands", &list);
 
   g_value_unset (&list);
@@ -333,7 +333,7 @@ gst_navigation_query_set_commandsv (GstQuery * query, gint n_cmds,
 gboolean
 gst_navigation_query_parse_commands_length (GstQuery * query, guint * n_cmds)
 {
-  GstStructure *structure;
+  const GstStructure *structure;
   const GValue *list;
 
   g_return_val_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, COMMANDS), FALSE);
@@ -368,7 +368,7 @@ gboolean
 gst_navigation_query_parse_commands_nth (GstQuery * query, guint nth,
     GstNavigationCommand * cmd)
 {
-  GstStructure *structure;
+  const GstStructure *structure;
   const GValue *list;
 
   g_return_val_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, COMMANDS), FALSE);
@@ -409,7 +409,7 @@ gst_navigation_query_new_angles (void)
 
   structure = gst_structure_new (GST_NAVIGATION_QUERY_NAME,
       "type", G_TYPE_STRING, "angles", NULL);
-  query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
+  query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
 
   return query;
 }
@@ -432,7 +432,7 @@ gst_navigation_query_set_angles (GstQuery * query, guint cur_angle,
 
   g_return_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, ANGLES));
 
-  structure = gst_query_get_structure (query);
+  structure = gst_query_writable_structure (query);
   gst_structure_set (structure,
       "angle", G_TYPE_UINT, cur_angle, "angles", G_TYPE_UINT, n_angles, NULL);
 }
@@ -456,7 +456,7 @@ gboolean
 gst_navigation_query_parse_angles (GstQuery * query, guint * cur_angle,
     guint * n_angles)
 {
-  GstStructure *structure;
+  const GstStructure *structure;
   gboolean ret = TRUE;
 
   g_return_val_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, ANGLES), FALSE);
index 2684517..4e35dac 100644 (file)
  * </refsect2>
  */
 
+/* FIXME 0.11: check if we need to add API for sometimes-supportedness
+ * (aka making up for GstImplementsInterface removal) */
+
+/* FIXME 0.11: replace signals with messages (+ make API thread-safe) */
+
 enum
 {
   NORM_CHANGED,
@@ -102,8 +107,6 @@ gst_tuner_get_type (void)
 
     gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
         "GstTuner", &gst_tuner_info, 0);
-    g_type_interface_add_prerequisite (gst_tuner_type,
-        GST_TYPE_IMPLEMENTS_INTERFACE);
   }
 
   return gst_tuner_type;
index c728135..09158d4 100644 (file)
 
 G_BEGIN_DECLS
 
+/* FIXME 0.11: remove all CLASS bits, this is an interface */
+
 #define GST_TYPE_TUNER \
   (gst_tuner_get_type ())
 #define GST_TUNER(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
 #define GST_TUNER_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER, GstTunerClass))
 #define GST_IS_TUNER(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
 #define GST_IS_TUNER_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
 #define GST_TUNER_GET_CLASS(inst) \
index 35ded69..4918862 100644 (file)
@@ -39,6 +39,9 @@
  * Since: 0.10.11
  */
 
+/* FIXME 0.11: check if we need to add API for sometimes-supportedness
+ * (aka making up for GstImplementsInterface removal) (probably yes) */
+
 static void gst_video_orientation_iface_init (GstVideoOrientationInterface *
     iface);
 
@@ -62,8 +65,6 @@ gst_video_orientation_get_type (void)
 
     gst_video_orientation_type = g_type_register_static (G_TYPE_INTERFACE,
         "GstVideoOrientation", &gst_video_orientation_info, 0);
-    g_type_interface_add_prerequisite (gst_video_orientation_type,
-        GST_TYPE_IMPLEMENTS_INTERFACE);
   }
 
   return gst_video_orientation_type;
index c02d08b..0ace827 100644 (file)
@@ -30,9 +30,9 @@ G_BEGIN_DECLS
 #define GST_TYPE_VIDEO_ORIENTATION \
   (gst_video_orientation_get_type ())
 #define GST_VIDEO_ORIENTATION(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_ORIENTATION, GstVideoOrientation))
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_ORIENTATION, GstVideoOrientation))
 #define GST_IS_VIDEO_ORIENTATION(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_ORIENTATION))
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_ORIENTATION))
 #define GST_VIDEO_ORIENTATION_GET_IFACE(inst) \
   (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VIDEO_ORIENTATION, GstVideoOrientationInterface))
 
@@ -61,6 +61,10 @@ typedef struct _GstVideoOrientationInterface GstVideoOrientationInterface;
 struct _GstVideoOrientationInterface {
   GTypeInterface parent;
 
+  /* FIXME 0.11: fix awkward API? add some kind of get_supported flags thing
+   * and then just return booleans/int from all vfuncs requiring the caller
+   * to check the flags first */
+
   /* virtual functions */
   gboolean (* get_hflip)   (GstVideoOrientation *video_orientation, gboolean *flip);
   gboolean (* get_vflip)   (GstVideoOrientation *video_orientation, gboolean *flip);
similarity index 64%
rename from gst-libs/gst/interfaces/xoverlay.c
rename to gst-libs/gst/interfaces/videooverlay.c
index 8e7ef07..8901ccb 100644 (file)
@@ -1,7 +1,6 @@
-/* GStreamer X-based Overlay
+/* GStreamer Video Overlay interface
  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * x-overlay.c: X-based overlay interface design
+ * Copyright (C) 2011 Tim-Philipp Müller <tim@centricular.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
  * Boston, MA 02111-1307, USA.
  */
 /**
- * SECTION:gstxoverlay
- * @short_description: Interface for setting/getting a Window on elements
- * supporting it
+ * SECTION:gstvideooverlay
+ * @short_description: Interface for setting/getting a window system resource
+ *    on elements supporting it to configure a window into which to render a
+ *    video.
  *
  * <refsect2>
  * <para>
- * The XOverlay interface is used for 2 main purposes :
+ * The #GstVideoOverlay interface is used for 2 main purposes :
  * <itemizedlist>
  * <listitem>
  * <para>
  * static GstBusSyncReply
  * create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
  * {
- *  // ignore anything but 'prepare-xwindow-id' element messages
- *  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- *    return GST_BUS_PASS;
- *
- *  if (!gst_structure_has_name (message-&gt;structure, "prepare-xwindow-id"))
+ *  // ignore anything but 'prepare-window-handle' element messages
+ *  if (!gst_is_video_overlay_prepare_window_handle_message (message))
  *    return GST_BUS_PASS;
  *
  *  win = XCreateSimpleWindow (disp, root, 0, 0, 320, 240, 0, 0, 0);
@@ -78,7 +75,7 @@
  *
  *  XSync (disp, FALSE);
  *
- *  gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
+ *  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)),
  *      win);
  *
  *  gst_message_unref (message);
  * usually the case when the application creates the videosink to use
  * (e.g. #xvimagesink, #ximagesink, etc.) itself; in this case, the application
  * can just create the videosink element, create and realize the window to
- * render the video on and then call gst_x_overlay_set_window_handle() directly
+ * render the video on and then call gst_video_overlay_set_window_handle() directly
  * with the XID or native window handle, before starting up the pipeline.
  * </para>
  * <para>
  * pipeline has been started up. When that happens, however, the video sink
  * will need to know right then whether to render onto an already existing
  * application window or whether to create its own window. This is when it
- * posts a prepare-xwindow-id message, and that is also why this message needs
+ * posts a prepare-window-handle message, and that is also why this message needs
  * to be handled in a sync bus handler which will be called from the streaming
  * thread directly (because the video sink will need an answer right then).
  * </para>
  * <para>
- * As response to the prepare-xwindow-id element message in the bus sync
- * handler, the application may use gst_x_overlay_set_window_handle() to tell
+ * As response to the prepare-window-handle element message in the bus sync
+ * handler, the application may use gst_video_overlay_set_window_handle() to tell
  * the video sink to render onto an existing window surface. At this point the
  * application should already have obtained the window handle / XID, so it
  * just needs to set it. It is generally not advisable to call any GUI toolkit
  * functions or window system functions from the streaming thread in which the
- * prepare-xwindow-id message is handled, because most GUI toolkits and
+ * prepare-window-handle message is handled, because most GUI toolkits and
  * windowing systems are not thread-safe at all and a lot of care would be
  * required to co-ordinate the toolkit and window system calls of the
  * different threads (Gtk+ users please note: prior to Gtk+ 2.18
  * </para>
  * </refsect2>
  * <refsect2>
- * <title>GstXOverlay and Gtk+</title>
+ * <title>GstVideoOverlay and Gtk+</title>
  * <para>
  * |[
  * #include &lt;gtk/gtk.h&gt;
  * static GstBusSyncReply
  * bus_sync_handler (GstBus * bus, GstMessage * message, gpointer user_data)
  * {
- *  // ignore anything but 'prepare-xwindow-id' element messages
- *  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- *    return GST_BUS_PASS;
- *  if (!gst_structure_has_name (message-&gt;structure, "prepare-xwindow-id"))
+ *  // ignore anything but 'prepare-window-handle' element messages
+ *  if (!gst_is_video_overlay_prepare_window_handle_message (message))
  *    return GST_BUS_PASS;
  *
  *  if (video_window_xid != 0) {
- *    GstXOverlay *xoverlay;
+ *    GstVideoOverlay *xoverlay;
  *
  *    // GST_MESSAGE_SRC (message) will be the video sink element
- *    xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
- *    gst_x_overlay_set_window_handle (xoverlay, video_window_xid);
+ *    xoverlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
+ *    gst_video_overlay_set_window_handle (xoverlay, video_window_xid);
  *  } else {
  *    g_warning ("Should have obtained video_window_xid by now!");
  *  }
  *   // This is here just for pedagogical purposes, GDK_WINDOW_XID will call
  *   // it as well in newer Gtk versions
  *   if (!gdk_window_ensure_native (widget->window))
- *     g_error ("Couldn't create native window needed for GstXOverlay!");
+ *     g_error ("Couldn't create native window needed for GstVideoOverlay!");
  * #endif
  *
  * #ifdef GDK_WINDOWING_X11
  * </para>
  * </refsect2>
  * <refsect2>
- * <title>GstXOverlay and Qt</title>
+ * <title>GstVideoOverlay and Qt</title>
  * <para>
  * |[
  * #include &lt;glib.h&gt;
  * #include &lt;gst/gst.h&gt;
- * #include &lt;gst/interfaces/xoverlay.h&gt;
+ * #include &lt;gst/interfaces/videooverlay.h&gt;
  *
  * #include &lt;QApplication&gt;
  * #include &lt;QTimer&gt;
  *   window.show();
  *
  *   WId xwinid = window.winId();
- *   gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
+ *   gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
  *
  *   // run the pipeline
  *
 #include "config.h"
 #endif
 
-#include "xoverlay.h"
-
-static void gst_x_overlay_base_init (gpointer g_class);
+#include "videooverlay.h"
 
 GType
-gst_x_overlay_get_type (void)
+gst_video_overlay_get_type (void)
 {
-  static GType gst_x_overlay_type = 0;
+  static GType gst_video_overlay_type = 0;
 
-  if (!gst_x_overlay_type) {
-    static const GTypeInfo gst_x_overlay_info = {
-      sizeof (GstXOverlayClass),
-      gst_x_overlay_base_init,
+  if (!gst_video_overlay_type) {
+    static const GTypeInfo gst_video_overlay_info = {
+      sizeof (GstVideoOverlayIface),
+      NULL,
       NULL,
       NULL,
       NULL,
@@ -316,49 +309,16 @@ gst_x_overlay_get_type (void)
       NULL,
     };
 
-    gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE,
-        "GstXOverlay", &gst_x_overlay_info, 0);
-    g_type_interface_add_prerequisite (gst_x_overlay_type,
-        GST_TYPE_IMPLEMENTS_INTERFACE);
+    gst_video_overlay_type = g_type_register_static (G_TYPE_INTERFACE,
+        "GstVideoOverlay", &gst_video_overlay_info, 0);
   }
 
-  return gst_x_overlay_type;
-}
-
-static void
-gst_x_overlay_base_init (gpointer g_class)
-{
-
+  return gst_video_overlay_type;
 }
 
 /**
- * gst_x_overlay_set_xwindow_id:
- * @overlay: a #GstXOverlay to set the window on.
- * @xwindow_id: a XID referencing the XWindow.
- *
- * This will call the video overlay's set_xwindow_id method. You should
- * use this method to tell to a XOverlay to display video output to a
- * specific XWindow. Passing 0 as the @xwindow_id will tell the overlay to
- * stop using that window and create an internal one.
- *
- * Deprecated: Use gst_x_overlay_set_window_handle() instead.
- */
-#ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-void gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
-#endif
-void
-gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
-{
-  GST_WARNING_OBJECT (overlay,
-      "Using deprecated gst_x_overlay_set_xwindow_id()");
-  gst_x_overlay_set_window_handle (overlay, xwindow_id);
-}
-#endif
-
-/**
- * gst_x_overlay_set_window_handle:
- * @overlay: a #GstXOverlay to set the window on.
+ * gst_video_overlay_set_window_handle:
+ * @overlay: a #GstVideoOverlay to set the window on.
  * @handle: a handle referencing the window.
  *
  * This will call the video overlay's set_window_handle method. You
@@ -369,135 +329,97 @@ gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
  * Since: 0.10.31
  */
 void
-gst_x_overlay_set_window_handle (GstXOverlay * overlay, guintptr handle)
+gst_video_overlay_set_window_handle (GstVideoOverlay * overlay, guintptr handle)
 {
-  GstXOverlayClass *klass;
+  GstVideoOverlayIface *iface;
 
   g_return_if_fail (overlay != NULL);
-  g_return_if_fail (GST_IS_X_OVERLAY (overlay));
+  g_return_if_fail (GST_IS_VIDEO_OVERLAY (overlay));
 
-  klass = GST_X_OVERLAY_GET_CLASS (overlay);
+  iface = GST_VIDEO_OVERLAY_GET_IFACE (overlay);
 
-  if (klass->set_window_handle) {
-    klass->set_window_handle (overlay, handle);
-  } else {
-#ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-#define set_xwindow_id set_xwindow_id_disabled
-#endif
-    if (sizeof (guintptr) <= sizeof (gulong) && klass->set_xwindow_id) {
-      GST_WARNING_OBJECT (overlay,
-          "Calling deprecated set_xwindow_id() method");
-      klass->set_xwindow_id (overlay, handle);
-    } else {
-      g_warning ("Refusing to cast guintptr to smaller gulong");
-    }
-#endif
+  if (iface->set_window_handle) {
+    iface->set_window_handle (overlay, handle);
   }
 }
 
 /**
- * gst_x_overlay_got_xwindow_id:
- * @overlay: a #GstXOverlay which got a XWindow.
- * @xwindow_id: a XID referencing the XWindow.
- *
- * This will post a "have-xwindow-id" element message on the bus.
- *
- * This function should only be used by video overlay plugin developers.
- *
- * Deprecated: Use gst_x_overlay_got_window_handle() instead.
- */
-#ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-void gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
-#endif
-void
-gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
-{
-  GST_WARNING_OBJECT (overlay,
-      "Using deprecated gst_x_overlay_got_xwindow_id()");
-  gst_x_overlay_got_window_handle (overlay, xwindow_id);
-}
-#endif
-
-/**
- * gst_x_overlay_got_window_handle:
- * @overlay: a #GstXOverlay which got a window
+ * gst_video_overlay_got_window_handle:
+ * @overlay: a #GstVideoOverlay which got a window
  * @handle: a platform-specific handle referencing the window
  *
- * This will post a "have-xwindow-id" element message on the bus.
+ * This will post a "have-window-handle" element message on the bus.
  *
  * This function should only be used by video overlay plugin developers.
  */
 void
-gst_x_overlay_got_window_handle (GstXOverlay * overlay, guintptr handle)
+gst_video_overlay_got_window_handle (GstVideoOverlay * overlay, guintptr handle)
 {
   GstStructure *s;
   GstMessage *msg;
 
   g_return_if_fail (overlay != NULL);
-  g_return_if_fail (GST_IS_X_OVERLAY (overlay));
+  g_return_if_fail (GST_IS_VIDEO_OVERLAY (overlay));
 
-  GST_LOG_OBJECT (GST_OBJECT (overlay), "xwindow_id = %p", (gpointer)
+  GST_LOG_OBJECT (GST_OBJECT (overlay), "window_handle = %p", (gpointer)
       handle);
-  s = gst_structure_new ("have-xwindow-id",
-      "xwindow-id", G_TYPE_ULONG, (unsigned long) handle,
+  s = gst_structure_new ("have-window-handle",
       "window-handle", G_TYPE_UINT64, (guint64) handle, NULL);
   msg = gst_message_new_element (GST_OBJECT (overlay), s);
   gst_element_post_message (GST_ELEMENT (overlay), msg);
 }
 
 /**
- * gst_x_overlay_prepare_xwindow_id:
- * @overlay: a #GstXOverlay which does not yet have an XWindow.
+ * gst_video_overlay_prepare_window_handle:
+ * @overlay: a #GstVideoOverlay which does not yet have an Window handle set
  *
- * This will post a "prepare-xwindow-id" element message on the bus
+ * This will post a "prepare-window-handle" element message on the bus
  * to give applications an opportunity to call
- * gst_x_overlay_set_xwindow_id() before a plugin creates its own
+ * gst_video_overlay_set_window_handle() before a plugin creates its own
  * window.
  *
  * This function should only be used by video overlay plugin developers.
  */
 void
-gst_x_overlay_prepare_xwindow_id (GstXOverlay * overlay)
+gst_video_overlay_prepare_window_handle (GstVideoOverlay * overlay)
 {
   GstStructure *s;
   GstMessage *msg;
 
   g_return_if_fail (overlay != NULL);
-  g_return_if_fail (GST_IS_X_OVERLAY (overlay));
+  g_return_if_fail (GST_IS_VIDEO_OVERLAY (overlay));
 
-  GST_LOG_OBJECT (GST_OBJECT (overlay), "prepare xwindow_id");
-  s = gst_structure_new ("prepare-xwindow-id", NULL);
+  GST_LOG_OBJECT (GST_OBJECT (overlay), "prepare window handle");
+  s = gst_structure_new ("prepare-window-handle", NULL);
   msg = gst_message_new_element (GST_OBJECT (overlay), s);
   gst_element_post_message (GST_ELEMENT (overlay), msg);
 }
 
 /**
- * gst_x_overlay_expose:
- * @overlay: a #GstXOverlay to expose.
+ * gst_video_overlay_expose:
+ * @overlay: a #GstVideoOverlay to expose.
  *
  * Tell an overlay that it has been exposed. This will redraw the current frame
  * in the drawable even if the pipeline is PAUSED.
  */
 void
-gst_x_overlay_expose (GstXOverlay * overlay)
+gst_video_overlay_expose (GstVideoOverlay * overlay)
 {
-  GstXOverlayClass *klass;
+  GstVideoOverlayIface *iface;
 
   g_return_if_fail (overlay != NULL);
-  g_return_if_fail (GST_IS_X_OVERLAY (overlay));
+  g_return_if_fail (GST_IS_VIDEO_OVERLAY (overlay));
 
-  klass = GST_X_OVERLAY_GET_CLASS (overlay);
+  iface = GST_VIDEO_OVERLAY_GET_IFACE (overlay);
 
-  if (klass->expose) {
-    klass->expose (overlay);
+  if (iface->expose) {
+    iface->expose (overlay);
   }
 }
 
 /**
- * gst_x_overlay_handle_events:
- * @overlay: a #GstXOverlay to expose.
+ * gst_video_overlay_handle_events:
+ * @overlay: a #GstVideoOverlay to expose.
  * @handle_events: a #gboolean indicating if events should be handled or not.
  *
  * Tell an overlay that it should handle events from the window system. These
@@ -509,34 +431,35 @@ gst_x_overlay_expose (GstXOverlay * overlay)
  * Since: 0.10.12
  */
 void
-gst_x_overlay_handle_events (GstXOverlay * overlay, gboolean handle_events)
+gst_video_overlay_handle_events (GstVideoOverlay * overlay,
+    gboolean handle_events)
 {
-  GstXOverlayClass *klass;
+  GstVideoOverlayIface *iface;
 
   g_return_if_fail (overlay != NULL);
-  g_return_if_fail (GST_IS_X_OVERLAY (overlay));
+  g_return_if_fail (GST_IS_VIDEO_OVERLAY (overlay));
 
-  klass = GST_X_OVERLAY_GET_CLASS (overlay);
+  iface = GST_VIDEO_OVERLAY_GET_IFACE (overlay);
 
-  if (klass->handle_events) {
-    klass->handle_events (overlay, handle_events);
+  if (iface->handle_events) {
+    iface->handle_events (overlay, handle_events);
   }
 }
 
 /**
- * gst_x_overlay_set_render_rectangle:
- * @overlay: a #GstXOverlay
+ * gst_video_overlay_set_render_rectangle:
+ * @overlay: a #GstVideoOverlay
  * @x: the horizontal offset of the render area inside the window
  * @y: the vertical offset of the render area inside the window
  * @width: the width of the render area inside the window
  * @height: the height of the render area inside the window
  *
  * Configure a subregion as a video target within the window set by
- * gst_x_overlay_set_window_handle(). If this is not used or not supported
+ * gst_video_overlay_set_window_handle(). If this is not used or not supported
  * the video will fill the area of the window set as the overlay to 100%.
  * By specifying the rectangle, the video can be overlayed to a specific region
  * of that window only. After setting the new rectangle one should call
- * gst_x_overlay_expose() to force a redraw. To unset the region pass -1 for
+ * gst_video_overlay_expose() to force a redraw. To unset the region pass -1 for
  * the @width and @height parameters.
  *
  * This method is needed for non fullscreen video overlay in UI toolkits that
@@ -547,21 +470,43 @@ gst_x_overlay_handle_events (GstXOverlay * overlay, gboolean handle_events)
  * Since: 0.10.29
  */
 gboolean
-gst_x_overlay_set_render_rectangle (GstXOverlay * overlay,
+gst_video_overlay_set_render_rectangle (GstVideoOverlay * overlay,
     gint x, gint y, gint width, gint height)
 {
-  GstXOverlayClass *klass;
+  GstVideoOverlayIface *iface;
 
   g_return_val_if_fail (overlay != NULL, FALSE);
-  g_return_val_if_fail (GST_IS_X_OVERLAY (overlay), FALSE);
+  g_return_val_if_fail (GST_IS_VIDEO_OVERLAY (overlay), FALSE);
   g_return_val_if_fail ((width == -1 && height == -1) ||
       (width > 0 && height > 0), FALSE);
 
-  klass = GST_X_OVERLAY_GET_CLASS (overlay);
+  iface = GST_VIDEO_OVERLAY_GET_IFACE (overlay);
 
-  if (klass->set_render_rectangle) {
-    klass->set_render_rectangle (overlay, x, y, width, height);
+  if (iface->set_render_rectangle) {
+    iface->set_render_rectangle (overlay, x, y, width, height);
     return TRUE;
   }
   return FALSE;
 }
+
+/**
+ * gst_is_video_overlay_prepare_window_handle_message:
+ * @msg: a #GstMessage
+ *
+ * Convenience function to check if the given message is a
+ * "prepare-window-handle" message from a #GstVideoOverlay.
+ *
+ * Since: 0.11.2
+ *
+ * Returns: whether @msg is a "prepare-window-handle" message
+ */
+gboolean
+gst_is_video_overlay_prepare_window_handle_message (GstMessage * msg)
+{
+  g_return_val_if_fail (msg != NULL, FALSE);
+
+  if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT)
+    return FALSE;
+
+  return gst_message_has_name (msg, "prepare-window-handle");
+}
diff --git a/gst-libs/gst/interfaces/videooverlay.h b/gst-libs/gst/interfaces/videooverlay.h
new file mode 100644 (file)
index 0000000..91806ec
--- /dev/null
@@ -0,0 +1,99 @@
+/* GStreamer Video Overlay Interface
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
+ * Copyright (C) 2011 Tim-Philipp Müller <tim@centricular.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VIDEO_OVERLAY_H__
+#define __GST_VIDEO_OVERLAY_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VIDEO_OVERLAY \
+    (gst_video_overlay_get_type ())
+#define GST_VIDEO_OVERLAY(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_OVERLAY, GstVideoOverlay))
+#define GST_IS_VIDEO_OVERLAY(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_OVERLAY))
+#define GST_VIDEO_OVERLAY_GET_IFACE(inst) \
+    (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VIDEO_OVERLAY, GstVideoOverlayIface))
+
+/**
+ * GstVideoOverlay:
+ *
+ * Opaque #GstVideoOverlay interface structure
+ */
+typedef struct _GstVideoOverlay GstVideoOverlay;
+typedef struct _GstVideoOverlayIface GstVideoOverlayIface;
+
+/**
+ * GstVideoOverlayIface:
+ * @interface: parent interface type.
+ * @expose: virtual method to handle expose events
+ * @handle_events: virtual method to handle events
+ * @set_render_rectangle: virtual method to set the render rectangle
+ * @set_window_handle: virtual method to configure the window handle
+ *
+ * #GstVideoOverlay interface
+ */
+struct _GstVideoOverlayIface {
+  GTypeInterface interface;
+
+  /* virtual functions */
+  void (* expose)              (GstVideoOverlay *overlay);
+
+  void (* handle_events)       (GstVideoOverlay *overlay, gboolean handle_events);
+
+  void (* set_render_rectangle) (GstVideoOverlay *overlay,
+                                 gint x, gint y,
+                                 gint width, gint height);
+
+  void (* set_window_handle)   (GstVideoOverlay *overlay, guintptr handle);
+};
+
+GType   gst_video_overlay_get_type (void);
+
+/* virtual function wrappers */
+
+gboolean gst_video_overlay_set_render_rectangle (GstVideoOverlay * overlay,
+                                                 gint              x,
+                                                 gint              y,
+                                                 gint              width,
+                                                 gint              height);
+
+void gst_video_overlay_expose             (GstVideoOverlay * overlay);
+
+void gst_video_overlay_handle_events      (GstVideoOverlay * overlay,
+                                           gboolean          handle_events);
+
+void gst_video_overlay_set_window_handle  (GstVideoOverlay * overlay,
+                                                             guintptr handle);
+
+/* public methods to dispatch bus messages */
+void gst_video_overlay_got_window_handle  (GstVideoOverlay * overlay,
+                                           guintptr          handle);
+
+void gst_video_overlay_prepare_window_handle (GstVideoOverlay * overlay);
+
+gboolean gst_is_video_overlay_prepare_window_handle_message (GstMessage * msg);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_OVERLAY_H__ */
diff --git a/gst-libs/gst/interfaces/xoverlay.h b/gst-libs/gst/interfaces/xoverlay.h
deleted file mode 100644 (file)
index 6ac355c..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/* GStreamer X-based Overlay
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * x-overlay.h: X-based overlay interface design
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_X_OVERLAY_H__
-#define __GST_X_OVERLAY_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_X_OVERLAY \
-  (gst_x_overlay_get_type ())
-#define GST_X_OVERLAY(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, \
-                                                 GstXOverlay))
-#define GST_X_OVERLAY_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_X_OVERLAY, GstXOverlayClass))
-#define GST_IS_X_OVERLAY(obj) \
-  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
-#define GST_IS_X_OVERLAY_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
-#define GST_X_OVERLAY_GET_CLASS(inst) \
-  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_X_OVERLAY, GstXOverlayClass))
-
-/**
- * GstXOverlay:
- *
- * Opaque #GstXOverlay data structure.
- */
-typedef struct _GstXOverlay GstXOverlay;
-typedef struct _GstXOverlayClass GstXOverlayClass;
-
-/**
- * GstXOverlayClass:
- * @klass: parent interface type.
- * @set_xwindow_id: (deprecated) virtual method to configure the XWindow handle
- * @expose: virtual method to handle expose events
- * @handle_events: virtual method to handle events
- * @set_render_rectangle: virtual method to set the render rectangle (since 0.10.29)
- * @set_window_handle: virtual method to configure the window handle
- *
- * #GstXOverlay interface
- */
-struct _GstXOverlayClass {
-  GTypeInterface klass;
-
-  /* virtual functions */
-#ifndef GST_DISABLE_DEPRECATED
-  void (* set_xwindow_id)      (GstXOverlay *overlay,
-                                gulong       xwindow_id);
-#else
-#ifndef __GTK_DOC_IGNORE__
-  void (* set_xwindow_id_disabled) (GstXOverlay *overlay,
-                                gulong       xwindow_id);
-#endif
-#endif /* not GST_DISABLE_DEPRECATED */
-
-  void (* expose)              (GstXOverlay *overlay);
-
-  void (* handle_events)       (GstXOverlay *overlay,
-                                gboolean     handle_events);
-
-  void (* set_render_rectangle) (GstXOverlay *overlay,
-                                 gint x, gint y,
-                                 gint width, gint height);
-
-  void (* set_window_handle)   (GstXOverlay *overlay,
-                                guintptr    handle);
-    /*< private >*/
-  gpointer                 _gst_reserved[GST_PADDING - 3];
-};
-
-GType   gst_x_overlay_get_type          (void);
-
-/* virtual class function wrappers */
-#ifndef GST_DISABLE_DEPRECATED
-void gst_x_overlay_set_xwindow_id      (GstXOverlay *overlay,
-                                        gulong xwindow_id);
-#endif
-
-gboolean gst_x_overlay_set_render_rectangle (GstXOverlay *overlay,
-                                             gint x, gint y,
-                                             gint width, gint height);
-
-void gst_x_overlay_expose              (GstXOverlay *overlay);
-
-void gst_x_overlay_handle_events       (GstXOverlay *overlay,
-                                        gboolean     handle_events);
-
-void gst_x_overlay_set_window_handle   (GstXOverlay *overlay,
-                                        guintptr handle);
-
-/* public methods to dispatch bus messages */
-#ifndef GST_DISABLE_DEPRECATED
-void gst_x_overlay_got_xwindow_id     (GstXOverlay *overlay, gulong xwindow_id);
-#endif
-
-void gst_x_overlay_got_window_handle  (GstXOverlay *overlay,
-    guintptr handle);
-
-void gst_x_overlay_prepare_xwindow_id (GstXOverlay *overlay);
-
-G_END_DECLS
-
-#endif /* __GST_X_OVERLAY_H__ */
index 086a86b..386ba09 100644 (file)
@@ -23,6 +23,7 @@ GstNetbuffer-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstnetbuffer-@GST
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
                --library=libgstnetbuffer-@GST_MAJORMINOR@.la \
                --include=Gst-@GST_MAJORMINOR@ \
index 6328a76..aaea75a 100644 (file)
 
 #include "gstnetbuffer.h"
 
-static void gst_netbuffer_finalize (GstNetBuffer * nbuf);
-static GstNetBuffer *gst_netbuffer_copy (GstNetBuffer * nbuf);
-
-static GstBufferClass *parent_class;
-
-G_DEFINE_TYPE (GstNetBuffer, gst_netbuffer, GST_TYPE_BUFFER);
-
-static void
-gst_netbuffer_class_init (GstNetBufferClass * netbuffer_class)
-{
-  GstMiniObjectClass *mo_class = GST_MINI_OBJECT_CLASS (netbuffer_class);
-
-  parent_class = g_type_class_peek_parent (netbuffer_class);
-
-  mo_class->copy = (GstMiniObjectCopyFunction) gst_netbuffer_copy;
-  mo_class->finalize = (GstMiniObjectFinalizeFunction) gst_netbuffer_finalize;
-}
-
 static void
-gst_netbuffer_init (GstNetBuffer * instance)
+meta_net_address_copy (GstBuffer * copybuf, GstMetaNetAddress * meta,
+    GstBuffer * buffer, gsize offset, gsize size)
 {
-}
+  GstMetaNetAddress *naddr;
 
-static void
-gst_netbuffer_finalize (GstNetBuffer * nbuf)
-{
-  GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (nbuf));
+  naddr = gst_buffer_add_meta_net_address (copybuf);
+  memcpy (&naddr->naddr, &meta->naddr, sizeof (meta->naddr));
 }
 
-static GstNetBuffer *
-gst_netbuffer_copy (GstNetBuffer * nbuf)
+const GstMetaInfo *
+gst_meta_net_address_get_info (void)
 {
-  GstNetBuffer *copy;
-
-  copy = gst_netbuffer_new ();
-
-  /* we simply copy everything from our parent */
-  GST_BUFFER_DATA (copy) =
-      g_memdup (GST_BUFFER_DATA (nbuf), GST_BUFFER_SIZE (nbuf));
-  /* make sure it gets freed (even if the parent is subclassed, we return a
-     normal buffer) */
-  GST_BUFFER_MALLOCDATA (copy) = GST_BUFFER_DATA (copy);
-  GST_BUFFER_SIZE (copy) = GST_BUFFER_SIZE (nbuf);
-
-  memcpy (&copy->to, &nbuf->to, sizeof (nbuf->to));
-  memcpy (&copy->from, &nbuf->from, sizeof (nbuf->from));
-
-  /* copy metadata */
-  gst_buffer_copy_metadata (GST_BUFFER_CAST (copy),
-      GST_BUFFER_CAST (nbuf), GST_BUFFER_COPY_ALL);
-
-  return copy;
-}
-
-/**
- * gst_netbuffer_new:
- *
- * Create a new network buffer.
- *
- * Returns: a new #GstNetBuffer.
- */
-GstNetBuffer *
-gst_netbuffer_new (void)
-{
-  GstNetBuffer *buf;
-
-  buf = (GstNetBuffer *) gst_mini_object_new (GST_TYPE_NETBUFFER);
-
-  return buf;
+  static const GstMetaInfo *meta_info = NULL;
+
+  if (meta_info == NULL) {
+    meta_info = gst_meta_register ("GstMetaNetAddress", "GstMetaNetAddress",
+        sizeof (GstMetaNetAddress),
+        (GstMetaInitFunction) NULL,
+        (GstMetaFreeFunction) NULL,
+        (GstMetaCopyFunction) meta_net_address_copy,
+        (GstMetaTransformFunction) NULL);
+  }
+  return meta_info;
 }
 
 /**
index 91770e4..368490a 100644 (file)
 
 G_BEGIN_DECLS
 
+#if 0
 typedef struct _GstNetBuffer GstNetBuffer;
 typedef struct _GstNetBufferClass GstNetBufferClass;
+#endif
 typedef struct _GstNetAddress GstNetAddress;
 
+#if 0
 #define GST_TYPE_NETBUFFER            (gst_netbuffer_get_type())
 #define GST_IS_NETBUFFER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NETBUFFER))
 #define GST_IS_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NETBUFFER))
 #define GST_NETBUFFER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_NETBUFFER, GstNetBufferClass))
 #define GST_NETBUFFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NETBUFFER, GstNetBuffer))
 #define GST_NETBUFFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NETBUFFER, GstNetBufferClass))
+#endif
 
 /**
  * GstNetType:
@@ -62,7 +66,7 @@ typedef enum {
 /**
  * GstNetAddress:
  *
- * An opaque network address as used in #GstNetBuffer.
+ * An opaque network address as used in #GstMetaNetAddress.
  */
 struct _GstNetAddress {
   /*< private >*/
@@ -76,36 +80,26 @@ struct _GstNetAddress {
   gpointer _gst_reserved[GST_PADDING];
 };
 
+typedef struct _GstMetaNetAddress GstMetaNetAddress;
+
 /**
- * GstNetBuffer:
- * @buffer: the parent #GstBuffer
- * @from: the address where this buffer came from.
- * @to: the address where this buffer should go to.
+ * GstMetaNetAddress:
  *
- * buffer for use in network sources and sinks.
- * It contains the source or destination address of the buffer.
+ * Buffer metadata for network addresses.
  */
-struct _GstNetBuffer {
-  GstBuffer buffer;
-
-  GstNetAddress from;
-  GstNetAddress to;
+struct _GstMetaNetAddress {
+  GstMeta       meta;
 
-  /*< private >*/
-  gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstNetBufferClass {
-  GstBufferClass  buffer_class;
-
-  /*< private >*/
-  gpointer _gst_reserved[GST_PADDING];
+  GstNetAddress naddr;
 };
 
-/* creating buffers */
-GType           gst_netbuffer_get_type           (void);
+const GstMetaInfo *gst_meta_net_address_get_info (void);
+#define GST_META_NET_ADDRESS_INFO (gst_meta_net_address_get_info())
 
-GstNetBuffer*   gst_netbuffer_new                (void);
+#define gst_buffer_get_meta_net_address(b) \
+  ((GstMetaNetAddress*)gst_buffer_get_meta((b),GST_META_NET_ADDRESS_INFO))
+#define gst_buffer_add_meta_net_address(b) \
+  ((GstMetaNetAddress*)gst_buffer_add_meta((b),GST_META_NET_ADDRESS_INFO,NULL))
 
 /* address operations */
 void            gst_netaddress_set_ip4_address   (GstNetAddress *naddr, guint32 address, guint16 port);
index fab6523..abb4fcd 100644 (file)
@@ -47,6 +47,7 @@ EXTRA_DIST = pbutils-marshal.list
 
 libgstpbutils_@GST_MAJORMINOR@_la_LIBADD = \
   $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
+  $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
   $(GST_LIBS)
 libgstpbutils_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
 libgstpbutils_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
@@ -81,6 +82,7 @@ GstPbutils-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstpbutils-@GST_MAJ
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                -I$(top_builddir)/gst-libs \
                --add-include-path=$(srcdir)/../video \
index 5e7de03..69cb742 100644 (file)
@@ -42,6 +42,9 @@
 
 #include "gst/gst-i18n-plugin.h"
 
+#include <gst/audio/audio.h>
+#include <gst/video/video.h>
+
 #include "pbutils.h"
 #include "pbutils-private.h"
 
@@ -184,7 +187,6 @@ static const FormatInfo formats[] = {
   {"video/x-nut", "NUT", FLAG_CONTAINER},
   {"video/x-nuv", "MythTV NuppelVideo (NUV)", FLAG_CONTAINER},
   {"video/x-qdrw", "Apple QuickDraw", 0},
-  {"video/x-raw-gray", N_("Uncompressed Gray Image"), 0},
   {"video/x-smc", "Apple SMC", 0},
   {"video/x-smoke", "Smoke", 0},
   {"video/x-tarkin", "Tarkin", 0},
@@ -251,8 +253,7 @@ static const FormatInfo formats[] = {
   {"audio/x-adpcm", NULL, 0},
   {"audio/x-mace", NULL, 0},
   {"audio/x-pn-realaudio", NULL, 0},
-  {"audio/x-raw-int", NULL, 0},
-  {"audio/x-raw-float", NULL, 0},
+  {"audio/x-raw", NULL, 0},
   {"audio/x-wma", NULL, 0},
   {"video/mpeg", NULL, FLAG_CONTAINER | FLAG_SYSTEMSTREAM},
   {"video/mpeg", NULL, 0},
@@ -274,14 +275,13 @@ static const FormatInfo formats[] = {
   {"audio/x-pn-multirate-realaudio-live", NULL, 0},
 #endif
   {"video/x-truemotion", NULL, 0},
-  {"video/x-raw-rgb", NULL, 0},
-  {"video/x-raw-yuv", NULL, 0},
+  {"video/x-raw", NULL, 0},
   {"video/x-svq", NULL, 0},
   {"video/x-wmv", NULL, 0},
   {"video/x-xan", NULL, 0}
 };
 
-/* returns static descriptions and dynamic ones (such as video/x-raw-yuv),
+/* returns static descriptions and dynamic ones (such as video/x-raw),
  * or NULL if caps aren't known at all */
 static gchar *
 format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
@@ -295,63 +295,61 @@ format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
 
   s = gst_caps_get_structure (caps, 0);
 
-  if (strcmp (info->type, "video/x-raw-yuv") == 0) {
-    const gchar *ret = NULL;
-    guint32 fourcc = 0;
+  if (strcmp (info->type, "video/x-raw") == 0) {
+    gchar *ret = NULL;
+    const gchar *str = 0;
+    GstVideoFormat format;
+    const GstVideoFormatInfo *finfo;
 
-    gst_structure_get_fourcc (s, "format", &fourcc);
-    switch (fourcc) {
-      case GST_MAKE_FOURCC ('I', '4', '2', '0'):
-        ret = _("Uncompressed planar YUV 4:2:0");
-        break;
-      case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
-        ret = _("Uncompressed planar YVU 4:2:0");
-        break;
-      case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
-        ret = _("Uncompressed packed YUV 4:2:2");
-        break;
-      case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
-        ret = _("Uncompressed packed YUV 4:1:0");
-        break;
-      case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
-        ret = _("Uncompressed packed YVU 4:1:0");
-        break;
-      case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
-      case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
-        ret = _("Uncompressed packed YUV 4:2:2");
-        break;
-      case GST_MAKE_FOURCC ('Y', '4', '1', 'P'):
-        ret = _("Uncompressed packed YUV 4:1:1");
-        break;
-      case GST_MAKE_FOURCC ('I', 'Y', 'U', '2'):
-        ret = _("Uncompressed packed YUV 4:4:4");
-        break;
-      case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
-        ret = _("Uncompressed planar YUV 4:2:2");
-        break;
-      case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
-        ret = _("Uncompressed planar YUV 4:1:1");
-        break;
-      case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
-        ret = _("Uncompressed black and white Y-plane");
-        break;
-      default:
-        ret = _("Uncompressed YUV");
-        break;
-    }
-    return g_strdup (ret);
-  } else if (strcmp (info->type, "video/x-raw-rgb") == 0) {
-    const gchar *rgb_str;
-    gint depth = 0;
+    str = gst_structure_get_string (s, "format");
+    format = gst_video_format_from_string (str);
+    if (format == GST_VIDEO_FORMAT_UNKNOWN)
+      return g_strdup (_("Uncompressed video"));
+
+    finfo = gst_video_format_get_info (format);
+
+    if (GST_VIDEO_FORMAT_INFO_IS_GRAY (finfo)) {
+      ret = g_strdup (_("Uncompressed gray"));
+    } else if (GST_VIDEO_FORMAT_INFO_IS_YUV (finfo)) {
+      const gchar *layout;
+      const gchar *subs;
+      gint w_sub, h_sub;
+
+      w_sub = GST_VIDEO_FORMAT_INFO_W_SUB (finfo, 1);
+      h_sub = GST_VIDEO_FORMAT_INFO_H_SUB (finfo, 1);
 
-    gst_structure_get_int (s, "depth", &depth);
-    rgb_str = gst_structure_has_field (s, "alpha_mask") ? "RGBA" : "RGB";
-    if (gst_structure_has_field (s, "paletted_data")) {
-      return g_strdup_printf (_("Uncompressed palettized %d-bit %s"), depth,
-          rgb_str);
+      if (GST_VIDEO_FORMAT_INFO_N_PLANES (finfo) == 1) {
+        layout = "planar";
+      } else {
+        layout = "packed";
+      }
+
+      if (w_sub == 1 && h_sub == 1) {
+        subs = "4:4:4";
+      } else if (w_sub == 2 && h_sub == 1) {
+        subs = "4:2:2";
+      } else if (w_sub == 2 && h_sub == 2) {
+        subs = "4:2:0";
+      } else if (w_sub == 4 && h_sub == 1) {
+        subs = "4:1:1";
+      } else {
+        subs = "";
+      }
+      ret = g_strdup_printf (_("Uncompressed %s YUV %s"), layout, subs);
+    } else if (GST_VIDEO_FORMAT_INFO_IS_RGB (finfo)) {
+      gboolean alpha, palette;
+      gint bits;
+
+      alpha = GST_VIDEO_FORMAT_INFO_HAS_ALPHA (finfo);
+      palette = GST_VIDEO_FORMAT_INFO_HAS_PALETTE (finfo);
+      bits = GST_VIDEO_FORMAT_INFO_BITS (finfo);
+
+      ret = g_strdup_printf (_("Uncompressed %s%d-bit %s"),
+          palette ? "palettized " : "", bits, alpha ? "RGBA" : "RGB");
     } else {
-      return g_strdup_printf ("Uncompressed %d-bit %s", depth, rgb_str);
+      ret = g_strdup (_("Uncompressed video"));
     }
+    return ret;
   } else if (strcmp (info->type, "video/x-h263") == 0) {
     const gchar *variant, *ret;
 
@@ -610,26 +608,25 @@ format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
       }
     }
     return g_strdup ("MPEG Video");
-  } else if (strcmp (info->type, "audio/x-raw-int") == 0) {
-    gint bitdepth = 0;
-
-    /* 8-bit pcm might not have depth field (?) */
-    if (!gst_structure_get_int (s, "depth", &bitdepth))
-      gst_structure_get_int (s, "width", &bitdepth);
-    if (bitdepth != 0)
-      return g_strdup_printf (_("Raw %d-bit PCM audio"), bitdepth);
-    else
-      return g_strdup (_("Raw PCM audio"));
-  } else if (strcmp (info->type, "audio/x-raw-float") == 0) {
-    gint bitdepth = 0;
-
-    gst_structure_get_int (s, "width", &bitdepth);
-    if (bitdepth != 0)
-      return g_strdup_printf (_("Raw %d-bit floating-point audio"), bitdepth);
-    else
-      return g_strdup (_("Raw floating-point audio"));
+  } else if (strcmp (info->type, "audio/x-raw") == 0) {
+    gint depth = 0;
+    gboolean is_float;
+    const gchar *str;
+    GstAudioFormat format;
+    const GstAudioFormatInfo *finfo;
+
+    str = gst_structure_get_string (s, "format");
+    format = gst_audio_format_from_string (str);
+    if (format == GST_AUDIO_FORMAT_UNKNOWN)
+      return g_strdup (_("Uncompressed audio"));
+
+    finfo = gst_audio_format_get_info (format);
+    depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo);
+    is_float = GST_AUDIO_FORMAT_INFO_IS_FLOAT (finfo);
+
+    return g_strdup_printf (_("Raw %d-bit %s audio"), depth,
+        is_float ? "floating-point" : "PCM");
   }
-
   return NULL;
 }
 
@@ -880,7 +877,7 @@ gst_pb_utils_get_encoder_description (const GstCaps * caps)
 
 /**
  * gst_pb_utils_get_element_description:
- * @factory_name: the name of the element, e.g. "gnomevfssrc"
+ * @factory_name: the name of the element, e.g. "giosrc"
  *
  * Returns a localised string describing the given element, for use in
  * error dialogs or other messages to be seen by the user. Should never
index eaa7507..710e5bc 100644 (file)
 
 struct _GstEncodingProfile
 {
-  GstMiniObject parent;
+  GObject parent;
 
   /*< public > */
   gchar *name;
@@ -165,8 +165,7 @@ gst_encoding_profile_get_type (void)
   static volatile gsize g_define_type_id__volatile = 0;
 
   if (g_once_init_enter (&g_define_type_id__volatile)) {
-    GType g_define_type_id =
-        g_type_register_static_simple (GST_TYPE_MINI_OBJECT,
+    GType g_define_type_id = g_type_register_static_simple (G_TYPE_OBJECT,
         g_intern_static_string ("GstEncodingProfile"),
         sizeof (GstEncodingProfileClass),
         (GClassInitFunc) gst_encoding_profile_class_intern_init,
@@ -194,8 +193,9 @@ gst_encoding_profile_get_type (void)
 }
 
 static void
-gst_encoding_profile_finalize (GstEncodingProfile * prof)
+gst_encoding_profile_finalize (GObject * object)
 {
+  GstEncodingProfile *prof = (GstEncodingProfile *) object;
   if (prof->name)
     g_free (prof->name);
   if (prof->format)
@@ -209,10 +209,9 @@ gst_encoding_profile_finalize (GstEncodingProfile * prof)
 }
 
 static void
-gst_encoding_profile_class_init (GstMiniObjectClass * klass)
+gst_encoding_profile_class_init (GObjectClass * klass)
 {
-  klass->finalize =
-      (GstMiniObjectFinalizeFunction) gst_encoding_profile_finalize;
+  klass->finalize = gst_encoding_profile_finalize;
 }
 
 /**
@@ -249,12 +248,13 @@ gst_encoding_profile_get_description (GstEncodingProfile * profile)
  *
  * Since: 0.10.32
  *
- * Returns: the #GstCaps corresponding to the media format used in the profile.
+ * Returns: (transfer full): the #GstCaps corresponding to the media format used
+ * in the profile. Unref after usage.
  */
-const GstCaps *
+GstCaps *
 gst_encoding_profile_get_format (GstEncodingProfile * profile)
 {
-  return profile->format;
+  return (profile->format ? gst_caps_ref (profile->format) : NULL);
 }
 
 /**
@@ -292,17 +292,17 @@ gst_encoding_profile_get_presence (GstEncodingProfile * profile)
  *
  * Since: 0.10.32
  *
- * Returns: The restriction #GstCaps to apply before the encoder
+ * Returns: (transfer full): The restriction #GstCaps to apply before the encoder
  * that will be used in the profile. The fields present in restriction caps are
  * properties of the raw stream (that is before encoding), such as height and
  * width for video and depth and sampling rate for audio. Does not apply to
  * #GstEncodingContainerProfile (since there is no corresponding raw stream).
- * Can be %NULL.
+ * Can be %NULL. Unref after usage.
  */
-const GstCaps *
+GstCaps *
 gst_encoding_profile_get_restriction (GstEncodingProfile * profile)
 {
-  return profile->restriction;
+  return (profile->restriction ? gst_caps_ref (profile->restriction) : NULL);
 }
 
 /**
@@ -432,20 +432,21 @@ gst_encoding_container_profile_init (GstEncodingContainerProfile * prof)
 }
 
 static void
-gst_encoding_container_profile_finalize (GstEncodingContainerProfile * prof)
+gst_encoding_container_profile_finalize (GObject * object)
 {
-  g_list_foreach (prof->encodingprofiles, (GFunc) gst_mini_object_unref, NULL);
+  GstEncodingContainerProfile *prof = (GstEncodingContainerProfile *) object;
+
+  g_list_foreach (prof->encodingprofiles, (GFunc) g_object_unref, NULL);
   g_list_free (prof->encodingprofiles);
 
-  GST_MINI_OBJECT_CLASS (gst_encoding_container_profile_parent_class)->finalize
-      ((GstMiniObject *) prof);
+  G_OBJECT_CLASS (gst_encoding_container_profile_parent_class)->finalize
+      ((GObject *) prof);
 }
 
 static void
-gst_encoding_container_profile_class_init (GstMiniObjectClass * klass)
+gst_encoding_container_profile_class_init (GObjectClass * klass)
 {
-  klass->finalize =
-      (GstMiniObjectFinalizeFunction) gst_encoding_container_profile_finalize;
+  klass->finalize = gst_encoding_container_profile_finalize;
 }
 
 const GList *
@@ -475,7 +476,7 @@ gst_encoding_video_profile_init (GstEncodingVideoProfile * prof)
 }
 
 static void
-gst_encoding_video_profile_class_init (GstMiniObjectClass * klass)
+gst_encoding_video_profile_class_init (GObjectClass * klass)
 {
 }
 
@@ -562,7 +563,7 @@ gst_encoding_audio_profile_init (GstEncodingAudioProfile * prof)
 }
 
 static void
-gst_encoding_audio_profile_class_init (GstMiniObjectClass * klass)
+gst_encoding_audio_profile_class_init (GObjectClass * klass)
 {
 }
 
@@ -688,7 +689,7 @@ common_creation (GType objtype, GstCaps * format, const gchar * preset,
 {
   GstEncodingProfile *prof;
 
-  prof = (GstEncodingProfile *) gst_mini_object_new (objtype);
+  prof = (GstEncodingProfile *) g_object_new (objtype, NULL);
 
   if (name)
     prof->name = g_strdup (name);
@@ -816,8 +817,8 @@ gst_encoding_profile_is_equal (GstEncodingProfile * a, GstEncodingProfile * b)
  *
  * Since: 0.10.32
  *
- * Returns: The full caps the given @profile can consume. Call gst_caps_unref()
- * when you are done with the caps.
+ * Returns: (transfer full): The full caps the given @profile can consume. Call
+ * gst_caps_unref() when you are done with the caps.
  */
 GstCaps *
 gst_encoding_profile_get_input_caps (GstEncodingProfile * profile)
@@ -827,7 +828,7 @@ gst_encoding_profile_get_input_caps (GstEncodingProfile * profile)
   GstStructure *st, *outst;
   GQuark out_name;
   guint i, len;
-  const GstCaps *fcaps;
+  GstCaps *fcaps;
 
   if (GST_IS_ENCODING_CONTAINER_PROFILE (profile)) {
     GstCaps *res = gst_caps_new_empty ();
@@ -844,7 +845,7 @@ gst_encoding_profile_get_input_caps (GstEncodingProfile * profile)
 
   /* fast-path */
   if ((profile->restriction == NULL) || gst_caps_is_any (profile->restriction))
-    return gst_caps_copy (fcaps);
+    return gst_caps_ref (fcaps);
 
   /* Combine the format with the restriction caps */
   outst = gst_caps_get_structure (fcaps, 0);
@@ -947,7 +948,7 @@ string_to_profile_transform (const GValue * src_value, GValue * dest_value)
   profile = combo_search (profilename);
 
   if (profile)
-    gst_value_take_mini_object (dest_value, (GstMiniObject *) profile);
+    g_value_take_object (dest_value, (GObject *) profile);
 }
 
 static gboolean
@@ -958,7 +959,7 @@ gst_encoding_profile_deserialize_valfunc (GValue * value, const gchar * s)
   profile = combo_search (s);
 
   if (profile) {
-    gst_value_take_mini_object (value, (GstMiniObject *) profile);
+    g_value_take_object (value, (GObject *) profile);
     return TRUE;
   }
 
index 86becca..6645436 100644 (file)
@@ -43,7 +43,7 @@ G_BEGIN_DECLS
 #define GST_IS_ENCODING_PROFILE(obj)                   \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_PROFILE))
 typedef struct _GstEncodingProfile GstEncodingProfile;
-typedef GstMiniObjectClass GstEncodingProfileClass;
+typedef GObjectClass GstEncodingProfileClass;
 GType gst_encoding_profile_get_type (void);
 
 
@@ -115,7 +115,7 @@ GType gst_encoding_audio_profile_get_type (void);
  *
  * Since: 0.10.32
  */
-#define gst_encoding_profile_unref(profile) (gst_mini_object_unref ((GstMiniObject*) profile))
+#define gst_encoding_profile_unref(profile) (g_object_unref ((GObject*) profile))
 
 /**
  * gst_encoding_profile_ref:
@@ -125,14 +125,14 @@ GType gst_encoding_audio_profile_get_type (void);
  *
  * Since: 0.10.32
  */
-#define gst_encoding_profile_ref(profile) (gst_mini_object_ref ((GstMiniObject*) profile))
+#define gst_encoding_profile_ref(profile) (g_object_ref ((GObject*) profile))
 
 const gchar *  gst_encoding_profile_get_name(GstEncodingProfile *profile);
 const gchar *  gst_encoding_profile_get_description(GstEncodingProfile *profile);
-const GstCaps *        gst_encoding_profile_get_format(GstEncodingProfile *profile);
+GstCaps *      gst_encoding_profile_get_format(GstEncodingProfile *profile);
 const gchar *  gst_encoding_profile_get_preset(GstEncodingProfile *profile);
 guint  gst_encoding_profile_get_presence(GstEncodingProfile *profile);
-const GstCaps *        gst_encoding_profile_get_restriction(GstEncodingProfile *profile);
+GstCaps *      gst_encoding_profile_get_restriction(GstEncodingProfile *profile);
 
 void   gst_encoding_profile_set_name(GstEncodingProfile *profile, const gchar *name);
 void   gst_encoding_profile_set_description(GstEncodingProfile *profile, const gchar *description);
index f3002b7..860b595 100644 (file)
@@ -74,7 +74,7 @@
 
 struct _GstEncodingTarget
 {
-  GstMiniObject parent;
+  GObject parent;
 
   gchar *name;
   gchar *category;
@@ -85,7 +85,7 @@ struct _GstEncodingTarget
   gchar *keyfile;
 };
 
-G_DEFINE_TYPE (GstEncodingTarget, gst_encoding_target, GST_TYPE_MINI_OBJECT);
+G_DEFINE_TYPE (GstEncodingTarget, gst_encoding_target, G_TYPE_OBJECT);
 
 static void
 gst_encoding_target_init (GstEncodingTarget * target)
@@ -94,8 +94,10 @@ gst_encoding_target_init (GstEncodingTarget * target)
 }
 
 static void
-gst_encoding_target_finalize (GstEncodingTarget * target)
+gst_encoding_target_finalize (GObject * object)
 {
+  GstEncodingTarget *target = (GstEncodingTarget *) object;
+
   GST_DEBUG ("Finalizing");
 
   if (target->name)
@@ -105,15 +107,14 @@ gst_encoding_target_finalize (GstEncodingTarget * target)
   if (target->description)
     g_free (target->description);
 
-  g_list_foreach (target->profiles, (GFunc) gst_mini_object_unref, NULL);
+  g_list_foreach (target->profiles, (GFunc) g_object_unref, NULL);
   g_list_free (target->profiles);
 }
 
 static void
-gst_encoding_target_class_init (GstMiniObjectClass * klass)
+gst_encoding_target_class_init (GObjectClass * klass)
 {
-  klass->finalize =
-      (GstMiniObjectFinalizeFunction) gst_encoding_target_finalize;
+  klass->finalize = gst_encoding_target_finalize;
 }
 
 /**
@@ -281,7 +282,7 @@ gst_encoding_target_new (const gchar * name, const gchar * category,
   if (!validate_name (category))
     goto invalid_category;
 
-  res = (GstEncodingTarget *) gst_mini_object_new (GST_TYPE_ENCODING_TARGET);
+  res = (GstEncodingTarget *) g_object_new (GST_TYPE_ENCODING_TARGET, NULL);
   res->name = g_strdup (name);
   res->category = g_strdup (category);
   res->description = g_strdup (description);
@@ -886,7 +887,7 @@ gst_encoding_target_load (const gchar * name, const gchar * category,
 
   /* Try from local profiles */
   tldir =
-      g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
+      g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_MAJORMINOR,
       GST_ENCODING_TARGET_DIRECTORY, NULL);
   target = gst_encoding_target_subload (tldir, category, lfilename, error);
   g_free (tldir);
@@ -1009,7 +1010,7 @@ gst_encoding_target_save (GstEncodingTarget * target, GError ** error)
 
   lfilename = g_strdup_printf ("%s" GST_ENCODING_TARGET_SUFFIX, target->name);
   filename =
-      g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
+      g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_MAJORMINOR,
       GST_ENCODING_TARGET_DIRECTORY, target->category, lfilename, NULL);
   g_free (lfilename);
 
@@ -1062,7 +1063,8 @@ gst_encoding_list_available_categories (void)
   gchar *topdir;
 
   /* First try user-local categories */
-  topdir = g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
+  topdir =
+      g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_MAJORMINOR,
       GST_ENCODING_TARGET_DIRECTORY, NULL);
   res = get_categories (topdir);
   g_free (topdir);
@@ -1178,7 +1180,8 @@ gst_encoding_list_all_targets (const gchar * categoryname)
   gchar *topdir;
 
   /* Get user-locals */
-  topdir = g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
+  topdir =
+      g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_MAJORMINOR,
       GST_ENCODING_TARGET_DIRECTORY, NULL);
   res = get_all_targets (topdir, categoryname);
   g_free (topdir);
index 70c049d..4dcf598 100644 (file)
@@ -89,7 +89,7 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_TARGET))
 
 typedef struct _GstEncodingTarget GstEncodingTarget;
-typedef GstMiniObjectClass GstEncodingTargetClass;
+typedef GObjectClass GstEncodingTargetClass;
 
 GType gst_encoding_target_get_type (void);
 
@@ -102,7 +102,7 @@ GType gst_encoding_target_get_type (void);
  * Since: 0.10.32
  */
 #define gst_encoding_target_unref(target) \
-  (gst_mini_object_unref ((GstMiniObject*) target))
+  (g_object_unref ((GObject*) target))
 
 /**
  * gst_encoding_target_ref:
@@ -113,7 +113,7 @@ GType gst_encoding_target_get_type (void);
  * Since: 0.10.32
  */
 #define gst_encoding_target_ref(target) \
-  (gst_mini_object_ref ((GstMiniObject*) target))
+  (g_object_ref ((GObject*) target))
 
 GstEncodingTarget *
 gst_encoding_target_new (const gchar *name, const gchar *category,
index 6949c80..7dc7846 100644 (file)
@@ -42,7 +42,7 @@ static GstDiscovererVideoInfo
 /* Per-stream information */
 
 G_DEFINE_TYPE (GstDiscovererStreamInfo, gst_discoverer_stream_info,
-    GST_TYPE_MINI_OBJECT);
+    G_TYPE_OBJECT);
 
 static void
 gst_discoverer_stream_info_init (GstDiscovererStreamInfo * info)
@@ -51,10 +51,12 @@ gst_discoverer_stream_info_init (GstDiscovererStreamInfo * info)
 }
 
 static void
-gst_discoverer_stream_info_finalize (GstDiscovererStreamInfo * info)
+gst_discoverer_stream_info_finalize (GObject * object)
 {
+  GstDiscovererStreamInfo *info = (GstDiscovererStreamInfo *) object;
+
   if (info->next)
-    gst_mini_object_unref ((GstMiniObject *) info->next);
+    g_object_unref ((GObject *) info->next);
 
   if (info->caps)
     gst_caps_unref (info->caps);
@@ -66,25 +68,17 @@ gst_discoverer_stream_info_finalize (GstDiscovererStreamInfo * info)
     gst_structure_free (info->misc);
 }
 
-static GstDiscovererStreamInfo *
-gst_discoverer_stream_info_copy (GstDiscovererStreamInfo * info)
-{
-  return gst_discoverer_info_copy_int (info, NULL);
-}
-
 static void
-gst_discoverer_stream_info_class_init (GstMiniObjectClass * klass)
+gst_discoverer_stream_info_class_init (GObjectClass * klass)
 {
-  klass->finalize =
-      (GstMiniObjectFinalizeFunction) gst_discoverer_stream_info_finalize;
-  klass->copy = (GstMiniObjectCopyFunction) gst_discoverer_stream_info_copy;
+  klass->finalize = gst_discoverer_stream_info_finalize;
 }
 
 static GstDiscovererStreamInfo *
 gst_discoverer_stream_info_new (void)
 {
   return (GstDiscovererStreamInfo *)
-      gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
+      g_object_new (GST_TYPE_DISCOVERER_STREAM_INFO, NULL);
 }
 
 static GstDiscovererStreamInfo *
@@ -147,28 +141,28 @@ static GstDiscovererContainerInfo *
 gst_discoverer_container_info_new (void)
 {
   return (GstDiscovererContainerInfo *)
-      gst_mini_object_new (GST_TYPE_DISCOVERER_CONTAINER_INFO);
+      g_object_new (GST_TYPE_DISCOVERER_CONTAINER_INFO, NULL);
 }
 
 static void
-gst_discoverer_container_info_finalize (GstDiscovererContainerInfo * info)
+gst_discoverer_container_info_finalize (GObject * object)
 {
+  GstDiscovererContainerInfo *info = (GstDiscovererContainerInfo *) object;
   GList *tmp;
 
   for (tmp = ((GstDiscovererContainerInfo *) info)->streams; tmp;
       tmp = tmp->next)
-    gst_mini_object_unref ((GstMiniObject *) tmp->data);
+    g_object_unref ((GObject *) tmp->data);
 
   gst_discoverer_stream_info_list_free (info->streams);
 
-  gst_discoverer_stream_info_finalize ((GstDiscovererStreamInfo *) info);
+  gst_discoverer_stream_info_finalize ((GObject *) info);
 }
 
 static void
-gst_discoverer_container_info_class_init (GstMiniObjectClass * klass)
+gst_discoverer_container_info_class_init (GObjectClass * klass)
 {
-  klass->finalize =
-      (GstMiniObjectFinalizeFunction) gst_discoverer_container_info_finalize;
+  klass->finalize = gst_discoverer_container_info_finalize;
 }
 
 static GstDiscovererContainerInfo *
@@ -214,7 +208,7 @@ static GstDiscovererAudioInfo *
 gst_discoverer_audio_info_new (void)
 {
   return (GstDiscovererAudioInfo *)
-      gst_mini_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO);
+      g_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO, NULL);
 }
 
 static GstDiscovererAudioInfo *
@@ -238,7 +232,7 @@ G_DEFINE_TYPE (GstDiscovererVideoInfo, gst_discoverer_video_info,
     GST_TYPE_DISCOVERER_STREAM_INFO);
 
 static void
-gst_discoverer_video_info_class_init (GstMiniObjectClass * klass)
+gst_discoverer_video_info_class_init (GObjectClass * klass)
 {
   /* Nothing to initialize */
 }
@@ -253,7 +247,7 @@ static GstDiscovererVideoInfo *
 gst_discoverer_video_info_new (void)
 {
   return (GstDiscovererVideoInfo *)
-      gst_mini_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO);
+      g_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO, NULL);
 }
 
 static GstDiscovererVideoInfo *
@@ -279,7 +273,7 @@ gst_discoverer_video_info_copy_int (GstDiscovererVideoInfo * ptr)
 }
 
 /* Global stream information */
-G_DEFINE_TYPE (GstDiscovererInfo, gst_discoverer_info, GST_TYPE_MINI_OBJECT);
+G_DEFINE_TYPE (GstDiscovererInfo, gst_discoverer_info, G_TYPE_OBJECT);
 
 static void
 gst_discoverer_info_init (GstDiscovererInfo * info)
@@ -288,12 +282,13 @@ gst_discoverer_info_init (GstDiscovererInfo * info)
 }
 
 static void
-gst_discoverer_info_finalize (GstDiscovererInfo * info)
+gst_discoverer_info_finalize (GObject * object)
 {
+  GstDiscovererInfo *info = (GstDiscovererInfo *) object;
   g_free (info->uri);
 
   if (info->stream_info)
-    gst_mini_object_unref ((GstMiniObject *) info->stream_info);
+    g_object_unref ((GObject *) info->stream_info);
 
   if (info->misc)
     gst_structure_free (info->misc);
@@ -307,7 +302,7 @@ gst_discoverer_info_finalize (GstDiscovererInfo * info)
 static GstDiscovererInfo *
 gst_discoverer_info_new (void)
 {
-  return (GstDiscovererInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_INFO);
+  return (GstDiscovererInfo *) g_object_new (GST_TYPE_DISCOVERER_INFO, NULL);
 }
 
 GstDiscovererInfo *
@@ -350,11 +345,9 @@ gst_discoverer_info_copy (GstDiscovererInfo * ptr)
 }
 
 static void
-gst_discoverer_info_class_init (GstMiniObjectClass * klass)
+gst_discoverer_info_class_init (GObjectClass * klass)
 {
-  klass->finalize =
-      (GstMiniObjectFinalizeFunction) gst_discoverer_info_finalize;
-  klass->copy = (GstMiniObjectCopyFunction) gst_discoverer_info_copy;
+  klass->finalize = gst_discoverer_info_finalize;
 }
 
 /**
index c41acee..bdbcb26 100644 (file)
@@ -99,7 +99,7 @@ struct _GstDiscovererPrivate
   GstElement *uridecodebin;
   GstBus *bus;
 
-  GType decodebin2_type;
+  GType decodebin_type;
 
   /* Custom main context variables */
   GMainContext *ctx;
@@ -242,7 +242,7 @@ uridecodebin_element_added_cb (GstElement * uridecodebin,
   GST_DEBUG ("New element added to uridecodebin : %s",
       GST_ELEMENT_NAME (child));
 
-  if (G_OBJECT_TYPE (child) == dc->priv->decodebin2_type) {
+  if (G_OBJECT_TYPE (child) == dc->priv->decodebin_type) {
     g_object_set (child, "post-stream-topology", TRUE, NULL);
   }
 }
@@ -289,14 +289,14 @@ gst_discoverer_init (GstDiscoverer * dc)
 
   GST_DEBUG_OBJECT (dc, "Done initializing Discoverer");
 
-  /* This is ugly. We get the GType of decodebin2 so we can quickly detect
-   * when a decodebin2 is added to uridecodebin so we can set the
+  /* This is ugly. We get the GType of decodebin so we can quickly detect
+   * when a decodebin is added to uridecodebin so we can set the
    * post-stream-topology setting to TRUE */
   dc->priv->element_added_id =
       g_signal_connect_object (dc->priv->uridecodebin, "element-added",
       G_CALLBACK (uridecodebin_element_added_cb), dc, 0);
-  tmp = gst_element_factory_make ("decodebin2", NULL);
-  dc->priv->decodebin2_type = G_OBJECT_TYPE (tmp);
+  tmp = gst_element_factory_make ("decodebin", NULL);
+  dc->priv->decodebin_type = G_OBJECT_TYPE (tmp);
   gst_object_unref (tmp);
 
   /* create queries */
@@ -409,8 +409,9 @@ gst_discoverer_set_timeout (GstDiscoverer * dc, GstClockTime timeout)
   DISCO_UNLOCK (dc);
 }
 
-static gboolean
-_event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
+static GstProbeReturn
+_event_probe (GstPad * pad, GstProbeType type, GstEvent * event,
+    PrivateStream * ps)
 {
   if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
     GstTagList *tl = NULL, *tmp;
@@ -434,7 +435,7 @@ _event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
     DISCO_UNLOCK (ps->dc);
   }
 
-  return TRUE;
+  return GST_PROBE_OK;
 }
 
 static void
@@ -468,7 +469,7 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
   g_object_set (ps->sink, "silent", TRUE, NULL);
   g_object_set (ps->queue, "max-size-buffers", 1, "silent", TRUE, NULL);
 
-  caps = gst_pad_get_caps_reffed (pad);
+  caps = gst_pad_get_caps (pad, NULL);
 
   if (gst_caps_can_intersect (caps, subs_caps)) {
     /* Subtitle streams are sparse and don't provide any information - don't
@@ -497,7 +498,8 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
   gst_object_unref (sinkpad);
 
   /* Add an event probe */
-  gst_pad_add_event_probe (pad, G_CALLBACK (_event_probe), ps);
+  gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT,
+      (GstPadProbeCallback) _event_probe, ps, NULL);
 
   DISCO_LOCK (dc);
   dc->priv->streams = g_list_append (dc->priv->streams, ps);
@@ -578,11 +580,11 @@ collect_stream_information (GstDiscoverer * dc, PrivateStream * ps, guint idx)
   g_free (stname);
 
   /* Get caps */
-  caps = gst_pad_get_negotiated_caps (ps->pad);
+  caps = gst_pad_get_current_caps (ps->pad);
   if (!caps) {
     GST_WARNING ("Couldn't get negotiated caps from %s:%s",
         GST_DEBUG_PAD_NAME (ps->pad));
-    caps = gst_pad_get_caps (ps->pad);
+    caps = gst_pad_get_caps (ps->pad, NULL);
   }
   if (caps) {
     GST_DEBUG ("Got caps %" GST_PTR_FORMAT, caps);
@@ -606,9 +608,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
   GstCaps *caps;
   GstStructure *caps_st, *tags_st;
   const gchar *name;
-  int tmp, tmp2;
+  int tmp;
   guint utmp;
-  gboolean btmp;
 
   if (!st || !gst_structure_id_has_field (st, _CAPS_QUARK)) {
     GST_WARNING ("Couldn't find caps !");
@@ -616,7 +617,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
       return parent;
     else
       return (GstDiscovererStreamInfo *)
-          gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
+          g_object_new (GST_TYPE_DISCOVERER_STREAM_INFO, NULL);
   }
 
   gst_structure_id_get (st, _CAPS_QUARK, GST_TYPE_CAPS, &caps, NULL);
@@ -630,7 +631,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
       info = (GstDiscovererAudioInfo *) parent;
     else {
       info = (GstDiscovererAudioInfo *)
-          gst_mini_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO);
+          g_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO, NULL);
       info->parent.caps = caps;
     }
 
@@ -665,36 +666,30 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
   } else if (g_str_has_prefix (name, "video/") ||
       g_str_has_prefix (name, "image/")) {
     GstDiscovererVideoInfo *info;
-    GstVideoFormat format;
+    GstVideoInfo vinfo;
 
     if (parent)
       info = (GstDiscovererVideoInfo *) parent;
     else {
       info = (GstDiscovererVideoInfo *)
-          gst_mini_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO);
+          g_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO, NULL);
       info->parent.caps = caps;
     }
 
-    if (gst_video_format_parse_caps (caps, &format, &tmp, &tmp2)) {
-      info->width = (guint) tmp;
-      info->height = (guint) tmp2;
-    }
+    if (gst_video_info_from_caps (&vinfo, caps)) {
+      info->width = (guint) vinfo.width;
+      info->height = (guint) vinfo.height;
 
-    if (gst_structure_get_int (caps_st, "depth", &tmp))
-      info->depth = (guint) tmp;
+      info->depth = (guint) 0;
 
-    if (gst_video_parse_caps_pixel_aspect_ratio (caps, &tmp, &tmp2)) {
-      info->par_num = tmp;
-      info->par_denom = tmp2;
-    }
+      info->par_num = vinfo.par_n;
+      info->par_denom = vinfo.par_d;
 
-    if (gst_video_parse_caps_framerate (caps, &tmp, &tmp2)) {
-      info->framerate_num = tmp;
-      info->framerate_denom = tmp2;
-    }
+      info->framerate_num = vinfo.fps_n;
+      info->framerate_denom = vinfo.fps_d;
 
-    if (gst_video_format_parse_caps_interlaced (caps, &btmp))
-      info->interlaced = btmp;
+      info->interlaced = (vinfo.flags & GST_VIDEO_FLAG_INTERLACED) != 0;
+    }
 
     if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
       gst_structure_id_get (st, _TAGS_QUARK,
@@ -722,7 +717,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
       info = parent;
     else {
       info = (GstDiscovererStreamInfo *)
-          gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
+          g_object_new (GST_TYPE_DISCOVERER_STREAM_INFO, NULL);
       info->caps = caps;
     }
 
@@ -885,7 +880,7 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology,
     GST_DEBUG ("next is a list of %d entries", len);
 
     cont = (GstDiscovererContainerInfo *)
-        gst_mini_object_new (GST_TYPE_DISCOVERER_CONTAINER_INFO);
+        g_object_new (GST_TYPE_DISCOVERER_CONTAINER_INFO, NULL);
     cont->parent.caps = caps;
     res = (GstDiscovererStreamInfo *) cont;
 
@@ -942,20 +937,18 @@ discoverer_collect (GstDiscoverer * dc)
     /* FIXME : Make this querying optional */
     if (TRUE) {
       GstElement *pipeline = (GstElement *) dc->priv->pipeline;
-      GstFormat format = GST_FORMAT_TIME;
       gint64 dur;
 
       GST_DEBUG ("Attempting to query duration");
 
-      if (gst_element_query_duration (pipeline, &format, &dur)) {
-        if (format == GST_FORMAT_TIME) {
-          GST_DEBUG ("Got duration %" GST_TIME_FORMAT, GST_TIME_ARGS (dur));
-          dc->priv->current_info->duration = (guint64) dur;
-        }
+      if (gst_element_query_duration (pipeline, GST_FORMAT_TIME, &dur)) {
+        GST_DEBUG ("Got duration %" GST_TIME_FORMAT, GST_TIME_ARGS (dur));
+        dc->priv->current_info->duration = (guint64) dur;
       }
 
       if (dc->priv->seeking_query) {
         if (gst_element_query (pipeline, dc->priv->seeking_query)) {
+          GstFormat format;
           gboolean seekable;
 
           gst_query_parse_seeking (dc->priv->seeking_query, &format,
@@ -989,8 +982,8 @@ discoverer_collect (GstDiscoverer * dc)
           gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0);
 
       if (g_str_has_prefix (gst_structure_get_name (st), "image/"))
-        ((GstDiscovererVideoInfo *) dc->priv->current_info->
-            stream_info)->is_image = TRUE;
+        ((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)->
+            is_image = TRUE;
     }
   }
 
@@ -1079,16 +1072,20 @@ handle_message (GstDiscoverer * dc, GstMessage * msg)
 
     case GST_MESSAGE_ELEMENT:
     {
-      GQuark sttype = gst_structure_get_name_id (msg->structure);
+      GQuark sttype;
+      const GstStructure *structure;
+
+      structure = gst_message_get_structure (msg);
+      sttype = gst_structure_get_name_id (structure);
       GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg),
-          "structure %" GST_PTR_FORMAT, msg->structure);
+          "structure %" GST_PTR_FORMAT, structure);
       if (sttype == _MISSING_PLUGIN_QUARK) {
         GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg),
             "Setting result to MISSING_PLUGINS");
         dc->priv->current_info->result = GST_DISCOVERER_MISSING_PLUGINS;
-        dc->priv->current_info->misc = gst_structure_copy (msg->structure);
+        dc->priv->current_info->misc = gst_structure_copy (structure);
       } else if (sttype == _STREAM_TOPOLOGY_QUARK) {
-        dc->priv->current_topology = gst_structure_copy (msg->structure);
+        dc->priv->current_topology = gst_structure_copy (structure);
       }
     }
       break;
@@ -1162,7 +1159,7 @@ _setup_locked (GstDiscoverer * dc)
 
   /* Pop URI off the pending URI list */
   dc->priv->current_info =
-      (GstDiscovererInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_INFO);
+      (GstDiscovererInfo *) g_object_new (GST_TYPE_DISCOVERER_INFO, NULL);
   dc->priv->current_info->uri = (gchar *) dc->priv->pending_uris->data;
   dc->priv->pending_uris =
       g_list_delete_link (dc->priv->pending_uris, dc->priv->pending_uris);
index 671dbaa..5225738 100644 (file)
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
 #define GST_IS_DISCOVERER_STREAM_INFO(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_STREAM_INFO))
 typedef struct _GstDiscovererStreamInfo GstDiscovererStreamInfo;
-typedef GstMiniObjectClass GstDiscovererStreamInfoClass;
+typedef GObjectClass GstDiscovererStreamInfoClass;
 GType gst_discoverer_stream_info_get_type (void);
 
 /**
@@ -56,8 +56,8 @@ GType gst_discoverer_stream_info_get_type (void);
  *
  * Since: 0.10.31
  */
-#define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) gst_mini_object_ref((GstMiniObject*) info))
-#define gst_discoverer_stream_info_unref(info) (gst_mini_object_unref((GstMiniObject*) info))
+#define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) g_object_ref((GObject*) info))
+#define gst_discoverer_stream_info_unref(info) (g_object_unref((GObject*) info))
 
 GstDiscovererStreamInfo* gst_discoverer_stream_info_get_previous(GstDiscovererStreamInfo* info);
 GstDiscovererStreamInfo* gst_discoverer_stream_info_get_next(GstDiscovererStreamInfo* info);
@@ -80,7 +80,7 @@ const gchar *            gst_discoverer_stream_info_get_stream_type_nick(GstDisc
 #define GST_IS_DISCOVERER_CONTAINER_INFO(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO))
 typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
-typedef GstMiniObjectClass GstDiscovererContainerInfoClass;
+typedef GObjectClass GstDiscovererContainerInfoClass;
 
 GType gst_discoverer_container_info_get_type (void);
 
@@ -101,7 +101,7 @@ GList *gst_discoverer_container_info_get_streams(GstDiscovererContainerInfo *inf
 #define GST_IS_DISCOVERER_AUDIO_INFO(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_AUDIO_INFO))
 typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
-typedef GstMiniObjectClass GstDiscovererAudioInfoClass;
+typedef GObjectClass GstDiscovererAudioInfoClass;
 
 GType gst_discoverer_audio_info_get_type (void);
 
@@ -125,7 +125,7 @@ guint gst_discoverer_audio_info_get_max_bitrate(const GstDiscovererAudioInfo* in
 #define GST_IS_DISCOVERER_VIDEO_INFO(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_VIDEO_INFO))
 typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
-typedef GstMiniObjectClass GstDiscovererVideoInfoClass;
+typedef GObjectClass GstDiscovererVideoInfoClass;
 GType gst_discoverer_video_info_get_type (void);
 
 guint           gst_discoverer_video_info_get_width(const GstDiscovererVideoInfo* info);
@@ -178,11 +178,11 @@ typedef struct _GstDiscovererInfo GstDiscovererInfo;
   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_INFO, GstDiscovererInfo))
 #define GST_IS_DISCOVERER_INFO(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_INFO))
-typedef GstMiniObjectClass GstDiscovererInfoClass;
+typedef GObjectClass GstDiscovererInfoClass;
 GType gst_discoverer_info_get_type (void);
 
-#define gst_discoverer_info_unref(info) (gst_mini_object_unref((GstMiniObject*)info))
-#define gst_discoverer_info_ref(info) (gst_mini_object_ref((GstMiniObject*)info))
+#define gst_discoverer_info_unref(info) (g_object_unref((GObject*)info))
+#define gst_discoverer_info_ref(info) (g_object_ref((Gbject*)info))
 
 GstDiscovererInfo*        gst_discoverer_info_copy (GstDiscovererInfo * ptr);
 
index 9b5f45e..5f52cbc 100644 (file)
  *       urisource-$(PROTOCOL_REQUIRED), e.g. urisource-http or urisource-mms
  *     </para></listitem>
  *     <listitem><para>
- *       element-$(ELEMENT_REQUIRED), e.g. element-ffmpegcolorspace
+ *       element-$(ELEMENT_REQUIRED), e.g. element-videoconvert
  *     </para></listitem>
  *     <listitem><para>
  *       decoder-$(CAPS_REQUIRED), e.g. (do read below for more details!):
index 1b6d44b..896d28d 100644 (file)
@@ -406,18 +406,20 @@ gst_missing_plugin_message_get_installer_detail (GstMessage * msg)
   GString *str = NULL;
   gchar *detail = NULL;
   gchar *desc;
+  const GstStructure *structure;
 
   g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL);
 
-  GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure);
+  structure = gst_message_get_structure (msg);
+  GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, structure);
 
-  missing_type = missing_structure_get_type (msg->structure);
+  missing_type = missing_structure_get_type (structure);
   if (missing_type == GST_MISSING_TYPE_UNKNOWN) {
     GST_WARNING ("couldn't parse 'type' field");
     goto error;
   }
 
-  type = gst_structure_get_string (msg->structure, "type");
+  type = gst_structure_get_string (structure, "type");
   g_assert (type != NULL);      /* validity already checked above */
 
   /* FIXME: use gst_installer_detail_new() here too */
@@ -444,14 +446,14 @@ gst_missing_plugin_message_get_installer_detail (GstMessage * msg)
     case GST_MISSING_TYPE_URISOURCE:
     case GST_MISSING_TYPE_URISINK:
     case GST_MISSING_TYPE_ELEMENT:
-      if (!missing_structure_get_string_detail (msg->structure, &detail))
+      if (!missing_structure_get_string_detail (structure, &detail))
         goto error;
       break;
     case GST_MISSING_TYPE_DECODER:
     case GST_MISSING_TYPE_ENCODER:{
       GstCaps *caps = NULL;
 
-      if (!missing_structure_get_caps_detail (msg->structure, &caps))
+      if (!missing_structure_get_caps_detail (structure, &caps))
         goto error;
 
       detail = gst_caps_to_string (caps);
@@ -498,19 +500,21 @@ gst_missing_plugin_message_get_description (GstMessage * msg)
   GstMissingType missing_type;
   const gchar *desc;
   gchar *ret = NULL;
+  const GstStructure *structure;
 
   g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL);
 
-  GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure);
+  structure = gst_message_get_structure (msg);
+  GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, structure);
 
-  desc = gst_structure_get_string (msg->structure, "name");
+  desc = gst_structure_get_string (structure, "name");
   if (desc != NULL && *desc != '\0') {
     ret = g_strdup (desc);
     goto done;
   }
 
   /* fallback #1 */
-  missing_type = missing_structure_get_type (msg->structure);
+  missing_type = missing_structure_get_type (structure);
 
   switch (missing_type) {
     case GST_MISSING_TYPE_URISOURCE:
@@ -518,7 +522,7 @@ gst_missing_plugin_message_get_description (GstMessage * msg)
     case GST_MISSING_TYPE_ELEMENT:{
       gchar *detail = NULL;
 
-      if (missing_structure_get_string_detail (msg->structure, &detail)) {
+      if (missing_structure_get_string_detail (structure, &detail)) {
         if (missing_type == GST_MISSING_TYPE_URISOURCE)
           ret = gst_pb_utils_get_source_description (detail);
         else if (missing_type == GST_MISSING_TYPE_URISINK)
@@ -533,7 +537,7 @@ gst_missing_plugin_message_get_description (GstMessage * msg)
     case GST_MISSING_TYPE_ENCODER:{
       GstCaps *caps = NULL;
 
-      if (missing_structure_get_caps_detail (msg->structure, &caps)) {
+      if (missing_structure_get_caps_detail (structure, &caps)) {
         if (missing_type == GST_MISSING_TYPE_DECODER)
           ret = gst_pb_utils_get_decoder_description (caps);
         else
@@ -591,13 +595,16 @@ done:
 gboolean
 gst_is_missing_plugin_message (GstMessage * msg)
 {
+  const GstStructure *structure;
+
   g_return_val_if_fail (msg != NULL, FALSE);
   g_return_val_if_fail (GST_IS_MESSAGE (msg), FALSE);
 
-  if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT || msg->structure == NULL)
+  structure = gst_message_get_structure (msg);
+  if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT || structure == NULL)
     return FALSE;
 
-  return gst_structure_has_name (msg->structure, "missing-plugin");
+  return gst_structure_has_name (structure, "missing-plugin");
 }
 
 /* takes ownership of the description */
index 5031df0..2d7fcd8 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 struct _GstDiscovererStreamInfo {
-  GstMiniObject          parent;
+  GObject                parent;
 
   GstDiscovererStreamInfo *previous;  /* NULL for starting points */
   GstDiscovererStreamInfo *next; /* NULL for containers */
@@ -65,7 +65,7 @@ struct _GstDiscovererVideoInfo {
 };
 
 struct _GstDiscovererInfo {
-  GstMiniObject parent;
+  GObject parent;
 
   gchar *uri;
   GstDiscovererResult result;
index b22fcde..f6e4226 100644 (file)
@@ -33,6 +33,7 @@ GstRiff-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstriff-@GST_MAJORMINO
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                --add-include-path=$(builddir)/../tag \
                --add-include-path=$(builddir)/../audio \
                --add-include-path=$(builddir)/../interfaces \
index 40b2bf6..fbf43da 100644 (file)
@@ -26,7 +26,7 @@
 #include "riff-ids.h"
 #include "riff-media.h"
 
-#include <gst/audio/multichannel.h>
+#include <gst/audio/audio.h>
 
 #include <string.h>
 #include <math.h>
@@ -68,21 +68,14 @@ gst_riff_create_video_caps (guint32 codec_fcc,
 
       if (strf) {
         if (bpp == 8) {
-          caps = gst_caps_new_simple ("video/x-raw-rgb",
-              "bpp", G_TYPE_INT, 8, "depth", G_TYPE_INT, 8,
-              "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
+          caps = gst_caps_new_simple ("video/x-raw",
+              "format", G_TYPE_STRING, "RGB8_PALETTED", NULL);
         } else if (bpp == 24) {
-          caps = gst_caps_new_simple ("video/x-raw-rgb",
-              "bpp", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24,
-              "endianness", G_TYPE_INT, G_BIG_ENDIAN,
-              "red_mask", G_TYPE_INT, 0xff, "green_mask", G_TYPE_INT, 0xff00,
-              "blue_mask", G_TYPE_INT, 0xff0000, NULL);
+          caps = gst_caps_new_simple ("video/x-raw",
+              "format", G_TYPE_STRING, "BGR", NULL);
         } else if (bpp == 32) {
-          caps = gst_caps_new_simple ("video/x-raw-rgb",
-              "bpp", G_TYPE_INT, 32, "depth", G_TYPE_INT, 24,
-              "endianness", G_TYPE_INT, G_BIG_ENDIAN,
-              "red_mask", G_TYPE_INT, 0xff00, "green_mask", G_TYPE_INT,
-              0xff0000, "blue_mask", G_TYPE_INT, 0xff000000, NULL);
+          caps = gst_caps_new_simple ("video/x-raw",
+              "format", G_TYPE_STRING, "BGRx", NULL);
         } else {
           GST_WARNING ("Unhandled DIB RGB depth: %d", bpp);
           return NULL;
@@ -90,8 +83,8 @@ gst_riff_create_video_caps (guint32 codec_fcc,
       } else {
         /* for template */
         caps =
-            gst_caps_from_string ("video/x-raw-rgb, bpp = (int) { 8, 24, 32 }, "
-            "depth = (int) { 8, 24}");
+            gst_caps_from_string ("video/x-raw, format = (string) "
+            "{ RGB8_PALETTED, BGR, BGRx }");
       }
 
       palette = strf_data;
@@ -105,40 +98,38 @@ gst_riff_create_video_caps (guint32 codec_fcc,
       break;
     }
     case GST_MAKE_FOURCC ('I', '4', '2', '0'):
-      caps = gst_caps_new_simple ("video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, codec_fcc, NULL);
+      caps = gst_caps_new_simple ("video/x-raw",
+          "format", G_TYPE_STRING, "I420", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Uncompressed planar YUV 4:2:0");
       break;
 
     case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
     case GST_MAKE_FOURCC ('Y', 'U', 'N', 'V'):
-      caps = gst_caps_new_simple ("video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
-          NULL);
+      caps = gst_caps_new_simple ("video/x-raw",
+          "format", G_TYPE_STRING, "YUY2", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
       break;
 
     case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
-      caps = gst_caps_new_simple ("video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, codec_fcc, NULL);
+      caps = gst_caps_new_simple ("video/x-raw",
+          "format", G_TYPE_STRING, "YVU9", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Uncompressed packed YVU 4:1:0");
       break;
 
     case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
     case GST_MAKE_FOURCC ('2', 'v', 'u', 'y'):
-      caps = gst_caps_new_simple ("video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
-          NULL);
+      caps = gst_caps_new_simple ("video/x-raw",
+          "format", G_TYPE_STRING, "UYVY", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
       break;
 
     case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
-      caps = gst_caps_new_simple ("video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, codec_fcc, NULL);
+      caps = gst_caps_new_simple ("video/x-raw",
+          "format", G_TYPE_STRING, "YV12", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Uncompressed packed YVU 4:2:2");
       break;
@@ -547,16 +538,14 @@ gst_riff_create_video_caps (guint32 codec_fcc,
 
     case GST_MAKE_FOURCC ('W', 'M', 'V', 'A'):
       caps = gst_caps_new_simple ("video/x-wmv",
-          "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC,
-          codec_fcc, NULL);
+          "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WMVA", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Microsoft Windows Media Advanced Profile");
       break;
 
     case GST_MAKE_FOURCC ('W', 'V', 'C', '1'):
       caps = gst_caps_new_simple ("video/x-wmv",
-          "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC,
-          codec_fcc, NULL);
+          "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WVC1", NULL);
       if (codec_name)
         *codec_name = g_strdup ("Microsoft Windows Media VC-1");
       break;
@@ -908,18 +897,19 @@ gst_riff_create_video_caps (guint32 codec_fcc,
   if (palette) {
     GstBuffer *copy;
     guint num_colors;
+    gsize size;
 
     if (strf != NULL)
       num_colors = strf->num_colors;
     else
       num_colors = 256;
 
-    if (GST_BUFFER_SIZE (palette) >= (num_colors * 4)) {
+    size = gst_buffer_get_size (palette);
+
+    if (size >= (num_colors * 4)) {
       /* palette is always at least 256*4 bytes */
-      copy =
-          gst_buffer_new_and_alloc (MAX (GST_BUFFER_SIZE (palette), 256 * 4));
-      memcpy (GST_BUFFER_DATA (copy), GST_BUFFER_DATA (palette),
-          GST_BUFFER_SIZE (palette));
+      copy = gst_buffer_new_and_alloc (MAX (size, 256 * 4));
+      gst_buffer_copy_into (copy, palette, GST_BUFFER_COPY_MEMORY, 0, size);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
       {
@@ -1131,6 +1121,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
         gint ba = strf->blockalign;
         gint ch = strf->channels;
         gint wd, ws;
+        GstAudioFormat format;
 
         /* If we have an empty blockalign, we take the width contained in 
          * strf->size */
@@ -1151,11 +1142,12 @@ gst_riff_create_audio_caps (guint16 codec_id,
         /* For reference, the actual depth is in strf->size */
         ws = wd;
 
-        caps = gst_caps_new_simple ("audio/x-raw-int",
-            "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
-            "channels", G_TYPE_INT, ch,
-            "width", G_TYPE_INT, wd,
-            "depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, wd != 8, NULL);
+        format =
+            gst_audio_format_build_integer (wd != 8, G_LITTLE_ENDIAN, wd, ws);
+
+        caps = gst_caps_new_simple ("audio/x-raw",
+            "format", G_TYPE_STRING, gst_audio_format_to_string (format),
+            "channels", G_TYPE_INT, ch, NULL);
 
         /* Add default channel layout. In theory this should be done
          * for 1 and 2 channels too but apparently breaks too many
@@ -1171,10 +1163,9 @@ gst_riff_create_audio_caps (guint16 codec_id,
         }
       } else {
         /* FIXME: this is pretty useless - we need fixed caps */
-        caps = gst_caps_from_string ("audio/x-raw-int, "
-            "endianness = (int) LITTLE_ENDIAN, "
-            "signed = (boolean) { true, false }, "
-            "width = (int) { 8, 16, 24, 32 }, " "depth = (int) [ 1, 32 ]");
+        caps = gst_caps_from_string ("audio/x-raw, "
+            "format = (string) { S8, U8, S16_LE, U16_LE, S24_LE, "
+            "U24_LE, S32_LE, U32_LE }");
       }
       if (codec_name && strf)
         *codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio",
@@ -1198,9 +1189,9 @@ gst_riff_create_audio_caps (guint16 codec_id,
         gint ch = strf->channels;
         gint wd = ba * 8 / ch;
 
-        caps = gst_caps_new_simple ("audio/x-raw-float",
-            "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
-            "channels", G_TYPE_INT, ch, "width", G_TYPE_INT, wd, NULL);
+        caps = gst_caps_new_simple ("audio/x-raw",
+            "format", G_TYPE_STRING, wd == 64 ? "F64_LE" : "F32_LE",
+            "channels", G_TYPE_INT, ch, NULL);
 
         /* Add default channel layout. In theory this should be done
          * for 1 and 2 channels too but apparently breaks too many
@@ -1216,8 +1207,8 @@ gst_riff_create_audio_caps (guint16 codec_id,
         }
       } else {
         /* FIXME: this is pretty useless - we need fixed caps */
-        caps = gst_caps_from_string ("audio/x-raw-float, "
-            "endianness = (int) LITTLE_ENDIAN, " "width = (int) { 32, 64 }");
+        caps = gst_caps_from_string ("audio/x-raw, "
+            "format = (string) { F32_LE, F64_LE }");
       }
       if (codec_name && strf)
         *codec_name = g_strdup_printf ("Uncompressed %d-bit IEEE float audio",
@@ -1466,25 +1457,28 @@ gst_riff_create_audio_caps (guint16 codec_id,
       guint16 valid_bits_per_sample;
       guint32 channel_mask;
       guint32 subformat_guid[4];
-      const guint8 *data;
+      guint8 *data;
+      gsize size;
 
       channels_max = 8;
 
       /* should be at least 22 bytes */
-      if (strf_data == NULL || GST_BUFFER_SIZE (strf_data) < 22) {
-        GST_WARNING ("WAVE_FORMAT_EXTENSIBLE data size is %d (expected: 22)",
-            (strf_data) ? GST_BUFFER_SIZE (strf_data) : -1);
+      size = gst_buffer_get_size (strf_data);
+
+      if (strf_data == NULL || size < 22) {
+        GST_WARNING ("WAVE_FORMAT_EXTENSIBLE data size is %" G_GSIZE_FORMAT
+            " (expected: 22)", (strf_data) ? size : -1);
         return NULL;
       }
 
-      data = GST_BUFFER_DATA (strf_data);
-
+      data = gst_buffer_map (strf_data, &size, NULL, GST_MAP_READ);
       valid_bits_per_sample = GST_READ_UINT16_LE (data);
       channel_mask = GST_READ_UINT32_LE (data + 2);
       subformat_guid[0] = GST_READ_UINT32_LE (data + 6);
       subformat_guid[1] = GST_READ_UINT32_LE (data + 10);
       subformat_guid[2] = GST_READ_UINT32_LE (data + 14);
       subformat_guid[3] = GST_READ_UINT32_LE (data + 18);
+      gst_buffer_unmap (strf_data, data, size);
 
       GST_DEBUG ("valid bps    = %u", valid_bits_per_sample);
       GST_DEBUG ("channel mask = 0x%08x", channel_mask);
@@ -1499,6 +1493,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
             gint ba = strf->blockalign;
             gint wd = ba * 8 / strf->channels;
             gint ws;
+            GstAudioFormat format;
 
             /* in riff, the depth is stored in the size field but it just
              * means that the _least_ significant bits are cleared. We can
@@ -1510,13 +1505,14 @@ gst_riff_create_audio_caps (guint16 codec_id,
              * if (valid_bits_per_sample != 0)
              *   ws = valid_bits_per_sample; */
 
-            caps = gst_caps_new_simple ("audio/x-raw-int",
-                "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+            format =
+                gst_audio_format_build_integer (wd != 8, G_LITTLE_ENDIAN, wd,
+                ws);
+
+            caps = gst_caps_new_simple ("audio/x-raw",
+                "format", G_TYPE_STRING, gst_audio_format_to_string (format),
                 "channels", G_TYPE_INT, strf->channels,
-                "width", G_TYPE_INT, wd,
-                "depth", G_TYPE_INT, ws,
-                "rate", G_TYPE_INT, strf->rate,
-                "signed", G_TYPE_BOOLEAN, wd != 8, NULL);
+                "rate", G_TYPE_INT, strf->rate, NULL);
 
             /* If channel_mask == 0 and channels > 2 let's
              * assume default layout as some wav files don't have the
@@ -1545,10 +1541,10 @@ gst_riff_create_audio_caps (guint16 codec_id,
             gint ba = strf->blockalign;
             gint wd = ba * 8 / strf->channels;
 
-            caps = gst_caps_new_simple ("audio/x-raw-float",
-                "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+            caps = gst_caps_new_simple ("audio/x-raw",
+                "format", G_TYPE_STRING, wd == 32 ? "F32_LE" : "F64_LE",
                 "channels", G_TYPE_INT, strf->channels,
-                "width", G_TYPE_INT, wd, "rate", G_TYPE_INT, strf->rate, NULL);
+                "rate", G_TYPE_INT, strf->rate, NULL);
 
             /* If channel_mask == 0 and channels > 2 let's
              * assume default layout as some wav files don't have the
index 314c19f..ab37e39 100644 (file)
@@ -52,8 +52,10 @@ gst_riff_read_chunk (GstElement * element,
 {
   GstBuffer *buf;
   GstFlowReturn res;
+  guint8 *data;
   guint size;
   guint64 offset = *_offset;
+  gsize bsize;
 
   g_return_val_if_fail (element != NULL, GST_FLOW_ERROR);
   g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
@@ -65,11 +67,13 @@ skip_junk:
   size = 8;
   if ((res = gst_pad_pull_range (pad, offset, size, &buf)) != GST_FLOW_OK)
     return res;
-  else if (GST_BUFFER_SIZE (buf) < size)
+  else if (gst_buffer_get_size (buf) < size)
     goto too_small;
 
-  *tag = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf));
-  size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
+  data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  *tag = GST_READ_UINT32_LE (data);
+  size = GST_READ_UINT32_LE (data + 4);
+  gst_buffer_unmap (buf, data, bsize);
   gst_buffer_unref (buf);
 
   GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
@@ -86,7 +90,7 @@ skip_junk:
 
   if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
     return res;
-  else if (GST_BUFFER_SIZE (buf) < size)
+  else if (gst_buffer_get_size (buf) < size)
     goto too_small;
 
   *_chunk_data = buf;
@@ -98,8 +102,8 @@ skip_junk:
 too_small:
   {
     /* short read, we return UNEXPECTED to mark the EOS case */
-    GST_DEBUG_OBJECT (element, "not enough data (available=%u, needed=%u)",
-        GST_BUFFER_SIZE (buf), size);
+    GST_DEBUG_OBJECT (element, "not enough data (available=%" G_GSIZE_FORMAT
+        ", needed=%u)", gst_buffer_get_size (buf), size);
     gst_buffer_unref (buf);
     return GST_FLOW_UNEXPECTED;
   }
@@ -125,7 +129,8 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
 {
   guint size, bufsize;
   guint32 fourcc;
-  guint8 *data;
+  guint8 *data, *ptr;
+  gsize bsize;
   guint offset = *_offset;
 
   g_return_val_if_fail (element != NULL, FALSE);
@@ -137,7 +142,7 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
   *chunk_data = NULL;
   *_fourcc = 0;
 
-  bufsize = GST_BUFFER_SIZE (buf);
+  bufsize = gst_buffer_get_size (buf);
 
   if (bufsize == offset)
     goto end_offset;
@@ -146,9 +151,11 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
     goto too_small;
 
   /* read header */
-  data = GST_BUFFER_DATA (buf) + offset;
-  fourcc = GST_READ_UINT32_LE (data);
-  size = GST_READ_UINT32_LE (data + 4);
+  data = ptr = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  ptr += offset;
+  fourcc = GST_READ_UINT32_LE (ptr);
+  size = GST_READ_UINT32_LE (ptr + 4);
+  gst_buffer_unmap (buf, data, bsize);
 
   GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
       GST_FOURCC_ARGS (fourcc), size);
@@ -165,7 +172,8 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
   }
 
   if (size)
-    *chunk_data = gst_buffer_create_sub (buf, offset + 8, size);
+    *chunk_data =
+        gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset + 8, size);
   else
     *chunk_data = NULL;
 
@@ -217,19 +225,21 @@ gst_riff_parse_file_header (GstElement * element,
 {
   guint8 *data;
   guint32 tag;
+  gsize size;
 
   g_return_val_if_fail (buf != NULL, FALSE);
   g_return_val_if_fail (doctype != NULL, FALSE);
 
-  if (GST_BUFFER_SIZE (buf) < 12)
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  if (size < 12)
     goto too_small;
 
-  data = GST_BUFFER_DATA (buf);
   tag = GST_READ_UINT32_LE (data);
   if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0)
     goto not_riff;
 
   *doctype = GST_READ_UINT32_LE (data + 8);
+  gst_buffer_unmap (buf, data, size);
 
   gst_buffer_unref (buf);
 
@@ -239,8 +249,9 @@ gst_riff_parse_file_header (GstElement * element,
 too_small:
   {
     GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
-        ("Not enough data to parse RIFF header (%d available, %d needed)",
-            GST_BUFFER_SIZE (buf), 12));
+        ("Not enough data to parse RIFF header (%" G_GSIZE_FORMAT " available,"
+            " %d needed)", size, 12));
+    gst_buffer_unmap (buf, data, size);
     gst_buffer_unref (buf);
     return FALSE;
   }
@@ -249,6 +260,7 @@ not_riff:
     GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
         ("Stream is no RIFF stream: %" GST_FOURCC_FORMAT,
             GST_FOURCC_ARGS (tag)));
+    gst_buffer_unmap (buf, data, size);
     gst_buffer_unref (buf);
     return FALSE;
   }
@@ -272,14 +284,19 @@ gst_riff_parse_strh (GstElement * element,
     GstBuffer * buf, gst_riff_strh ** _strh)
 {
   gst_riff_strh *strh;
+  guint8 *data;
+  gsize size;
 
   g_return_val_if_fail (buf != NULL, FALSE);
   g_return_val_if_fail (_strh != NULL, FALSE);
 
-  if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh))
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  if (size < sizeof (gst_riff_strh))
     goto too_small;
 
-  strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+  strh = g_memdup (data, size);
+  gst_buffer_unmap (buf, data, size);
+
   gst_buffer_unref (buf);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
@@ -328,8 +345,9 @@ gst_riff_parse_strh (GstElement * element,
 too_small:
   {
     GST_ERROR_OBJECT (element,
-        "Too small strh (%d available, %d needed)",
-        GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
+        "Too small strh (%" G_GSIZE_FORMAT " available, %d needed)",
+        size, (int) sizeof (gst_riff_strh));
+    gst_buffer_unmap (buf, data, size);
     gst_buffer_unref (buf);
     return FALSE;
   }
@@ -357,15 +375,19 @@ gst_riff_parse_strf_vids (GstElement * element,
     GstBuffer * buf, gst_riff_strf_vids ** _strf, GstBuffer ** data)
 {
   gst_riff_strf_vids *strf;
+  guint8 *bdata;
+  gsize size;
 
   g_return_val_if_fail (buf != NULL, FALSE);
   g_return_val_if_fail (_strf != NULL, FALSE);
   g_return_val_if_fail (data != NULL, FALSE);
 
-  if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids))
+  bdata = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  if (size < sizeof (gst_riff_strf_vids))
     goto too_small;
 
-  strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+  strf = g_memdup (bdata, size);
+  gst_buffer_unmap (buf, bdata, size);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
   strf->size = GUINT32_FROM_LE (strf->size);
@@ -383,16 +405,18 @@ gst_riff_parse_strf_vids (GstElement * element,
 
   /* size checking */
   *data = NULL;
-  if (strf->size > GST_BUFFER_SIZE (buf)) {
+  if (strf->size > size) {
     GST_WARNING_OBJECT (element,
-        "strf_vids header gave %d bytes data, only %d available",
-        strf->size, GST_BUFFER_SIZE (buf));
-    strf->size = GST_BUFFER_SIZE (buf);
+        "strf_vids header gave %d bytes data, only %" G_GSIZE_FORMAT
+        " available", strf->size, size);
+    strf->size = size;
   }
-  if (sizeof (gst_riff_strf_vids) < GST_BUFFER_SIZE (buf)) {
-    *data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_vids),
-        GST_BUFFER_SIZE (buf) - sizeof (gst_riff_strf_vids));
+  if (sizeof (gst_riff_strf_vids) < size) {
+    *data =
+        gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL,
+        sizeof (gst_riff_strf_vids), size - sizeof (gst_riff_strf_vids));
   }
+  gst_buffer_unref (buf);
 
   /* debug */
   GST_INFO_OBJECT (element, "strf tag found in context vids:");
@@ -409,9 +433,8 @@ gst_riff_parse_strf_vids (GstElement * element,
   GST_INFO_OBJECT (element, " num_colors  %d", strf->num_colors);
   GST_INFO_OBJECT (element, " imp_colors  %d", strf->imp_colors);
   if (*data)
-    GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
-
-  gst_buffer_unref (buf);
+    GST_INFO_OBJECT (element, " %" G_GSIZE_FORMAT " bytes extradata",
+        gst_buffer_get_size (*data));
 
   *_strf = strf;
 
@@ -421,8 +444,9 @@ gst_riff_parse_strf_vids (GstElement * element,
 too_small:
   {
     GST_ERROR_OBJECT (element,
-        "Too small strf_vids (%d available, %d needed)",
-        GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
+        "Too small strf_vids (%" G_GSIZE_FORMAT " available, %d needed)",
+        size, (int) sizeof (gst_riff_strf_vids));
+    gst_buffer_unmap (buf, data, size);
     gst_buffer_unref (buf);
     return FALSE;
   }
@@ -450,18 +474,18 @@ gst_riff_parse_strf_auds (GstElement * element,
     GstBuffer * buf, gst_riff_strf_auds ** _strf, GstBuffer ** data)
 {
   gst_riff_strf_auds *strf;
-  guint bufsize;
+  gsize bsize;
+  guint8 *bdata;
 
   g_return_val_if_fail (buf != NULL, FALSE);
   g_return_val_if_fail (_strf != NULL, FALSE);
   g_return_val_if_fail (data != NULL, FALSE);
 
-  bufsize = GST_BUFFER_SIZE (buf);
-
-  if (bufsize < sizeof (gst_riff_strf_auds))
+  bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  if (bsize < sizeof (gst_riff_strf_auds))
     goto too_small;
 
-  strf = g_memdup (GST_BUFFER_DATA (buf), bufsize);
+  strf = g_memdup (bdata, bsize);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
   strf->format = GUINT16_FROM_LE (strf->format);
@@ -474,18 +498,19 @@ gst_riff_parse_strf_auds (GstElement * element,
 
   /* size checking */
   *data = NULL;
-  if (bufsize > sizeof (gst_riff_strf_auds) + 2) {
+  if (bsize > sizeof (gst_riff_strf_auds) + 2) {
     gint len;
 
-    len = GST_READ_UINT16_LE (&GST_BUFFER_DATA (buf)[16]);
-    if (len + 2 + sizeof (gst_riff_strf_auds) > bufsize) {
+    len = GST_READ_UINT16_LE (&data[16]);
+    if (len + 2 + sizeof (gst_riff_strf_auds) > bsize) {
       GST_WARNING_OBJECT (element,
           "Extradata indicated %d bytes, but only %" G_GSSIZE_FORMAT
-          " available", len, bufsize - 2 - sizeof (gst_riff_strf_auds));
-      len = bufsize - 2 - sizeof (gst_riff_strf_auds);
+          " available", len, bsize - 2 - sizeof (gst_riff_strf_auds));
+      len = bsize - 2 - sizeof (gst_riff_strf_auds);
     }
     if (len)
-      *data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_auds) + 2, len);
+      *data = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL,
+          sizeof (gst_riff_strf_auds) + 2, len);
   }
 
   /* debug */
@@ -497,8 +522,10 @@ gst_riff_parse_strf_auds (GstElement * element,
   GST_INFO_OBJECT (element, " blockalign  %d", strf->blockalign);
   GST_INFO_OBJECT (element, " size        %d", strf->size);
   if (*data)
-    GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
+    GST_INFO_OBJECT (element, " %" G_GSIZE_FORMAT " bytes extradata",
+        gst_buffer_get_size (*data));
 
+  gst_buffer_unmap (buf, bdata, bsize);
   gst_buffer_unref (buf);
 
   *_strf = strf;
@@ -509,8 +536,9 @@ gst_riff_parse_strf_auds (GstElement * element,
 too_small:
   {
     GST_ERROR_OBJECT (element,
-        "Too small strf_auds (%d available, %" G_GSSIZE_FORMAT " needed)",
-        bufsize, sizeof (gst_riff_strf_auds));
+        "Too small strf_auds (%" G_GSIZE_FORMAT " available"
+        ", %" G_GSSIZE_FORMAT " needed)", bsize, sizeof (gst_riff_strf_auds));
+    gst_buffer_unmap (buf, bdata, bsize);
     gst_buffer_unref (buf);
     return FALSE;
   }
@@ -538,15 +566,20 @@ gst_riff_parse_strf_iavs (GstElement * element,
     GstBuffer * buf, gst_riff_strf_iavs ** _strf, GstBuffer ** data)
 {
   gst_riff_strf_iavs *strf;
+  gsize bsize;
+  guint8 *bdata;
 
   g_return_val_if_fail (buf != NULL, FALSE);
   g_return_val_if_fail (_strf != NULL, FALSE);
   g_return_val_if_fail (data != NULL, FALSE);
 
-  if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs))
+  bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  if (bsize < sizeof (gst_riff_strf_iavs))
     goto too_small;
 
-  strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+  strf = g_memdup (bdata, bsize);
+  gst_buffer_unmap (buf, bdata, bsize);
+
   gst_buffer_unref (buf);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
@@ -580,8 +613,9 @@ gst_riff_parse_strf_iavs (GstElement * element,
 too_small:
   {
     GST_ERROR_OBJECT (element,
-        "Too small strf_iavs (%d available, %" G_GSSIZE_FORMAT " needed)",
-        GST_BUFFER_SIZE (buf), sizeof (gst_riff_strf_iavs));
+        "Too small strf_iavs (%" G_GSIZE_FORMAT "available"
+        ", %" G_GSSIZE_FORMAT " needed)", bsize, sizeof (gst_riff_strf_iavs));
+    gst_buffer_unmap (buf, bdata, bsize);
     gst_buffer_unref (buf);
     return FALSE;
   }
@@ -601,8 +635,9 @@ void
 gst_riff_parse_info (GstElement * element,
     GstBuffer * buf, GstTagList ** _taglist)
 {
-  guint8 *data;
-  guint size, tsize;
+  guint8 *data, *ptr;
+  gsize size, left;
+  guint tsize;
   guint32 tag;
   const gchar *type;
   GstTagList *taglist;
@@ -613,23 +648,27 @@ gst_riff_parse_info (GstElement * element,
     *_taglist = NULL;
     return;
   }
-  data = GST_BUFFER_DATA (buf);
-  size = GST_BUFFER_SIZE (buf);
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+
   taglist = gst_tag_list_new ();
 
-  while (size > 8) {
-    tag = GST_READ_UINT32_LE (data);
-    tsize = GST_READ_UINT32_LE (data + 4);
-    size -= 8;
-    data += 8;
+  ptr = data;
+  left = size;
+
+  while (left > 8) {
+    tag = GST_READ_UINT32_LE (ptr);
+    tsize = GST_READ_UINT32_LE (ptr + 4);
+    left -= 8;
+    ptr += 8;
 
     GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
         GST_FOURCC_ARGS (tag), tsize);
 
-    if (tsize > size) {
+    if (tsize > left) {
       GST_WARNING_OBJECT (element,
-          "Tagsize %d is larger than available data %d", tsize, size);
-      tsize = size;
+          "Tagsize %d is larger than available data %" G_GSIZE_FORMAT,
+          tsize, left);
+      tsize = left;
     }
 
     /* find out the type of metadata */
@@ -711,13 +750,13 @@ gst_riff_parse_info (GstElement * element,
         break;
     }
 
-    if (type != NULL && data[0] != '\0') {
+    if (type != NULL && ptr[0] != '\0') {
       static const gchar *env_vars[] = { "GST_AVI_TAG_ENCODING",
         "GST_RIFF_TAG_ENCODING", "GST_TAG_ENCODING", NULL
       };
       gchar *val;
 
-      val = gst_tag_freeform_string_to_utf8 ((gchar *) data, tsize, env_vars);
+      val = gst_tag_freeform_string_to_utf8 ((gchar *) ptr, tsize, env_vars);
 
       if (val) {
         gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);
@@ -729,12 +768,12 @@ gst_riff_parse_info (GstElement * element,
 
     if (tsize & 1) {
       tsize++;
-      if (tsize > size)
-        tsize = size;
+      if (tsize > left)
+        tsize = left;
     }
 
-    data += tsize;
-    size -= tsize;
+    ptr += tsize;
+    left -= tsize;
   }
 
   if (!gst_tag_list_is_empty (taglist)) {
@@ -743,6 +782,7 @@ gst_riff_parse_info (GstElement * element,
     *_taglist = NULL;
     gst_tag_list_free (taglist);
   }
+  gst_buffer_unmap (buf, data, size);
 
   return;
 }
index 5e327ae..79d8126 100644 (file)
@@ -34,6 +34,7 @@ GstRtp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstrtp-@GST_MAJORMINOR@
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_MAJORMINOR@` \
index d1a43a9..d9a7c5b 100644 (file)
@@ -156,16 +156,12 @@ static GstFlowReturn gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload
 static GstStateChangeReturn gst_base_rtp_payload_audio_change_state (GstElement
     * element, GstStateChange transition);
 
-static gboolean gst_base_rtp_payload_audio_handle_event (GstPad * pad,
-    GstEvent * event);
+static gboolean gst_base_rtp_payload_audio_handle_event (GstBaseRTPPayload
+    * payload, GstEvent * event);
 
-GST_BOILERPLATE (GstBaseRTPAudioPayload, gst_base_rtp_audio_payload,
-    GstBaseRTPPayload, GST_TYPE_BASE_RTP_PAYLOAD);
-
-static void
-gst_base_rtp_audio_payload_base_init (gpointer klass)
-{
-}
+#define gst_base_rtp_audio_payload_parent_class parent_class
+G_DEFINE_TYPE (GstBaseRTPAudioPayload, gst_base_rtp_audio_payload,
+    GST_TYPE_BASE_RTP_PAYLOAD);
 
 static void
 gst_base_rtp_audio_payload_class_init (GstBaseRTPAudioPayloadClass * klass)
@@ -202,8 +198,7 @@ gst_base_rtp_audio_payload_class_init (GstBaseRTPAudioPayloadClass * klass)
 }
 
 static void
-gst_base_rtp_audio_payload_init (GstBaseRTPAudioPayload * payload,
-    GstBaseRTPAudioPayloadClass * klass)
+gst_base_rtp_audio_payload_init (GstBaseRTPAudioPayload * payload)
 {
   payload->priv = GST_BASE_RTP_AUDIO_PAYLOAD_GET_PRIVATE (payload);
 
@@ -404,19 +399,23 @@ gst_base_rtp_audio_payload_set_meta (GstBaseRTPAudioPayload * payload,
 {
   GstBaseRTPPayload *basepayload;
   GstBaseRTPAudioPayloadPrivate *priv;
+  GstRTPBuffer rtp;
 
   basepayload = GST_BASE_RTP_PAYLOAD_CAST (payload);
   priv = payload->priv;
 
   /* set payload type */
-  gst_rtp_buffer_set_payload_type (buffer, basepayload->pt);
+  gst_rtp_buffer_map (buffer, GST_MAP_WRITE, &rtp);
+  gst_rtp_buffer_set_payload_type (&rtp, basepayload->pt);
   /* set marker bit for disconts */
   if (priv->discont) {
     GST_DEBUG_OBJECT (payload, "Setting marker and DISCONT");
-    gst_rtp_buffer_set_marker (buffer, TRUE);
+    gst_rtp_buffer_set_marker (&rtp, TRUE);
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
     priv->discont = FALSE;
   }
+  gst_rtp_buffer_unmap (&rtp);
+
   GST_BUFFER_TIMESTAMP (buffer) = timestamp;
 
   /* get the offset in RTP time */
@@ -456,6 +455,7 @@ gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
   GstBuffer *outbuf;
   guint8 *payload;
   GstFlowReturn ret;
+  GstRTPBuffer rtp;
 
   basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
 
@@ -466,8 +466,10 @@ gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
   outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
 
   /* copy payload */
-  payload = gst_rtp_buffer_get_payload (outbuf);
+  gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+  payload = gst_rtp_buffer_get_payload (&rtp);
   memcpy (payload, data, payload_len);
+  gst_rtp_buffer_unmap (&rtp);
 
   /* set metadata */
   gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
@@ -492,7 +494,7 @@ gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
   priv = baseaudiopayload->priv;
   basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
 
-  payload_len = GST_BUFFER_SIZE (buffer);
+  payload_len = gst_buffer_get_size (buffer);
 
   GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
       payload_len, GST_TIME_ARGS (timestamp));
@@ -511,24 +513,29 @@ gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
 
   if (priv->buffer_list) {
     GstBufferList *list;
-    GstBufferListIterator *it;
+    guint i, len;
 
     list = gst_buffer_list_new ();
-    it = gst_buffer_list_iterate (list);
+    len = gst_buffer_list_len (list);
 
-    /* add both buffers to the buffer list */
-    gst_buffer_list_iterator_add_group (it);
-    gst_buffer_list_iterator_add (it, outbuf);
-    gst_buffer_list_iterator_add (it, buffer);
-
-    gst_buffer_list_iterator_free (it);
+    for (i = 0; i < len; i++) {
+      /* FIXME */
+      g_warning ("bufferlist not implemented");
+      gst_buffer_list_add (list, outbuf);
+      gst_buffer_list_add (list, buffer);
+    }
 
     GST_DEBUG_OBJECT (baseaudiopayload, "Pushing list %p", list);
     ret = gst_basertppayload_push_list (basepayload, list);
   } else {
+    GstRTPBuffer rtp;
+
     /* copy payload */
-    payload = gst_rtp_buffer_get_payload (outbuf);
-    memcpy (payload, GST_BUFFER_DATA (buffer), payload_len);
+    gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+    payload = gst_rtp_buffer_get_payload (&rtp);
+    gst_buffer_extract (buffer, 0, payload, payload_len);
+    gst_rtp_buffer_unmap (&rtp);
+
     gst_buffer_unref (buffer);
 
     GST_DEBUG_OBJECT (baseaudiopayload, "Pushing buffer %p", outbuf);
@@ -607,13 +614,17 @@ gst_base_rtp_audio_payload_flush (GstBaseRTPAudioPayload * baseaudiopayload,
         gst_base_rtp_audio_payload_push_buffer (baseaudiopayload, buffer,
         timestamp);
   } else {
+    GstRTPBuffer rtp;
+
     /* create buffer to hold the payload */
     outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
 
     /* copy payload */
-    payload = gst_rtp_buffer_get_payload (outbuf);
+    gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+    payload = gst_rtp_buffer_get_payload (&rtp);
     gst_adapter_copy (adapter, payload, 0, payload_len);
     gst_adapter_flush (adapter, payload_len);
+    gst_rtp_buffer_unmap (&rtp);
 
     /* set metadata */
     gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
@@ -861,7 +872,7 @@ gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload *
       "Calculated min_payload_len %u and max_payload_len %u",
       min_payload_len, max_payload_len);
 
-  size = GST_BUFFER_SIZE (buffer);
+  size = gst_buffer_get_size (buffer);
 
   /* shortcut, we don't need to use the adapter when the packet can be pushed
    * through directly. */
@@ -942,12 +953,13 @@ gst_base_rtp_payload_audio_change_state (GstElement * element,
 }
 
 static gboolean
-gst_base_rtp_payload_audio_handle_event (GstPad * pad, GstEvent * event)
+gst_base_rtp_payload_audio_handle_event (GstBaseRTPPayload * basep,
+    GstEvent * event)
 {
   GstBaseRTPAudioPayload *payload;
   gboolean res = FALSE;
 
-  payload = GST_BASE_RTP_AUDIO_PAYLOAD (gst_pad_get_parent (pad));
+  payload = GST_BASE_RTP_AUDIO_PAYLOAD (basep);
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_EOS:
@@ -961,9 +973,9 @@ gst_base_rtp_payload_audio_handle_event (GstPad * pad, GstEvent * event)
       break;
   }
 
-  gst_object_unref (payload);
+  /* let parent handle the remainder of the event */
+  res = GST_BASE_RTP_PAYLOAD_CLASS (parent_class)->handle_event (basep, event);
 
-  /* return FALSE to let parent handle the remainder of the event */
   return res;
 }
 
index 9c33413..397e5c1 100644 (file)
 
 #include "gstbasertpdepayload.h"
 
-#ifdef GST_DISABLE_DEPRECATED
-#define QUEUE_LOCK_INIT(base)   (g_static_rec_mutex_init(&base->queuelock))
-#define QUEUE_LOCK_FREE(base)   (g_static_rec_mutex_free(&base->queuelock))
-#define QUEUE_LOCK(base)        (g_static_rec_mutex_lock(&base->queuelock))
-#define QUEUE_UNLOCK(base)      (g_static_rec_mutex_unlock(&base->queuelock))
-#else
-/* otherwise it's already been defined in the header (FIXME 0.11)*/
-#endif
-
 GST_DEBUG_CATEGORY_STATIC (basertpdepayload_debug);
 #define GST_CAT_DEFAULT (basertpdepayload_debug)
 
@@ -65,12 +56,9 @@ enum
   LAST_SIGNAL
 };
 
-#define DEFAULT_QUEUE_DELAY    0
-
 enum
 {
   PROP_0,
-  PROP_QUEUE_DELAY,
   PROP_LAST
 };
 
@@ -80,7 +68,6 @@ static void gst_base_rtp_depayload_set_property (GObject * object,
 static void gst_base_rtp_depayload_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
-static gboolean gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps);
 static GstFlowReturn gst_base_rtp_depayload_chain (GstPad * pad,
     GstBuffer * in);
 static gboolean gst_base_rtp_depayload_handle_sink_event (GstPad * pad,
@@ -96,13 +83,35 @@ static gboolean gst_base_rtp_depayload_packet_lost (GstBaseRTPDepayload *
 static gboolean gst_base_rtp_depayload_handle_event (GstBaseRTPDepayload *
     filter, GstEvent * event);
 
-GST_BOILERPLATE (GstBaseRTPDepayload, gst_base_rtp_depayload, GstElement,
-    GST_TYPE_ELEMENT);
+static GstElementClass *parent_class = NULL;
+static void gst_base_rtp_depayload_class_init (GstBaseRTPDepayloadClass *
+    klass);
+static void gst_base_rtp_depayload_init (GstBaseRTPDepayload * basertppayload,
+    GstBaseRTPDepayloadClass * klass);
 
-static void
-gst_base_rtp_depayload_base_init (gpointer klass)
+GType
+gst_base_rtp_depayload_get_type (void)
 {
-  /*GstElementClass *element_class = GST_ELEMENT_CLASS (klass); */
+  static GType base_rtp_depayload_type = 0;
+
+  if (g_once_init_enter ((gsize *) & base_rtp_depayload_type)) {
+    static const GTypeInfo base_rtp_depayload_info = {
+      sizeof (GstBaseRTPDepayloadClass),
+      NULL,
+      NULL,
+      (GClassInitFunc) gst_base_rtp_depayload_class_init,
+      NULL,
+      NULL,
+      sizeof (GstBaseRTPDepayload),
+      0,
+      (GInstanceInitFunc) gst_base_rtp_depayload_init,
+    };
+
+    g_once_init_leave ((gsize *) & base_rtp_depayload_type,
+        g_type_register_static (GST_TYPE_ELEMENT, "GstBaseRTPDepayload",
+            &base_rtp_depayload_info, G_TYPE_FLAG_ABSTRACT));
+  }
+  return base_rtp_depayload_type;
 }
 
 static void
@@ -121,21 +130,6 @@ gst_base_rtp_depayload_class_init (GstBaseRTPDepayloadClass * klass)
   gobject_class->set_property = gst_base_rtp_depayload_set_property;
   gobject_class->get_property = gst_base_rtp_depayload_get_property;
 
-  /**
-   * GstBaseRTPDepayload::queue-delay
-   *
-   * Control the amount of packets to buffer.
-   *
-   * Deprecated: Use a jitterbuffer or RTP session manager to delay packet
-   * playback. This property has no effect anymore since 0.10.15.
-   */
-#ifndef GST_REMOVE_DEPRECATED
-  g_object_class_install_property (gobject_class, PROP_QUEUE_DELAY,
-      g_param_spec_uint ("queue-delay", "Queue Delay",
-          "Amount of ms to queue/buffer, deprecated", 0, G_MAXUINT,
-          DEFAULT_QUEUE_DELAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-#endif
-
   gstelement_class->change_state = gst_base_rtp_depayload_change_state;
 
   klass->set_gst_timestamp = gst_base_rtp_depayload_set_gst_timestamp;
@@ -162,8 +156,6 @@ gst_base_rtp_depayload_init (GstBaseRTPDepayload * filter,
       gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink");
   g_return_if_fail (pad_template != NULL);
   filter->sinkpad = gst_pad_new_from_template (pad_template, "sink");
-  gst_pad_set_setcaps_function (filter->sinkpad,
-      gst_base_rtp_depayload_setcaps);
   gst_pad_set_chain_function (filter->sinkpad, gst_base_rtp_depayload_chain);
   gst_pad_set_event_function (filter->sinkpad,
       gst_base_rtp_depayload_handle_sink_event);
@@ -176,33 +168,24 @@ gst_base_rtp_depayload_init (GstBaseRTPDepayload * filter,
   gst_pad_use_fixed_caps (filter->srcpad);
   gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
 
-  filter->queue = g_queue_new ();
-  filter->queue_delay = DEFAULT_QUEUE_DELAY;
-
   gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
 }
 
 static void
 gst_base_rtp_depayload_finalize (GObject * object)
 {
-  GstBaseRTPDepayload *filter = GST_BASE_RTP_DEPAYLOAD (object);
-
-  g_queue_free (filter->queue);
-
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static gboolean
-gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps)
+gst_base_rtp_depayload_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
 {
-  GstBaseRTPDepayload *filter;
   GstBaseRTPDepayloadClass *bclass;
   GstBaseRTPDepayloadPrivate *priv;
   gboolean res;
   GstStructure *caps_struct;
   const GValue *value;
 
-  filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad));
   priv = filter->priv;
 
   bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
@@ -251,8 +234,6 @@ gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps)
 
   priv->negotiated = res;
 
-  gst_object_unref (filter);
-
   return res;
 }
 
@@ -269,6 +250,7 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
   guint32 rtptime;
   gboolean discont;
   gint gap;
+  GstRTPBuffer rtp;
 
   filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
   priv = filter->priv;
@@ -293,8 +275,11 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
   priv->timestamp = timestamp;
   priv->duration = GST_BUFFER_DURATION (in);
 
-  seqnum = gst_rtp_buffer_get_seq (in);
-  rtptime = gst_rtp_buffer_get_timestamp (in);
+  gst_rtp_buffer_map (in, GST_MAP_READ, &rtp);
+  seqnum = gst_rtp_buffer_get_seq (&rtp);
+  rtptime = gst_rtp_buffer_get_timestamp (&rtp);
+  gst_rtp_buffer_unmap (&rtp);
+
   discont = FALSE;
 
   GST_LOG_OBJECT (filter, "discont %d, seqnum %u, rtptime %u, timestamp %"
@@ -337,7 +322,7 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
     /* we detected a seqnum discont but the buffer was not flagged with a discont,
      * set the discont flag so that the subclass can throw away old data. */
     priv->discont = TRUE;
-    in = gst_buffer_make_metadata_writable (in);
+    in = gst_buffer_make_writable (in);
     GST_BUFFER_FLAG_SET (in, GST_BUFFER_FLAG_DISCONT);
   }
 
@@ -361,22 +346,14 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
 not_negotiated:
   {
     /* this is not fatal but should be filtered earlier */
-    if (GST_BUFFER_CAPS (in) == NULL) {
-      GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
-          ("No RTP format was negotiated."),
-          ("Input buffers need to have RTP caps set on them. This is usually "
-              "achieved by setting the 'caps' property of the upstream source "
-              "element (often udpsrc or appsrc), or by putting a capsfilter "
-              "element before the depayloader and setting the 'caps' property "
-              "on that. Also see http://cgit.freedesktop.org/gstreamer/"
-              "gst-plugins-good/tree/gst/rtp/README"));
-    } else {
-      GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
-          ("No RTP format was negotiated."),
-          ("RTP caps on input buffer were rejected, most likely because they "
-              "were incomplete or contained wrong values. Check the debug log "
-              "for more information."));
-    }
+    GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
+        ("No RTP format was negotiated."),
+        ("Input buffers need to have RTP caps set on them. This is usually "
+            "achieved by setting the 'caps' property of the upstream source "
+            "element (often udpsrc or appsrc), or by putting a capsfilter "
+            "element before the depayloader and setting the 'caps' property "
+            "on that. Also see http://cgit.freedesktop.org/gstreamer/"
+            "gst-plugins-good/tree/gst/rtp/README"));
     gst_buffer_unref (in);
     return GST_FLOW_NOT_NEGOTIATED;
   }
@@ -417,19 +394,19 @@ gst_base_rtp_depayload_handle_event (GstBaseRTPDepayload * filter,
       filter->need_newsegment = TRUE;
       filter->priv->next_seqnum = -1;
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_CAPS:
     {
-      gboolean update;
-      gdouble rate;
-      GstFormat fmt;
-      gint64 start, stop, position;
-
-      gst_event_parse_new_segment (event, &update, &rate, &fmt, &start, &stop,
-          &position);
+      GstCaps *caps;
 
-      gst_segment_set_newsegment (&filter->segment, update, rate, fmt,
-          start, stop, position);
+      gst_event_parse_caps (event, &caps);
 
+      res = gst_base_rtp_depayload_setcaps (filter, caps);
+      forward = FALSE;
+      break;
+    }
+    case GST_EVENT_SEGMENT:
+    {
+      gst_event_copy_segment (event, &filter->segment);
       /* don't pass the event downstream, we generate our own segment including
        * the NTP time and other things we receive in caps */
       forward = FALSE;
@@ -500,6 +477,7 @@ create_segment_event (GstBaseRTPDepayload * filter, gboolean update,
   GstEvent *event;
   GstClockTime stop;
   GstBaseRTPDepayloadPrivate *priv;
+  GstSegment segment;
 
   priv = filter->priv;
 
@@ -508,9 +486,15 @@ create_segment_event (GstBaseRTPDepayload * filter, gboolean update,
   else
     stop = -1;
 
-  event = gst_event_new_new_segment_full (update, priv->play_speed,
-      priv->play_scale, GST_FORMAT_TIME, position, stop,
-      position + priv->npt_start);
+  gst_segment_init (&segment, GST_FORMAT_TIME);
+  segment.rate = priv->play_speed;
+  segment.applied_rate = priv->play_scale;
+  segment.start = 0;
+  segment.stop = stop;
+  segment.time = priv->npt_start;
+  segment.position = position;
+
+  event = gst_event_new_segment (&segment);
 
   return event;
 }
@@ -519,18 +503,16 @@ typedef struct
 {
   GstBaseRTPDepayload *depayload;
   GstBaseRTPDepayloadClass *bclass;
-  GstCaps *caps;
   gboolean do_ts;
   gboolean rtptime;
 } HeaderData;
 
-static GstBufferListItem
-set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
+static gboolean
+set_headers (GstBuffer ** buffer, guint idx, HeaderData * data)
 {
   GstBaseRTPDepayload *depayload = data->depayload;
 
-  *buffer = gst_buffer_make_metadata_writable (*buffer);
-  gst_buffer_set_caps (*buffer, data->caps);
+  *buffer = gst_buffer_make_writable (*buffer);
 
   /* set the timestamp if we must and can */
   if (data->bclass->set_gst_timestamp && data->do_ts)
@@ -542,7 +524,7 @@ set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
     depayload->priv->discont = FALSE;
   }
 
-  return GST_BUFFER_LIST_SKIP_GROUP;
+  return TRUE;
 }
 
 static GstFlowReturn
@@ -552,7 +534,6 @@ gst_base_rtp_depayload_prepare_push (GstBaseRTPDepayload * filter,
   HeaderData data;
 
   data.depayload = filter;
-  data.caps = GST_PAD_CAPS (filter->srcpad);
   data.rtptime = rtptime;
   data.do_ts = do_ts;
   data.bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
@@ -562,7 +543,7 @@ gst_base_rtp_depayload_prepare_push (GstBaseRTPDepayload * filter,
     gst_buffer_list_foreach (*blist, (GstBufferListFunc) set_headers, &data);
   } else {
     GstBuffer **buf = obj;
-    set_headers (buf, 0, 0, &data);
+    set_headers (buf, 0, &data);
   }
 
   /* if this is the first buffer send a NEWSEGMENT */
@@ -769,14 +750,7 @@ static void
 gst_base_rtp_depayload_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
-  GstBaseRTPDepayload *filter;
-
-  filter = GST_BASE_RTP_DEPAYLOAD (object);
-
   switch (prop_id) {
-    case PROP_QUEUE_DELAY:
-      filter->queue_delay = g_value_get_uint (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -787,14 +761,7 @@ static void
 gst_base_rtp_depayload_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
 {
-  GstBaseRTPDepayload *filter;
-
-  filter = GST_BASE_RTP_DEPAYLOAD (object);
-
   switch (prop_id) {
-    case PROP_QUEUE_DELAY:
-      g_value_set_uint (value, filter->queue_delay);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index d0326a4..68f178d 100644 (file)
@@ -40,15 +40,6 @@ G_BEGIN_DECLS
 #define GST_BASE_RTP_DEPAYLOAD_SINKPAD(depayload) (GST_BASE_RTP_DEPAYLOAD (depayload)->sinkpad)
 #define GST_BASE_RTP_DEPAYLOAD_SRCPAD(depayload)  (GST_BASE_RTP_DEPAYLOAD (depayload)->srcpad)
 
-#ifndef GST_DISABLE_DEPRECATED
-/* this was presumably never meant to be public API, or should at least
- * have been prefixed if it was. Don't use. (FIXME: remove in 0.11) */
-#define QUEUE_LOCK_INIT(base)   (g_static_rec_mutex_init(&base->queuelock))
-#define QUEUE_LOCK_FREE(base)   (g_static_rec_mutex_free(&base->queuelock))
-#define QUEUE_LOCK(base)        (g_static_rec_mutex_lock(&base->queuelock))
-#define QUEUE_UNLOCK(base)      (g_static_rec_mutex_unlock(&base->queuelock))
-#endif
-
 typedef struct _GstBaseRTPDepayload      GstBaseRTPDepayload;
 typedef struct _GstBaseRTPDepayloadClass GstBaseRTPDepayloadClass;
 typedef struct _GstBaseRTPDepayloadPrivate GstBaseRTPDepayloadPrivate;
@@ -59,30 +50,9 @@ struct _GstBaseRTPDepayload
 
   GstPad *sinkpad, *srcpad;
 
-#ifndef GST_REMOVE_DEPRECATED
-  /* lock to protect the queue, deprecated */
-  GStaticRecMutex queuelock;
-
-  /* deprecated */
-  gboolean thread_running;
-  /* the releaser thread, deprecated */
-  GThread *thread;
-#endif
-
   /* this attribute must be set by the child */
   guint clock_rate;
 
-#ifndef GST_REMOVE_DEPRECATED
-  /* this value can be modified by the child if needed, deprecated */
-  guint queue_delay;
-#endif
-
-  /* we will queue up to RTP_QUEUEDELAY ms of packets,
-   * reordering them if necessary
-   * dropping any packets that are more than
-   * RTP_QUEUEDELAY ms late, deprecated */
-  GQueue *queue;
-
   GstSegment segment;
   gboolean need_newsegment;
 
@@ -111,10 +81,6 @@ struct _GstBaseRTPDepayloadClass
   /* virtuals, inform the subclass of the caps. */
   gboolean (*set_caps) (GstBaseRTPDepayload *filter, GstCaps *caps);
 
-  /* non-pure function, default implementation in base class
-   * this does buffering, reordering and dropping, deprecated */
-  GstFlowReturn (*add_to_queue) (GstBaseRTPDepayload *filter, GstBuffer *in);
-
   /* pure virtual function, child must use this to process incoming
    * rtp packets. If the child returns a buffer without a valid timestamp,
    * the timestamp of @in will be applied to the result buffer and the
index e27d97a..112f9a4 100644 (file)
@@ -94,8 +94,10 @@ static void gst_basertppayload_init (GstBaseRTPPayload * basertppayload,
     gpointer g_class);
 static void gst_basertppayload_finalize (GObject * object);
 
-static gboolean gst_basertppayload_sink_setcaps (GstPad * pad, GstCaps * caps);
-static GstCaps *gst_basertppayload_sink_getcaps (GstPad * pad);
+static GstCaps *gst_basertppayload_sink_getcaps (GstPad * pad,
+    GstCaps * filter);
+static gboolean gst_basertppayload_event_default (GstBaseRTPPayload *
+    basertppayload, GstEvent * event);
 static gboolean gst_basertppayload_event (GstPad * pad, GstEvent * event);
 static GstFlowReturn gst_basertppayload_chain (GstPad * pad,
     GstBuffer * buffer);
@@ -117,7 +119,7 @@ gst_basertppayload_get_type (void)
 {
   static GType basertppayload_type = 0;
 
-  if (!basertppayload_type) {
+  if (g_once_init_enter ((gsize *) & basertppayload_type)) {
     static const GTypeInfo basertppayload_info = {
       sizeof (GstBaseRTPPayloadClass),
       (GBaseInitFunc) gst_basertppayload_base_init,
@@ -130,9 +132,9 @@ gst_basertppayload_get_type (void)
       (GInstanceInitFunc) gst_basertppayload_init,
     };
 
-    basertppayload_type =
+    g_once_init_leave ((gsize *) & basertppayload_type,
         g_type_register_static (GST_TYPE_ELEMENT, "GstBaseRTPPayload",
-        &basertppayload_info, G_TYPE_FLAG_ABSTRACT);
+            &basertppayload_info, G_TYPE_FLAG_ABSTRACT));
   }
   return basertppayload_type;
 }
@@ -239,6 +241,8 @@ gst_basertppayload_class_init (GstBaseRTPPayloadClass * klass)
 
   gstelement_class->change_state = gst_basertppayload_change_state;
 
+  klass->handle_event = gst_basertppayload_event_default;
+
   GST_DEBUG_CATEGORY_INIT (basertppayload_debug, "basertppayload", 0,
       "Base class for RTP Payloaders");
 }
@@ -264,8 +268,6 @@ gst_basertppayload_init (GstBaseRTPPayload * basertppayload, gpointer g_class)
   g_return_if_fail (templ != NULL);
 
   basertppayload->sinkpad = gst_pad_new_from_template (templ, "sink");
-  gst_pad_set_setcaps_function (basertppayload->sinkpad,
-      gst_basertppayload_sink_setcaps);
   gst_pad_set_getcaps_function (basertppayload->sinkpad,
       gst_basertppayload_sink_getcaps);
   gst_pad_set_event_function (basertppayload->sinkpad,
@@ -323,27 +325,8 @@ gst_basertppayload_finalize (GObject * object)
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-static gboolean
-gst_basertppayload_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
-  GstBaseRTPPayload *basertppayload;
-  GstBaseRTPPayloadClass *basertppayload_class;
-  gboolean ret = TRUE;
-
-  GST_DEBUG_OBJECT (pad, "setting caps %" GST_PTR_FORMAT, caps);
-  basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
-  basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
-
-  if (basertppayload_class->set_caps)
-    ret = basertppayload_class->set_caps (basertppayload, caps);
-
-  gst_object_unref (basertppayload);
-
-  return ret;
-}
-
 static GstCaps *
-gst_basertppayload_sink_getcaps (GstPad * pad)
+gst_basertppayload_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstBaseRTPPayload *basertppayload;
   GstBaseRTPPayloadClass *basertppayload_class;
@@ -355,7 +338,7 @@ gst_basertppayload_sink_getcaps (GstPad * pad)
   basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
 
   if (basertppayload_class->get_caps)
-    caps = basertppayload_class->get_caps (basertppayload, pad);
+    caps = basertppayload_class->get_caps (basertppayload, pad, filter);
 
   if (!caps) {
     caps = GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (pad));
@@ -363,7 +346,10 @@ gst_basertppayload_sink_getcaps (GstPad * pad)
         "using pad template %p with caps %p %" GST_PTR_FORMAT,
         GST_PAD_PAD_TEMPLATE (pad), caps, caps);
 
-    caps = gst_caps_ref (caps);
+    if (filter)
+      caps = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    else
+      caps = gst_caps_ref (caps);
   }
 
   gst_object_unref (basertppayload);
@@ -372,63 +358,73 @@ gst_basertppayload_sink_getcaps (GstPad * pad)
 }
 
 static gboolean
-gst_basertppayload_event (GstPad * pad, GstEvent * event)
+gst_basertppayload_event_default (GstBaseRTPPayload * basertppayload,
+    GstEvent * event)
 {
-  GstBaseRTPPayload *basertppayload;
-  GstBaseRTPPayloadClass *basertppayload_class;
-  gboolean res;
-
-  basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (basertppayload == NULL)) {
-    gst_event_unref (event);
-    return FALSE;
-  }
-  basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
-
-  if (basertppayload_class->handle_event) {
-    res = basertppayload_class->handle_event (pad, event);
-    if (res)
-      goto done;
-  }
+  gboolean res = FALSE;
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_FLUSH_START:
-      res = gst_pad_event_default (pad, event);
+      res = gst_pad_event_default (basertppayload->sinkpad, event);
       break;
     case GST_EVENT_FLUSH_STOP:
-      res = gst_pad_event_default (pad, event);
+      res = gst_pad_event_default (basertppayload->sinkpad, event);
       gst_segment_init (&basertppayload->segment, GST_FORMAT_UNDEFINED);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_CAPS:
+    {
+      GstBaseRTPPayloadClass *basertppayload_class;
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      GST_DEBUG_OBJECT (basertppayload, "setting caps %" GST_PTR_FORMAT, caps);
+
+      basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
+      if (basertppayload_class->set_caps)
+        res = basertppayload_class->set_caps (basertppayload, caps);
+
+      gst_event_unref (event);
+      break;
+    }
+    case GST_EVENT_SEGMENT:
     {
-      gboolean update;
-      gdouble rate, arate;
-      GstFormat fmt;
-      gint64 start, stop, position;
       GstSegment *segment;
 
       segment = &basertppayload->segment;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &fmt,
-          &start, &stop, &position);
-      gst_segment_set_newsegment_full (segment, update, rate, arate, fmt, start,
-          stop, position);
+      gst_event_copy_segment (event, segment);
 
       GST_DEBUG_OBJECT (basertppayload,
-          "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
-          "format %d, "
-          "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
-          G_GINT64_FORMAT ", accum %" G_GINT64_FORMAT, update, rate, arate,
-          segment->format, segment->start, segment->stop, segment->time,
-          segment->accum);
-      /* fallthrough */
+          "configured SEGMENT %" GST_SEGMENT_FORMAT, segment);
+      res = gst_pad_event_default (basertppayload->sinkpad, event);
+      break;
     }
     default:
-      res = gst_pad_event_default (pad, event);
+      res = gst_pad_event_default (basertppayload->sinkpad, event);
       break;
   }
+  return res;
+}
+
+static gboolean
+gst_basertppayload_event (GstPad * pad, GstEvent * event)
+{
+  GstBaseRTPPayload *basertppayload;
+  GstBaseRTPPayloadClass *basertppayload_class;
+  gboolean res = FALSE;
+
+  basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
+  if (G_UNLIKELY (basertppayload == NULL)) {
+    gst_event_unref (event);
+    return FALSE;
+  }
+
+  basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
+
+  if (basertppayload_class->handle_event)
+    res = basertppayload_class->handle_event (basertppayload, event);
+  else
+    gst_event_unref (event);
 
-done:
   gst_object_unref (basertppayload);
 
   return res;
@@ -560,7 +556,7 @@ gst_basertppayload_set_outcaps (GstBaseRTPPayload * payload,
   payload->abidata.ABI.ptime = 0;
 
   /* the peer caps can override some of the defaults */
-  peercaps = gst_pad_peer_get_caps (payload->srcpad);
+  peercaps = gst_pad_peer_get_caps (payload->srcpad, srccaps);
   if (peercaps == NULL) {
     /* no peer caps, just add the other properties */
     gst_caps_set_simple (srccaps,
@@ -577,11 +573,10 @@ gst_basertppayload_set_outcaps (GstBaseRTPPayload * payload,
     gint pt;
     guint max_ptime, ptime;
 
-    /* peer provides caps we can use to fixate, intersect. This always returns a
-     * writable caps. */
-    temp = gst_caps_intersect (srccaps, peercaps);
+    /* peer provides caps we can use to fixate. They are already intersected
+     * with our srccaps, just make them writable */
+    temp = gst_caps_make_writable (peercaps);
     gst_caps_unref (srccaps);
-    gst_caps_unref (peercaps);
 
     if (gst_caps_is_empty (temp)) {
       gst_caps_unref (temp);
@@ -704,14 +699,13 @@ typedef struct
   guint32 ssrc;
   guint16 seqnum;
   guint8 pt;
-  GstCaps *caps;
   GstClockTime timestamp;
   guint64 offset;
   guint32 rtptime;
 } HeaderData;
 
-static GstBufferListItem
-find_timestamp (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
+static gboolean
+find_timestamp (GstBuffer ** buffer, guint idx, HeaderData * data)
 {
   data->timestamp = GST_BUFFER_TIMESTAMP (*buffer);
   data->offset = GST_BUFFER_OFFSET (*buffer);
@@ -719,23 +713,27 @@ find_timestamp (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
   /* stop when we find a timestamp. We take whatever offset is associated with
    * the timestamp (if any) to do perfect timestamps when we need to. */
   if (data->timestamp != -1)
-    return GST_BUFFER_LIST_END;
+    return FALSE;
   else
-    return GST_BUFFER_LIST_CONTINUE;
+    return TRUE;
 }
 
-static GstBufferListItem
+static gboolean
 set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
 {
-  gst_rtp_buffer_set_ssrc (*buffer, data->ssrc);
-  gst_rtp_buffer_set_payload_type (*buffer, data->pt);
-  gst_rtp_buffer_set_seq (*buffer, data->seqnum);
-  gst_rtp_buffer_set_timestamp (*buffer, data->rtptime);
-  gst_buffer_set_caps (*buffer, data->caps);
+  GstRTPBuffer rtp;
+
+  gst_rtp_buffer_map (*buffer, GST_MAP_WRITE, &rtp);
+  gst_rtp_buffer_set_ssrc (&rtp, data->ssrc);
+  gst_rtp_buffer_set_payload_type (&rtp, data->pt);
+  gst_rtp_buffer_set_seq (&rtp, data->seqnum);
+  gst_rtp_buffer_set_timestamp (&rtp, data->rtptime);
+  gst_rtp_buffer_unmap (&rtp);
+
   /* increment the seqnum for each buffer */
   data->seqnum++;
 
-  return GST_BUFFER_LIST_SKIP_GROUP;
+  return TRUE;
 }
 
 /* Updates the SSRC, payload type, seqnum and timestamp of the RTP buffer
@@ -761,7 +759,6 @@ gst_basertppayload_prepare_push (GstBaseRTPPayload * payload,
   data.seqnum = payload->seqnum;
   data.ssrc = payload->current_ssrc;
   data.pt = payload->pt;
-  data.caps = GST_PAD_CAPS (payload->srcpad);
 
   /* find the first buffer with a timestamp */
   if (is_list) {
@@ -818,14 +815,13 @@ gst_basertppayload_prepare_push (GstBaseRTPPayload * payload,
   priv->next_seqnum = data.seqnum;
   payload->timestamp = data.rtptime;
 
-  GST_LOG_OBJECT (payload,
-      "Preparing to push packet with size %d, seq=%d, rtptime=%u, timestamp %"
-      GST_TIME_FORMAT, (is_list) ? -1 :
-      GST_BUFFER_SIZE (GST_BUFFER (obj)), payload->seqnum, data.rtptime,
-      GST_TIME_ARGS (data.timestamp));
+  GST_LOG_OBJECT (payload, "Preparing to push packet with size %"
+      G_GSIZE_FORMAT ", seq=%d, rtptime=%u, timestamp %" GST_TIME_FORMAT,
+      (is_list) ? -1 : gst_buffer_get_size (GST_BUFFER (obj)),
+      payload->seqnum, data.rtptime, GST_TIME_ARGS (data.timestamp));
 
-  if (g_atomic_int_compare_and_exchange (&payload->
-          priv->notified_first_timestamp, 1, 0)) {
+  if (g_atomic_int_compare_and_exchange (&payload->priv->
+          notified_first_timestamp, 1, 0)) {
     g_object_notify (G_OBJECT (payload), "timestamp");
     g_object_notify (G_OBJECT (payload), "seqnum");
   }
index 86a5721..72b3839 100644 (file)
@@ -134,17 +134,19 @@ struct _GstBaseRTPPayloadClass
 {
   GstElementClass parent_class;
 
+  /* query accepted caps */
+  GstCaps *     (*get_caps)             (GstBaseRTPPayload *payload, GstPad * pad, GstCaps * filter);
   /* receive caps on the sink pad, configure the payloader. */
   gboolean      (*set_caps)             (GstBaseRTPPayload *payload, GstCaps *caps);
+
   /* handle a buffer, perform 0 or more gst_basertppayload_push() on
    * the RTP buffers. This function takes ownership of the buffer. */
   GstFlowReturn (*handle_buffer)        (GstBaseRTPPayload *payload,
                                          GstBuffer *buffer);
-  gboolean      (*handle_event)         (GstPad * pad, GstEvent * event);
-  GstCaps *     (*get_caps)             (GstBaseRTPPayload *payload, GstPad * pad);
+  gboolean      (*handle_event)         (GstBaseRTPPayload *payload, GstEvent * event);
 
   /*< private >*/
-  gpointer _gst_reserved[GST_PADDING-2];
+  gpointer _gst_reserved[GST_PADDING];
 };
 
 GType           gst_basertppayload_get_type             (void);
index 3b37c6f..323c5cf 100644 (file)
@@ -70,10 +70,8 @@ gst_rtcp_buffer_new_take_data (gpointer data, guint len)
   g_return_val_if_fail (len > 0, NULL);
 
   result = gst_buffer_new ();
-
-  GST_BUFFER_MALLOCDATA (result) = data;
-  GST_BUFFER_DATA (result) = data;
-  GST_BUFFER_SIZE (result) = len;
+  gst_buffer_take_memory (result, -1,
+      gst_memory_new_wrapped (0, data, g_free, len, 0, len));
 
   return result;
 }
@@ -205,15 +203,17 @@ wrong_padding:
 gboolean
 gst_rtcp_buffer_validate (GstBuffer * buffer)
 {
+  gboolean res;
   guint8 *data;
-  guint len;
+  gsize len;
 
   g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
 
-  data = GST_BUFFER_DATA (buffer);
-  len = GST_BUFFER_SIZE (buffer);
+  data = gst_buffer_map (buffer, &len, NULL, GST_MAP_READ);
+  res = gst_rtcp_buffer_validate_data (data, len);
+  gst_buffer_unmap (buffer, data, len);
 
-  return gst_rtcp_buffer_validate_data (data, len);
+  return res;
 }
 
 /**
@@ -233,36 +233,71 @@ gst_rtcp_buffer_new (guint mtu)
   g_return_val_if_fail (mtu > 0, NULL);
 
   result = gst_buffer_new ();
-  GST_BUFFER_MALLOCDATA (result) = g_malloc0 (mtu);
-  GST_BUFFER_DATA (result) = GST_BUFFER_MALLOCDATA (result);
-  GST_BUFFER_SIZE (result) = mtu;
+  gst_buffer_take_memory (result, -1,
+      gst_memory_new_wrapped (0, g_malloc0 (mtu), g_free, mtu, 0, mtu));
 
   return result;
 }
 
 /**
- * gst_rtcp_buffer_end:
+ * gst_rtcp_buffer_map:
  * @buffer: a buffer with an RTCP packet
+ * @flags: flags for the mapping
+ * @rtcp: resulting #GstRTCPBuffer
  *
- * Finish @buffer after being constructured. This function is usually called
- * after gst_rtcp_buffer_new() and after adding the RTCP items to the new buffer. 
+ * Open @buffer for reading or writing, depending on @flags. The resulting RTCP
+ * buffer state is stored in @rtcp.
+ */
+gboolean
+gst_rtcp_buffer_map (GstBuffer * buffer, GstMapFlags flags,
+    GstRTCPBuffer * rtcp)
+{
+  g_return_val_if_fail (rtcp != NULL, FALSE);
+  g_return_val_if_fail (rtcp->buffer == NULL, FALSE);
+  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
+
+  rtcp->buffer = buffer;
+  rtcp->flags = flags;
+  rtcp->data = gst_buffer_map (buffer, &rtcp->size, &rtcp->maxsize, flags);
+
+  /* allow for expansion, e.g. adding packets, if needed */
+  if ((flags & GST_MAP_WRITE) != 0) {
+    /* unmap and adjust to max available, and remap */
+    gst_buffer_unmap (buffer, rtcp->data, rtcp->maxsize);
+    rtcp->data = gst_buffer_map (buffer, &rtcp->size, &rtcp->maxsize, flags);
+  }
+
+  return TRUE;
+}
+
+/**
+ * gst_rtcp_buffer_unmap:
+ * @buffer: a buffer with an RTCP packet
+ *
+ * Finish @rtcp after being constructured. This function is usually called
+ * after gst_rtcp_buffer_map() and after adding the RTCP items to the new buffer.
  *
  * The function adjusts the size of @buffer with the total length of all the
  * added packets.
  */
-void
-gst_rtcp_buffer_end (GstBuffer * buffer)
+gboolean
+gst_rtcp_buffer_unmap (GstRTCPBuffer * rtcp)
 {
+  gboolean res;
   GstRTCPPacket packet;
 
-  g_return_if_fail (GST_IS_BUFFER (buffer));
+  g_return_val_if_fail (rtcp != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
 
   /* move to the first free space */
-  if (gst_rtcp_buffer_get_first_packet (buffer, &packet))
+  if (gst_rtcp_buffer_get_first_packet (rtcp, &packet))
     while (gst_rtcp_packet_move_to_next (&packet));
 
   /* shrink size */
-  GST_BUFFER_SIZE (buffer) = packet.offset;
+  res = gst_buffer_unmap (rtcp->buffer, rtcp->data, packet.offset);
+  rtcp->buffer = NULL;
+
+  return res;
 }
 
 /**
@@ -274,15 +309,16 @@ gst_rtcp_buffer_end (GstBuffer * buffer)
  * Returns: the number of RTCP packets in @buffer.
  */
 guint
-gst_rtcp_buffer_get_packet_count (GstBuffer * buffer)
+gst_rtcp_buffer_get_packet_count (GstRTCPBuffer * rtcp)
 {
   GstRTCPPacket packet;
   guint count;
 
-  g_return_val_if_fail (GST_IS_BUFFER (buffer), 0);
+  g_return_val_if_fail (rtcp != NULL, 0);
+  g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), 0);
 
   count = 0;
-  if (gst_rtcp_buffer_get_first_packet (buffer, &packet)) {
+  if (gst_rtcp_buffer_get_first_packet (rtcp, &packet)) {
     do {
       count++;
     } while (gst_rtcp_packet_move_to_next (&packet));
@@ -307,10 +343,9 @@ read_packet_header (GstRTCPPacket * packet)
   guint offset;
 
   g_return_val_if_fail (packet != NULL, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
-  data = GST_BUFFER_DATA (packet->buffer);
-  size = GST_BUFFER_SIZE (packet->buffer);
+  data = packet->rtcp->data;
+  size = packet->rtcp->size;
 
   offset = packet->offset;
 
@@ -345,13 +380,14 @@ read_packet_header (GstRTCPPacket * packet)
  * Returns: TRUE if the packet existed in @buffer.
  */
 gboolean
-gst_rtcp_buffer_get_first_packet (GstBuffer * buffer, GstRTCPPacket * packet)
+gst_rtcp_buffer_get_first_packet (GstRTCPBuffer * rtcp, GstRTCPPacket * packet)
 {
-  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
+  g_return_val_if_fail (rtcp != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
   g_return_val_if_fail (packet != NULL, FALSE);
 
   /* init to 0 */
-  packet->buffer = buffer;
+  packet->rtcp = rtcp;
   packet->offset = 0;
   packet->type = GST_RTCP_TYPE_INVALID;
 
@@ -376,7 +412,6 @@ gst_rtcp_packet_move_to_next (GstRTCPPacket * packet)
 {
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* if we have a padding or invalid packet, it must be the last, 
    * return FALSE */
@@ -413,22 +448,23 @@ end:
  * if the max mtu is exceeded for the buffer.
  */
 gboolean
-gst_rtcp_buffer_add_packet (GstBuffer * buffer, GstRTCPType type,
+gst_rtcp_buffer_add_packet (GstRTCPBuffer * rtcp, GstRTCPType type,
     GstRTCPPacket * packet)
 {
   guint len, size;
   guint8 *data;
   gboolean result;
 
-  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
+  g_return_val_if_fail (rtcp != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
   g_return_val_if_fail (type != GST_RTCP_TYPE_INVALID, FALSE);
   g_return_val_if_fail (packet != NULL, FALSE);
 
   /* find free space */
-  if (gst_rtcp_buffer_get_first_packet (buffer, packet))
+  if (gst_rtcp_buffer_get_first_packet (rtcp, packet))
     while (gst_rtcp_packet_move_to_next (packet));
 
-  size = GST_BUFFER_SIZE (buffer);
+  size = rtcp->size;
 
   /* packet->offset is now pointing to the next free offset in the buffer to
    * start a compount packet. Next we figure out if we have enough free space in
@@ -461,7 +497,7 @@ gst_rtcp_buffer_add_packet (GstBuffer * buffer, GstRTCPType type,
   if (packet->offset + len >= size)
     goto no_space;
 
-  data = GST_BUFFER_DATA (buffer) + packet->offset;
+  data = rtcp->data + packet->offset;
 
   data[0] = (GST_RTCP_VERSION << 6);
   data[1] = type;
@@ -510,9 +546,8 @@ gst_rtcp_packet_remove (GstRTCPPacket * packet)
   offset = packet->offset + (packet->length << 2) + 4;
 
   /* Overwrite this packet with the rest of the data */
-  memmove (GST_BUFFER_DATA (packet->buffer) + packet->offset,
-      GST_BUFFER_DATA (packet->buffer) + offset,
-      GST_BUFFER_SIZE (packet->buffer) - offset);
+  memmove (packet->rtcp->data + packet->offset,
+      packet->rtcp->data + offset, packet->rtcp->size - offset);
 
   /* try to read next header */
   ret = read_packet_header (packet);
@@ -612,9 +647,8 @@ gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket * packet, guint32 * ssrc,
 
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_SR);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -653,9 +687,8 @@ gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket * packet, guint32 ssrc,
 
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_SR);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -686,9 +719,8 @@ gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -711,9 +743,8 @@ gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket * packet, guint32 ssrc)
 
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_RR);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -734,7 +765,6 @@ gst_rtcp_packet_get_rb_count (GstRTCPPacket * packet)
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR ||
       packet->type == GST_RTCP_TYPE_SR, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
   return packet->count;
 }
@@ -765,9 +795,8 @@ gst_rtcp_packet_get_rb (GstRTCPPacket * packet, guint nth, guint32 * ssrc,
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_RR ||
       packet->type == GST_RTCP_TYPE_SR);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -835,13 +864,12 @@ gst_rtcp_packet_add_rb (GstRTCPPacket * packet, guint32 ssrc,
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR ||
       packet->type == GST_RTCP_TYPE_SR, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   if (packet->count >= GST_RTCP_MAX_RB_COUNT)
     goto no_space;
 
-  data = GST_BUFFER_DATA (packet->buffer);
-  size = GST_BUFFER_SIZE (packet->buffer);
+  data = packet->rtcp->data;
+  size = packet->rtcp->size;
 
   /* skip header */
   offset = packet->offset + 4;
@@ -911,7 +939,6 @@ gst_rtcp_packet_set_rb (GstRTCPPacket * packet, guint nth, guint32 ssrc,
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_RR ||
       packet->type == GST_RTCP_TYPE_SR);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
   g_warning ("not implemented");
 }
@@ -930,7 +957,6 @@ gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket * packet)
 {
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
   return packet->count;
 }
@@ -948,7 +974,6 @@ gst_rtcp_packet_sdes_first_item (GstRTCPPacket * packet)
 {
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   packet->item_offset = 4;
   packet->item_count = 0;
@@ -977,14 +1002,13 @@ gst_rtcp_packet_sdes_next_item (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* if we are at the last item, we are done */
   if (packet->item_count == packet->count)
     return FALSE;
 
   /* move to SDES */
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
   data += packet->offset;
   /* move to item */
   offset = packet->item_offset;
@@ -1028,10 +1052,9 @@ gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
   /* move to SDES */
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
   data += packet->offset;
   /* move to item */
   data += packet->item_offset;
@@ -1057,10 +1080,9 @@ gst_rtcp_packet_sdes_first_entry (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* move to SDES */
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
   data += packet->offset;
   /* move to item */
   offset = packet->item_offset;
@@ -1096,10 +1118,9 @@ gst_rtcp_packet_sdes_next_entry (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* move to SDES */
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
   data += packet->offset;
   /* move to item */
   offset = packet->item_offset;
@@ -1150,10 +1171,9 @@ gst_rtcp_packet_sdes_get_entry (GstRTCPPacket * packet,
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* move to SDES */
-  bdata = GST_BUFFER_DATA (packet->buffer);
+  bdata = packet->rtcp->data;
   bdata += packet->offset;
   /* move to item */
   offset = packet->item_offset;
@@ -1194,7 +1214,6 @@ gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket * packet,
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   if (!gst_rtcp_packet_sdes_get_entry (packet, type, &tlen, &tdata))
     return FALSE;
@@ -1225,7 +1244,6 @@ gst_rtcp_packet_sdes_add_item (GstRTCPPacket * packet, guint32 ssrc)
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* increment item count when possible */
   if (packet->count >= GST_RTCP_MAX_SDES_ITEM_COUNT)
@@ -1238,8 +1256,8 @@ gst_rtcp_packet_sdes_add_item (GstRTCPPacket * packet, guint32 ssrc)
   gst_rtcp_packet_sdes_next_item (packet);
 
   /* move to SDES */
-  data = GST_BUFFER_DATA (packet->buffer);
-  size = GST_BUFFER_SIZE (packet->buffer);
+  data = packet->rtcp->data;
+  size = packet->rtcp->size;
   data += packet->offset;
   /* move to current item */
   offset = packet->item_offset;
@@ -1295,11 +1313,10 @@ gst_rtcp_packet_sdes_add_entry (GstRTCPPacket * packet, GstRTCPSDESType type,
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   /* move to SDES */
-  bdata = GST_BUFFER_DATA (packet->buffer);
-  size = GST_BUFFER_SIZE (packet->buffer);
+  bdata = packet->rtcp->data;
+  size = packet->rtcp->size;
   bdata += packet->offset;
   /* move to item */
   offset = packet->item_offset;
@@ -1371,7 +1388,6 @@ gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket * packet, guint nth)
 
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
   /* get amount of sources and check that we don't read too much */
   sc = packet->count;
@@ -1389,10 +1405,10 @@ gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket * packet, guint nth)
   offset += packet->offset;
 
   /* check if the packet is valid */
-  if (offset + 4 > GST_BUFFER_SIZE (packet->buffer))
+  if (offset + 4 > packet->rtcp->size)
     return 0;
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
   data += offset;
 
   ssrc = GST_READ_UINT32_BE (data);
@@ -1419,13 +1435,12 @@ gst_rtcp_packet_bye_add_ssrc (GstRTCPPacket * packet, guint32 ssrc)
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   if (packet->count >= GST_RTCP_MAX_BYE_SSRC_COUNT)
     goto no_space;
 
-  data = GST_BUFFER_DATA (packet->buffer);
-  size = GST_BUFFER_SIZE (packet->buffer);
+  data = packet->rtcp->data;
+  size = packet->rtcp->size;
 
   /* skip header */
   offset = packet->offset + 4;
@@ -1477,7 +1492,6 @@ gst_rtcp_packet_bye_add_ssrcs (GstRTCPPacket * packet, guint32 * ssrc,
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   res = TRUE;
   for (i = 0; i < len && res; i++) {
@@ -1504,7 +1518,7 @@ get_reason_offset (GstRTCPPacket * packet)
   offset += packet->offset;
 
   /* check if the packet is valid */
-  if (offset + 1 > GST_BUFFER_SIZE (packet->buffer))
+  if (offset + 1 > packet->rtcp->size)
     return 0;
 
   return offset;
@@ -1527,13 +1541,12 @@ gst_rtcp_packet_bye_get_reason_len (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
   roffset = get_reason_offset (packet);
   if (roffset == 0)
     return 0;
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   return data[roffset];
 }
@@ -1556,13 +1569,12 @@ gst_rtcp_packet_bye_get_reason (GstRTCPPacket * packet)
 
   g_return_val_if_fail (packet != NULL, NULL);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, NULL);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), NULL);
 
   roffset = get_reason_offset (packet);
   if (roffset == 0)
     return NULL;
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* get length of reason string */
   len = data[roffset];
@@ -1573,7 +1585,7 @@ gst_rtcp_packet_bye_get_reason (GstRTCPPacket * packet)
   roffset += 1;
 
   /* check if enough data to copy */
-  if (roffset + len > GST_BUFFER_SIZE (packet->buffer))
+  if (roffset + len > packet->rtcp->size)
     return NULL;
 
   return g_strndup ((gconstpointer) (data + roffset), len);
@@ -1597,7 +1609,6 @@ gst_rtcp_packet_bye_set_reason (GstRTCPPacket * packet, const gchar * reason)
 
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
   if (reason == NULL)
     return TRUE;
@@ -1613,8 +1624,8 @@ gst_rtcp_packet_bye_set_reason (GstRTCPPacket * packet, const gchar * reason)
   if (roffset == 0)
     goto no_space;
 
-  data = GST_BUFFER_DATA (packet->buffer);
-  size = GST_BUFFER_SIZE (packet->buffer);
+  data = packet->rtcp->data;
+  size = packet->rtcp->size;
 
   /* we have 1 byte length and we need to pad to 4 bytes */
   padded = ((len + 1) + 3) & ~3;
@@ -1660,9 +1671,8 @@ gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket * packet)
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
           packet->type == GST_RTCP_TYPE_PSFB), 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -1688,9 +1698,8 @@ gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket * packet, guint32 ssrc)
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
       packet->type == GST_RTCP_TYPE_PSFB);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header */
   data += packet->offset + 4;
@@ -1716,9 +1725,8 @@ gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket * packet)
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
           packet->type == GST_RTCP_TYPE_PSFB), 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header and sender ssrc */
   data += packet->offset + 8;
@@ -1744,9 +1752,8 @@ gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket * packet, guint32 ssrc)
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
       packet->type == GST_RTCP_TYPE_PSFB);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   /* skip header and sender ssrc */
   data += packet->offset + 8;
@@ -1790,9 +1797,8 @@ gst_rtcp_packet_fb_set_type (GstRTCPPacket * packet, GstRTCPFBType type)
   g_return_if_fail (packet != NULL);
   g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
       packet->type == GST_RTCP_TYPE_PSFB);
-  g_return_if_fail (GST_IS_BUFFER (packet->buffer));
 
-  data = GST_BUFFER_DATA (packet->buffer);
+  data = packet->rtcp->data;
 
   data[packet->offset] = (data[packet->offset] & 0xe0) | type;
   packet->count = type;
@@ -1963,9 +1969,8 @@ gst_rtcp_packet_fb_get_fci_length (GstRTCPPacket * packet)
   g_return_val_if_fail (packet != NULL, 0);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
       packet->type == GST_RTCP_TYPE_PSFB, 0);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
 
-  data = GST_BUFFER_DATA (packet->buffer) + packet->offset + 2;
+  data = packet->rtcp->data + packet->offset + 2;
 
   return GST_READ_UINT16_BE (data) - 2;
 }
@@ -1990,12 +1995,11 @@ gst_rtcp_packet_fb_set_fci_length (GstRTCPPacket * packet, guint16 wordlen)
   g_return_val_if_fail (packet != NULL, FALSE);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
       packet->type == GST_RTCP_TYPE_PSFB, FALSE);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
 
-  if (GST_BUFFER_SIZE (packet->buffer) < packet->offset + ((wordlen + 3) * 4))
+  if (packet->rtcp->size < packet->offset + ((wordlen + 3) * 4))
     return FALSE;
 
-  data = GST_BUFFER_DATA (packet->buffer) + packet->offset + 2;
+  data = packet->rtcp->data + packet->offset + 2;
   wordlen += 2;
   GST_WRITE_UINT16_BE (data, wordlen);
 
@@ -2020,9 +2024,8 @@ gst_rtcp_packet_fb_get_fci (GstRTCPPacket * packet)
   g_return_val_if_fail (packet != NULL, NULL);
   g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
       packet->type == GST_RTCP_TYPE_PSFB, NULL);
-  g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), NULL);
 
-  data = GST_BUFFER_DATA (packet->buffer) + packet->offset;
+  data = packet->rtcp->data + packet->offset;
 
   if (GST_READ_UINT16_BE (data + 2) <= 2)
     return NULL;
index 6f57fad..a9a547d 100644 (file)
@@ -156,8 +156,19 @@ typedef enum
  */
 #define GST_RTCP_VALID_VALUE ((GST_RTCP_VERSION << 14) | GST_RTCP_TYPE_SR)
 
+typedef struct _GstRTCPBuffer GstRTCPBuffer;
 typedef struct _GstRTCPPacket GstRTCPPacket;
 
+struct _GstRTCPBuffer
+{
+  GstBuffer   *buffer;
+
+  GstMapFlags  flags;
+  guint8      *data;
+  gsize        size;
+  gsize        maxsize;
+};
+
 /**
  * GstRTCPPacket:
  * @buffer: pointer to RTCP buffer
@@ -168,8 +179,8 @@ typedef struct _GstRTCPPacket GstRTCPPacket;
  */
 struct _GstRTCPPacket
 { 
-  GstBuffer   *buffer;
-  guint        offset;
+  GstRTCPBuffer *rtcp;
+  guint         offset;
   
   /*< private >*/
   gboolean     padding;      /* padding field of current packet */
@@ -190,14 +201,16 @@ gboolean        gst_rtcp_buffer_validate_data     (guint8 *data, guint len);
 gboolean        gst_rtcp_buffer_validate          (GstBuffer *buffer);
 
 GstBuffer*      gst_rtcp_buffer_new               (guint mtu);
-void            gst_rtcp_buffer_end               (GstBuffer *buffer);
+
+gboolean        gst_rtcp_buffer_map               (GstBuffer *buffer, GstMapFlags flags, GstRTCPBuffer *rtcp);
+gboolean        gst_rtcp_buffer_unmap             (GstRTCPBuffer *rtcp);
 
 /* adding/retrieving packets */
-guint           gst_rtcp_buffer_get_packet_count  (GstBuffer *buffer);
-gboolean        gst_rtcp_buffer_get_first_packet  (GstBuffer *buffer, GstRTCPPacket *packet);
+guint           gst_rtcp_buffer_get_packet_count  (GstRTCPBuffer *rtcp);
+gboolean        gst_rtcp_buffer_get_first_packet  (GstRTCPBuffer *rtcp, GstRTCPPacket *packet);
 gboolean        gst_rtcp_packet_move_to_next      (GstRTCPPacket *packet);
 
-gboolean        gst_rtcp_buffer_add_packet        (GstBuffer *buffer, GstRTCPType type,
+gboolean        gst_rtcp_buffer_add_packet        (GstRTCPBuffer *rtcp, GstRTCPType type,
                                                   GstRTCPPacket *packet);
 gboolean        gst_rtcp_packet_remove            (GstRTCPPacket *packet);
 
index d99f646..0b1f916 100644 (file)
@@ -101,6 +101,7 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len,
 {
   guint len;
   guint8 *data;
+  GstMemory *mem;
 
   g_return_if_fail (csrc_count <= 15);
   g_return_if_fail (GST_IS_BUFFER (buffer));
@@ -108,11 +109,9 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len,
   len = GST_RTP_HEADER_LEN + csrc_count * sizeof (guint32)
       + payload_len + pad_len;
 
-  data = g_malloc (len);
-  GST_BUFFER_MALLOCDATA (buffer) = data;
-  GST_BUFFER_DATA (buffer) = data;
-  GST_BUFFER_SIZE (buffer) = len;
+  mem = gst_allocator_alloc (NULL, len, 0);
 
+  data = gst_memory_map (mem, NULL, NULL, GST_MAP_WRITE);
   /* fill in defaults */
   GST_RTP_HEADER_VERSION (data) = GST_RTP_VERSION;
   GST_RTP_HEADER_PADDING (data) = FALSE;
@@ -125,6 +124,9 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len,
   GST_RTP_HEADER_SEQ (data) = 0;
   GST_RTP_HEADER_TIMESTAMP (data) = 0;
   GST_RTP_HEADER_SSRC (data) = 0;
+  gst_memory_unmap (mem, data, len);
+
+  gst_buffer_take_memory (buffer, -1, mem);
 }
 
 /**
@@ -139,7 +141,7 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len,
  * Returns: A newly allocated buffer with @data and of size @len.
  */
 GstBuffer *
-gst_rtp_buffer_new_take_data (gpointer data, guint len)
+gst_rtp_buffer_new_take_data (gpointer data, gsize len)
 {
   GstBuffer *result;
 
@@ -147,10 +149,8 @@ gst_rtp_buffer_new_take_data (gpointer data, guint len)
   g_return_val_if_fail (len > 0, NULL);
 
   result = gst_buffer_new ();
-
-  GST_BUFFER_MALLOCDATA (result) = data;
-  GST_BUFFER_DATA (result) = data;
-  GST_BUFFER_SIZE (result) = len;
+  gst_buffer_take_memory (result, -1,
+      gst_memory_new_wrapped (0, data, g_free, len, 0, len));
 
   return result;
 }
@@ -167,7 +167,7 @@ gst_rtp_buffer_new_take_data (gpointer data, guint len)
  * Returns: A newly allocated buffer with a copy of @data and of size @len.
  */
 GstBuffer *
-gst_rtp_buffer_new_copy_data (gpointer data, guint len)
+gst_rtp_buffer_new_copy_data (gpointer data, gsize len)
 {
   return gst_rtp_buffer_new_take_data (g_memdup (data, len), len);
 }
@@ -201,7 +201,7 @@ gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len,
 
 /**
  * gst_rtp_buffer_new_allocate_len:
- * @packet_len: the total length of the packet
+ * @rtp_len: the total length of the packet
  * @pad_len: the amount of padding
  * @csrc_count: the number of CSRC entries
  *
@@ -391,7 +391,7 @@ dump_packet:
  * Returns: TRUE if the data points to a valid RTP packet.
  */
 gboolean
-gst_rtp_buffer_validate_data (guint8 * data, guint len)
+gst_rtp_buffer_validate_data (guint8 * data, gsize len)
 {
   return validate_data (data, len, NULL, 0);
 }
@@ -410,133 +410,78 @@ gst_rtp_buffer_validate_data (guint8 * data, guint len)
 gboolean
 gst_rtp_buffer_validate (GstBuffer * buffer)
 {
+  gboolean res;
   guint8 *data;
-  guint len;
+  gsize len;
 
   g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
 
-  data = GST_BUFFER_DATA (buffer);
-  len = GST_BUFFER_SIZE (buffer);
+  data = gst_buffer_map (buffer, &len, NULL, GST_MAP_READ);
+  res = validate_data (data, len, NULL, 0);
+  gst_buffer_unmap (buffer, data, len);
 
-  return validate_data (data, len, NULL, 0);
+  return res;
 }
 
-/**
- * gst_rtp_buffer_list_validate:
- * @list: the buffer list to validate
- *
- * Check if all RTP packets in the @list are valid using gst_rtp_buffer_validate_data().
- * Use this function to validate an list before using the other functions in
- * this module.
- *
- * Returns: TRUE if @list consists only of valid RTP packets.
- *
- * Since: 0.10.24
- */
 gboolean
-gst_rtp_buffer_list_validate (GstBufferList * list)
+gst_rtp_buffer_map (GstBuffer * buffer, GstMapFlags flags, GstRTPBuffer * rtp)
 {
-  guint16 prev_seqnum = 0;
-  GstBufferListIterator *it;
-  guint i = 0;
-
-  g_return_val_if_fail (GST_IS_BUFFER_LIST (list), FALSE);
-
-  it = gst_buffer_list_iterate (list);
-  g_return_val_if_fail (it != NULL, FALSE);
-
-  /* iterate through all the RTP packets in the list */
-  while (gst_buffer_list_iterator_next_group (it)) {
-    GstBuffer *rtpbuf;
-    GstBuffer *paybuf;
-    guint8 *packet_header;
-    guint8 *packet_payload;
-    guint payload_size;
-    guint packet_size;
-    guint j, n_buffers;
-
-    /* each group should consists of at least 1 buffer: The first buffer always
-     * contains the complete RTP header. Next buffers contain the payload */
-    n_buffers = gst_buffer_list_iterator_n_buffers (it);
-    if (n_buffers < 1)
-      goto invalid_list;
-
-    /* get the RTP header (and if n_buffers == 1 also the payload) */
-    rtpbuf = gst_buffer_list_iterator_next (it);
-    packet_header = GST_BUFFER_DATA (rtpbuf);
-    if (packet_header == NULL)
-      goto invalid_list;
-
-    /* check the sequence number */
-    if (G_UNLIKELY (i == 0)) {
-      prev_seqnum = g_ntohs (GST_RTP_HEADER_SEQ (packet_header));
-      i++;
-    } else {
-      if (++prev_seqnum != g_ntohs (GST_RTP_HEADER_SEQ (packet_header)))
-        goto invalid_list;
-    }
+  guint8 *data;
+  gsize size, maxsize;
 
-    packet_size = GST_BUFFER_SIZE (rtpbuf);
-    packet_payload = NULL;
-    payload_size = 0;
+  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
+  g_return_val_if_fail (rtp != NULL, FALSE);
+  g_return_val_if_fail (rtp->buffer == NULL, FALSE);
 
-    /* get the payload buffers */
-    for (j = 1; j < n_buffers; j++) {
-      /* get the payload */
-      paybuf = gst_buffer_list_iterator_next (it);
+  data = gst_buffer_map (buffer, &size, &maxsize, flags);
+  if (data == NULL)
+    return FALSE;
 
-      if ((packet_payload = GST_BUFFER_DATA (paybuf)) == NULL)
-        goto invalid_list;
+  rtp->buffer = buffer;
+  rtp->flags = flags;
+  rtp->data = data;
+  rtp->size = size;
+  rtp->maxsize = maxsize;
 
-      if ((payload_size = GST_BUFFER_SIZE (paybuf)) == 0)
-        goto invalid_list;
+  return TRUE;
+}
 
-      /* the size of the RTP packet within the current group */
-      packet_size += payload_size;
-    }
+gboolean
+gst_rtp_buffer_unmap (GstRTPBuffer * rtp)
+{
+  g_return_val_if_fail (rtp != NULL, FALSE);
+  g_return_val_if_fail (rtp->buffer != NULL, FALSE);
 
-    /* validate packet */
-    if (!validate_data (packet_header, packet_size, packet_payload,
-            payload_size)) {
-      goto invalid_list;
-    }
-  }
+  gst_buffer_unmap (rtp->buffer, rtp->data, rtp->size);
 
-  gst_buffer_list_iterator_free (it);
+  rtp->buffer = NULL;
 
   return TRUE;
-
-  /* ERRORS */
-invalid_list:
-  {
-    gst_buffer_list_iterator_free (it);
-    return FALSE;
-  }
 }
 
+
 /**
  * gst_rtp_buffer_set_packet_len:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @len: the new packet length
  *
- * Set the total @buffer size to @len. The data in the buffer will be made
- * larger if needed. Any padding will be removed from the packet. 
+ * Set the total @rtp size to @len. The data in the buffer will be made
+ * larger if needed. Any padding will be removed from the packet.
  */
 void
-gst_rtp_buffer_set_packet_len (GstBuffer * buffer, guint len)
+gst_rtp_buffer_set_packet_len (GstRTPBuffer * rtp, guint len)
 {
-  guint oldlen;
   guint8 *data;
 
-  oldlen = GST_BUFFER_SIZE (buffer);
-  data = GST_BUFFER_DATA (buffer);
+  data = rtp->data;
 
-  if (oldlen < len) {
-    data = g_realloc (GST_BUFFER_MALLOCDATA (buffer), len);
-    GST_BUFFER_MALLOCDATA (buffer) = data;
-    GST_BUFFER_DATA (buffer) = data;
+  if (rtp->maxsize <= len) {
+    /* FIXME, realloc bigger space */
+    g_warning ("not implemented");
   }
-  GST_BUFFER_SIZE (buffer) = len;
+
+  gst_buffer_set_size (rtp->buffer, len);
+  rtp->size = len;
 
   /* remove any padding */
   GST_RTP_HEADER_PADDING (data) = FALSE;
@@ -544,21 +489,21 @@ gst_rtp_buffer_set_packet_len (GstBuffer * buffer, guint len)
 
 /**
  * gst_rtp_buffer_get_packet_len:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Return the total length of the packet in @buffer.
  *
  * Returns: The total length of the packet in @buffer.
  */
 guint
-gst_rtp_buffer_get_packet_len (GstBuffer * buffer)
+gst_rtp_buffer_get_packet_len (GstRTPBuffer * rtp)
 {
-  return GST_BUFFER_SIZE (buffer);
+  return gst_buffer_get_size (rtp->buffer);
 }
 
 /**
  * gst_rtp_buffer_get_header_len:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Return the total length of the header in @buffer. This include the length of
  * the fixed header, the CSRC list and the extension header.
@@ -566,12 +511,12 @@ gst_rtp_buffer_get_packet_len (GstBuffer * buffer)
  * Returns: The total length of the header in @buffer.
  */
 guint
-gst_rtp_buffer_get_header_len (GstBuffer * buffer)
+gst_rtp_buffer_get_header_len (GstRTPBuffer * rtp)
 {
   guint len;
   guint8 *data;
 
-  data = GST_BUFFER_DATA (buffer);
+  data = rtp->data;
 
   len = GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data);
   if (GST_RTP_HEADER_EXTENSION (data))
@@ -582,45 +527,45 @@ gst_rtp_buffer_get_header_len (GstBuffer * buffer)
 
 /**
  * gst_rtp_buffer_get_version:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the version number of the RTP packet in @buffer.
  *
  * Returns: The version of @buffer.
  */
 guint8
-gst_rtp_buffer_get_version (GstBuffer * buffer)
+gst_rtp_buffer_get_version (GstRTPBuffer * rtp)
 {
-  return GST_RTP_HEADER_VERSION (GST_BUFFER_DATA (buffer));
+  return GST_RTP_HEADER_VERSION (rtp->data);
 }
 
 /**
  * gst_rtp_buffer_set_version:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @version: the new version
  *
  * Set the version of the RTP packet in @buffer to @version.
  */
 void
-gst_rtp_buffer_set_version (GstBuffer * buffer, guint8 version)
+gst_rtp_buffer_set_version (GstRTPBuffer * rtp, guint8 version)
 {
   g_return_if_fail (version < 0x04);
 
-  GST_RTP_HEADER_VERSION (GST_BUFFER_DATA (buffer)) = version;
+  GST_RTP_HEADER_VERSION (rtp->data) = version;
 }
 
 /**
  * gst_rtp_buffer_get_padding:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Check if the padding bit is set on the RTP packet in @buffer.
  *
  * Returns: TRUE if @buffer has the padding bit set.
  */
 gboolean
-gst_rtp_buffer_get_padding (GstBuffer * buffer)
+gst_rtp_buffer_get_padding (GstRTPBuffer * rtp)
 {
-  return GST_RTP_HEADER_PADDING (GST_BUFFER_DATA (buffer));
+  return GST_RTP_HEADER_PADDING (rtp->data);
 }
 
 /**
@@ -631,14 +576,14 @@ gst_rtp_buffer_get_padding (GstBuffer * buffer)
  * Set the padding bit on the RTP packet in @buffer to @padding.
  */
 void
-gst_rtp_buffer_set_padding (GstBuffer * buffer, gboolean padding)
+gst_rtp_buffer_set_padding (GstRTPBuffer * rtp, gboolean padding)
 {
-  GST_RTP_HEADER_PADDING (GST_BUFFER_DATA (buffer)) = padding;
+  GST_RTP_HEADER_PADDING (rtp->data) = padding;
 }
 
 /**
  * gst_rtp_buffer_pad_to:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @len: the new amount of padding
  *
  * Set the amount of padding in the RTP packet in @buffer to
@@ -647,11 +592,11 @@ gst_rtp_buffer_set_padding (GstBuffer * buffer, gboolean padding)
  * NOTE: This function does not work correctly.
  */
 void
-gst_rtp_buffer_pad_to (GstBuffer * buffer, guint len)
+gst_rtp_buffer_pad_to (GstRTPBuffer * rtp, guint len)
 {
   guint8 *data;
 
-  data = GST_BUFFER_DATA (buffer);
+  data = rtp->data;
 
   if (len > 0)
     GST_RTP_HEADER_PADDING (data) = TRUE;
@@ -663,34 +608,34 @@ gst_rtp_buffer_pad_to (GstBuffer * buffer, guint len)
 
 /**
  * gst_rtp_buffer_get_extension:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Check if the extension bit is set on the RTP packet in @buffer.
  * 
  * Returns: TRUE if @buffer has the extension bit set.
  */
 gboolean
-gst_rtp_buffer_get_extension (GstBuffer * buffer)
+gst_rtp_buffer_get_extension (GstRTPBuffer * rtp)
 {
-  return GST_RTP_HEADER_EXTENSION (GST_BUFFER_DATA (buffer));
+  return GST_RTP_HEADER_EXTENSION (rtp->data);
 }
 
 /**
  * gst_rtp_buffer_set_extension:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @extension: the new extension
  *
  * Set the extension bit on the RTP packet in @buffer to @extension.
  */
 void
-gst_rtp_buffer_set_extension (GstBuffer * buffer, gboolean extension)
+gst_rtp_buffer_set_extension (GstRTPBuffer * rtp, gboolean extension)
 {
-  GST_RTP_HEADER_EXTENSION (GST_BUFFER_DATA (buffer)) = extension;
+  GST_RTP_HEADER_EXTENSION (rtp->data) = extension;
 }
 
 /**
  * gst_rtp_buffer_get_extension_data:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @bits: location for result bits
  * @data: location for data
  * @wordlen: location for length of @data in 32 bits words
@@ -707,13 +652,13 @@ gst_rtp_buffer_set_extension (GstBuffer * buffer, gboolean extension)
  * Since: 0.10.15
  */
 gboolean
-gst_rtp_buffer_get_extension_data (GstBuffer * buffer, guint16 * bits,
+gst_rtp_buffer_get_extension_data (GstRTPBuffer * rtp, guint16 * bits,
     gpointer * data, guint * wordlen)
 {
   guint len;
   guint8 *pdata;
 
-  pdata = GST_BUFFER_DATA (buffer);
+  pdata = rtp->data;
 
   if (!GST_RTP_HEADER_EXTENSION (pdata))
     return FALSE;
@@ -734,7 +679,7 @@ gst_rtp_buffer_get_extension_data (GstBuffer * buffer, guint16 * bits,
 
 /**
  * gst_rtp_buffer_set_extension_data:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @bits: the bits specific for the extension
  * @length: the length that counts the number of 32-bit words in
  * the extension, excluding the extension header ( therefore zero is a valid length)
@@ -748,23 +693,23 @@ gst_rtp_buffer_get_extension_data (GstBuffer * buffer, guint16 * bits,
  * Since: 0.10.18
  */
 gboolean
-gst_rtp_buffer_set_extension_data (GstBuffer * buffer, guint16 bits,
+gst_rtp_buffer_set_extension_data (GstRTPBuffer * rtp, guint16 bits,
     guint16 length)
 {
   guint32 min_size = 0;
   guint8 *data;
 
-  data = GST_BUFFER_DATA (buffer);
+  data = rtp->data;
 
   /* check if the buffer is big enough to hold the extension */
   min_size =
       GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data) + 4 +
       length * sizeof (guint32);
-  if (G_UNLIKELY (min_size > GST_BUFFER_SIZE (buffer)))
+  if (G_UNLIKELY (min_size > rtp->size))
     goto too_small;
 
   /* now we can set the extension bit */
-  gst_rtp_buffer_set_extension (buffer, TRUE);
+  GST_RTP_HEADER_EXTENSION (rtp->data) = TRUE;
 
   data += GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data);
   GST_WRITE_UINT16_BE (data, bits);
@@ -776,100 +721,56 @@ gst_rtp_buffer_set_extension_data (GstBuffer * buffer, guint16 bits,
 too_small:
   {
     g_warning
-        ("rtp buffer too small: need more than %d bytes but only have %d bytes",
-        min_size, GST_BUFFER_SIZE (buffer));
+        ("rtp buffer too small: need more than %d bytes but only have %"
+        G_GSIZE_FORMAT " bytes", min_size, rtp->size);
     return FALSE;
   }
 }
 
 /**
  * gst_rtp_buffer_get_ssrc:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the SSRC of the RTP packet in @buffer.
  * 
  * Returns: the SSRC of @buffer in host order.
  */
 guint32
-gst_rtp_buffer_get_ssrc (GstBuffer * buffer)
-{
-  return g_ntohl (GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_list_get_ssrc:
- * @list: the buffer list
- *
- * Get the SSRC of the first RTP packet in @list.
- * All RTP packets within @list have the same SSRC.
- *
- * Returns: the SSRC of @list in host order.
- *
- * Since: 0.10.24
- */
-guint32
-gst_rtp_buffer_list_get_ssrc (GstBufferList * list)
+gst_rtp_buffer_get_ssrc (GstRTPBuffer * rtp)
 {
-  GstBuffer *buffer;
-
-  buffer = gst_buffer_list_get (list, 0, 0);
-  g_return_val_if_fail (buffer != NULL, 0);
-
-  return g_ntohl (GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (buffer)));
+  return g_ntohl (GST_RTP_HEADER_SSRC (rtp->data));
 }
 
 /**
  * gst_rtp_buffer_set_ssrc:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @ssrc: the new SSRC
  *
  * Set the SSRC on the RTP packet in @buffer to @ssrc.
  */
 void
-gst_rtp_buffer_set_ssrc (GstBuffer * buffer, guint32 ssrc)
-{
-  GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (buffer)) = g_htonl (ssrc);
-}
-
-static GstBufferListItem
-set_ssrc_header (GstBuffer ** buffer, guint group, guint idx, guint32 * ssrc)
-{
-  GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (*buffer)) = g_htonl (*ssrc);
-  return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_ssrc:
- * @list: the buffer list
- * @ssrc: the new SSRC
- *
- * Set the SSRC on each RTP packet in @list to @ssrc.
- *
- * Since: 0.10.24
- */
-void
-gst_rtp_buffer_list_set_ssrc (GstBufferList * list, guint32 ssrc)
+gst_rtp_buffer_set_ssrc (GstRTPBuffer * rtp, guint32 ssrc)
 {
-  gst_buffer_list_foreach (list, (GstBufferListFunc) set_ssrc_header, &ssrc);
+  GST_RTP_HEADER_SSRC (rtp->data) = g_htonl (ssrc);
 }
 
 /**
  * gst_rtp_buffer_get_csrc_count:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the CSRC count of the RTP packet in @buffer.
  * 
  * Returns: the CSRC count of @buffer.
  */
 guint8
-gst_rtp_buffer_get_csrc_count (GstBuffer * buffer)
+gst_rtp_buffer_get_csrc_count (GstRTPBuffer * rtp)
 {
-  return GST_RTP_HEADER_CSRC_COUNT (GST_BUFFER_DATA (buffer));
+  return GST_RTP_HEADER_CSRC_COUNT (rtp->data);
 }
 
 /**
  * gst_rtp_buffer_get_csrc:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @idx: the index of the CSRC to get
  *
  * Get the CSRC at index @idx in @buffer.
@@ -877,11 +778,11 @@ gst_rtp_buffer_get_csrc_count (GstBuffer * buffer)
  * Returns: the CSRC at index @idx in host order.
  */
 guint32
-gst_rtp_buffer_get_csrc (GstBuffer * buffer, guint8 idx)
+gst_rtp_buffer_get_csrc (GstRTPBuffer * rtp, guint8 idx)
 {
   guint8 *data;
 
-  data = GST_BUFFER_DATA (buffer);
+  data = rtp->data;
 
   g_return_val_if_fail (idx < GST_RTP_HEADER_CSRC_COUNT (data), 0);
 
@@ -890,18 +791,18 @@ gst_rtp_buffer_get_csrc (GstBuffer * buffer, guint8 idx)
 
 /**
  * gst_rtp_buffer_set_csrc:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @idx: the CSRC index to set
  * @csrc: the CSRC in host order to set at @idx
  *
  * Modify the CSRC at index @idx in @buffer to @csrc.
  */
 void
-gst_rtp_buffer_set_csrc (GstBuffer * buffer, guint8 idx, guint32 csrc)
+gst_rtp_buffer_set_csrc (GstRTPBuffer * rtp, guint8 idx, guint32 csrc)
 {
   guint8 *data;
 
-  data = GST_BUFFER_DATA (buffer);
+  data = rtp->data;
 
   g_return_if_fail (idx < GST_RTP_HEADER_CSRC_COUNT (data));
 
@@ -910,260 +811,118 @@ gst_rtp_buffer_set_csrc (GstBuffer * buffer, guint8 idx, guint32 csrc)
 
 /**
  * gst_rtp_buffer_get_marker:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Check if the marker bit is set on the RTP packet in @buffer.
  *
  * Returns: TRUE if @buffer has the marker bit set.
  */
 gboolean
-gst_rtp_buffer_get_marker (GstBuffer * buffer)
+gst_rtp_buffer_get_marker (GstRTPBuffer * rtp)
 {
-  return GST_RTP_HEADER_MARKER (GST_BUFFER_DATA (buffer));
+  return GST_RTP_HEADER_MARKER (rtp->data);
 }
 
 /**
  * gst_rtp_buffer_set_marker:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @marker: the new marker
  *
  * Set the marker bit on the RTP packet in @buffer to @marker.
  */
 void
-gst_rtp_buffer_set_marker (GstBuffer * buffer, gboolean marker)
+gst_rtp_buffer_set_marker (GstRTPBuffer * rtp, gboolean marker)
 {
-  GST_RTP_HEADER_MARKER (GST_BUFFER_DATA (buffer)) = marker;
+  GST_RTP_HEADER_MARKER (rtp->data) = marker;
 }
 
 /**
  * gst_rtp_buffer_get_payload_type:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the payload type of the RTP packet in @buffer.
  *
  * Returns: The payload type.
  */
 guint8
-gst_rtp_buffer_get_payload_type (GstBuffer * buffer)
-{
-  return GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_list_get_payload_type:
- * @list: the buffer list
- *
- * Get the payload type of the first RTP packet in @list.
- * All packets in @list should have the same payload type.
- *
- * Returns: The payload type.
- *
- * Since: 0.10.24
- */
-guint8
-gst_rtp_buffer_list_get_payload_type (GstBufferList * list)
+gst_rtp_buffer_get_payload_type (GstRTPBuffer * rtp)
 {
-  GstBuffer *buffer;
-
-  buffer = gst_buffer_list_get (list, 0, 0);
-  g_return_val_if_fail (buffer != NULL, 0);
-
-  return GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (buffer));
+  return GST_RTP_HEADER_PAYLOAD_TYPE (rtp->data);
 }
 
 /**
  * gst_rtp_buffer_set_payload_type:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @payload_type: the new type
  *
  * Set the payload type of the RTP packet in @buffer to @payload_type.
  */
 void
-gst_rtp_buffer_set_payload_type (GstBuffer * buffer, guint8 payload_type)
+gst_rtp_buffer_set_payload_type (GstRTPBuffer * rtp, guint8 payload_type)
 {
   g_return_if_fail (payload_type < 0x80);
 
-  GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (buffer)) = payload_type;
-}
-
-static GstBufferListItem
-set_pt_header (GstBuffer ** buffer, guint group, guint idx, guint8 * pt)
-{
-  GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (*buffer)) = *pt;
-  return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_payload_type:
- * @list: the buffer list
- * @payload_type: the new type
- *
- * Set the payload type of each RTP packet in @list to @payload_type.
- *
- * Since: 0.10.24
- */
-void
-gst_rtp_buffer_list_set_payload_type (GstBufferList * list, guint8 payload_type)
-{
-  g_return_if_fail (payload_type < 0x80);
-
-  gst_buffer_list_foreach (list, (GstBufferListFunc) set_pt_header,
-      &payload_type);
+  GST_RTP_HEADER_PAYLOAD_TYPE (rtp->data) = payload_type;
 }
 
 /**
  * gst_rtp_buffer_get_seq:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the sequence number of the RTP packet in @buffer.
  *
  * Returns: The sequence number in host order.
  */
 guint16
-gst_rtp_buffer_get_seq (GstBuffer * buffer)
+gst_rtp_buffer_get_seq (GstRTPBuffer * rtp)
 {
-  return g_ntohs (GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (buffer)));
+  return g_ntohs (GST_RTP_HEADER_SEQ (rtp->data));
 }
 
 /**
  * gst_rtp_buffer_set_seq:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @seq: the new sequence number
  *
  * Set the sequence number of the RTP packet in @buffer to @seq.
  */
 void
-gst_rtp_buffer_set_seq (GstBuffer * buffer, guint16 seq)
+gst_rtp_buffer_set_seq (GstRTPBuffer * rtp, guint16 seq)
 {
-  GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (buffer)) = g_htons (seq);
-}
-
-static GstBufferListItem
-set_seq_header (GstBuffer ** buffer, guint group, guint idx, guint16 * seq)
-{
-  GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (*buffer)) = g_htons (*seq);
-  (*seq)++;
-  return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_seq:
- * @list: the buffer list
- * @seq: the new sequence number
- *
- * Set the sequence number of each RTP packet in @list to @seq.
- *
- * Returns: The seq number of the last packet in the list + 1.
- *
- * Since: 0.10.24
- */
-guint16
-gst_rtp_buffer_list_set_seq (GstBufferList * list, guint16 seq)
-{
-  gst_buffer_list_foreach (list, (GstBufferListFunc) set_seq_header, &seq);
-  return seq;
+  GST_RTP_HEADER_SEQ (rtp->data) = g_htons (seq);
 }
 
 /**
- * gst_rtp_buffer_list_get_seq:
- * @list: the buffer list
- *
- * Get the sequence number of the first RTP packet in @list.
- * All packets within @list have the same sequence number.
- *
- * Returns: The seq number
- *
- * Since: 0.10.24
- */
-guint16
-gst_rtp_buffer_list_get_seq (GstBufferList * list)
-{
-  GstBuffer *buffer;
-
-  buffer = gst_buffer_list_get (list, 0, 0);
-  g_return_val_if_fail (buffer != NULL, 0);
-
-  return g_ntohl (GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (buffer)));
-}
-
-
-/**
  * gst_rtp_buffer_get_timestamp:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the timestamp of the RTP packet in @buffer.
  *
  * Returns: The timestamp in host order.
  */
 guint32
-gst_rtp_buffer_get_timestamp (GstBuffer * buffer)
-{
-  return g_ntohl (GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_list_get_timestamp:
- * @list: the buffer list
- *
- * Get the timestamp of the first RTP packet in @list.
- * All packets within @list have the same timestamp.
- *
- * Returns: The timestamp in host order.
- *
- * Since: 0.10.24
- */
-guint32
-gst_rtp_buffer_list_get_timestamp (GstBufferList * list)
+gst_rtp_buffer_get_timestamp (GstRTPBuffer * rtp)
 {
-  GstBuffer *buffer;
-
-  buffer = gst_buffer_list_get (list, 0, 0);
-  g_return_val_if_fail (buffer != NULL, 0);
-
-  return g_ntohl (GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (buffer)));
+  return g_ntohl (GST_RTP_HEADER_TIMESTAMP (rtp->data));
 }
 
 /**
  * gst_rtp_buffer_set_timestamp:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @timestamp: the new timestamp
  *
  * Set the timestamp of the RTP packet in @buffer to @timestamp.
  */
 void
-gst_rtp_buffer_set_timestamp (GstBuffer * buffer, guint32 timestamp)
-{
-  GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (buffer)) = g_htonl (timestamp);
-}
-
-
-static GstBufferListItem
-set_timestamp_header (GstBuffer ** buffer, guint group, guint idx,
-    guint32 * timestamp)
+gst_rtp_buffer_set_timestamp (GstRTPBuffer * rtp, guint32 timestamp)
 {
-  GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (*buffer)) = g_htonl (*timestamp);
-  return GST_BUFFER_LIST_SKIP_GROUP;
+  GST_RTP_HEADER_TIMESTAMP (rtp->data) = g_htonl (timestamp);
 }
 
-/**
- * gst_rtp_buffer_list_set_timestamp:
- * @list: the buffer list
- * @timestamp: the new timestamp
- *
- * Set the timestamp of each RTP packet in @list to @timestamp.
- *
- * Since: 0.10.24
- */
-void
-gst_rtp_buffer_list_set_timestamp (GstBufferList * list, guint32 timestamp)
-{
-  gst_buffer_list_foreach (list, (GstBufferListFunc) set_timestamp_header,
-      &timestamp);
-}
 
 /**
  * gst_rtp_buffer_get_payload_subbuffer:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @offset: the offset in the payload
  * @len: the length in the payload
  *
@@ -1176,25 +935,26 @@ gst_rtp_buffer_list_set_timestamp (GstBufferList * list, guint32 timestamp)
  * Since: 0.10.10
  */
 GstBuffer *
-gst_rtp_buffer_get_payload_subbuffer (GstBuffer * buffer, guint offset,
+gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer * rtp, guint offset,
     guint len)
 {
   guint poffset, plen;
 
-  plen = gst_rtp_buffer_get_payload_len (buffer);
+  plen = gst_rtp_buffer_get_payload_len (rtp);
   /* we can't go past the length */
   if (G_UNLIKELY (offset >= plen))
     goto wrong_offset;
 
   /* apply offset */
-  poffset = gst_rtp_buffer_get_header_len (buffer) + offset;
+  poffset = gst_rtp_buffer_get_header_len (rtp) + offset;
   plen -= offset;
 
   /* see if we need to shrink the buffer based on @len */
   if (len != -1 && len < plen)
     plen = len;
 
-  return gst_buffer_create_sub (buffer, poffset, plen);
+  return gst_buffer_copy_region (rtp->buffer, GST_BUFFER_COPY_ALL, poffset,
+      plen);
 
   /* ERRORS */
 wrong_offset:
@@ -1206,7 +966,7 @@ wrong_offset:
 
 /**
  * gst_rtp_buffer_get_payload_buffer:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Create a buffer of the payload of the RTP packet in @buffer. This function
  * will internally create a subbuffer of @buffer so that a memcpy can be
@@ -1215,29 +975,29 @@ wrong_offset:
  * Returns: A new buffer with the data of the payload.
  */
 GstBuffer *
-gst_rtp_buffer_get_payload_buffer (GstBuffer * buffer)
+gst_rtp_buffer_get_payload_buffer (GstRTPBuffer * rtp)
 {
-  return gst_rtp_buffer_get_payload_subbuffer (buffer, 0, -1);
+  return gst_rtp_buffer_get_payload_subbuffer (rtp, 0, -1);
 }
 
 /**
  * gst_rtp_buffer_get_payload_len:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get the length of the payload of the RTP packet in @buffer.
  *
  * Returns: The length of the payload in @buffer.
  */
 guint
-gst_rtp_buffer_get_payload_len (GstBuffer * buffer)
+gst_rtp_buffer_get_payload_len (GstRTPBuffer * rtp)
 {
   guint len, size;
   guint8 *data;
 
-  size = GST_BUFFER_SIZE (buffer);
-  data = GST_BUFFER_DATA (buffer);
+  size = rtp->size;
+  data = rtp->data;
 
-  len = size - gst_rtp_buffer_get_header_len (buffer);
+  len = size - gst_rtp_buffer_get_header_len (rtp);
 
   if (GST_RTP_HEADER_PADDING (data))
     len -= data[size - 1];
@@ -1246,46 +1006,8 @@ gst_rtp_buffer_get_payload_len (GstBuffer * buffer)
 }
 
 /**
- * gst_rtp_buffer_list_get_payload_len:
- * @list: the buffer list
- *
- * Get the length of the payload of the RTP packet in @list.
- *
- * Returns: The length of the payload in @list.
- *
- * Since: 0.10.24
- */
-guint
-gst_rtp_buffer_list_get_payload_len (GstBufferList * list)
-{
-  guint len;
-  GstBufferListIterator *it;
-
-  it = gst_buffer_list_iterate (list);
-  len = 0;
-
-  while (gst_buffer_list_iterator_next_group (it)) {
-    guint i;
-    GstBuffer *buf;
-
-    i = 0;
-    while ((buf = gst_buffer_list_iterator_next (it))) {
-      /* skip the RTP header */
-      if (!i++)
-        continue;
-      /* take the size of the current buffer */
-      len += GST_BUFFER_SIZE (buf);
-    }
-  }
-
-  gst_buffer_list_iterator_free (it);
-
-  return len;
-}
-
-/**
  * gst_rtp_buffer_get_payload:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  *
  * Get a pointer to the payload data in @buffer. This pointer is valid as long
  * as a reference to @buffer is held.
@@ -1293,9 +1015,9 @@ gst_rtp_buffer_list_get_payload_len (GstBufferList * list)
  * Returns: A pointer to the payload data in @buffer.
  */
 gpointer
-gst_rtp_buffer_get_payload (GstBuffer * buffer)
+gst_rtp_buffer_get_payload (GstRTPBuffer * rtp)
 {
-  return GST_BUFFER_DATA (buffer) + gst_rtp_buffer_get_header_len (buffer);
+  return rtp->data + gst_rtp_buffer_get_header_len (rtp);
 }
 
 /**
@@ -1395,7 +1117,7 @@ gst_rtp_buffer_ext_timestamp (guint64 * exttimestamp, guint32 timestamp)
 
 /**
  * gst_rtp_buffer_get_extension_onebyte_header:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @id: The ID of the header extension to be read (between 1 and 14).
  * @nth: Read the nth extension packet with the requested ID
  * @data: location for data
@@ -1410,7 +1132,7 @@ gst_rtp_buffer_ext_timestamp (guint64 * exttimestamp, guint32 timestamp)
  */
 
 gboolean
-gst_rtp_buffer_get_extension_onebyte_header (GstBuffer * buffer, guint8 id,
+gst_rtp_buffer_get_extension_onebyte_header (GstRTPBuffer * rtp, guint8 id,
     guint nth, gpointer * data, guint * size)
 {
   guint16 bits;
@@ -1421,7 +1143,7 @@ gst_rtp_buffer_get_extension_onebyte_header (GstBuffer * buffer, guint8 id,
 
   g_return_val_if_fail (id > 0 && id < 15, FALSE);
 
-  if (!gst_rtp_buffer_get_extension_data (buffer, &bits, (gpointer) & pdata,
+  if (!gst_rtp_buffer_get_extension_data (rtp, &bits, (gpointer) & pdata,
           &wordlen))
     return FALSE;
 
@@ -1474,7 +1196,7 @@ gst_rtp_buffer_get_extension_onebyte_header (GstBuffer * buffer, guint8 id,
 
 /**
  * gst_rtp_buffer_get_extension_twobytes_header:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @appbits: Application specific bits
  * @id: The ID of the header extension to be read (between 1 and 14).
  * @nth: Read the nth extension packet with the requested ID
@@ -1490,7 +1212,7 @@ gst_rtp_buffer_get_extension_onebyte_header (GstBuffer * buffer, guint8 id,
  */
 
 gboolean
-gst_rtp_buffer_get_extension_twobytes_header (GstBuffer * buffer,
+gst_rtp_buffer_get_extension_twobytes_header (GstRTPBuffer * rtp,
     guint8 * appbits, guint8 id, guint nth, gpointer * data, guint * size)
 {
   guint16 bits;
@@ -1500,7 +1222,7 @@ gst_rtp_buffer_get_extension_twobytes_header (GstBuffer * buffer,
   gulong offset = 0;
   guint count = 0;
 
-  if (!gst_rtp_buffer_get_extension_data (buffer, &bits, (gpointer) & pdata,
+  if (!gst_rtp_buffer_get_extension_data (rtp, &bits, (gpointer) & pdata,
           &wordlen))
     return FALSE;
 
@@ -1588,7 +1310,7 @@ get_onebyte_header_end_offset (guint8 * pdata, guint wordlen)
 
 /**
  * gst_rtp_buffer_add_extension_onebyte_header:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @id: The ID of the header extension (between 1 and 14).
  * @data: location for data
  * @size: the size of the data in bytes
@@ -1607,7 +1329,7 @@ get_onebyte_header_end_offset (guint8 * pdata, guint wordlen)
  */
 
 gboolean
-gst_rtp_buffer_add_extension_onebyte_header (GstBuffer * buffer, guint8 id,
+gst_rtp_buffer_add_extension_onebyte_header (GstRTPBuffer * rtp, guint8 id,
     gpointer data, guint size)
 {
   guint16 bits;
@@ -1617,9 +1339,9 @@ gst_rtp_buffer_add_extension_onebyte_header (GstBuffer * buffer, guint8 id,
 
   g_return_val_if_fail (id > 0 && id < 15, FALSE);
   g_return_val_if_fail (size >= 1 && size <= 16, FALSE);
-  g_return_val_if_fail (gst_buffer_is_writable (buffer), FALSE);
+  g_return_val_if_fail (gst_buffer_is_writable (rtp->buffer), FALSE);
 
-  has_bit = gst_rtp_buffer_get_extension_data (buffer, &bits,
+  has_bit = gst_rtp_buffer_get_extension_data (rtp, &bits,
       (gpointer) & pdata, &wordlen);
 
   if (has_bit) {
@@ -1635,10 +1357,10 @@ gst_rtp_buffer_add_extension_onebyte_header (GstBuffer * buffer, guint8 id,
       return FALSE;
 
     nextext = pdata + offset;
-    offset = nextext - GST_BUFFER_DATA (buffer);
+    offset = nextext - rtp->data;
 
     /* Don't add extra header if there isn't enough space */
-    if (GST_BUFFER_SIZE (buffer) < offset + size + 1)
+    if (rtp->size < offset + size + 1)
       return FALSE;
 
     nextext[0] = (id << 4) | (0x0F & (size - 1));
@@ -1652,13 +1374,13 @@ gst_rtp_buffer_add_extension_onebyte_header (GstBuffer * buffer, guint8 id,
       wordlen = extlen / 4;
     }
 
-    gst_rtp_buffer_set_extension_data (buffer, 0xBEDE, wordlen);
+    gst_rtp_buffer_set_extension_data (rtp, 0xBEDE, wordlen);
   } else {
     wordlen = (size + 1) / 4 + (((size + 1) % 4) ? 1 : 0);
 
-    gst_rtp_buffer_set_extension_data (buffer, 0xBEDE, wordlen);
+    gst_rtp_buffer_set_extension_data (rtp, 0xBEDE, wordlen);
 
-    gst_rtp_buffer_get_extension_data (buffer, &bits,
+    gst_rtp_buffer_get_extension_data (rtp, &bits,
         (gpointer) & pdata, &wordlen);
 
     pdata[0] = (id << 4) | (0x0F & (size - 1));
@@ -1708,7 +1430,7 @@ get_twobytes_header_end_offset (guint8 * pdata, guint wordlen)
 
 /**
  * gst_rtp_buffer_add_extension_twobytes_header:
- * @buffer: the buffer
+ * @rtp: the RTP packet
  * @appbits: Application specific bits
  * @id: The ID of the header extension
  * @data: location for data
@@ -1728,7 +1450,7 @@ get_twobytes_header_end_offset (guint8 * pdata, guint wordlen)
  */
 
 gboolean
-gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
+gst_rtp_buffer_add_extension_twobytes_header (GstRTPBuffer * rtp,
     guint8 appbits, guint8 id, gpointer data, guint size)
 {
   guint16 bits;
@@ -1738,9 +1460,9 @@ gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
 
   g_return_val_if_fail ((appbits & 0xF0) == 0, FALSE);
   g_return_val_if_fail (size < 256, FALSE);
-  g_return_val_if_fail (gst_buffer_is_writable (buffer), FALSE);
+  g_return_val_if_fail (gst_buffer_is_writable (rtp->buffer), FALSE);
 
-  has_bit = gst_rtp_buffer_get_extension_data (buffer, &bits,
+  has_bit = gst_rtp_buffer_get_extension_data (rtp, &bits,
       (gpointer) & pdata, &wordlen);
 
   if (has_bit) {
@@ -1755,10 +1477,10 @@ gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
 
     nextext = pdata + offset;
 
-    offset = nextext - GST_BUFFER_DATA (buffer);
+    offset = nextext - rtp->data;
 
     /* Don't add extra header if there isn't enough space */
-    if (GST_BUFFER_SIZE (buffer) < offset + size + 2)
+    if (rtp->size < offset + size + 2)
       return FALSE;
 
     nextext[0] = id;
@@ -1773,15 +1495,15 @@ gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
       wordlen = extlen / 4;
     }
 
-    gst_rtp_buffer_set_extension_data (buffer, (0x100 << 4) | (appbits & 0x0F),
+    gst_rtp_buffer_set_extension_data (rtp, (0x100 << 4) | (appbits & 0x0F),
         wordlen);
   } else {
     wordlen = (size + 2) / 4 + (((size + 2) % 4) ? 1 : 0);
 
-    gst_rtp_buffer_set_extension_data (buffer, (0x100 << 4) | (appbits & 0x0F),
+    gst_rtp_buffer_set_extension_data (rtp, (0x100 << 4) | (appbits & 0x0F),
         wordlen);
 
-    gst_rtp_buffer_get_extension_data (buffer, &bits,
+    gst_rtp_buffer_get_extension_data (rtp, &bits,
         (gpointer) & pdata, &wordlen);
 
     pdata[0] = id;
@@ -1793,267 +1515,3 @@ gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
 
   return TRUE;
 }
-
-/**
- * gst_rtp_buffer_list_get_extension_onebyte_header:
- * @bufferlist: the bufferlist
- * @group_idx: The index of the group in the #GstBufferList
- * @id: The ID of the header extension to be read (between 1 and 14).
- * @nth: Read the nth extension packet with the requested ID
- * @data: location for data
- * @size: the size of the data in bytes
- *
- * Parses RFC 5285 style header extensions with a one byte header. It will
- * return the nth extension with the requested id.
- *
- * Returns: TRUE if @buffer had the requested header extension
- *
- * Since: 0.10.31
- */
-
-gboolean
-gst_rtp_buffer_list_get_extension_onebyte_header (GstBufferList * bufferlist,
-    guint group_idx, guint8 id, guint nth, gpointer * data, guint * size)
-{
-  GstBuffer *buffer;
-
-  buffer = gst_buffer_list_get (bufferlist, group_idx, 0);
-
-  if (!buffer)
-    return FALSE;
-
-  return gst_rtp_buffer_get_extension_onebyte_header (buffer, id, nth, data,
-      size);
-}
-
-
-/**
- * gst_rtp_buffer_list_get_extension_twobytes_header:
- * @bufferlist: the bufferlist
- * @group_idx: The index of the group in the #GstBufferList
- * @appbits: Application specific bits
- * @id: The ID of the header extension to be read (between 1 and 14).
- * @nth: Read the nth extension packet with the requested ID
- * @data: location for data
- * @size: the size of the data in bytes
- *
- * Parses RFC 5285 style header extensions with a two bytes header. It will
- * return the nth extension with the requested id.
- *
- * Returns: TRUE if @buffer had the requested header extension
- *
- * Since: 0.10.31
- */
-
-gboolean
-gst_rtp_buffer_list_get_extension_twobytes_header (GstBufferList * bufferlist,
-    guint group_idx, guint8 * appbits, guint8 id, guint nth,
-    gpointer * data, guint * size)
-{
-  GstBuffer *buffer;
-
-  buffer = gst_buffer_list_get (bufferlist, group_idx, 0);
-
-  if (!buffer)
-    return FALSE;
-
-  return gst_rtp_buffer_get_extension_twobytes_header (buffer, appbits, id,
-      nth, data, size);
-}
-
-/**
- * gst_rtp_buffer_list_add_extension_onebyte_header:
- * @it: a #GstBufferListIterator pointing right after the #GstBuffer where
- * the header extension should be added
- * @id: The ID of the header extension (between 1 and 14).
- * @data: location for data
- * @size: the size of the data in bytes
- *
- * Adds a RFC 5285 header extension with a one byte header to the end of the
- * RTP header. If there is already a RFC 5285 header extension with a one byte
- * header, the new extension will be appended.
- * It will not work if there is already a header extension that does not follow
- * the mecanism described in RFC 5285 or if there is a header extension with
- * a two bytes header as described in RFC 5285. In that case, use
- * gst_rtp_buffer_list_add_extension_twobytes_header()
- *
- * This function will not modify the data section of the RTP buffer, only
- * the header.
- *
- * Returns: %TRUE if header extension could be added
- *
- * Since: 0.10.31
- */
-
-gboolean
-gst_rtp_buffer_list_add_extension_onebyte_header (GstBufferListIterator * it,
-    guint8 id, gpointer data, guint size)
-{
-  GstBuffer *buffer;
-  guint16 bits;
-  guint8 *pdata;
-  guint wordlen;
-  gboolean retval;
-  guint endoffset = 0;
-
-  g_return_val_if_fail (gst_buffer_list_iterator_n_buffers (it) == 1, FALSE);
-  g_return_val_if_fail (id > 0 && id < 15, FALSE);
-  g_return_val_if_fail (size >= 1 && size <= 16, FALSE);
-
-  buffer = gst_buffer_list_iterator_steal (it);
-
-  if (GST_RTP_HEADER_EXTENSION (GST_BUFFER_DATA (buffer))) {
-    gst_rtp_buffer_get_extension_data (buffer, &bits, (gpointer) & pdata,
-        &wordlen);
-
-    if (bits != 0xBEDE)
-      return FALSE;
-
-    endoffset = get_onebyte_header_end_offset (pdata, wordlen);
-    if (endoffset == 0)
-      return FALSE;
-    endoffset += pdata - GST_BUFFER_DATA (buffer);
-  } else {
-    endoffset = GST_BUFFER_SIZE (buffer) + 4;
-  }
-
-  if (endoffset + size + 1 > GST_BUFFER_SIZE (buffer)) {
-    guint newsize;
-    GstBuffer *newbuffer;
-
-    newsize = endoffset + size + 1;
-    if (newsize % 4)
-      newsize += 4 - (newsize % 4);
-    newbuffer = gst_buffer_new_and_alloc (newsize);
-    memcpy (GST_BUFFER_DATA (newbuffer), GST_BUFFER_DATA (buffer),
-        GST_BUFFER_SIZE (buffer));
-    gst_buffer_copy_metadata (newbuffer, buffer, GST_BUFFER_COPY_ALL);
-    gst_buffer_unref (buffer);
-    buffer = newbuffer;
-  } else {
-    buffer = gst_buffer_make_writable (buffer);
-  }
-
-  retval = gst_rtp_buffer_add_extension_onebyte_header (buffer, id, data, size);
-
-  gst_buffer_list_iterator_take (it, buffer);
-
-  return retval;
-}
-
-/**
- * gst_rtp_buffer_list_add_extension_twobytes_header:
- * @it: a #GstBufferListIterator pointing right after the #GstBuffer where
- * the header extension should be added
- * @appbits: Application specific bits
- * @id: The ID of the header extension
- * @data: location for data
- * @size: the size of the data in bytes
- *
- * Adds a RFC 5285 header extension with a two bytes header to the end of the
- * RTP header. If there is already a RFC 5285 header extension with a two bytes
- * header, the new extension will be appended.
- * It will not work if there is already a header extension that does not follow
- * the mecanism described in RFC 5285 or if there is a header extension with
- * a one byte header as described in RFC 5285. In that case, use
- * gst_rtp_buffer_add_extension_onebyte_header()
- *
- * This function will not modify the data section of the RTP buffer, only
- * the header.
- *
- * Returns: %TRUE if header extension could be added
- *
- * Since: 0.10.31
- */
-
-gboolean
-gst_rtp_buffer_list_add_extension_twobytes_header (GstBufferListIterator * it,
-    guint8 appbits, guint8 id, gpointer data, guint size)
-{
-  GstBuffer *buffer;
-  guint16 bits;
-  guint8 *pdata;
-  guint wordlen;
-  gboolean retval;
-  guint endoffset;
-
-  g_return_val_if_fail ((appbits & 0xF0) == 0, FALSE);
-  g_return_val_if_fail (size < 256, FALSE);
-  g_return_val_if_fail (gst_buffer_list_iterator_n_buffers (it) == 1, FALSE);
-
-  buffer = gst_buffer_list_iterator_steal (it);
-
-  if (GST_RTP_HEADER_EXTENSION (GST_BUFFER_DATA (buffer))) {
-    gst_rtp_buffer_get_extension_data (buffer, &bits, (gpointer) & pdata,
-        &wordlen);
-
-    if (bits != ((0x100 << 4) | (appbits & 0x0f)))
-      return FALSE;
-
-    endoffset = get_twobytes_header_end_offset (pdata, wordlen);
-    if (endoffset == 0)
-      return FALSE;
-    endoffset += pdata - GST_BUFFER_DATA (buffer);
-  } else {
-    endoffset = GST_BUFFER_SIZE (buffer) + 4;
-  }
-
-  if (endoffset + size + 2 > GST_BUFFER_SIZE (buffer)) {
-    guint newsize;
-    GstBuffer *newbuffer;
-
-    newsize = endoffset + size + 2;
-    if (newsize % 4)
-      newsize += 4 - newsize % 4;
-    newbuffer = gst_buffer_new_and_alloc (newsize);
-    memcpy (GST_BUFFER_DATA (newbuffer), GST_BUFFER_DATA (buffer),
-        GST_BUFFER_SIZE (buffer));
-    gst_buffer_copy_metadata (newbuffer, buffer, GST_BUFFER_COPY_ALL);
-    gst_buffer_unref (buffer);
-    buffer = newbuffer;
-  } else {
-    buffer = gst_buffer_make_writable (buffer);
-  }
-
-  retval = gst_rtp_buffer_add_extension_twobytes_header (buffer, appbits, id,
-      data, size);
-
-  gst_buffer_list_iterator_take (it, buffer);
-
-  return retval;
-}
-
-/**
- * gst_rtp_buffer_list_from_buffer:
- * @buffer: a #GstBuffer containing a RTP packet
- *
- * Splits a #GstBuffer into a #GstBufferList containing separate
- * buffers for the header and data sections.
- *
- * Returns: a #GstBufferList
- */
-
-GstBufferList *
-gst_rtp_buffer_list_from_buffer (GstBuffer * buffer)
-{
-  GstBufferList *bufferlist;
-  GstBuffer *sub;
-  GstBufferListIterator *it;
-  guint8 *payload;
-
-  bufferlist = gst_buffer_list_new ();
-
-  it = gst_buffer_list_iterate (bufferlist);
-  gst_buffer_list_iterator_add_group (it);
-
-  payload = gst_rtp_buffer_get_payload (buffer);
-  sub = gst_buffer_create_sub (buffer, 0, payload - GST_BUFFER_DATA (buffer));
-  gst_buffer_list_iterator_add (it, sub);
-
-  sub = gst_rtp_buffer_get_payload_buffer (buffer);
-  gst_buffer_list_iterator_add (it, sub);
-
-  gst_buffer_list_iterator_free (it);
-
-  return bufferlist;
-}
index c82fd71..b40e714 100644 (file)
@@ -36,129 +36,115 @@ G_BEGIN_DECLS
  */
 #define GST_RTP_VERSION 2
 
+
+typedef struct _GstRTPBuffer GstRTPBuffer;
+
+/**
+ * GstRTPBuffer:
+ * @buffer: pointer to RTP buffer
+ *
+ * Data structure that points to an RTP packet.
+ * The size of the structure is made public to allow stack allocations.
+ */
+struct _GstRTPBuffer
+{
+  GstBuffer   *buffer;
+  GstMapFlags  flags;
+  guint8      *data;
+  gsize        size;
+  gsize        maxsize;
+};
+
 /* creating buffers */
-void            gst_rtp_buffer_allocate_data         (GstBuffer *buffer, guint payload_len, 
+void            gst_rtp_buffer_allocate_data         (GstBuffer *buffer, guint payload_len,
                                                       guint8 pad_len, guint8 csrc_count);
 
-GstBuffer*      gst_rtp_buffer_new_take_data         (gpointer data, guint len);
-GstBuffer*      gst_rtp_buffer_new_copy_data         (gpointer data, guint len);
+GstBuffer*      gst_rtp_buffer_new_take_data         (gpointer data, gsize len);
+GstBuffer*      gst_rtp_buffer_new_copy_data         (gpointer data, gsize len);
 GstBuffer*      gst_rtp_buffer_new_allocate          (guint payload_len, guint8 pad_len, guint8 csrc_count);
 GstBuffer*      gst_rtp_buffer_new_allocate_len      (guint packet_len, guint8 pad_len, guint8 csrc_count);
 
-GstBufferList*  gst_rtp_buffer_list_from_buffer      (GstBuffer * buffer);
-
-
 guint           gst_rtp_buffer_calc_header_len       (guint8 csrc_count);
 guint           gst_rtp_buffer_calc_packet_len       (guint payload_len, guint8 pad_len, guint8 csrc_count);
 guint           gst_rtp_buffer_calc_payload_len      (guint packet_len, guint8 pad_len, guint8 csrc_count);
 
-gboolean        gst_rtp_buffer_validate_data         (guint8 *data, guint len);
+gboolean        gst_rtp_buffer_validate_data         (guint8 *data, gsize len);
 gboolean        gst_rtp_buffer_validate              (GstBuffer *buffer);
-gboolean        gst_rtp_buffer_list_validate         (GstBufferList *list);
 
-void            gst_rtp_buffer_set_packet_len        (GstBuffer *buffer, guint len);
-guint           gst_rtp_buffer_get_packet_len        (GstBuffer *buffer);
 
-guint           gst_rtp_buffer_get_header_len        (GstBuffer *buffer);
+gboolean        gst_rtp_buffer_map                   (GstBuffer *buffer, GstMapFlags flags, GstRTPBuffer *rtp);
+gboolean        gst_rtp_buffer_unmap                 (GstRTPBuffer *rtp);
+
+void            gst_rtp_buffer_set_packet_len        (GstRTPBuffer *rtp, guint len);
+guint           gst_rtp_buffer_get_packet_len        (GstRTPBuffer *rtp);
+
+guint           gst_rtp_buffer_get_header_len        (GstRTPBuffer *rtp);
 
-guint8          gst_rtp_buffer_get_version           (GstBuffer *buffer);
-void            gst_rtp_buffer_set_version           (GstBuffer *buffer, guint8 version);
+guint8          gst_rtp_buffer_get_version           (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_version           (GstRTPBuffer *rtp, guint8 version);
 
-gboolean        gst_rtp_buffer_get_padding           (GstBuffer *buffer);
-void            gst_rtp_buffer_set_padding           (GstBuffer *buffer, gboolean padding);
-void            gst_rtp_buffer_pad_to                (GstBuffer *buffer, guint len);
+gboolean        gst_rtp_buffer_get_padding           (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_padding           (GstRTPBuffer *rtp, gboolean padding);
+void            gst_rtp_buffer_pad_to                (GstRTPBuffer *rtp, guint len);
 
-gboolean        gst_rtp_buffer_get_extension         (GstBuffer *buffer);
-void            gst_rtp_buffer_set_extension         (GstBuffer *buffer, gboolean extension);
-gboolean        gst_rtp_buffer_get_extension_data    (GstBuffer *buffer, guint16 *bits,
+gboolean        gst_rtp_buffer_get_extension         (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_extension         (GstRTPBuffer *rtp, gboolean extension);
+gboolean        gst_rtp_buffer_get_extension_data    (GstRTPBuffer *rtp, guint16 *bits,
                                                       gpointer *data, guint *wordlen);
-gboolean        gst_rtp_buffer_set_extension_data    (GstBuffer *buffer, guint16 bits, guint16 length);
+gboolean        gst_rtp_buffer_set_extension_data    (GstRTPBuffer *rtp, guint16 bits, guint16 length);
 
-guint32         gst_rtp_buffer_get_ssrc              (GstBuffer *buffer);
-guint32         gst_rtp_buffer_list_get_ssrc         (GstBufferList *list);
-void            gst_rtp_buffer_set_ssrc              (GstBuffer *buffer, guint32 ssrc);
-void            gst_rtp_buffer_list_set_ssrc         (GstBufferList *list, guint32 ssrc);
+guint32         gst_rtp_buffer_get_ssrc              (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_ssrc              (GstRTPBuffer *rtp, guint32 ssrc);
 
-guint8          gst_rtp_buffer_get_csrc_count        (GstBuffer *buffer);
-guint32         gst_rtp_buffer_get_csrc              (GstBuffer *buffer, guint8 idx);
-void            gst_rtp_buffer_set_csrc              (GstBuffer *buffer, guint8 idx, guint32 csrc);
+guint8          gst_rtp_buffer_get_csrc_count        (GstRTPBuffer *rtp);
+guint32         gst_rtp_buffer_get_csrc              (GstRTPBuffer *rtp, guint8 idx);
+void            gst_rtp_buffer_set_csrc              (GstRTPBuffer *rtp, guint8 idx, guint32 csrc);
 
-gboolean        gst_rtp_buffer_get_marker            (GstBuffer *buffer);
-void            gst_rtp_buffer_set_marker            (GstBuffer *buffer, gboolean marker);
+gboolean        gst_rtp_buffer_get_marker            (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_marker            (GstRTPBuffer *rtp, gboolean marker);
 
-guint8          gst_rtp_buffer_get_payload_type      (GstBuffer *buffer);
-guint8          gst_rtp_buffer_list_get_payload_type (GstBufferList *list);
-void            gst_rtp_buffer_set_payload_type      (GstBuffer *buffer, guint8 payload_type);
-void            gst_rtp_buffer_list_set_payload_type (GstBufferList *list, guint8 payload_type);
+guint8          gst_rtp_buffer_get_payload_type      (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_payload_type      (GstRTPBuffer *rtp, guint8 payload_type);
 
-guint16         gst_rtp_buffer_get_seq               (GstBuffer *buffer);
-guint16         gst_rtp_buffer_list_get_seq          (GstBufferList *list);
-void            gst_rtp_buffer_set_seq               (GstBuffer *buffer, guint16 seq);
-guint16         gst_rtp_buffer_list_set_seq          (GstBufferList *list, guint16 seq);
+guint16         gst_rtp_buffer_get_seq               (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_seq               (GstRTPBuffer *rtp, guint16 seq);
 
-guint32         gst_rtp_buffer_get_timestamp         (GstBuffer *buffer);
-guint32         gst_rtp_buffer_list_get_timestamp    (GstBufferList *list);
-void            gst_rtp_buffer_set_timestamp         (GstBuffer *buffer, guint32 timestamp);
-void            gst_rtp_buffer_list_set_timestamp    (GstBufferList *list, guint32 timestamp);
+guint32         gst_rtp_buffer_get_timestamp         (GstRTPBuffer *rtp);
+void            gst_rtp_buffer_set_timestamp         (GstRTPBuffer *rtp, guint32 timestamp);
 
-GstBuffer*     gst_rtp_buffer_get_payload_buffer    (GstBuffer *buffer);
-GstBuffer*     gst_rtp_buffer_get_payload_subbuffer (GstBuffer *buffer, guint offset, guint len);
+GstBuffer*     gst_rtp_buffer_get_payload_buffer    (GstRTPBuffer *rtp);
+GstBuffer*     gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer *rtp, guint offset, guint len);
 
-guint           gst_rtp_buffer_get_payload_len       (GstBuffer *buffer);
-guint           gst_rtp_buffer_list_get_payload_len  (GstBufferList *list);
-gpointer        gst_rtp_buffer_get_payload           (GstBuffer *buffer);
+guint           gst_rtp_buffer_get_payload_len       (GstRTPBuffer *rtp);
+gpointer        gst_rtp_buffer_get_payload           (GstRTPBuffer *rtp);
 
 /* some helpers */
 guint32         gst_rtp_buffer_default_clock_rate    (guint8 payload_type);
 gint            gst_rtp_buffer_compare_seqnum        (guint16 seqnum1, guint16 seqnum2);
 guint64         gst_rtp_buffer_ext_timestamp         (guint64 *exttimestamp, guint32 timestamp);
 
-gboolean        gst_rtp_buffer_get_extension_onebyte_header (GstBuffer * buffer,
-                                                             guint8 id,
-                                                             guint nth,
-                                                             gpointer * data,
-                                                             guint * size);
-gboolean        gst_rtp_buffer_get_extension_twobytes_header (GstBuffer * buffer,
+gboolean        gst_rtp_buffer_get_extension_onebyte_header  (GstRTPBuffer *rtp,
+                                                              guint8 id,
+                                                              guint nth,
+                                                              gpointer * data,
+                                                              guint * size);
+gboolean        gst_rtp_buffer_get_extension_twobytes_header (GstRTPBuffer *rtp,
                                                               guint8 * appbits,
                                                               guint8 id,
                                                               guint nth,
                                                               gpointer * data,
                                                               guint * size);
 
-gboolean       gst_rtp_buffer_add_extension_onebyte_header (GstBuffer * buffer,
-                                                            guint8 id,
-                                                            gpointer data,
-                                                            guint size);
-gboolean       gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
+gboolean       gst_rtp_buffer_add_extension_onebyte_header  (GstRTPBuffer *rtp,
+                                                             guint8 id,
+                                                             gpointer data,
+                                                             guint size);
+gboolean       gst_rtp_buffer_add_extension_twobytes_header (GstRTPBuffer *rtp,
                                                              guint8 appbits,
                                                              guint8 id,
                                                              gpointer data,
                                                              guint size);
 
-gboolean       gst_rtp_buffer_list_get_extension_onebyte_header (GstBufferList * bufferlist,
-                                                                 guint group_idx,
-                                                                 guint8 id,
-                                                                 guint nth,
-                                                                 gpointer * data,
-                                                                 guint * size);
-gboolean       gst_rtp_buffer_list_get_extension_twobytes_header (GstBufferList * bufferlist,
-                                                                  guint group_idx,
-                                                                  guint8 * appbits,
-                                                                  guint8 id,
-                                                                  guint nth,
-                                                                  gpointer * data,
-                                                                  guint * size);
-
-gboolean       gst_rtp_buffer_list_add_extension_onebyte_header (GstBufferListIterator * it,
-                                                                  guint8 id,
-                                                                  gpointer data,
-                                                                  guint size);
-gboolean       gst_rtp_buffer_list_add_extension_twobytes_header (GstBufferListIterator * it,
-                                                                  guint8 appbits,
-                                                                  guint8 id,
-                                                                  gpointer data,
-                                                                  guint size);
-
 
 G_END_DECLS
 
index bd27a40..74adf9e 100644 (file)
@@ -66,6 +66,7 @@ GstRtsp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstrtsp-@GST_MAJORMINO
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_builddir)/gst-libs \
                -I$(top_srcdir)/gst-libs \
                --add-include-path=$(builddir)/../sdp \
index 5ad8080..200b11b 100644 (file)
@@ -25,6 +25,7 @@ GstSdp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstsdp-@GST_MAJORMINOR@
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
                --library=libgstsdp-@GST_MAJORMINOR@.la \
index 50d69aa..39fc3d8 100644 (file)
@@ -37,6 +37,7 @@ GstTag-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgsttag-@GST_MAJORMINOR@
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_MAJORMINOR@` \
                --library=libgsttag-@GST_MAJORMINOR@.la \
index 3e5e53b..967f535 100644 (file)
@@ -231,7 +231,7 @@ struct _GstExifWriter
 struct _GstExifReader
 {
   GstTagList *taglist;
-  const GstBuffer *buffer;
+  GstBuffer *buffer;
   guint32 base_offset;
   gint byte_order;
 
@@ -454,7 +454,7 @@ static const GstExifTagMatch tag_map_gps[] = {
 /* GstExifReader functions */
 static void
 gst_exif_reader_init (GstExifReader * reader, gint byte_order,
-    const GstBuffer * buf, guint32 base_offset)
+    GstBuffer * buf, guint32 base_offset)
 {
   ensure_exif_tags ();
 
@@ -875,9 +875,10 @@ write_exif_undefined_tag_from_taglist (GstExifWriter * writer,
     const GstTagList * taglist, const GstExifTagMatch * exiftag)
 {
   const GValue *value;
-  const guint8 *data = NULL;
-  gint size = 0;
+  guint8 *data = NULL;
+  gsize size = 0;
   gint tag_size = gst_tag_list_get_tag_size (taglist, exiftag->gst_tag);
+  GstBuffer *buf = NULL;
 
   if (tag_size != 1) {
     GST_WARNING ("Only the first item in the taglist will be serialized");
@@ -894,10 +895,8 @@ write_exif_undefined_tag_from_taglist (GstExifWriter * writer,
       break;
     default:
       if (G_VALUE_TYPE (value) == GST_TYPE_BUFFER) {
-        GstBuffer *buf = gst_value_get_buffer (value);
-
-        data = GST_BUFFER_DATA (buf);
-        size = GST_BUFFER_SIZE (buf);
+        buf = gst_value_get_buffer (value);
+        data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
       } else {
         GST_WARNING ("Conversion from %s to raw data not supported",
             G_VALUE_TYPE_NAME (value));
@@ -905,10 +904,11 @@ write_exif_undefined_tag_from_taglist (GstExifWriter * writer,
       break;
   }
 
-  if (size == 0)
-    return;
+  if (size > 0)
+    write_exif_undefined_tag (writer, exiftag->exif_tag, data, size);
 
-  write_exif_undefined_tag (writer, exiftag->exif_tag, data, size);
+  if (buf)
+    gst_buffer_unmap (buf, data, size);
 }
 
 static void
@@ -1188,6 +1188,9 @@ parse_exif_ascii_tag (GstExifReader * reader, const GstExifTagMatch * tag,
   GError *error = NULL;
 
   if (count > 4) {
+    guint8 *data;
+    gsize size;
+
     if (offset < reader->base_offset) {
       GST_WARNING ("Offset is smaller (%u) than base offset (%u)", offset,
           reader->base_offset);
@@ -1195,15 +1198,17 @@ parse_exif_ascii_tag (GstExifReader * reader, const GstExifTagMatch * tag,
     }
 
     real_offset = offset - reader->base_offset;
-    if (real_offset >= GST_BUFFER_SIZE (reader->buffer)) {
-      GST_WARNING ("Invalid offset %u for buffer of size %u, not adding tag %s",
-          real_offset, GST_BUFFER_SIZE (reader->buffer), tag->gst_tag);
+
+    data = gst_buffer_map (reader->buffer, &size, NULL, GST_MAP_READ);
+    if (real_offset >= size) {
+      GST_WARNING ("Invalid offset %u for buffer of size %" G_GSIZE_FORMAT
+          ", not adding tag %s", real_offset, size, tag->gst_tag);
+      gst_buffer_unmap (reader->buffer, data, size);
       return;
     }
 
-    str =
-        g_strndup ((gchar *) (GST_BUFFER_DATA (reader->buffer) + real_offset),
-        count);
+    str = g_strndup ((gchar *) (data + real_offset), count);
+    gst_buffer_unmap (reader->buffer, data, size);
   } else {
     str = g_strndup ((gchar *) offset_as_data, count);
   }
@@ -1283,6 +1288,9 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag,
   guint32 real_offset;
 
   if (count > 4) {
+    guint8 *bdata;
+    gsize bsize;
+
     if (offset < reader->base_offset) {
       GST_WARNING ("Offset is smaller (%u) than base offset (%u)", offset,
           reader->base_offset);
@@ -1290,16 +1298,22 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag,
     }
 
     real_offset = offset - reader->base_offset;
-    if (real_offset >= GST_BUFFER_SIZE (reader->buffer)) {
-      GST_WARNING ("Invalid offset %u for buffer of size %u, not adding tag %s",
-          real_offset, GST_BUFFER_SIZE (reader->buffer), tag->gst_tag);
+
+    bdata = gst_buffer_map (reader->buffer, &bsize, NULL, GST_MAP_READ);
+
+    if (real_offset >= bsize) {
+      GST_WARNING ("Invalid offset %u for buffer of size %" G_GSIZE_FORMAT
+          ", not adding tag %s", real_offset, bsize, tag->gst_tag);
+      gst_buffer_unmap (reader->buffer, bdata, bsize);
       return;
     }
 
     /* +1 because it could be a string without the \0 */
     data = malloc (sizeof (guint8) * count + 1);
-    memcpy (data, GST_BUFFER_DATA (reader->buffer) + real_offset, count);
+    memcpy (data, bdata + real_offset, count);
     data[count] = 0;
+
+    gst_buffer_unmap (reader->buffer, bdata, bsize);
   } else {
     data = malloc (sizeof (guint8) * count + 1);
     memcpy (data, (guint8 *) offset_as_data, count);
@@ -1311,9 +1325,8 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag,
     GstBuffer *buf;
 
     buf = gst_buffer_new ();
-    GST_BUFFER_DATA (buf) = data;
-    GST_BUFFER_MALLOCDATA (buf) = data;
-    GST_BUFFER_SIZE (buf) = count;
+    gst_buffer_take_memory (buf, -1,
+        gst_memory_new_wrapped (0, data, g_free, count, 0, count));
     data = NULL;
 
     gst_tag_list_add (reader->taglist, GST_TAG_MERGE_APPEND, tag->gst_tag,
@@ -1339,6 +1352,8 @@ exif_reader_read_rational_tag (GstExifReader * exif_reader,
   guint32 real_offset;
   gint32 frac_n = 0;
   gint32 frac_d = 0;
+  guint8 *data;
+  gsize size;
 
   if (count > 1) {
     GST_WARNING ("Rationals with multiple entries are not supported");
@@ -1350,13 +1365,16 @@ exif_reader_read_rational_tag (GstExifReader * exif_reader,
   }
 
   real_offset = offset - exif_reader->base_offset;
-  if (real_offset >= GST_BUFFER_SIZE (exif_reader->buffer)) {
-    GST_WARNING ("Invalid offset %u for buffer of size %u",
-        real_offset, GST_BUFFER_SIZE (exif_reader->buffer));
-    return FALSE;
+
+  data = gst_buffer_map (exif_reader->buffer, &size, NULL, GST_MAP_READ);
+
+  if (real_offset >= size) {
+    GST_WARNING ("Invalid offset %u for buffer of size %" G_GSIZE_FORMAT,
+        real_offset, size);
+    goto reader_fail;
   }
 
-  gst_byte_reader_init_from_buffer (&data_reader, exif_reader->buffer);
+  gst_byte_reader_init (&data_reader, data, size);
   if (!gst_byte_reader_set_pos (&data_reader, real_offset))
     goto reader_fail;
 
@@ -1390,10 +1408,13 @@ exif_reader_read_rational_tag (GstExifReader * exif_reader,
   if (_frac_d)
     *_frac_d = frac_d;
 
+  gst_buffer_unmap (exif_reader->buffer, data, size);
+
   return TRUE;
 
 reader_fail:
   GST_WARNING ("Failed to read from byte reader. (Buffer too short?)");
+  gst_buffer_unmap (exif_reader->buffer, data, size);
   return FALSE;
 }
 
@@ -1493,12 +1514,17 @@ write_exif_ifd (const GstTagList * taglist, gboolean byte_order,
       }
 
       if (inner_ifd) {
+        guint8 *data;
+        gsize size;
+
         GST_DEBUG ("Adding inner ifd: %x", tag_map[i].exif_tag);
         gst_exif_writer_write_tag_header (&writer, tag_map[i].exif_tag,
             EXIF_TYPE_LONG, 1,
             gst_byte_writer_get_size (&writer.datawriter), FALSE);
-        gst_byte_writer_put_data (&writer.datawriter,
-            GST_BUFFER_DATA (inner_ifd), GST_BUFFER_SIZE (inner_ifd));
+
+        data = gst_buffer_map (inner_ifd, &size, NULL, GST_MAP_READ);
+        gst_byte_writer_put_data (&writer.datawriter, data, size);
+        gst_buffer_unmap (inner_ifd, data, size);
         gst_buffer_unref (inner_ifd);
       }
       continue;
@@ -1568,15 +1594,17 @@ parse_exif_ifd (GstExifReader * exif_reader, gint buf_offset,
   GstByteReader reader;
   guint16 entries = 0;
   guint16 i;
+  guint8 *data;
+  gsize size;
 
   g_return_val_if_fail (exif_reader->byte_order == G_LITTLE_ENDIAN
       || exif_reader->byte_order == G_BIG_ENDIAN, FALSE);
 
-  gst_byte_reader_init_from_buffer (&reader, exif_reader->buffer);
-  if (!gst_byte_reader_set_pos (&reader, buf_offset)) {
-    GST_WARNING ("Buffer offset invalid when parsing exif ifd");
-    return FALSE;
-  }
+  data = gst_buffer_map (exif_reader->buffer, &size, NULL, GST_MAP_READ);
+
+  gst_byte_reader_init (&reader, data, size);
+  if (!gst_byte_reader_set_pos (&reader, buf_offset))
+    goto invalid_offset;
 
   /* read the IFD entries number */
   if (exif_reader->byte_order == G_LITTLE_ENDIAN) {
@@ -1686,12 +1714,20 @@ parse_exif_ifd (GstExifReader * exif_reader, gint buf_offset,
       }
     }
   }
+  gst_buffer_unmap (exif_reader->buffer, data, size);
 
   return TRUE;
 
+invalid_offset:
+  {
+    GST_WARNING ("Buffer offset invalid when parsing exif ifd");
+    gst_buffer_unmap (exif_reader->buffer, data, size);
+    return FALSE;
+  }
 read_error:
   {
     GST_WARNING ("Failed to parse the exif ifd");
+    gst_buffer_unmap (exif_reader->buffer, data, size);
     return FALSE;
   }
 }
@@ -1732,14 +1768,18 @@ gst_tag_list_to_exif_buffer_with_tiff_header (const GstTagList * taglist)
 {
   GstBuffer *ifd;
   GstByteWriter writer;
-  guint size;
+  gsize size;
+  guint8 *data;
 
   ifd = gst_tag_list_to_exif_buffer (taglist, G_BYTE_ORDER, 8);
   if (ifd == NULL) {
     GST_WARNING ("Failed to create exif buffer");
     return NULL;
   }
-  size = TIFF_HEADER_SIZE + GST_BUFFER_SIZE (ifd);
+
+  data = gst_buffer_map (ifd, &size, NULL, GST_MAP_READ);
+
+  size += TIFF_HEADER_SIZE;
 
   /* TODO what is the correct endianness here? */
   gst_byte_writer_init_with_size (&writer, size, FALSE);
@@ -1753,17 +1793,19 @@ gst_tag_list_to_exif_buffer_with_tiff_header (const GstTagList * taglist)
     gst_byte_writer_put_uint16_be (&writer, 42);
     gst_byte_writer_put_uint32_be (&writer, 8);
   }
-  if (!gst_byte_writer_put_data (&writer, GST_BUFFER_DATA (ifd),
-          GST_BUFFER_SIZE (ifd))) {
+  if (!gst_byte_writer_put_data (&writer, data, size)) {
     GST_WARNING ("Byte writer size mismatch");
     /* reaching here is a programming error because we should have a buffer
      * large enough */
     g_assert_not_reached ();
+    gst_buffer_unmap (ifd, data, size);
     gst_buffer_unref (ifd);
     gst_byte_writer_reset (&writer);
     return NULL;
   }
+  gst_buffer_unmap (ifd, data, size);
   gst_buffer_unref (ifd);
+
   return gst_byte_writer_reset_and_get_buffer (&writer);
 }
 
@@ -1783,7 +1825,7 @@ gst_tag_list_to_exif_buffer_with_tiff_header (const GstTagList * taglist)
  * Since: 0.10.30
  */
 GstTagList *
-gst_tag_list_from_exif_buffer (const GstBuffer * buffer, gint byte_order,
+gst_tag_list_from_exif_buffer (GstBuffer * buffer, gint byte_order,
     guint32 base_offset)
 {
   GstExifReader reader;
@@ -1816,7 +1858,7 @@ read_error:
  * Since: 0.10.30
  */
 GstTagList *
-gst_tag_list_from_exif_buffer_with_tiff_header (const GstBuffer * buffer)
+gst_tag_list_from_exif_buffer_with_tiff_header (GstBuffer * buffer)
 {
   GstByteReader reader;
   guint16 fortytwo = 42;
@@ -1824,11 +1866,14 @@ gst_tag_list_from_exif_buffer_with_tiff_header (const GstBuffer * buffer)
   guint32 offset;
   GstTagList *taglist = NULL;
   GstBuffer *subbuffer;
+  guint8 *data, *sdata;
+  gsize size, ssize;
+
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
 
-  GST_LOG ("Parsing exif tags with tiff header of size %u",
-      GST_BUFFER_SIZE (buffer));
+  GST_LOG ("Parsing exif tags with tiff header of size %" G_GSIZE_FORMAT, size);
 
-  gst_byte_reader_init_from_buffer (&reader, buffer);
+  gst_byte_reader_init (&reader, data, size);
 
   GST_LOG ("Parsing the tiff header");
   if (!gst_byte_reader_get_uint16_be (&reader, &endianness)) {
@@ -1843,32 +1888,42 @@ gst_tag_list_from_exif_buffer_with_tiff_header (const GstBuffer * buffer)
     if (!gst_byte_reader_get_uint16_be (&reader, &fortytwo) ||
         !gst_byte_reader_get_uint32_be (&reader, &offset))
       goto byte_reader_fail;
-  } else {
-    GST_WARNING ("Invalid endianness number %u", endianness);
-    return NULL;
-  }
+  } else
+    goto invalid_endianness;
 
-  if (fortytwo != 42) {
-    GST_WARNING ("Invalid magic number %u, should be 42", fortytwo);
-    return NULL;
-  }
+  if (fortytwo != 42)
+    goto invalid_magic;
 
-  subbuffer = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (buffer) -
-      (TIFF_HEADER_SIZE - 2));
-  memcpy (GST_BUFFER_DATA (subbuffer),
-      GST_BUFFER_DATA (buffer) + TIFF_HEADER_SIZE,
-      GST_BUFFER_SIZE (buffer) - TIFF_HEADER_SIZE);
+  subbuffer = gst_buffer_new_and_alloc (size - (TIFF_HEADER_SIZE - 2));
+
+  sdata = gst_buffer_map (subbuffer, &ssize, NULL, GST_MAP_WRITE);
+  memcpy (sdata, data + TIFF_HEADER_SIZE, size - TIFF_HEADER_SIZE);
+  gst_buffer_unmap (subbuffer, sdata, ssize);
 
   taglist = gst_tag_list_from_exif_buffer (subbuffer,
       endianness == TIFF_LITTLE_ENDIAN ? G_LITTLE_ENDIAN : G_BIG_ENDIAN, 8);
 
   gst_buffer_unref (subbuffer);
+
+done:
+  gst_buffer_unmap (buffer, data, size);
+
   return taglist;
 
 byte_reader_fail:
   {
     GST_WARNING ("Failed to read values from buffer");
-    return NULL;
+    goto done;
+  }
+invalid_endianness:
+  {
+    GST_WARNING ("Invalid endianness number %u", endianness);
+    goto done;
+  }
+invalid_magic:
+  {
+    GST_WARNING ("Invalid magic number %u, should be 42", fortytwo);
+    goto done;
   }
 }
 
@@ -1968,6 +2023,8 @@ deserialize_geo_coordinate (GstExifReader * exif_reader,
   gdouble degrees;
   gdouble minutes;
   gdouble seconds;
+  guint8 *data = NULL;
+  gsize size = 0;
 
   GST_LOG ("Starting to parse %s tag in exif 0x%x", exiftag->gst_tag,
       exiftag->exif_tag);
@@ -2024,8 +2081,11 @@ deserialize_geo_coordinate (GstExifReader * exif_reader,
     return ret;
   }
 
+  data = gst_buffer_map (exif_reader->buffer, &size, NULL, GST_MAP_READ);
+
   /* now parse the fractions */
-  gst_byte_reader_init_from_buffer (&fractions_reader, exif_reader->buffer);
+  gst_byte_reader_init (&fractions_reader, data, size);
+
   if (!gst_byte_reader_set_pos (&fractions_reader,
           next_tagdata.offset - exif_reader->base_offset))
     goto reader_fail;
@@ -2047,6 +2107,7 @@ deserialize_geo_coordinate (GstExifReader * exif_reader,
         !gst_byte_reader_get_uint32_be (&fractions_reader, &seconds_d))
       goto reader_fail;
   }
+  gst_buffer_unmap (exif_reader->buffer, data, size);
 
   GST_DEBUG ("Read degrees fraction for tag %s: %u/%u %u/%u %u/%u",
       exiftag->gst_tag, degrees_n, degrees_d, minutes_n, minutes_d,
@@ -2068,6 +2129,8 @@ deserialize_geo_coordinate (GstExifReader * exif_reader,
 
 reader_fail:
   GST_WARNING ("Failed to read fields from buffer (too short?)");
+  if (data)
+    gst_buffer_unmap (exif_reader->buffer, data, size);
   return ret;
 }
 
index 893989a..ab4bbc4 100644 (file)
@@ -102,6 +102,7 @@ struct _GstTagDemuxPrivate
 
   GstTagDemuxState state;
   GstBuffer *collect;
+  gsize collect_size;
   GstCaps *src_caps;
 
   GstTagList *event_tags;
@@ -110,7 +111,6 @@ struct _GstTagDemuxPrivate
 
   GstSegment segment;
   gboolean need_newseg;
-  gboolean newseg_update;
 
   GList *pending_events;
 };
@@ -141,7 +141,6 @@ static gboolean gst_tag_demux_src_activate_pull (GstPad * pad, gboolean active);
 static GstFlowReturn gst_tag_demux_read_range (GstTagDemux * tagdemux,
     guint64 offset, guint length, GstBuffer ** buffer);
 
-static gboolean gst_tag_demux_src_checkgetrange (GstPad * srcpad);
 static GstFlowReturn gst_tag_demux_src_getrange (GstPad * srcpad,
     guint64 offset, guint length, GstBuffer ** buffer);
 
@@ -254,6 +253,7 @@ gst_tag_demux_reset (GstTagDemux * tagdemux)
   tagdemux->priv->send_tag_event = FALSE;
 
   gst_buffer_replace (buffer_p, NULL);
+  tagdemux->priv->collect_size = 0;
   gst_caps_replace (caps_p, NULL);
 
   gst_tag_demux_remove_srcpad (tagdemux);
@@ -269,7 +269,6 @@ gst_tag_demux_reset (GstTagDemux * tagdemux)
 
   gst_segment_init (&tagdemux->priv->segment, GST_FORMAT_UNDEFINED);
   tagdemux->priv->need_newseg = TRUE;
-  tagdemux->priv->newseg_update = FALSE;
 
   g_list_foreach (tagdemux->priv->pending_events,
       (GFunc) gst_mini_object_unref, NULL);
@@ -344,8 +343,6 @@ gst_tag_demux_add_srcpad (GstTagDemux * tagdemux, GstCaps * new_caps)
         GST_DEBUG_FUNCPTR (gst_tag_demux_srcpad_event));
     gst_pad_set_activatepull_function (tagdemux->priv->srcpad,
         GST_DEBUG_FUNCPTR (gst_tag_demux_src_activate_pull));
-    gst_pad_set_checkgetrange_function (tagdemux->priv->srcpad,
-        GST_DEBUG_FUNCPTR (gst_tag_demux_src_checkgetrange));
     gst_pad_set_getrange_function (tagdemux->priv->srcpad,
         GST_DEBUG_FUNCPTR (gst_tag_demux_src_getrange));
 
@@ -388,18 +385,23 @@ gst_tag_demux_remove_srcpad (GstTagDemux * demux)
  * also return TRUE and set *buf_ref to NULL if the buffer was before
  * the start of the data */
 static gboolean
-gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
+gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref,
+    gsize * buf_size)
 {
   GstBuffer *buf = *buf_ref;
 
   guint trim_start = 0;
-  guint out_size = GST_BUFFER_SIZE (buf);
-  guint64 out_offset = GST_BUFFER_OFFSET (buf);
+  guint out_size, bsize;
+  guint64 out_offset, boffset;
   gboolean need_sub = FALSE;
 
+  bsize = out_size = gst_buffer_get_size (buf);
+  boffset = out_offset = GST_BUFFER_OFFSET (buf);
+
   /* Adjust offset and length */
   if (!GST_BUFFER_OFFSET_IS_VALID (buf)) {
     /* Can't change anything without an offset */
+    *buf_size = bsize;
     return TRUE;
   }
 
@@ -439,26 +441,28 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
   }
 
   if (need_sub == TRUE) {
-    if (out_size != GST_BUFFER_SIZE (buf) || !gst_buffer_is_writable (buf)) {
+    if (out_size != bsize || !gst_buffer_is_writable (buf)) {
       GstBuffer *sub;
 
       GST_DEBUG_OBJECT (tagdemux, "Sub-buffering to trim size %d offset %"
           G_GINT64_FORMAT " to %d offset %" G_GINT64_FORMAT,
-          GST_BUFFER_SIZE (buf), GST_BUFFER_OFFSET (buf), out_size, out_offset);
+          bsize, boffset, out_size, out_offset);
 
-      sub = gst_buffer_create_sub (buf, trim_start, out_size);
+      sub =
+          gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, trim_start,
+          out_size);
       g_return_val_if_fail (sub != NULL, FALSE);
       gst_buffer_unref (buf);
       *buf_ref = buf = sub;
+      *buf_size = out_size;
     } else {
       GST_DEBUG_OBJECT (tagdemux, "Adjusting buffer from size %d offset %"
           G_GINT64_FORMAT " to %d offset %" G_GINT64_FORMAT,
-          GST_BUFFER_SIZE (buf), GST_BUFFER_OFFSET (buf), out_size, out_offset);
+          bsize, boffset, out_size, out_offset);
     }
 
     GST_BUFFER_OFFSET (buf) = out_offset;
     GST_BUFFER_OFFSET_END (buf) = out_offset + out_size;
-    gst_buffer_set_caps (buf, tagdemux->priv->src_caps);
   }
 
   return TRUE;
@@ -485,7 +489,7 @@ gst_tag_demux_chain_parse_tag (GstTagDemux * demux, GstBuffer * collect)
   guint tagsize = 0;
   guint available;
 
-  g_assert (gst_buffer_is_metadata_writable (collect));
+  g_assert (gst_buffer_is_writable (collect));
 
   klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
 
@@ -501,7 +505,7 @@ gst_tag_demux_chain_parse_tag (GstTagDemux * demux, GstBuffer * collect)
   g_assert (klass->identify_tag != NULL);
   g_assert (klass->parse_tag != NULL);
 
-  available = GST_BUFFER_SIZE (collect);
+  available = gst_buffer_get_size (collect);
 
   if (available < klass->min_start_size) {
     GST_DEBUG_OBJECT (demux, "Only %u bytes available, but %u needed "
@@ -535,13 +539,13 @@ gst_tag_demux_chain_parse_tag (GstTagDemux * demux, GstBuffer * collect)
       return;                   /* wait for more data */
     }
 
-    saved_size = GST_BUFFER_SIZE (collect);
-    GST_BUFFER_SIZE (collect) = tagsize;
+    saved_size = gst_buffer_get_size (collect);
+    gst_buffer_set_size (collect, tagsize);
     newsize = tagsize;
 
     parse_ret = klass->parse_tag (demux, collect, TRUE, &newsize, &tags);
 
-    GST_BUFFER_SIZE (collect) = saved_size;
+    gst_buffer_set_size (collect, saved_size);
 
     switch (parse_ret) {
       case GST_TAG_DEMUX_RESULT_OK:
@@ -572,19 +576,22 @@ static GstFlowReturn
 gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
 {
   GstTagDemux *demux;
+  gsize size;
 
   demux = GST_TAG_DEMUX (GST_PAD_PARENT (pad));
 
-  /* Update our segment last_stop info */
+  size = gst_buffer_get_size (buf);
+
+  /* Update our segment position info */
   if (demux->priv->segment.format == GST_FORMAT_BYTES) {
     if (GST_BUFFER_OFFSET_IS_VALID (buf))
-      demux->priv->segment.last_stop = GST_BUFFER_OFFSET (buf);
-    demux->priv->segment.last_stop += GST_BUFFER_SIZE (buf);
+      demux->priv->segment.position = GST_BUFFER_OFFSET (buf);
+    demux->priv->segment.position += size;
   } else if (demux->priv->segment.format == GST_FORMAT_TIME) {
     if (GST_BUFFER_TIMESTAMP_IS_VALID (buf))
-      demux->priv->segment.last_stop = GST_BUFFER_TIMESTAMP (buf);
+      demux->priv->segment.position = GST_BUFFER_TIMESTAMP (buf);
     if (GST_BUFFER_DURATION_IS_VALID (buf))
-      demux->priv->segment.last_stop += GST_BUFFER_DURATION (buf);
+      demux->priv->segment.position += GST_BUFFER_DURATION (buf);
   }
 
   if (demux->priv->collect == NULL) {
@@ -592,12 +599,12 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
   } else {
     demux->priv->collect = gst_buffer_join (demux->priv->collect, buf);
   }
+  demux->priv->collect_size += size;
   buf = NULL;
 
   switch (demux->priv->state) {
     case GST_TAG_DEMUX_READ_START_TAG:
-      demux->priv->collect =
-          gst_buffer_make_metadata_writable (demux->priv->collect);
+      demux->priv->collect = gst_buffer_make_writable (demux->priv->collect);
       gst_tag_demux_chain_parse_tag (demux, demux->priv->collect);
       if (demux->priv->state != GST_TAG_DEMUX_TYPEFINDING)
         break;
@@ -605,19 +612,20 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
     case GST_TAG_DEMUX_TYPEFINDING:{
       GstTypeFindProbability probability = 0;
       GstBuffer *typefind_buf = NULL;
+      gsize typefind_size;
       GstCaps *caps;
 
-      if (GST_BUFFER_SIZE (demux->priv->collect) <
+      if (demux->priv->collect_size <
           TYPE_FIND_MIN_SIZE + demux->priv->strip_start)
         break;                  /* Go get more data first */
 
-      GST_DEBUG_OBJECT (demux, "Typefinding with size %d",
-          GST_BUFFER_SIZE (demux->priv->collect));
+      GST_DEBUG_OBJECT (demux, "Typefinding with size %" G_GSIZE_FORMAT,
+          demux->priv->collect_size);
 
       /* Trim the buffer and adjust offset for typefinding */
       typefind_buf = demux->priv->collect;
       gst_buffer_ref (typefind_buf);
-      if (!gst_tag_demux_trim_buffer (demux, &typefind_buf))
+      if (!gst_tag_demux_trim_buffer (demux, &typefind_buf, &typefind_size))
         return GST_FLOW_UNEXPECTED;
 
       if (typefind_buf == NULL)
@@ -627,7 +635,7 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
           typefind_buf, &probability);
 
       if (caps == NULL) {
-        if (GST_BUFFER_SIZE (typefind_buf) < TYPE_FIND_MAX_SIZE) {
+        if (typefind_size < TYPE_FIND_MAX_SIZE) {
           /* Just break for more data */
           gst_buffer_unref (typefind_buf);
           return GST_FLOW_OK;
@@ -639,6 +647,7 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
         gst_buffer_unref (typefind_buf);
         gst_buffer_unref (demux->priv->collect);
         demux->priv->collect = NULL;
+        demux->priv->collect_size = 0;
         return GST_FLOW_ERROR;
       }
       gst_buffer_unref (typefind_buf);
@@ -660,12 +669,14 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
     }
     case GST_TAG_DEMUX_STREAMING:{
       GstBuffer *outbuf = NULL;
+      gsize outbuf_size;
 
       /* Trim the buffer and adjust offset */
       if (demux->priv->collect) {
         outbuf = demux->priv->collect;
         demux->priv->collect = NULL;
-        if (!gst_tag_demux_trim_buffer (demux, &outbuf))
+        demux->priv->collect_size = 0;
+        if (!gst_tag_demux_trim_buffer (demux, &outbuf, &outbuf_size))
           return GST_FLOW_UNEXPECTED;
       }
       if (outbuf) {
@@ -692,10 +703,6 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
           demux->priv->send_tag_event = FALSE;
         }
 
-        /* Ensure the caps are set correctly */
-        outbuf = gst_buffer_make_metadata_writable (outbuf);
-        gst_buffer_set_caps (outbuf, GST_PAD_CAPS (demux->priv->srcpad));
-
         GST_LOG_OBJECT (demux, "Pushing buffer %p", outbuf);
 
         return gst_pad_push (demux->priv->srcpad, outbuf);
@@ -726,18 +733,10 @@ gst_tag_demux_sink_event (GstPad * pad, GstEvent * event)
       }
       ret = gst_pad_event_default (pad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:{
-      gboolean update;
-      gdouble rate, arate;
-      GstFormat format;
-      gint64 start, stop, position;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate,
-          &format, &start, &stop, &position);
+    case GST_EVENT_SEGMENT:
+    {
+      gst_event_copy_segment (event, &demux->priv->segment);
 
-      gst_segment_set_newsegment_full (&demux->priv->segment, update, rate,
-          arate, format, start, stop, position);
-      demux->priv->newseg_update = update;
       demux->priv->need_newseg = TRUE;
       gst_event_unref (event);
       ret = TRUE;
@@ -770,16 +769,14 @@ gst_tag_demux_sink_event (GstPad * pad, GstEvent * event)
 static gboolean
 gst_tag_demux_get_upstream_size (GstTagDemux * tagdemux)
 {
-  GstFormat format;
   gint64 len;
 
   /* Short-cut if we already queried upstream */
   if (tagdemux->priv->upstream_size > 0)
     return TRUE;
 
-  format = GST_FORMAT_BYTES;
-  if (!gst_pad_query_peer_duration (tagdemux->priv->sinkpad, &format, &len) ||
-      len <= 0) {
+  if (!gst_pad_query_peer_duration (tagdemux->priv->sinkpad, GST_FORMAT_BYTES,
+          &len) || len <= 0) {
     return FALSE;
   }
 
@@ -885,6 +882,7 @@ gst_tag_demux_pull_end_tag (GstTagDemux * demux, GstTagList ** tags)
   gboolean res = FALSE;
   guint64 offset;
   guint tagsize;
+  gsize bsize;
 
   klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
 
@@ -913,9 +911,11 @@ gst_tag_demux_pull_end_tag (GstTagDemux * demux, GstTagList ** tags)
     goto done;
   }
 
-  if (GST_BUFFER_SIZE (buffer) < klass->min_end_size) {
-    GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file "
-        "(required: %u bytes)", GST_BUFFER_SIZE (buffer), klass->min_end_size);
+  bsize = gst_buffer_get_size (buffer);
+
+  if (bsize < klass->min_end_size) {
+    GST_DEBUG_OBJECT (demux, "Only managed to read %" G_GSIZE_FORMAT " bytes"
+        "from file (required: %u bytes)", bsize, klass->min_end_size);
     goto done;
   }
 
@@ -937,7 +937,7 @@ gst_tag_demux_pull_end_tag (GstTagDemux * demux, GstTagList ** tags)
     g_assert (tagsize >= klass->min_end_size);
 
     /* Get buffer that's exactly the requested size */
-    if (GST_BUFFER_SIZE (buffer) != tagsize) {
+    if (bsize != tagsize) {
       gst_buffer_unref (buffer);
       buffer = NULL;
 
@@ -953,22 +953,24 @@ gst_tag_demux_pull_end_tag (GstTagDemux * demux, GstTagList ** tags)
         goto done;
       }
 
-      if (GST_BUFFER_SIZE (buffer) < tagsize) {
-        GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file",
-            GST_BUFFER_SIZE (buffer));
+      bsize = gst_buffer_get_size (buffer);
+
+      if (bsize < tagsize) {
+        GST_DEBUG_OBJECT (demux, "Only managed to read %" G_GSIZE_FORMAT
+            " bytes from file", bsize);
         goto done;
       }
     }
 
     GST_BUFFER_OFFSET (buffer) = offset;
 
-    saved_size = GST_BUFFER_SIZE (buffer);
-    GST_BUFFER_SIZE (buffer) = tagsize;
+    saved_size = bsize;
+    gst_buffer_set_size (buffer, tagsize);
     newsize = tagsize;
 
     parse_ret = klass->parse_tag (demux, buffer, FALSE, &newsize, &new_tags);
 
-    GST_BUFFER_SIZE (buffer) = saved_size;
+    gst_buffer_set_size (buffer, saved_size);
 
     switch (parse_ret) {
       case GST_TAG_DEMUX_RESULT_OK:
@@ -1015,6 +1017,7 @@ gst_tag_demux_pull_start_tag (GstTagDemux * demux, GstTagList ** tags)
   gboolean have_tag;
   gboolean res = FALSE;
   guint req, tagsize;
+  gsize bsize;
 
   klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
 
@@ -1037,9 +1040,11 @@ gst_tag_demux_pull_start_tag (GstTagDemux * demux, GstTagList ** tags)
     goto done;
   }
 
-  if (GST_BUFFER_SIZE (buffer) < klass->min_start_size) {
-    GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file - "
-        "no tag in this file", GST_BUFFER_SIZE (buffer));
+  bsize = gst_buffer_get_size (buffer);
+
+  if (bsize < klass->min_start_size) {
+    GST_DEBUG_OBJECT (demux, "Only managed to read %" G_GSIZE_FORMAT
+        " bytes from file - no tag in this file", bsize);
     goto done;
   }
 
@@ -1061,7 +1066,7 @@ gst_tag_demux_pull_start_tag (GstTagDemux * demux, GstTagList ** tags)
     /* Now pull the entire tag */
     g_assert (tagsize >= klass->min_start_size);
 
-    if (GST_BUFFER_SIZE (buffer) < tagsize) {
+    if (bsize < tagsize) {
       gst_buffer_unref (buffer);
       buffer = NULL;
 
@@ -1072,21 +1077,23 @@ gst_tag_demux_pull_start_tag (GstTagDemux * demux, GstTagList ** tags)
         goto done;
       }
 
-      if (GST_BUFFER_SIZE (buffer) < tagsize) {
-        GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file",
-            GST_BUFFER_SIZE (buffer));
+      bsize = gst_buffer_get_size (buffer);
+
+      if (bsize < tagsize) {
+        GST_DEBUG_OBJECT (demux, "Only managed to read %" G_GSIZE_FORMAT
+            " bytes from file", bsize);
         GST_ELEMENT_ERROR (demux, STREAM, DECODE,
             (_("Failed to read tag: not enough data")), (NULL));
         goto done;
       }
     }
 
-    saved_size = GST_BUFFER_SIZE (buffer);
-    GST_BUFFER_SIZE (buffer) = tagsize;
+    saved_size = bsize;
+    gst_buffer_set_size (buffer, tagsize);
     newsize = tagsize;
     parse_ret = klass->parse_tag (demux, buffer, TRUE, &newsize, &new_tags);
 
-    GST_BUFFER_SIZE (buffer) = saved_size;
+    gst_buffer_set_size (buffer, saved_size);
 
     switch (parse_ret) {
       case GST_TAG_DEMUX_RESULT_OK:
@@ -1141,6 +1148,8 @@ gst_tag_demux_sink_activate (GstPad * sinkpad)
   gboolean e_tag_ok, s_tag_ok;
   gboolean ret = FALSE;
   GstCaps *caps = NULL;
+  GstQuery *query;
+  gboolean pull_mode;
 
   demux = GST_TAG_DEMUX (GST_PAD_PARENT (sinkpad));
   klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
@@ -1151,14 +1160,22 @@ gst_tag_demux_sink_activate (GstPad * sinkpad)
    * collect buffers, read the start tag and output a buffer to end
    * preroll.
    */
-  if (!gst_pad_check_pull_range (sinkpad) ||
-      !gst_pad_activate_pull (sinkpad, TRUE)) {
-    GST_DEBUG_OBJECT (demux, "No pull mode. Changing to push, but won't be "
-        "able to read end tags");
-    demux->priv->state = GST_TAG_DEMUX_READ_START_TAG;
-    return gst_pad_activate_push (sinkpad, TRUE);
+  query = gst_query_new_scheduling ();
+
+  if (!gst_pad_peer_query (sinkpad, query)) {
+    gst_query_unref (query);
+    goto activate_push;
   }
 
+  gst_query_parse_scheduling (query, &pull_mode, NULL, NULL, NULL, NULL, NULL);
+  gst_query_unref (query);
+
+  if (!pull_mode)
+    goto activate_push;
+
+  if (!gst_pad_activate_pull (sinkpad, TRUE))
+    goto activate_push;
+
   /* Look for tags at start and end of file */
   GST_DEBUG_OBJECT (demux, "Activated pull mode. Looking for tags");
   if (!gst_tag_demux_get_upstream_size (demux))
@@ -1249,6 +1266,14 @@ done_activate:
     gst_caps_unref (caps);
 
   return ret;
+
+activate_push:
+  {
+    GST_DEBUG_OBJECT (demux, "No pull mode. Changing to push, but won't be "
+        "able to read end tags");
+    demux->priv->state = GST_TAG_DEMUX_READ_START_TAG;
+    return gst_pad_activate_push (sinkpad, TRUE);
+  }
 }
 
 static gboolean
@@ -1259,14 +1284,6 @@ gst_tag_demux_src_activate_pull (GstPad * pad, gboolean active)
   return gst_pad_activate_pull (demux->priv->sinkpad, active);
 }
 
-static gboolean
-gst_tag_demux_src_checkgetrange (GstPad * srcpad)
-{
-  GstTagDemux *demux = GST_TAG_DEMUX (GST_PAD_PARENT (srcpad));
-
-  return gst_pad_check_pull_range (demux->priv->sinkpad);
-}
-
 static GstFlowReturn
 gst_tag_demux_read_range (GstTagDemux * demux,
     guint64 offset, guint length, GstBuffer ** buffer)
@@ -1274,6 +1291,7 @@ gst_tag_demux_read_range (GstTagDemux * demux,
   GstFlowReturn ret;
   guint64 in_offset;
   guint in_length;
+  gsize size;
 
   g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
 
@@ -1296,13 +1314,11 @@ gst_tag_demux_read_range (GstTagDemux * demux,
   ret = gst_pad_pull_range (demux->priv->sinkpad, in_offset, in_length, buffer);
 
   if (ret == GST_FLOW_OK && *buffer) {
-    if (!gst_tag_demux_trim_buffer (demux, buffer))
+    if (!gst_tag_demux_trim_buffer (demux, buffer, &size))
       goto read_beyond_end;
 
     /* this should only happen in streaming mode */
     g_assert (*buffer != NULL);
-
-    gst_buffer_set_caps (*buffer, demux->priv->src_caps);
   }
 
   return ret;
@@ -1462,20 +1478,19 @@ gst_tag_demux_send_new_segment (GstTagDemux * tagdemux)
   GstEvent *event;
   gint64 start, stop, position;
   GstSegment *seg = &tagdemux->priv->segment;
+  GstSegment newseg;
 
   if (seg->format == GST_FORMAT_UNDEFINED) {
     GST_LOG_OBJECT (tagdemux,
         "No new segment received before first buffer. Using default");
-    gst_segment_set_newsegment (seg, FALSE, 1.0,
-        GST_FORMAT_BYTES, tagdemux->priv->strip_start, -1,
-        tagdemux->priv->strip_start);
+    gst_segment_init (seg, GST_FORMAT_BYTES);
+    seg->start = tagdemux->priv->strip_start;
+    seg->time = tagdemux->priv->strip_start;
   }
 
   /* Can't adjust segments in non-BYTES formats */
   if (tagdemux->priv->segment.format != GST_FORMAT_BYTES) {
-    event = gst_event_new_new_segment_full (tagdemux->priv->newseg_update,
-        seg->rate, seg->applied_rate, seg->format, seg->start,
-        seg->stop, seg->time);
+    event = gst_event_new_segment (seg);
     return gst_pad_push_event (tagdemux->priv->srcpad, event);
   }
 
@@ -1525,13 +1540,13 @@ gst_tag_demux_send_new_segment (GstTagDemux * tagdemux)
     }
   }
 
-  GST_DEBUG_OBJECT (tagdemux,
-      "Sending new segment update %d, rate %g, format %d, "
-      "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT ", position %"
-      G_GINT64_FORMAT, tagdemux->priv->newseg_update, seg->rate, seg->format,
-      start, stop, position);
+  GST_DEBUG_OBJECT (tagdemux, "Sending segment %" GST_SEGMENT_FORMAT, seg);
+
+  gst_segment_copy_into (seg, &newseg);
+  newseg.start = start;
+  newseg.stop = stop;
+  newseg.position = position;
+  event = gst_event_new_segment (&newseg);
 
-  event = gst_event_new_new_segment_full (tagdemux->priv->newseg_update,
-      seg->rate, seg->applied_rate, seg->format, start, stop, position);
   return gst_pad_push_event (tagdemux->priv->srcpad, event);
 }
index 9c0d234..6d0a741 100644 (file)
@@ -82,21 +82,9 @@ struct _GstTagMuxPrivate
 GST_DEBUG_CATEGORY_STATIC (gst_tag_mux_debug);
 #define GST_CAT_DEFAULT gst_tag_mux_debug
 
-static void
-gst_tag_mux_iface_init (GType tag_type)
-{
-  static const GInterfaceInfo tag_setter_info = {
-    NULL,
-    NULL,
-    NULL
-  };
-
-  g_type_add_interface_static (tag_type, GST_TYPE_TAG_SETTER, &tag_setter_info);
-}
-
-GST_BOILERPLATE_FULL (GstTagMux, gst_tag_mux,
-    GstElement, GST_TYPE_ELEMENT, gst_tag_mux_iface_init);
-
+#define gst_tag_mux_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstTagMux, gst_tag_mux, GST_TYPE_ELEMENT,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
 
 static GstStateChangeReturn
 gst_tag_mux_change_state (GstElement * element, GstStateChange transition);
@@ -127,13 +115,6 @@ gst_tag_mux_finalize (GObject * obj)
 }
 
 static void
-gst_tag_mux_base_init (gpointer g_class)
-{
-  GST_DEBUG_CATEGORY_INIT (gst_tag_mux_debug, "tagmux", 0,
-      "tag muxer base class");
-}
-
-static void
 gst_tag_mux_class_init (GstTagMuxClass * klass)
 {
   GObjectClass *gobject_class;
@@ -146,12 +127,15 @@ gst_tag_mux_class_init (GstTagMuxClass * klass)
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_tag_mux_change_state);
 
   g_type_class_add_private (klass, sizeof (GstTagMuxPrivate));
+
+  GST_DEBUG_CATEGORY_INIT (gst_tag_mux_debug, "tagmux", 0,
+      "tag muxer base class");
 }
 
 static void
-gst_tag_mux_init (GstTagMux * mux, GstTagMuxClass * mux_class)
+gst_tag_mux_init (GstTagMux * mux)
 {
-  GstElementClass *element_klass = GST_ELEMENT_CLASS (mux_class);
+  GstElementClass *element_klass = GST_ELEMENT_GET_CLASS (mux);
   GstPadTemplate *tmpl;
 
   mux->priv =
@@ -163,7 +147,7 @@ gst_tag_mux_init (GstTagMux * mux, GstTagMuxClass * mux_class)
     mux->priv->sinkpad = gst_pad_new_from_template (tmpl, "sink");
   } else {
     g_warning ("GstTagMux subclass '%s' did not install a %s pad template!\n",
-        G_OBJECT_CLASS_NAME (mux_class), "sink");
+        G_OBJECT_CLASS_NAME (element_klass), "sink");
     mux->priv->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
   }
   gst_pad_set_chain_function (mux->priv->sinkpad,
@@ -184,7 +168,7 @@ gst_tag_mux_init (GstTagMux * mux, GstTagMuxClass * mux_class)
     }
   } else {
     g_warning ("GstTagMux subclass '%s' did not install a %s pad template!\n",
-        G_OBJECT_CLASS_NAME (mux_class), "source");
+        G_OBJECT_CLASS_NAME (element_klass), "source");
     mux->priv->srcpad = gst_pad_new ("src", GST_PAD_SRC);
   }
   gst_element_add_pad (GST_ELEMENT (mux), mux->priv->srcpad);
@@ -226,6 +210,7 @@ gst_tag_mux_render_start_tag (GstTagMux * mux)
   GstTagList *taglist;
   GstEvent *event;
   GstFlowReturn ret;
+  GstSegment segment;
 
   taglist = gst_tag_mux_get_tags (mux);
 
@@ -243,19 +228,14 @@ gst_tag_mux_render_start_tag (GstTagMux * mux)
     return GST_FLOW_OK;
   }
 
-  if (GST_BUFFER_CAPS (buffer) == NULL) {
-    buffer = gst_buffer_make_metadata_writable (buffer);
-    gst_buffer_set_caps (buffer, GST_PAD_CAPS (mux->priv->srcpad));
-  }
-
-  mux->priv->start_tag_size = GST_BUFFER_SIZE (buffer);
+  mux->priv->start_tag_size = gst_buffer_get_size (buffer);
   GST_LOG_OBJECT (mux, "tag size = %" G_GSIZE_FORMAT " bytes",
       mux->priv->start_tag_size);
 
   /* Send newsegment event from byte position 0, so the tag really gets
    * written to the start of the file, independent of the upstream segment */
-  gst_pad_push_event (mux->priv->srcpad,
-      gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0));
+  gst_segment_init (&segment, GST_FORMAT_BYTES);
+  gst_pad_push_event (mux->priv->srcpad, gst_event_new_segment (&segment));
 
   /* Send an event about the new tags to downstream elements */
   /* gst_event_new_tag takes ownership of the list, so use a copy */
@@ -286,6 +266,7 @@ gst_tag_mux_render_end_tag (GstTagMux * mux)
   GstBuffer *buffer;
   GstTagList *taglist;
   GstFlowReturn ret;
+  GstSegment segment;
 
   taglist = gst_tag_mux_get_tags (mux);
 
@@ -302,20 +283,15 @@ gst_tag_mux_render_end_tag (GstTagMux * mux)
     return GST_FLOW_OK;
   }
 
-  if (GST_BUFFER_CAPS (buffer) == NULL) {
-    buffer = gst_buffer_make_metadata_writable (buffer);
-    gst_buffer_set_caps (buffer, GST_PAD_CAPS (mux->priv->srcpad));
-  }
-
-  mux->priv->end_tag_size = GST_BUFFER_SIZE (buffer);
+  mux->priv->end_tag_size = gst_buffer_get_size (buffer);
   GST_LOG_OBJECT (mux, "tag size = %" G_GSIZE_FORMAT " bytes",
       mux->priv->end_tag_size);
 
   /* Send newsegment event from the end of the file, so it gets written there,
      independent of whatever new segment events upstream has sent us */
-  gst_pad_push_event (mux->priv->srcpad,
-      gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES,
-          mux->priv->max_offset, -1, 0));
+  gst_segment_init (&segment, GST_FORMAT_BYTES);
+  segment.start = mux->priv->max_offset;
+  gst_pad_push_event (mux->priv->srcpad, gst_event_new_segment (&segment));
 
   GST_BUFFER_OFFSET (buffer) = mux->priv->max_offset;
   ret = gst_pad_push (mux->priv->srcpad, buffer);
@@ -334,27 +310,25 @@ static GstEvent *
 gst_tag_mux_adjust_event_offsets (GstTagMux * mux,
     const GstEvent * newsegment_event)
 {
-  GstFormat format;
-  gint64 start, stop, cur;
+  GstSegment segment;
 
-  gst_event_parse_new_segment ((GstEvent *) newsegment_event, NULL, NULL,
-      &format, &start, &stop, &cur);
+  gst_event_copy_segment ((GstEvent *) newsegment_event, &segment);
 
-  g_assert (format == GST_FORMAT_BYTES);
+  g_assert (segment.format == GST_FORMAT_BYTES);
 
-  if (start != -1)
-    start += mux->priv->start_tag_size;
-  if (stop != -1)
-    stop += mux->priv->start_tag_size;
-  if (cur != -1)
-    cur += mux->priv->start_tag_size;
+  if (segment.start != -1)
+    segment.start += mux->priv->start_tag_size;
+  if (segment.stop != -1)
+    segment.stop += mux->priv->start_tag_size;
+  if (segment.time != -1)
+    segment.time += mux->priv->start_tag_size;
 
   GST_DEBUG_OBJECT (mux, "adjusting newsegment event offsets to start=%"
       G_GINT64_FORMAT ", stop=%" G_GINT64_FORMAT ", cur=%" G_GINT64_FORMAT
-      " (delta = +%" G_GSIZE_FORMAT ")", start, stop, cur,
-      mux->priv->start_tag_size);
+      " (delta = +%" G_GSIZE_FORMAT ")", segment.start, segment.stop,
+      segment.time, mux->priv->start_tag_size);
 
-  return gst_event_new_new_segment (TRUE, 1.0, format, start, stop, cur);
+  return gst_event_new_segment (&segment);
 }
 
 static GstFlowReturn
@@ -376,19 +350,18 @@ gst_tag_mux_chain (GstPad * pad, GstBuffer * buffer)
 
     /* Now send the cached newsegment event that we got from upstream */
     if (mux->priv->newsegment_ev) {
-      gint64 start;
       GstEvent *newseg;
+      GstSegment segment;
 
       GST_DEBUG_OBJECT (mux, "sending cached newsegment event");
       newseg = gst_tag_mux_adjust_event_offsets (mux, mux->priv->newsegment_ev);
       gst_event_unref (mux->priv->newsegment_ev);
       mux->priv->newsegment_ev = NULL;
 
-      gst_event_parse_new_segment (newseg, NULL, NULL, NULL, &start, NULL,
-          NULL);
+      gst_event_copy_segment (newseg, &segment);
 
       gst_pad_push_event (mux->priv->srcpad, newseg);
-      mux->priv->current_offset = start;
+      mux->priv->current_offset = segment.start;
       mux->priv->max_offset =
           MAX (mux->priv->max_offset, mux->priv->current_offset);
     } else {
@@ -398,7 +371,7 @@ gst_tag_mux_chain (GstPad * pad, GstBuffer * buffer)
     mux->priv->render_start_tag = FALSE;
   }
 
-  buffer = gst_buffer_make_metadata_writable (buffer);
+  buffer = gst_buffer_make_writable (buffer);
 
   if (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE) {
     GST_LOG_OBJECT (mux, "Adjusting buffer offset from %" G_GINT64_FORMAT
@@ -407,9 +380,8 @@ gst_tag_mux_chain (GstPad * pad, GstBuffer * buffer)
     GST_BUFFER_OFFSET (buffer) += mux->priv->start_tag_size;
   }
 
-  length = GST_BUFFER_SIZE (buffer);
+  length = gst_buffer_get_size (buffer);
 
-  gst_buffer_set_caps (buffer, GST_PAD_CAPS (mux->priv->srcpad));
   ret = gst_pad_push (mux->priv->srcpad, buffer);
 
   mux->priv->current_offset += length;
@@ -451,15 +423,15 @@ gst_tag_mux_sink_event (GstPad * pad, GstEvent * event)
       result = TRUE;
       break;
     }
-    case GST_EVENT_NEWSEGMENT:{
-      GstFormat fmt;
-      gint64 start;
+    case GST_EVENT_SEGMENT:
+    {
+      GstSegment segment;
 
-      gst_event_parse_new_segment (event, NULL, NULL, &fmt, &start, NULL, NULL);
+      gst_event_copy_segment (event, &segment);
 
-      if (fmt != GST_FORMAT_BYTES) {
+      if (segment.format != GST_FORMAT_BYTES) {
         GST_WARNING_OBJECT (mux, "dropping newsegment event in %s format",
-            gst_format_get_name (fmt));
+            gst_format_get_name (segment.format));
         gst_event_unref (event);
         break;
       }
@@ -483,7 +455,7 @@ gst_tag_mux_sink_event (GstPad * pad, GstEvent * event)
             gst_tag_mux_adjust_event_offsets (mux, event));
         gst_event_unref (event);
 
-        mux->priv->current_offset = start;
+        mux->priv->current_offset = segment.start;
         mux->priv->max_offset =
             MAX (mux->priv->max_offset, mux->priv->current_offset);
       }
index 8fb2f85..44cb50f 100644 (file)
@@ -422,8 +422,9 @@ decode_failed:
 }
 
 /**
- * gst_tag_list_from_vorbiscomment_buffer:
- * @buffer: buffer to convert
+ * gst_tag_list_from_vorbiscomment:
+ * @data: data to convert
+ * @size: size of @data
  * @id_data: identification data at start of stream
  * @id_data_length: length of identification data
  * @vendor_string: pointer to a string that should take the vendor string
@@ -436,7 +437,7 @@ decode_failed:
  *          given vorbiscomment buffer or NULL on error.
  */
 GstTagList *
-gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
+gst_tag_list_from_vorbiscomment (const guint8 * data, gsize size,
     const guint8 * id_data, const guint id_data_length, gchar ** vendor_string)
 {
 #define ADVANCE(x) G_STMT_START{                                                \
@@ -452,15 +453,12 @@ gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
   gchar *cur, *value;
   guint cur_size;
   guint iterations;
-  guint8 *data;
-  guint size, value_len;
+  guint value_len;
   GstTagList *list;
 
-  g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
+  g_return_val_if_fail (data != NULL, NULL);
   g_return_val_if_fail (id_data != NULL || id_data_length == 0, NULL);
 
-  data = GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer);
   list = gst_tag_list_new ();
 
   if (size < 11 || size <= id_data_length + 4)
@@ -515,6 +513,37 @@ error:
 #undef ADVANCE
 }
 
+/**
+ * gst_tag_list_from_vorbiscomment_buffer:
+ * @buffer: buffer to convert
+ * @id_data: identification data at start of stream
+ * @id_data_length: length of identification data
+ * @vendor_string: pointer to a string that should take the vendor string
+ *                 of this vorbis comment or NULL if you don't need it.
+ *
+ * Creates a new tag list that contains the information parsed out of a
+ * vorbiscomment packet.
+ *
+ * Returns: A new #GstTagList with all tags that could be extracted from the
+ *          given vorbiscomment buffer or NULL on error.
+ */
+GstTagList *
+gst_tag_list_from_vorbiscomment_buffer (GstBuffer * buffer,
+    const guint8 * id_data, const guint id_data_length, gchar ** vendor_string)
+{
+  GstTagList *res;
+  guint8 *data;
+  gsize size;
+
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+  res =
+      gst_tag_list_from_vorbiscomment (data, size, id_data, id_data_length,
+      vendor_string);
+  gst_buffer_unmap (buffer, data, size);
+
+  return res;
+}
+
 typedef struct
 {
   guint count;
@@ -527,20 +556,30 @@ static GList *
 gst_tag_to_metadata_block_picture (const gchar * tag,
     const GValue * image_value)
 {
+#if 0
   gchar *comment_data, *data_result;
   const gchar *mime_type;
   guint mime_type_len;
   GstStructure *mime_struct;
   GstBuffer *buffer;
+#endif
   GList *l = NULL;
+#if 0
+  guint8 *data;
+  gsize size;
   GstByteWriter writer;
   GstTagImageType image_type = GST_TAG_IMAGE_TYPE_NONE;
   gint width = 0, height = 0;
   guint8 *metadata_block;
   guint metadata_block_len;
+#endif
 
   g_return_val_if_fail (image_value != NULL, NULL);
 
+  /* FIXME, no more buffer caps */
+  g_assert_not_reached ();
+
+#if 0
   buffer = gst_value_get_buffer (image_value);
   g_return_val_if_fail (gst_caps_is_fixed (buffer->caps), NULL);
   mime_struct = gst_caps_get_structure (buffer->caps, 0);
@@ -554,7 +593,7 @@ gst_tag_to_metadata_block_picture (const gchar * tag,
       &image_type, "width", G_TYPE_INT, &width, "height", G_TYPE_INT, &height,
       NULL);
 
-  metadata_block_len = 32 + mime_type_len + GST_BUFFER_SIZE (buffer);
+  metadata_block_len = 32 + mime_type_len + gst_buffer_get_size (buffer);
   gst_byte_writer_init_with_size (&writer, metadata_block_len, TRUE);
 
   if (image_type == GST_TAG_IMAGE_TYPE_NONE
@@ -580,9 +619,12 @@ gst_tag_to_metadata_block_picture (const gchar * tag,
   gst_byte_writer_put_uint32_be_unchecked (&writer, 0);
   /* for indexed formats the number of colors */
   gst_byte_writer_put_uint32_be_unchecked (&writer, 0);
-  gst_byte_writer_put_uint32_be_unchecked (&writer, GST_BUFFER_SIZE (buffer));
-  gst_byte_writer_put_data_unchecked (&writer, GST_BUFFER_DATA (buffer),
-      GST_BUFFER_SIZE (buffer));
+
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+  gst_byte_writer_put_uint32_be_unchecked (&writer, size);
+  gst_byte_writer_put_data_unchecked (&writer, data, size);
+  gst_buffer_unmap (buffer, data, size);
+
   g_assert (gst_byte_writer_get_pos (&writer) == metadata_block_len);
 
   metadata_block = gst_byte_writer_reset_and_get_data (&writer);
@@ -592,6 +634,7 @@ gst_tag_to_metadata_block_picture (const gchar * tag,
   g_free (comment_data);
 
   l = g_list_append (l, data_result);
+#endif
 
   return l;
 }
@@ -748,7 +791,7 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
     const gchar * vendor_string)
 {
   GstBuffer *buffer;
-  guint8 *data;
+  guint8 *data, *odata;
   guint i;
   GList *l;
   MyForEach my_data = { 0, 0, NULL };
@@ -764,8 +807,9 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
   required_size = id_data_length + 4 + vendor_len + 4 + 1;
   gst_tag_list_foreach ((GstTagList *) list, write_one_tag, &my_data);
   required_size += 4 * my_data.count + my_data.data_count;
+
   buffer = gst_buffer_new_and_alloc (required_size);
-  data = GST_BUFFER_DATA (buffer);
+  odata = data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
   if (id_data_length > 0) {
     memcpy (data, id_data, id_data_length);
     data += id_data_length;
@@ -793,6 +837,7 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
   g_list_foreach (my_data.entries, (GFunc) g_free, NULL);
   g_list_free (my_data.entries);
   *data = 1;
+  gst_buffer_unmap (buffer, odata, required_size);
 
   return buffer;
 }
index 6ae5d99..0c178b4 100644 (file)
@@ -175,6 +175,7 @@ xmp_tag_type_get_name (GstXmpTagType tagtype)
     default:
       g_assert_not_reached ();
   }
+  return NULL;                  /* make compiler happy with -DG_DISABLE_ASSERT */
 }
 
 struct _PendingXmpTag
@@ -1271,11 +1272,11 @@ read_one_tag (GstTagList * list, XmpTag * xmptag,
  * Since: 0.10.29
  */
 GstTagList *
-gst_tag_list_from_xmp_buffer (const GstBuffer * buffer)
+gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
 {
   GstTagList *list = NULL;
-  const gchar *xps, *xp1, *xp2, *xpe, *ns, *ne;
-  guint len, max_ft_len;
+  gchar *xps, *xp1, *xp2, *xpe, *ns, *ne;
+  gsize len, max_ft_len;
   gboolean in_tag;
   gchar *part, *pp;
   guint i;
@@ -1286,25 +1287,32 @@ gst_tag_list_from_xmp_buffer (const GstBuffer * buffer)
   XmpTag *context_tag = NULL;
 
   GstXmpNamespaceMap ns_map[] = {
-    {"dc", NULL},
-    {"exif", NULL},
-    {"tiff", NULL},
-    {"xap", NULL},
-    {"photoshop", NULL},
-    {"Iptc4xmpCore", NULL},
-    {"Iptc4xmpExt", NULL},
+    {"dc", NULL}
+    ,
+    {"exif", NULL}
+    ,
+    {"tiff", NULL}
+    ,
+    {"xap", NULL}
+    ,
+    {"photoshop", NULL}
+    ,
+    {"Iptc4xmpCore", NULL}
+    ,
+    {"Iptc4xmpExt", NULL}
+    ,
     {NULL, NULL}
   };
 
   xmp_tags_initialize ();
 
   g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
-  g_return_val_if_fail (GST_BUFFER_SIZE (buffer) > 0, NULL);
 
   GST_LOG ("Starting xmp parsing");
 
-  xps = (const gchar *) GST_BUFFER_DATA (buffer);
-  len = GST_BUFFER_SIZE (buffer);
+  xps = gst_buffer_map (buffer, &len, NULL, GST_MAP_READ);
+  g_return_val_if_fail (len > 0, NULL);
+
   xpe = &xps[len + 1];
 
   /* check header and footer */
@@ -1566,6 +1574,8 @@ gst_tag_list_from_xmp_buffer (const GstBuffer * buffer)
   }
   g_free (part);
 
+  gst_buffer_unmap (buffer, xps, len);
+
   return list;
 
   /* Errors */
@@ -1783,6 +1793,8 @@ gst_tag_list_to_xmp_buffer_full (const GstTagList * list, gboolean read_only,
   XmpSerializationData serialization_data;
   GString *data;
   guint i;
+  gsize bsize;
+  gpointer bdata;
 
   serialization_data.data = g_string_sized_new (4096);
   serialization_data.schemas = schemas;
@@ -1851,10 +1863,12 @@ gst_tag_list_to_xmp_buffer_full (const GstTagList * list, gboolean read_only,
   g_string_append_printf (data, "<?xpacket end=\"%c\"?>",
       (read_only ? 'r' : 'w'));
 
+  bsize = data->len;
+  bdata = g_string_free (data, FALSE);
+
   buffer = gst_buffer_new ();
-  GST_BUFFER_SIZE (buffer) = data->len;
-  GST_BUFFER_DATA (buffer) = (guint8 *) g_string_free (data, FALSE);
-  GST_BUFFER_MALLOCDATA (buffer) = GST_BUFFER_DATA (buffer);
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (0, bdata, g_free, bsize, 0, bsize));
 
   return buffer;
 }
index 6dabddd..f1f2e4a 100644 (file)
@@ -96,37 +96,57 @@ guint
 gst_tag_get_id3v2_tag_size (GstBuffer * buffer)
 {
   guint8 *data, flags;
-  guint size;
+  gsize size;
+  guint result = 0;
 
   g_return_val_if_fail (buffer != NULL, 0);
 
-  if (GST_BUFFER_SIZE (buffer) < ID3V2_HDR_SIZE)
-    return 0;
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
 
-  data = GST_BUFFER_DATA (buffer);
+  if (size < ID3V2_HDR_SIZE)
+    goto too_small;
 
   /* Check for 'ID3' string at start of buffer */
-  if (data[0] != 'I' || data[1] != 'D' || data[2] != '3') {
-    GST_DEBUG ("No ID3v2 tag in data");
-    return 0;
-  }
+  if (data[0] != 'I' || data[1] != 'D' || data[2] != '3')
+    goto no_tag;
 
   /* Read the flags */
   flags = data[5];
 
   /* Read the size from the header */
-  size = id3v2_read_synch_uint (data + 6, 4);
-  if (size == 0)
-    return ID3V2_HDR_SIZE;
+  result = id3v2_read_synch_uint (data + 6, 4);
+  if (result == 0)
+    goto empty;
 
-  size += ID3V2_HDR_SIZE;
+  result += ID3V2_HDR_SIZE;
 
   /* Expand the read size to include a footer if there is one */
   if ((flags & ID3V2_HDR_FLAG_FOOTER))
-    size += 10;
+    result += 10;
 
-  GST_DEBUG ("ID3v2 tag, size: %u bytes", size);
-  return size;
+  GST_DEBUG ("ID3v2 tag, size: %u bytes", result);
+
+done:
+  gst_buffer_unmap (buffer, data, size);
+
+  return result;
+
+too_small:
+  {
+    GST_DEBUG ("size too small");
+    goto done;
+  }
+no_tag:
+  {
+    GST_DEBUG ("No ID3v2 tag in data");
+    goto done;
+  }
+empty:
+  {
+    GST_DEBUG ("Empty tag size");
+    result = ID3V2_HDR_SIZE;
+    goto done;
+  }
 }
 
 guint8 *
@@ -174,6 +194,7 @@ gst_tag_list_from_id3v2_tag (GstBuffer * buffer)
 {
   guint8 *data, *uu_data = NULL;
   guint read_size;
+  gsize size;
   ID3TagsWorking work;
   guint8 flags;
   guint16 version;
@@ -184,7 +205,7 @@ gst_tag_list_from_id3v2_tag (GstBuffer * buffer)
   if (read_size < ID3V2_HDR_SIZE)
     return NULL;
 
-  data = GST_BUFFER_DATA (buffer);
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
 
   /* Read the version */
   version = GST_READ_UINT16_BE (data + 3);
@@ -193,12 +214,8 @@ gst_tag_list_from_id3v2_tag (GstBuffer * buffer)
   flags = data[5];
 
   /* Validate the version. At the moment, we only support up to 2.4.0 */
-  if (ID3V2_VER_MAJOR (version) > 4 || ID3V2_VER_MINOR (version) > 0) {
-    GST_WARNING ("ID3v2 tag is from revision 2.%d.%d, "
-        "but decoder only supports 2.%d.%d. Ignoring as per spec.",
-        version >> 8, version & 0xff, ID3V2_VERSION >> 8, ID3V2_VERSION & 0xff);
-    return NULL;
-  }
+  if (ID3V2_VER_MAJOR (version) > 4 || ID3V2_VER_MINOR (version) > 0)
+    goto wrong_version;
 
   GST_DEBUG ("ID3v2 header flags: %s %s %s %s",
       (flags & ID3V2_HDR_FLAG_UNSYNC) ? "UNSYNC" : "",
@@ -207,25 +224,20 @@ gst_tag_list_from_id3v2_tag (GstBuffer * buffer)
       (flags & ID3V2_HDR_FLAG_FOOTER) ? "FOOTER" : "");
 
   /* This shouldn't really happen! Caller should have checked first */
-  if (GST_BUFFER_SIZE (buffer) < read_size) {
-    GST_DEBUG
-        ("Found ID3v2 tag with revision 2.%d.%d - need %u more bytes to read",
-        version >> 8, version & 0xff,
-        (guint) (read_size - GST_BUFFER_SIZE (buffer)));
-    return NULL;
-  }
+  if (size < read_size)
+    goto not_enough_data;
 
   GST_DEBUG ("Reading ID3v2 tag with revision 2.%d.%d of size %u", version >> 8,
       version & 0xff, read_size);
 
-  GST_MEMDUMP ("ID3v2 tag", GST_BUFFER_DATA (buffer), read_size);
+  GST_MEMDUMP ("ID3v2 tag", data, read_size);
 
   memset (&work, 0, sizeof (ID3TagsWorking));
   work.buffer = buffer;
   work.hdr.version = version;
   work.hdr.size = read_size;
   work.hdr.flags = flags;
-  work.hdr.frame_data = GST_BUFFER_DATA (buffer) + ID3V2_HDR_SIZE;
+  work.hdr.frame_data = data + ID3V2_HDR_SIZE;
   if (flags & ID3V2_HDR_FLAG_FOOTER)
     work.hdr.frame_data_size = read_size - ID3V2_HDR_SIZE - 10;
   else
@@ -246,7 +258,27 @@ gst_tag_list_from_id3v2_tag (GstBuffer * buffer)
 
   g_free (uu_data);
 
+  gst_buffer_unmap (buffer, data, size);
+
   return work.tags;
+
+  /* ERRORS */
+wrong_version:
+  {
+    GST_WARNING ("ID3v2 tag is from revision 2.%d.%d, "
+        "but decoder only supports 2.%d.%d. Ignoring as per spec.",
+        version >> 8, version & 0xff, ID3V2_VERSION >> 8, ID3V2_VERSION & 0xff);
+    gst_buffer_unmap (buffer, data, size);
+    return NULL;
+  }
+not_enough_data:
+  {
+    GST_DEBUG
+        ("Found ID3v2 tag with revision 2.%d.%d - need %u more bytes to read",
+        version >> 8, version & 0xff, (guint) (read_size - size));
+    gst_buffer_unmap (buffer, data, size);
+    return NULL;
+  }
 }
 
 static guint
@@ -365,9 +397,11 @@ static void
 id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
 {
   GstBuffer *blob;
-  GstCaps *caps;
   guint8 *frame_data;
+#if 0
+  GstCaps *caps;
   gchar *media_type;
+#endif
   guint frame_size, header_size;
   guint i;
 
@@ -388,7 +422,7 @@ id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
   frame_size = size + header_size;
 
   blob = gst_buffer_new_and_alloc (frame_size);
-  memcpy (GST_BUFFER_DATA (blob), frame_data, frame_size);
+  gst_buffer_fill (blob, 0, frame_data, frame_size);
 
   /* Sanitize frame id */
   for (i = 0; i < 4; i++) {
@@ -396,6 +430,7 @@ id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
       frame_data[i] = '_';
   }
 
+#if 0
   media_type = g_strdup_printf ("application/x-gst-id3v2-%c%c%c%c-frame",
       g_ascii_tolower (frame_data[0]), g_ascii_tolower (frame_data[1]),
       g_ascii_tolower (frame_data[2]), g_ascii_tolower (frame_data[3]));
@@ -404,6 +439,7 @@ id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
   gst_buffer_set_caps (blob, caps);
   gst_caps_unref (caps);
   g_free (media_type);
+#endif
 
   /* gst_util_dump_mem (GST_BUFFER_DATA (blob), GST_BUFFER_SIZE (blob)); */
 
@@ -416,7 +452,6 @@ static gboolean
 id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size)
 {
   guint frame_hdr_size;
-  guint8 *start;
 
   /* Extended header if present */
   if (work->hdr.flags & ID3V2_HDR_FLAG_EXTHDR) {
@@ -438,7 +473,6 @@ id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size)
     work->hdr.frame_data_size -= work->hdr.ext_hdr_size;
   }
 
-  start = GST_BUFFER_DATA (work->buffer);
   frame_hdr_size = id3v2_frame_hdr_size (work->hdr.version);
   if (work->hdr.frame_data_size <= frame_hdr_size) {
     GST_DEBUG ("Tag has no data frames. Broken tag");
@@ -520,6 +554,7 @@ id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size)
         }
     }
 #if 1
+#if 0
     GST_LOG
         ("Frame @ %ld (0x%02lx) id %s size %u, next=%ld (0x%02lx) obsolete=%d",
         (glong) (work->hdr.frame_data - start),
@@ -527,6 +562,7 @@ id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size)
         (glong) (work->hdr.frame_data + frame_hdr_size + frame_size - start),
         (glong) (work->hdr.frame_data + frame_hdr_size + frame_size - start),
         obsolete_id);
+#endif
 #define flag_string(flag,str) \
         ((frame_flags & (flag)) ? (str) : "")
     GST_LOG ("Frame header flags: 0x%04x %s %s %s %s %s %s %s", frame_flags,
index ba8f878..65fddd1 100644 (file)
@@ -463,7 +463,12 @@ GList *                 gst_tag_to_vorbis_comments              (const GstTagLis
                                                                  const gchar *          tag);
 
 /* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
-GstTagList *            gst_tag_list_from_vorbiscomment_buffer  (const GstBuffer *      buffer,
+GstTagList *            gst_tag_list_from_vorbiscomment         (const guint8 *         data,
+                                                                 gsize                  size,
+                                                                 const guint8 *         id_data,
+                                                                 const guint            id_data_length,
+                                                                 gchar **               vendor_string);
+GstTagList *            gst_tag_list_from_vorbiscomment_buffer  (GstBuffer *            buffer,
                                                                  const guint8 *         id_data,
                                                                  const guint            id_data_length,
                                                                  gchar **               vendor_string);
@@ -497,7 +502,7 @@ GstTagList *            gst_tag_list_from_id3v2_tag (GstBuffer * buffer);
 guint                   gst_tag_get_id3v2_tag_size  (GstBuffer * buffer);
 
 /* functions to  convert GstBuffers with xmp packets contents to GstTagLists and back */
-GstTagList *            gst_tag_list_from_xmp_buffer  (const GstBuffer *  buffer);
+GstTagList *            gst_tag_list_from_xmp_buffer  (GstBuffer *  buffer);
 GstBuffer *             gst_tag_list_to_xmp_buffer    (const GstTagList * list,
                                                        gboolean           read_only);
 GstBuffer *            gst_tag_list_to_xmp_buffer_full (const GstTagList * list,
@@ -511,12 +516,12 @@ GstBuffer *             gst_tag_list_to_exif_buffer (const GstTagList * taglist,
 
 GstBuffer *             gst_tag_list_to_exif_buffer_with_tiff_header (const GstTagList * taglist);
 
-GstTagList *            gst_tag_list_from_exif_buffer (const GstBuffer * buffer,
+GstTagList *            gst_tag_list_from_exif_buffer (GstBuffer * buffer,
                                                        gint byte_order,
                                                        guint32 base_offset);
 
 GstTagList *            gst_tag_list_from_exif_buffer_with_tiff_header (
-                                                      const GstBuffer * buffer);
+                                                      GstBuffer * buffer);
 
 /* other tag-related functions */
 
index f89b348..ed05e1b 100644 (file)
@@ -566,10 +566,9 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data,
     guint image_data_len, GstTagImageType image_type)
 {
   const gchar *name;
-
   GstBuffer *image;
-
   GstCaps *caps;
+  guint8 *data;
 
   g_return_val_if_fail (image_data != NULL, NULL);
   g_return_val_if_fail (image_data_len > 0, NULL);
@@ -578,14 +577,14 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data,
   GST_DEBUG ("image data len: %u bytes", image_data_len);
 
   /* allocate space for a NUL terminator for an uri too */
-  image = gst_buffer_try_new_and_alloc (image_data_len + 1);
-  if (image == NULL) {
-    GST_WARNING ("failed to allocate buffer of %d for image", image_data_len);
-    return NULL;
-  }
+  image = gst_buffer_new_and_alloc (image_data_len + 1);
+  if (image == NULL)
+    goto alloc_failed;
 
-  memcpy (GST_BUFFER_DATA (image), image_data, image_data_len);
-  GST_BUFFER_DATA (image)[image_data_len] = '\0';
+  data = gst_buffer_map (image, NULL, NULL, GST_MAP_WRITE);
+  memcpy (data, image_data, image_data_len);
+  data[image_data_len] = '\0';
+  gst_buffer_unmap (image, data, image_data_len + 1);
 
   /* Find GStreamer media type, can't trust declared type */
   caps = gst_type_find_helper_for_buffer (NULL, image, NULL);
@@ -609,7 +608,7 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data,
    * to keep the original size of the image
    */
   if (!g_str_equal (name, "text/uri-list"))
-    GST_BUFFER_SIZE (image) = image_data_len;
+    gst_buffer_set_size (image, image_data_len);
 
   if (image_type != GST_TAG_IMAGE_TYPE_NONE) {
     GST_LOG ("Setting image type: %d", image_type);
@@ -618,8 +617,9 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data,
         image_type, NULL);
   }
 
-  gst_buffer_set_caps (image, caps);
+  g_warning ("extra image data can't be set");
   gst_caps_unref (caps);
+
   return image;
 
 /* ERRORS */
@@ -636,4 +636,11 @@ error:
       gst_caps_unref (caps);
     return NULL;
   }
+alloc_failed:
+  {
+    GST_WARNING ("failed to allocate buffer of %d for image", image_data_len);
+    gst_buffer_unref (image);
+    return NULL;
+  }
+
 }
index 21ce6e4..15b0c60 100644 (file)
@@ -13,12 +13,12 @@ lib_LTLIBRARIES = libgstvideo-@GST_MAJORMINOR@.la
 CLEANFILES = $(BUILT_SOURCES)
 
 libgstvideo_@GST_MAJORMINOR@_la_SOURCES = \
-       video.c gstvideosink.c gstvideofilter.c convertframe.c
+       video.c gstvideosink.c gstvideofilter.c convertframe.c gstmetavideo.c gstvideopool.c
 nodist_libgstvideo_@GST_MAJORMINOR@_la_SOURCES = $(BUILT_SOURCES)
 
 libgstvideo_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/video
 libgstvideo_@GST_MAJORMINOR@include_HEADERS = \
-       video.h gstvideosink.h gstvideofilter.h
+       video.h gstvideosink.h gstvideofilter.h gstmetavideo.h gstvideopool.h
 nodist_libgstvideo_@GST_MAJORMINOR@include_HEADERS = $(built_headers)
 
 libgstvideo_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
@@ -44,6 +44,7 @@ GstVideo-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstvideo-@GST_MAJORMI
                --nsversion=@GST_MAJORMINOR@ \
                --strip-prefix=Gst \
                $(gir_cincludes) \
+               -DGST_USE_UNSTABLE_API \
                -I$(top_srcdir)/gst-libs \
                -I$(top_builddir)/gst-libs \
                --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_MAJORMINOR@` \
index 58dc426..a71efd8 100644 (file)
@@ -120,7 +120,7 @@ build_convert_frame_pipeline (GstElement ** src_element,
   /* videoscale is here to correct for the pixel-aspect-ratio for us */
   GST_DEBUG ("creating elements");
   if (!create_element ("appsrc", &src, &error) ||
-      !create_element ("ffmpegcolorspace", &csp, &error) ||
+      !create_element ("videoconvert", &csp, &error) ||
       !create_element ("videoscale", &vscale, &error) ||
       !create_element ("appsink", &sink, &error))
     goto no_elements;
@@ -233,6 +233,7 @@ link_failed:
 /**
  * gst_video_convert_frame:
  * @buf: a #GstBuffer
+ * @from_caps: the #GstCaps to convert from
  * @to_caps: the #GstCaps to convert to
  * @timeout: the maximum amount of time allowed for the processing.
  * @error: pointer to a #GError. Can be %NULL.
@@ -250,23 +251,21 @@ link_failed:
  *
  */
 GstBuffer *
-gst_video_convert_frame (GstBuffer * buf, const GstCaps * to_caps,
-    GstClockTime timeout, GError ** error)
+gst_video_convert_frame (GstBuffer * buf, GstCaps * from_caps,
+    const GstCaps * to_caps, GstClockTime timeout, GError ** error)
 {
   GstMessage *msg;
   GstBuffer *result = NULL;
   GError *err = NULL;
   GstBus *bus;
-  GstCaps *from_caps, *to_caps_copy = NULL;
+  GstCaps *to_caps_copy = NULL;
   GstFlowReturn ret;
   GstElement *pipeline, *src, *sink;
   guint i, n;
 
   g_return_val_if_fail (buf != NULL, NULL);
   g_return_val_if_fail (to_caps != NULL, NULL);
-  g_return_val_if_fail (GST_BUFFER_CAPS (buf) != NULL, NULL);
-
-  from_caps = GST_BUFFER_CAPS (buf);
+  g_return_val_if_fail (from_caps != NULL, NULL);
 
   to_caps_copy = gst_caps_new_empty ();
   n = gst_caps_get_size (to_caps);
@@ -290,8 +289,8 @@ gst_video_convert_frame (GstBuffer * buf, const GstCaps * to_caps,
   gst_element_set_state (pipeline, GST_STATE_PAUSED);
 
   /* feed buffer in appsrc */
-  GST_DEBUG ("feeding buffer %p, size %u, caps %" GST_PTR_FORMAT,
-      buf, GST_BUFFER_SIZE (buf), from_caps);
+  GST_DEBUG ("feeding buffer %p, size %" G_GSIZE_FORMAT ", caps %"
+      GST_PTR_FORMAT, buf, gst_buffer_get_size (buf), from_caps);
   g_signal_emit_by_name (src, "push-buffer", buf, &ret);
 
   /* now see what happens. We either got an error somewhere or the pipeline
@@ -597,14 +596,15 @@ done:
  *
  */
 void
-gst_video_convert_frame_async (GstBuffer * buf, const GstCaps * to_caps,
-    GstClockTime timeout, GstVideoConvertFrameCallback callback,
-    gpointer user_data, GDestroyNotify destroy_notify)
+gst_video_convert_frame_async (GstBuffer * buf, GstCaps * from_caps,
+    const GstCaps * to_caps, GstClockTime timeout,
+    GstVideoConvertFrameCallback callback, gpointer user_data,
+    GDestroyNotify destroy_notify)
 {
   GMainContext *context = NULL;
   GError *error = NULL;
   GstBus *bus;
-  GstCaps *from_caps, *to_caps_copy = NULL;
+  GstCaps *to_caps_copy = NULL;
   GstElement *pipeline, *src, *sink;
   guint i, n;
   GSource *source;
@@ -612,7 +612,7 @@ gst_video_convert_frame_async (GstBuffer * buf, const GstCaps * to_caps,
 
   g_return_if_fail (buf != NULL);
   g_return_if_fail (to_caps != NULL);
-  g_return_if_fail (GST_BUFFER_CAPS (buf) != NULL);
+  g_return_if_fail (from_caps != NULL);
   g_return_if_fail (callback != NULL);
 
   context = g_main_context_get_thread_default ();
@@ -620,8 +620,6 @@ gst_video_convert_frame_async (GstBuffer * buf, const GstCaps * to_caps,
   if (!context)
     context = g_main_context_default ();
 
-  from_caps = GST_BUFFER_CAPS (buf);
-
   to_caps_copy = gst_caps_new_empty ();
   n = gst_caps_get_size (to_caps);
   for (i = 0; i < n; i++) {
diff --git a/gst-libs/gst/video/gstmetavideo.c b/gst-libs/gst/video/gstmetavideo.c
new file mode 100644 (file)
index 0000000..574fd76
--- /dev/null
@@ -0,0 +1,223 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gstmetavideo.h"
+
+/* video metadata */
+const GstMetaInfo *
+gst_meta_video_get_info (void)
+{
+  static const GstMetaInfo *meta_video_info = NULL;
+
+  if (meta_video_info == NULL) {
+    meta_video_info = gst_meta_register (GST_META_API_VIDEO, "GstMetaVideo",
+        sizeof (GstMetaVideo),
+        (GstMetaInitFunction) NULL,
+        (GstMetaFreeFunction) NULL,
+        (GstMetaCopyFunction) NULL, (GstMetaTransformFunction) NULL);
+  }
+  return meta_video_info;
+}
+
+/**
+ * gst_buffer_add_meta_video:
+ * @buffer: a #GstBuffer
+ * @flags: #GstVideoFlags
+ * @format: a #GstVideoFormat
+ * @width: the width
+ * @height: the height
+ *
+ * Attaches GstVideoMeta metadata to @buffer with the given parameters and the
+ * default offsets and strides for @format and @width x @height.
+ *
+ * This function calculates the default offsets and strides and then calls
+ * gst_buffer_add_meta_video_full() with them.
+ *
+ * Returns: the #GstMetaVideo on @buffer.
+ */
+GstMetaVideo *
+gst_buffer_add_meta_video (GstBuffer * buffer, GstVideoFlags flags,
+    GstVideoFormat format, guint width, guint height)
+{
+  GstMetaVideo *meta;
+  GstVideoInfo info;
+
+  gst_video_info_set_format (&info, format, width, height);
+
+  meta = gst_buffer_add_meta_video_full (buffer, flags, format, width, height,
+      info.finfo->n_planes, info.offset, info.stride);
+
+  return meta;
+}
+
+/**
+ * gst_buffer_add_meta_video_full:
+ * @buffer: a #GstBuffer
+ * @flags: #GstVideoFlags
+ * @format: a #GstVideoFormat
+ * @width: the width
+ * @height: the height
+ * @n_planes: number of planes
+ * @offset: offset of each plane
+ * @stride: stride of each plane
+ *
+ * Attaches GstVideoMeta metadata to @buffer with the given parameters.
+ *
+ * Returns: the #GstMetaVideo on @buffer.
+ */
+GstMetaVideo *
+gst_buffer_add_meta_video_full (GstBuffer * buffer, GstVideoFlags flags,
+    GstVideoFormat format, guint width, guint height,
+    guint n_planes, gsize offset[GST_VIDEO_MAX_PLANES],
+    gint stride[GST_VIDEO_MAX_PLANES])
+{
+  GstMetaVideo *meta;
+  guint i;
+
+  meta =
+      (GstMetaVideo *) gst_buffer_add_meta (buffer, GST_META_INFO_VIDEO, NULL);
+
+  meta->flags = flags;
+  meta->format = format;
+  meta->width = width;
+  meta->height = height;
+  meta->buffer = buffer;
+
+  meta->n_planes = n_planes;
+  for (i = 0; i < n_planes; i++) {
+    meta->offset[i] = offset[i];
+    meta->stride[i] = stride[i];
+  }
+  return meta;
+}
+
+static GstMemory *
+find_mem_for_offset (GstBuffer * buffer, guint * offset, GstMapFlags flags)
+{
+  guint n, i;
+  GstMemory *res = NULL;
+
+  n = gst_buffer_n_memory (buffer);
+  for (i = 0; i < n; i++) {
+    GstMemory *mem = NULL;
+    gsize size;
+
+    mem = gst_buffer_peek_memory (buffer, i, flags);
+    size = gst_memory_get_sizes (mem, NULL, NULL);
+
+    if (*offset < size) {
+      res = mem;
+      break;
+    }
+    *offset -= size;
+  }
+  return res;
+}
+
+/**
+ * gst_meta_video_map:
+ * @meta: a #GstVideoMeta
+ * @plane: a plane
+ * @stride: result stride
+ * @flags: @GstMapFlags
+ *
+ * Map the video plane with index @plane in @meta and return a pointer to the
+ * first byte of the plane and the stride of the plane.
+ *
+ * Returns: a pointer to the first byte of the plane data
+ */
+gpointer
+gst_meta_video_map (GstMetaVideo * meta, guint plane, gint * stride,
+    GstMapFlags flags)
+{
+  guint offset;
+  gboolean write;
+  GstBuffer *buffer;
+  GstMemory *mem;
+  guint8 *base;
+
+  g_return_val_if_fail (meta != NULL, NULL);
+  g_return_val_if_fail (plane < meta->n_planes, NULL);
+  g_return_val_if_fail (stride != NULL, NULL);
+
+  buffer = meta->buffer;
+  g_return_val_if_fail (buffer != NULL, NULL);
+
+  write = (flags & GST_MAP_WRITE) != 0;
+  g_return_val_if_fail (!write || gst_buffer_is_writable (buffer), NULL);
+
+  offset = meta->offset[plane];
+  *stride = meta->stride[plane];
+  /* find the memory block for this plane, this is the memory block containing
+   * the plane offset */
+  mem = find_mem_for_offset (buffer, &offset, flags);
+
+  base = gst_memory_map (mem, NULL, NULL, flags);
+
+  /* move to the right offset inside the block */
+  return base + offset;
+}
+
+/**
+ * gst_meta_video_unmap:
+ * @meta: a #GstVideoMeta
+ * @plane: a plane
+ * @data: the data to unmap
+ *
+ * Unmap previously mapped data with gst_video_meta_map().
+ *
+ * Returns: TRUE if the memory was successfully unmapped.
+ */
+gboolean
+gst_meta_video_unmap (GstMetaVideo * meta, guint plane, gpointer data)
+{
+  guint offset;
+  GstBuffer *buffer;
+  GstMemory *mem;
+  guint8 *base;
+
+  g_return_val_if_fail (meta != NULL, FALSE);
+  g_return_val_if_fail (plane < meta->n_planes, FALSE);
+
+  buffer = meta->buffer;
+  g_return_val_if_fail (buffer != NULL, FALSE);
+
+  offset = meta->offset[plane];
+  mem = find_mem_for_offset (buffer, &offset, GST_MAP_READ);
+  base = data;
+
+  gst_memory_unmap (mem, base - offset, -1);
+
+  return TRUE;
+}
+
+const GstMetaInfo *
+gst_meta_video_crop_get_info (void)
+{
+  static const GstMetaInfo *meta_video_crop_info = NULL;
+
+  if (meta_video_crop_info == NULL) {
+    meta_video_crop_info =
+        gst_meta_register (GST_META_API_VIDEO_CROP, "GstMetaVideoCrop",
+        sizeof (GstMetaVideoCrop), (GstMetaInitFunction) NULL,
+        (GstMetaFreeFunction) NULL, (GstMetaCopyFunction) NULL,
+        (GstMetaTransformFunction) NULL);
+  }
+  return meta_video_crop_info;
+}
diff --git a/gst-libs/gst/video/gstmetavideo.h b/gst-libs/gst/video/gstmetavideo.h
new file mode 100644 (file)
index 0000000..e88b0b5
--- /dev/null
@@ -0,0 +1,108 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_META_VIDEO_H__
+#define __GST_META_VIDEO_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+#define GST_META_API_VIDEO   "GstMetaVideo"
+#define GST_META_INFO_VIDEO  (gst_meta_video_get_info())
+typedef struct _GstMetaVideo GstMetaVideo;
+
+#define GST_META_API_VIDEO_CROP   "GstMetaVideoCrop"
+#define GST_META_INFO_VIDEO_CROP  (gst_meta_video_crop_get_info())
+typedef struct _GstMetaVideoCrop GstMetaVideoCrop;
+
+/**
+ * GstMetaVideo:
+ * @meta: parent #GstMeta
+ * @flags: additional video flags
+ * @n_planes: the number of planes in the image
+ * @offset: array of offsets for the planes
+ * @stride: array of strides for the planes
+ * @map: map the memory of a plane
+ * @unmap: unmap the memory of a plane
+ *
+ * Extra buffer metadata describing image properties
+ */
+struct _GstMetaVideo {
+  GstMeta            meta;
+
+  GstBuffer         *buffer;
+
+  GstVideoFlags      flags;
+  GstVideoFormat     format;
+  guint              width;
+  guint              height;
+
+  guint              n_planes;
+  gsize              offset[GST_VIDEO_MAX_PLANES];
+  gint               stride[GST_VIDEO_MAX_PLANES];
+
+  gpointer (*map)    (GstMetaVideo *meta, guint plane, gint *stride,
+                      GstMapFlags flags);
+  gboolean (*unmap)  (GstMetaVideo *meta, guint plane, gpointer data);
+};
+
+const GstMetaInfo * gst_meta_video_get_info (void);
+
+#define gst_buffer_get_meta_video(b) ((GstMetaVideo*)gst_buffer_get_meta((b),GST_META_INFO_VIDEO))
+GstMetaVideo * gst_buffer_add_meta_video       (GstBuffer *buffer, GstVideoFlags flags,
+                                                GstVideoFormat format, guint width, guint height);
+GstMetaVideo * gst_buffer_add_meta_video_full  (GstBuffer *buffer, GstVideoFlags flags,
+                                                GstVideoFormat format, guint width, guint height,
+                                                guint n_planes, gsize offset[GST_VIDEO_MAX_PLANES],
+                                                gint stride[GST_VIDEO_MAX_PLANES]);
+
+gpointer       gst_meta_video_map        (GstMetaVideo *meta, guint plane, gint *stride,
+                                          GstMapFlags flags);
+gboolean       gst_meta_video_unmap      (GstMetaVideo *meta, guint plane, gpointer data);
+
+/**
+ * GstMetaVideoCrop:
+ * @meta: parent #GstMeta
+ * @x: the horizontal offset
+ * @y: the vertical offset
+ * @width: the cropped width
+ * @height: the cropped height
+ *
+ * Extra buffer metadata describing image cropping.
+ */
+struct _GstMetaVideoCrop {
+  GstMeta       meta;
+
+  guint         x;
+  guint         y;
+  guint         width;
+  guint         height;
+};
+
+const GstMetaInfo * gst_meta_video_crop_get_info (void);
+
+#define gst_buffer_get_meta_video_crop(b) ((GstMetaVideoCrop*)gst_buffer_get_meta((b),GST_META_INFO_VIDEO_CROP))
+#define gst_buffer_add_meta_video_crop(b) ((GstMetaVideoCrop*)gst_buffer_add_meta((b),GST_META_INFO_VIDEO_CROP, NULL))
+
+G_END_DECLS
+
+#endif /* __GST_META_VIDEO_H__ */
index 2d08a60..16b0cb2 100644 (file)
@@ -75,20 +75,19 @@ gst_video_filter_get_type (void)
 
 static gboolean
 gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
-    guint * size)
+    gsize * size)
 {
-  GstVideoFormat fmt;
-  gint width, height;
+  GstVideoInfo info;
 
-  if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) {
+  if (!gst_video_info_from_caps (&info, caps)) {
     GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps);
     return FALSE;
   }
 
-  *size = gst_video_format_get_size (fmt, width, height);
+  *size = info.size;
 
-  GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %"
-      GST_PTR_FORMAT, *size, caps);
+  GST_DEBUG_OBJECT (btrans, "Returning size %" G_GSIZE_FORMAT " bytes"
+      "for caps %" GST_PTR_FORMAT, *size, caps);
 
   return TRUE;
 }
diff --git a/gst-libs/gst/video/gstvideopool.c b/gst-libs/gst/video/gstvideopool.c
new file mode 100644 (file)
index 0000000..435a327
--- /dev/null
@@ -0,0 +1,74 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gst/video/gstvideopool.h"
+
+/**
+ * gst_buffer_pool_config_set_video_alignment:
+ * @config: a #GstStructure
+ * @align: a #GstVideoAlignment
+ *
+ * Set the video alignment in @align to the bufferpool configuration
+ * @config
+ */
+void
+gst_buffer_pool_config_set_video_alignment (GstStructure * config,
+    GstVideoAlignment * align)
+{
+  g_return_if_fail (config != NULL);
+  g_return_if_fail (align != NULL);
+
+  gst_structure_set (config,
+      "padding-top", G_TYPE_UINT, align->padding_top,
+      "padding-bottom", G_TYPE_UINT, align->padding_bottom,
+      "padding-left", G_TYPE_UINT, align->padding_left,
+      "padding-right", G_TYPE_UINT, align->padding_right,
+      "stride-align0", G_TYPE_UINT, align->stride_align[0],
+      "stride-align1", G_TYPE_UINT, align->stride_align[1],
+      "stride-align2", G_TYPE_UINT, align->stride_align[2],
+      "stride-align3", G_TYPE_UINT, align->stride_align[3], NULL);
+}
+
+/**
+ * gst_buffer_pool_config_get_video_alignment:
+ * @config: a #GstStructure
+ * @align: a #GstVideoAlignment
+ *
+ * Get the video alignment from the bufferpool configuration @config in
+ * in @align
+ *
+ * Returns: #TRUE if @config could be parsed correctly.
+ */
+gboolean
+gst_buffer_pool_config_get_video_alignment (GstStructure * config,
+    GstVideoAlignment * align)
+{
+  g_return_val_if_fail (config != NULL, FALSE);
+  g_return_val_if_fail (align != NULL, FALSE);
+
+  return gst_structure_get (config,
+      "padding-top", G_TYPE_UINT, &align->padding_top,
+      "padding-bottom", G_TYPE_UINT, &align->padding_bottom,
+      "padding-left", G_TYPE_UINT, &align->padding_left,
+      "padding-right", G_TYPE_UINT, &align->padding_right,
+      "stride-align0", G_TYPE_UINT, &align->stride_align[0],
+      "stride-align1", G_TYPE_UINT, &align->stride_align[1],
+      "stride-align2", G_TYPE_UINT, &align->stride_align[2],
+      "stride-align3", G_TYPE_UINT, &align->stride_align[3], NULL);
+}
diff --git a/gst-libs/gst/video/gstvideopool.h b/gst-libs/gst/video/gstvideopool.h
new file mode 100644 (file)
index 0000000..179c724
--- /dev/null
@@ -0,0 +1,74 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VIDEO_POOL_H__
+#define __GST_VIDEO_POOL_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_BUFFER_POOL_OPTION_META_VIDEO:
+ *
+ * An option that can be activated on bufferpool to request video metadata
+ * on buffers from the pool.
+ */
+#define GST_BUFFER_POOL_OPTION_META_VIDEO "GstBufferPoolOptionMetaVideo"
+
+/**
+ * GST_BUFFER_POOL_OPTION_VIDEO_LAYOUT:
+ *
+ * A bufferpool option to enable extra padding. When a bufferpool supports this
+ * option, gst_buffer_pool_set_video_alignment() can be called.
+ */
+#define GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT "GstBufferPoolOptionVideoAlignment"
+
+typedef struct _GstVideoAlignment GstVideoAlignment;
+
+/**
+ * GstVideoAlignment:
+ * @padding_left: extra pixels on the left side
+ * @padding_right: extra pixels on the right side
+ * @padding_top: extra pixels on the top
+ * @padding_bottom: extra pixels on the bottom
+ * @stride_align: array with extra alignment requirements for the strides
+ *
+ * Extra alignment paramters for the memory of video buffers. This
+ * structure is usually used to configure the bufferpool if it supports the
+ * #GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.
+ */
+struct _GstVideoAlignment
+{
+  guint padding_top;
+  guint padding_bottom;
+  guint padding_left;
+  guint padding_right;
+  guint stride_align[GST_VIDEO_MAX_PLANES];
+};
+
+void             gst_buffer_pool_config_set_video_alignment  (GstStructure *config, GstVideoAlignment *align);
+gboolean         gst_buffer_pool_config_get_video_alignment  (GstStructure *config, GstVideoAlignment *align);
+
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_POOL_H__ */
index 4b64cfc..d860340 100644 (file)
 #  include "config.h"
 #endif
 
+#include <string.h>
+
 #include "video.h"
+#include "gstmetavideo.h"
+
+static int fill_planes (GstVideoInfo * info);
+
+typedef struct
+{
+  guint32 fourcc;
+  GstVideoFormatInfo info;
+} VideoFormat;
+
+/* depths: bits, n_components, shift, depth */
+#define DPTH0            0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
+#define DPTH8            8, 1, { 0, 0, 0, 0 }, { 8, 0, 0, 0 }
+#define DPTH888          8, 3, { 0, 0, 0, 0 }, { 8, 8, 8, 0 }
+#define DPTH8888         8, 4, { 0, 0, 0, 0 }, { 8, 8, 8, 8 }
+#define DPTH10_10_10     10, 3, { 0, 0, 0, 0 }, { 10, 10, 10, 0 }
+#define DPTH16           16, 1, { 0, 0, 0, 0 }, { 16, 0, 0, 0 }
+#define DPTH16_16_16     16, 3, { 0, 0, 0, 0 }, { 16, 16, 16, 0 }
+#define DPTH16_16_16_16  16, 4, { 0, 0, 0, 0 }, { 16, 16, 16, 16 }
+#define DPTH555          16, 3, { 10, 5, 0, 0 }, { 5, 5, 5, 0 }
+#define DPTH565          16, 3, { 11, 5, 0, 0 }, { 5, 6, 5, 0 }
+
+/* pixel strides */
+#define PSTR0             { 0, 0, 0, 0 }
+#define PSTR1             { 1, 0, 0, 0 }
+#define PSTR111           { 1, 1, 1, 0 }
+#define PSTR1111          { 1, 1, 1, 1 }
+#define PSTR122           { 1, 2, 2, 0 }
+#define PSTR2             { 2, 0, 0, 0 }
+#define PSTR222           { 2, 2, 2, 0 }
+#define PSTR244           { 2, 4, 4, 0 }
+#define PSTR444           { 4, 4, 4, 0 }
+#define PSTR4444          { 4, 4, 4, 4 }
+#define PSTR333           { 3, 3, 3, 0 }
+#define PSTR488           { 4, 8, 8, 0 }
+#define PSTR8888          { 8, 8, 8, 8 }
+
+/* planes */
+#define PLANE_NA          0, { 0, 0, 0, 0 }
+#define PLANE0            1, { 0, 0, 0, 0 }
+#define PLANE011          2, { 0, 1, 1, 0 }
+#define PLANE012          3, { 0, 1, 2, 0 }
+#define PLANE0123         4, { 0, 1, 2, 3 }
+#define PLANE021          3, { 0, 2, 1, 0 }
+
+/* offsets */
+#define OFFS0             { 0, 0, 0, 0 }
+#define OFFS013           { 0, 1, 3, 0 }
+#define OFFS102           { 1, 0, 2, 0 }
+#define OFFS1230          { 1, 2, 3, 0 }
+#define OFFS012           { 0, 1, 2, 0 }
+#define OFFS210           { 2, 1, 0, 0 }
+#define OFFS123           { 1, 2, 3, 0 }
+#define OFFS321           { 3, 2, 1, 0 }
+#define OFFS0123          { 0, 1, 2, 3 }
+#define OFFS2103          { 2, 1, 0, 3 }
+#define OFFS3210          { 3, 2, 1, 0 }
+#define OFFS031           { 0, 3, 1, 0 }
+#define OFFS026           { 0, 2, 6, 0 }
+#define OFFS001           { 0, 0, 1, 0 }
+#define OFFS010           { 0, 1, 0, 0 }
+#define OFFS104           { 1, 0, 4, 0 }
+#define OFFS2460          { 2, 4, 6, 0 }
+
+/* subsampling */
+#define SUB410            { 0, 2, 2, 0 }, { 0, 2, 2, 0 }
+#define SUB411            { 0, 2, 2, 0 }, { 0, 0, 0, 0 }
+#define SUB420            { 0, 1, 1, 0 }, { 0, 1, 1, 0 }
+#define SUB422            { 0, 1, 1, 0 }, { 0, 0, 0, 0 }
+#define SUB4              { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
+#define SUB444            { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
+#define SUB4444           { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
+#define SUB4204           { 0, 1, 1, 0 }, { 0, 1, 1, 0 }
+
+#define MAKE_YUV_FORMAT(name, fourcc, depth, pstride, plane, offs, sub ) \
+ { fourcc, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), GST_VIDEO_FORMAT_FLAG_YUV, depth, pstride, plane, offs, sub } }
+#define MAKE_YUVA_FORMAT(name, fourcc, depth, pstride, plane, offs, sub) \
+ { fourcc, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_ALPHA, depth, pstride, plane, offs, sub } }
+
+#define MAKE_RGB_FORMAT(name, depth, pstride, plane, offs, sub) \
+ { 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), GST_VIDEO_FORMAT_FLAG_RGB, depth, pstride, plane, offs, sub } }
+#define MAKE_RGBA_FORMAT(name, depth, pstride, plane, offs, sub) \
+ { 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), GST_VIDEO_FORMAT_FLAG_RGB | GST_VIDEO_FORMAT_FLAG_ALPHA, depth, pstride, plane, offs, sub } }
+
+#define MAKE_GRAY_FORMAT(name, depth, pstride, plane, offs, sub) \
+ { 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), GST_VIDEO_FORMAT_FLAG_GRAY, depth, pstride, plane, offs, sub } }
+
+static VideoFormat formats[] = {
+  {0x00000000, {GST_VIDEO_FORMAT_UNKNOWN, "UNKNOWN", 0, DPTH0, PSTR0, PLANE_NA,
+          OFFS0}},
+
+  MAKE_YUV_FORMAT (I420, GST_MAKE_FOURCC ('I', '4', '2', '0'), DPTH888, PSTR111,
+      PLANE012, OFFS0, SUB420),
+  MAKE_YUV_FORMAT (YV12, GST_MAKE_FOURCC ('Y', 'V', '1', '2'), DPTH888, PSTR111,
+      PLANE021, OFFS0, SUB420),
+  MAKE_YUV_FORMAT (YUY2, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), DPTH888, PSTR244,
+      PLANE0, OFFS013, SUB422),
+  MAKE_YUV_FORMAT (UYVY, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), DPTH888, PSTR244,
+      PLANE0, OFFS102, SUB422),
+  MAKE_YUVA_FORMAT (AYUV, GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'), DPTH8888,
+      PSTR4444, PLANE0, OFFS1230, SUB4444),
+  MAKE_RGB_FORMAT (RGBx, DPTH888, PSTR444, PLANE0, OFFS012, SUB444),
+  MAKE_RGB_FORMAT (BGRx, DPTH888, PSTR444, PLANE0, OFFS210, SUB444),
+  MAKE_RGB_FORMAT (xRGB, DPTH888, PSTR444, PLANE0, OFFS123, SUB444),
+  MAKE_RGB_FORMAT (xBGR, DPTH888, PSTR444, PLANE0, OFFS321, SUB444),
+  MAKE_RGBA_FORMAT (RGBA, DPTH8888, PSTR4444, PLANE0, OFFS0123, SUB4444),
+  MAKE_RGBA_FORMAT (BGRA, DPTH8888, PSTR4444, PLANE0, OFFS2103, SUB4444),
+  MAKE_RGBA_FORMAT (ARGB, DPTH8888, PSTR4444, PLANE0, OFFS1230, SUB4444),
+  MAKE_RGBA_FORMAT (ABGR, DPTH8888, PSTR4444, PLANE0, OFFS3210, SUB4444),
+  MAKE_RGB_FORMAT (RGB, DPTH888, PSTR333, PLANE0, OFFS012, SUB444),
+  MAKE_RGB_FORMAT (BGR, DPTH888, PSTR333, PLANE0, OFFS210, SUB444),
+
+  MAKE_YUV_FORMAT (Y41B, GST_MAKE_FOURCC ('Y', '4', '1', 'B'), DPTH888, PSTR111,
+      PLANE012, OFFS0, SUB411),
+  MAKE_YUV_FORMAT (Y42B, GST_MAKE_FOURCC ('Y', '4', '2', 'B'), DPTH888, PSTR111,
+      PLANE012, OFFS0, SUB422),
+  MAKE_YUV_FORMAT (YVYU, GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'), DPTH888, PSTR244,
+      PLANE0, OFFS031, SUB422),
+  MAKE_YUV_FORMAT (Y444, GST_MAKE_FOURCC ('Y', '4', '4', '4'), DPTH888, PSTR111,
+      PLANE012, OFFS0, SUB444),
+  MAKE_YUV_FORMAT (v210, GST_MAKE_FOURCC ('v', '2', '1', '0'), DPTH10_10_10,
+      PSTR0, PLANE0, OFFS0, SUB422),
+  MAKE_YUV_FORMAT (v216, GST_MAKE_FOURCC ('v', '2', '1', '6'), DPTH16_16_16,
+      PSTR488, PLANE0, OFFS026, SUB422),
+  MAKE_YUV_FORMAT (NV12, GST_MAKE_FOURCC ('N', 'V', '1', '2'), DPTH888, PSTR122,
+      PLANE011, OFFS001, SUB420),
+  MAKE_YUV_FORMAT (NV21, GST_MAKE_FOURCC ('N', 'V', '2', '1'), DPTH888, PSTR122,
+      PLANE011, OFFS010, SUB420),
+
+  MAKE_GRAY_FORMAT (GRAY8, DPTH8, PSTR1, PLANE0, OFFS0, SUB4),
+  MAKE_GRAY_FORMAT (GRAY16_BE, DPTH16, PSTR2, PLANE0, OFFS0, SUB4),
+  MAKE_GRAY_FORMAT (GRAY16_LE, DPTH16, PSTR2, PLANE0, OFFS0, SUB4),
+
+  MAKE_YUV_FORMAT (v308, GST_MAKE_FOURCC ('v', '3', '0', '8'), DPTH888, PSTR333,
+      PLANE0, OFFS012, SUB444),
+  MAKE_YUV_FORMAT (Y800, GST_MAKE_FOURCC ('Y', '8', '0', '0'), DPTH8, PSTR1,
+      PLANE0, OFFS0, SUB4),
+  MAKE_YUV_FORMAT (Y16, GST_MAKE_FOURCC ('Y', '1', '6', ' '), DPTH16, PSTR2,
+      PLANE0, OFFS0, SUB4),
+
+  MAKE_RGB_FORMAT (RGB16, DPTH565, PSTR222, PLANE0, OFFS0, SUB444),
+  MAKE_RGB_FORMAT (BGR16, DPTH565, PSTR222, PLANE0, OFFS0, SUB444),
+  MAKE_RGB_FORMAT (RGB15, DPTH555, PSTR222, PLANE0, OFFS0, SUB444),
+  MAKE_RGB_FORMAT (BGR15, DPTH555, PSTR222, PLANE0, OFFS0, SUB444),
+
+  MAKE_YUV_FORMAT (UYVP, GST_MAKE_FOURCC ('U', 'Y', 'V', 'P'), DPTH10_10_10,
+      PSTR0, PLANE0, OFFS0, SUB422),
+  MAKE_YUVA_FORMAT (A420, GST_MAKE_FOURCC ('A', '4', '2', '0'), DPTH8888,
+      PSTR1111, PLANE0123, OFFS0, SUB4204),
+  MAKE_RGBA_FORMAT (RGB8_PALETTED, DPTH8888, PSTR1111, PLANE0, OFFS0, SUB4444),
+  MAKE_YUV_FORMAT (YUV9, GST_MAKE_FOURCC ('Y', 'U', 'V', '9'), DPTH888, PSTR111,
+      PLANE012, OFFS0, SUB410),
+  MAKE_YUV_FORMAT (YVU9, GST_MAKE_FOURCC ('Y', 'V', 'U', '9'), DPTH888, PSTR111,
+      PLANE021, OFFS0, SUB410),
+  MAKE_YUV_FORMAT (IYU1, GST_MAKE_FOURCC ('I', 'Y', 'U', '1'), DPTH888, PSTR0,
+      PLANE0, OFFS104, SUB411),
+  MAKE_RGBA_FORMAT (ARGB64, DPTH16_16_16_16, PSTR8888, PLANE0, OFFS2460,
+      SUB444),
+  MAKE_YUVA_FORMAT (AYUV64, 0x00000000, DPTH16_16_16_16, PSTR8888, PLANE0,
+      OFFS2460, SUB444),
+  MAKE_YUV_FORMAT (r210, GST_MAKE_FOURCC ('r', '2', '1', '0'), DPTH10_10_10,
+      PSTR444, PLANE0, OFFS0, SUB444),
+};
 
 /**
  * SECTION:gstvideo
  * </refsect2>
  */
 
-static GstVideoFormat gst_video_format_from_rgb32_masks (int red_mask,
-    int green_mask, int blue_mask);
-static GstVideoFormat gst_video_format_from_rgba32_masks (int red_mask,
-    int green_mask, int blue_mask, int alpha_mask);
-static GstVideoFormat gst_video_format_from_rgb24_masks (int red_mask,
-    int green_mask, int blue_mask);
-static GstVideoFormat gst_video_format_from_rgb16_masks (int red_mask,
-    int green_mask, int blue_mask);
-
-
-/**
- * gst_video_frame_rate:
- * @pad: pointer to a #GstPad
- *
- * A convenience function to retrieve a GValue holding the framerate
- * from the caps on a pad.
- *
- * The pad needs to have negotiated caps containing a framerate property.
- *
- * Returns: NULL if the pad has no configured caps or the configured caps
- * do not contain a framerate.
- *
- */
-const GValue *
-gst_video_frame_rate (GstPad * pad)
-{
-  const GValue *fps;
-  gchar *fps_string;
-
-  const GstCaps *caps = NULL;
-  GstStructure *structure;
-
-  /* get pad caps */
-  caps = GST_PAD_CAPS (pad);
-  if (caps == NULL) {
-    g_warning ("gstvideo: failed to get caps of pad %s:%s",
-        GST_DEBUG_PAD_NAME (pad));
-    return NULL;
-  }
-
-  structure = gst_caps_get_structure (caps, 0);
-  if ((fps = gst_structure_get_value (structure, "framerate")) == NULL) {
-    g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
-        GST_DEBUG_PAD_NAME (pad));
-    return NULL;
-  }
-  if (!GST_VALUE_HOLDS_FRACTION (fps)) {
-    g_warning
-        ("gstvideo: framerate property of pad %s:%s is not of type Fraction",
-        GST_DEBUG_PAD_NAME (pad));
-    return NULL;
-  }
-
-  fps_string = gst_value_serialize (fps);
-  GST_DEBUG ("Framerate request on pad %s:%s: %s",
-      GST_DEBUG_PAD_NAME (pad), fps_string);
-  g_free (fps_string);
-
-  return fps;
-}
-
-/**
- * gst_video_get_size:
- * @pad: pointer to a #GstPad
- * @width: pointer to integer to hold pixel width of the video frames (output)
- * @height: pointer to integer to hold pixel height of the video frames (output)
- *
- * Inspect the caps of the provided pad and retrieve the width and height of
- * the video frames it is configured for.
- *
- * The pad needs to have negotiated caps containing width and height properties.
- *
- * Returns: TRUE if the width and height could be retrieved.
- *
- */
-gboolean
-gst_video_get_size (GstPad * pad, gint * width, gint * height)
-{
-  const GstCaps *caps = NULL;
-  GstStructure *structure;
-  gboolean ret;
-
-  g_return_val_if_fail (pad != NULL, FALSE);
-  g_return_val_if_fail (width != NULL, FALSE);
-  g_return_val_if_fail (height != NULL, FALSE);
-
-  caps = GST_PAD_CAPS (pad);
-
-  if (caps == NULL) {
-    g_warning ("gstvideo: failed to get caps of pad %s:%s",
-        GST_DEBUG_PAD_NAME (pad));
-    return FALSE;
-  }
-
-  structure = gst_caps_get_structure (caps, 0);
-  ret = gst_structure_get_int (structure, "width", width);
-  ret &= gst_structure_get_int (structure, "height", height);
-
-  if (!ret) {
-    g_warning ("gstvideo: failed to get size properties on pad %s:%s",
-        GST_DEBUG_PAD_NAME (pad));
-    return FALSE;
-  }
-
-  GST_DEBUG ("size request on pad %s:%s: %dx%d",
-      GST_DEBUG_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
-
-  return TRUE;
-}
-
 /**
  * gst_video_calculate_display_ratio:
  * @dar_n: Numerator of the calculated display_ratio
@@ -197,1919 +252,853 @@ gst_video_calculate_display_ratio (guint * dar_n, guint * dar_d,
   *dar_d = den;
 
   return TRUE;
+
+  /* ERRORS */
 error_overflow:
-  return FALSE;
+  {
+    GST_WARNING ("overflow in multiply");
+    return FALSE;
+  }
 }
 
-/**
- * gst_video_format_parse_caps_interlaced:
- * @caps: the fixed #GstCaps to parse
- * @interlaced: whether @caps represents interlaced video or not, may be NULL (output)
- *
- * Extracts whether the caps represents interlaced content or not and places it
- * in @interlaced.
- *
- * Since: 0.10.23
- *
- * Returns: TRUE if @caps was parsed correctly.
- */
-gboolean
-gst_video_format_parse_caps_interlaced (GstCaps * caps, gboolean * interlaced)
+static GstVideoFormat
+gst_video_format_from_rgb32_masks (int red_mask, int green_mask, int blue_mask)
 {
-  GstStructure *structure;
-
-  if (!gst_caps_is_fixed (caps))
-    return FALSE;
+  if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
+      blue_mask == 0x0000ff00) {
+    return GST_VIDEO_FORMAT_RGBx;
+  }
+  if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
+      blue_mask == 0xff000000) {
+    return GST_VIDEO_FORMAT_BGRx;
+  }
+  if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
+      blue_mask == 0x000000ff) {
+    return GST_VIDEO_FORMAT_xRGB;
+  }
+  if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
+      blue_mask == 0x00ff0000) {
+    return GST_VIDEO_FORMAT_xBGR;
+  }
 
-  structure = gst_caps_get_structure (caps, 0);
+  return GST_VIDEO_FORMAT_UNKNOWN;
+}
 
-  if (interlaced) {
-    if (!gst_structure_get_boolean (structure, "interlaced", interlaced))
-      *interlaced = FALSE;
+static GstVideoFormat
+gst_video_format_from_rgba32_masks (int red_mask, int green_mask,
+    int blue_mask, int alpha_mask)
+{
+  if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
+      blue_mask == 0x0000ff00 && alpha_mask == 0x000000ff) {
+    return GST_VIDEO_FORMAT_RGBA;
   }
-
-  return TRUE;
+  if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
+      blue_mask == 0xff000000 && alpha_mask == 0x000000ff) {
+    return GST_VIDEO_FORMAT_BGRA;
+  }
+  if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
+      blue_mask == 0x000000ff && alpha_mask == 0xff000000) {
+    return GST_VIDEO_FORMAT_ARGB;
+  }
+  if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
+      blue_mask == 0x00ff0000 && alpha_mask == 0xff000000) {
+    return GST_VIDEO_FORMAT_ABGR;
+  }
+  return GST_VIDEO_FORMAT_UNKNOWN;
 }
 
-/**
- * gst_video_parse_caps_color_matrix:
- * @caps: the fixed #GstCaps to parse
- *
- * Extracts the color matrix used by the caps.  Possible values are
- * "sdtv" for the standard definition color matrix (as specified in
- * Rec. ITU-R BT.470-6) or "hdtv" for the high definition color
- * matrix (as specified in Rec. ITU-R BT.709)
- *
- * Since: 0.10.29
- *
- * Returns: a color matrix string, or NULL if no color matrix could be
- *     determined.
- */
-const char *
-gst_video_parse_caps_color_matrix (GstCaps * caps)
+static GstVideoFormat
+gst_video_format_from_rgb24_masks (int red_mask, int green_mask, int blue_mask)
 {
-  GstStructure *structure;
-  const char *s;
+  if (red_mask == 0xff0000 && green_mask == 0x00ff00 && blue_mask == 0x0000ff) {
+    return GST_VIDEO_FORMAT_RGB;
+  }
+  if (red_mask == 0x0000ff && green_mask == 0x00ff00 && blue_mask == 0xff0000) {
+    return GST_VIDEO_FORMAT_BGR;
+  }
 
-  if (!gst_caps_is_fixed (caps))
-    return NULL;
+  return GST_VIDEO_FORMAT_UNKNOWN;
+}
 
-  structure = gst_caps_get_structure (caps, 0);
+#define GST_VIDEO_COMP1_MASK_16_INT 0xf800
+#define GST_VIDEO_COMP2_MASK_16_INT 0x07e0
+#define GST_VIDEO_COMP3_MASK_16_INT 0x001f
 
-  s = gst_structure_get_string (structure, "color-matrix");
-  if (s)
-    return s;
+#define GST_VIDEO_COMP1_MASK_15_INT 0x7c00
+#define GST_VIDEO_COMP2_MASK_15_INT 0x03e0
+#define GST_VIDEO_COMP3_MASK_15_INT 0x001f
 
-  if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
-    return "sdtv";
+static GstVideoFormat
+gst_video_format_from_rgb16_masks (int red_mask, int green_mask, int blue_mask)
+{
+  if (red_mask == GST_VIDEO_COMP1_MASK_16_INT
+      && green_mask == GST_VIDEO_COMP2_MASK_16_INT
+      && blue_mask == GST_VIDEO_COMP3_MASK_16_INT) {
+    return GST_VIDEO_FORMAT_RGB16;
   }
-
-  return NULL;
+  if (red_mask == GST_VIDEO_COMP3_MASK_16_INT
+      && green_mask == GST_VIDEO_COMP2_MASK_16_INT
+      && blue_mask == GST_VIDEO_COMP1_MASK_16_INT) {
+    return GST_VIDEO_FORMAT_BGR16;
+  }
+  if (red_mask == GST_VIDEO_COMP1_MASK_15_INT
+      && green_mask == GST_VIDEO_COMP2_MASK_15_INT
+      && blue_mask == GST_VIDEO_COMP3_MASK_15_INT) {
+    return GST_VIDEO_FORMAT_RGB15;
+  }
+  if (red_mask == GST_VIDEO_COMP3_MASK_15_INT
+      && green_mask == GST_VIDEO_COMP2_MASK_15_INT
+      && blue_mask == GST_VIDEO_COMP1_MASK_15_INT) {
+    return GST_VIDEO_FORMAT_BGR15;
+  }
+  return GST_VIDEO_FORMAT_UNKNOWN;
 }
 
 /**
- * gst_video_parse_caps_chroma_site:
- * @caps: the fixed #GstCaps to parse
- *
- * Extracts the chroma site used by the caps.  Possible values are
- * "mpeg2" for MPEG-2 style chroma siting (co-sited horizontally,
- * halfway-sited vertically), "jpeg" for JPEG and Theora style
- * chroma siting (halfway-sited both horizontally and vertically).
- * Other chroma site values are possible, but uncommon.
- *
- * When no chroma site is specified in the caps, it should be assumed
- * to be "mpeg2".
- *
- * Since: 0.10.29
- *
- * Returns: a chroma site string, or NULL if no chroma site could be
- *     determined.
+ * gst_video_format_from_masks:
+ * @depth: the amount of bits used for a pixel
+ * @bpp: the amount of bits used to store a pixel. This value is bigger than
+ *   @depth
+ * @endianness: the endianness of the masks
+ * @red_mask: the red mask
+ * @green_mask: the green mask
+ * @blue_mask: the blue mask
+ * @alpha_mask: the optional alpha mask
+ *
+ * Find the #GstVideoFormat for the given parameters.
+ *
+ * Returns: a #GstVideoFormat or GST_VIDEO_FORMAT_UNKNOWN when the parameters to
+ * not specify a known format.
  */
-const char *
-gst_video_parse_caps_chroma_site (GstCaps * caps)
+GstVideoFormat
+gst_video_format_from_masks (gint depth, gint bpp, gint endianness,
+    gint red_mask, gint green_mask, gint blue_mask, gint alpha_mask)
 {
-  GstStructure *structure;
-  const char *s;
-
-  if (!gst_caps_is_fixed (caps))
-    return NULL;
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  s = gst_structure_get_string (structure, "chroma-site");
-  if (s)
-    return s;
-
-  if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
-    return "mpeg2";
+  GstVideoFormat format;
+
+  /* our caps system handles 24/32bpp RGB as big-endian. */
+  if ((bpp == 24 || bpp == 32) && endianness == G_LITTLE_ENDIAN) {
+    red_mask = GUINT32_TO_BE (red_mask);
+    green_mask = GUINT32_TO_BE (green_mask);
+    blue_mask = GUINT32_TO_BE (blue_mask);
+    endianness = G_BIG_ENDIAN;
+    if (bpp == 24) {
+      red_mask >>= 8;
+      green_mask >>= 8;
+      blue_mask >>= 8;
+    }
   }
 
-  return NULL;
+  if (depth == 30 && bpp == 32) {
+    format = GST_VIDEO_FORMAT_r210;
+  } else if (depth == 24 && bpp == 32) {
+    format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
+        blue_mask);
+  } else if (depth == 32 && bpp == 32 && alpha_mask) {
+    format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
+        blue_mask, alpha_mask);
+  } else if (depth == 24 && bpp == 24) {
+    format = gst_video_format_from_rgb24_masks (red_mask, green_mask,
+        blue_mask);
+  } else if ((depth == 15 || depth == 16) && bpp == 16 &&
+      endianness == G_BYTE_ORDER) {
+    format = gst_video_format_from_rgb16_masks (red_mask, green_mask,
+        blue_mask);
+  } else if (depth == 8 && bpp == 8) {
+    format = GST_VIDEO_FORMAT_RGB8_PALETTED;
+  } else if (depth == 64 && bpp == 64) {
+    format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
+        blue_mask, alpha_mask);
+    if (format == GST_VIDEO_FORMAT_ARGB) {
+      format = GST_VIDEO_FORMAT_ARGB64;
+    } else {
+      format = GST_VIDEO_FORMAT_UNKNOWN;
+    }
+  } else {
+    format = GST_VIDEO_FORMAT_UNKNOWN;
+  }
+  return format;
 }
 
 /**
- * gst_video_format_parse_caps:
- * @caps: the #GstCaps to parse
- * @format: the #GstVideoFormat of the video represented by @caps (output)
- * @width: the width of the video represented by @caps, may be NULL (output)
- * @height: the height of the video represented by @caps, may be NULL (output)
+ * gst_video_format_from_fourcc:
+ * @fourcc: a FOURCC value representing raw YUV video
  *
- * Determines the #GstVideoFormat of @caps and places it in the location
- * pointed to by @format.  Extracts the size of the video and places it
- * in the location pointed to by @width and @height.  If @caps does not
- * represent one of the raw video formats listed in #GstVideoFormat, the
- * function will fail and return FALSE.
+ * Converts a FOURCC value into the corresponding #GstVideoFormat.
+ * If the FOURCC cannot be represented by #GstVideoFormat,
+ * #GST_VIDEO_FORMAT_UNKNOWN is returned.
  *
  * Since: 0.10.16
  *
- * Returns: TRUE if @caps was parsed correctly.
+ * Returns: the #GstVideoFormat describing the FOURCC value
  */
-gboolean
-gst_video_format_parse_caps (const GstCaps * caps, GstVideoFormat * format,
-    int *width, int *height)
+GstVideoFormat
+gst_video_format_from_fourcc (guint32 fourcc)
 {
-  GstStructure *structure;
-  gboolean ok = TRUE;
-
-  if (!gst_caps_is_fixed (caps))
-    return FALSE;
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (format) {
-    if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
-      guint32 fourcc;
-
-      ok &= gst_structure_get_fourcc (structure, "format", &fourcc);
-
-      *format = gst_video_format_from_fourcc (fourcc);
-      if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
-        ok = FALSE;
-      }
-    } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
-      int depth;
-      int bpp;
-      int endianness = 0;
-      int red_mask = 0;
-      int green_mask = 0;
-      int blue_mask = 0;
-      int alpha_mask = 0;
-      gboolean have_alpha;
-
-      ok &= gst_structure_get_int (structure, "depth", &depth);
-      ok &= gst_structure_get_int (structure, "bpp", &bpp);
-
-      if (bpp != 8) {
-        ok &= gst_structure_get_int (structure, "endianness", &endianness);
-        ok &= gst_structure_get_int (structure, "red_mask", &red_mask);
-        ok &= gst_structure_get_int (structure, "green_mask", &green_mask);
-        ok &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
-      }
-      have_alpha = gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
-
-      if (depth == 30 && bpp == 32 && endianness == G_BIG_ENDIAN) {
-        *format = GST_VIDEO_FORMAT_r210;
-      } else if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
-        *format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
-            blue_mask);
-        if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
-          ok = FALSE;
-        }
-      } else if (depth == 32 && bpp == 32 && endianness == G_BIG_ENDIAN &&
-          have_alpha) {
-        *format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
-            blue_mask, alpha_mask);
-        if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
-          ok = FALSE;
-        }
-      } else if (depth == 24 && bpp == 24 && endianness == G_BIG_ENDIAN) {
-        *format = gst_video_format_from_rgb24_masks (red_mask, green_mask,
-            blue_mask);
-        if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
-          ok = FALSE;
-        }
-      } else if ((depth == 15 || depth == 16) && bpp == 16 &&
-          endianness == G_BYTE_ORDER) {
-        *format = gst_video_format_from_rgb16_masks (red_mask, green_mask,
-            blue_mask);
-        if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
-          ok = FALSE;
-        }
-      } else if (depth == 8 && bpp == 8) {
-        *format = GST_VIDEO_FORMAT_RGB8_PALETTED;
-      } else if (depth == 64 && bpp == 64) {
-        *format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
-            blue_mask, alpha_mask);
-        if (*format == GST_VIDEO_FORMAT_ARGB) {
-          *format = GST_VIDEO_FORMAT_ARGB64;
-        } else {
-          *format = GST_VIDEO_FORMAT_UNKNOWN;
-          ok = FALSE;
-        }
-      } else {
-        ok = FALSE;
-      }
-    } else if (gst_structure_has_name (structure, "video/x-raw-gray")) {
-      int depth;
-      int bpp;
-      int endianness;
-
-      ok &= gst_structure_get_int (structure, "depth", &depth);
-      ok &= gst_structure_get_int (structure, "bpp", &bpp);
-
-      if (bpp > 8)
-        ok &= gst_structure_get_int (structure, "endianness", &endianness);
-
-      if (depth == 8 && bpp == 8) {
-        *format = GST_VIDEO_FORMAT_GRAY8;
-      } else if (depth == 16 && bpp == 16 && endianness == G_BIG_ENDIAN) {
-        *format = GST_VIDEO_FORMAT_GRAY16_BE;
-      } else if (depth == 16 && bpp == 16 && endianness == G_LITTLE_ENDIAN) {
-        *format = GST_VIDEO_FORMAT_GRAY16_LE;
-      } else {
-        ok = FALSE;
-      }
-    } else {
-      ok = FALSE;
-    }
+  switch (fourcc) {
+    case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+      return GST_VIDEO_FORMAT_I420;
+    case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+      return GST_VIDEO_FORMAT_YV12;
+    case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+      return GST_VIDEO_FORMAT_YUY2;
+    case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
+      return GST_VIDEO_FORMAT_YVYU;
+    case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
+      return GST_VIDEO_FORMAT_UYVY;
+    case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
+      return GST_VIDEO_FORMAT_AYUV;
+    case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
+      return GST_VIDEO_FORMAT_Y41B;
+    case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
+      return GST_VIDEO_FORMAT_Y42B;
+    case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
+      return GST_VIDEO_FORMAT_Y444;
+    case GST_MAKE_FOURCC ('v', '2', '1', '0'):
+      return GST_VIDEO_FORMAT_v210;
+    case GST_MAKE_FOURCC ('v', '2', '1', '6'):
+      return GST_VIDEO_FORMAT_v216;
+    case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
+      return GST_VIDEO_FORMAT_NV12;
+    case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
+      return GST_VIDEO_FORMAT_NV21;
+    case GST_MAKE_FOURCC ('v', '3', '0', '8'):
+      return GST_VIDEO_FORMAT_v308;
+    case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
+    case GST_MAKE_FOURCC ('Y', '8', ' ', ' '):
+    case GST_MAKE_FOURCC ('G', 'R', 'E', 'Y'):
+      return GST_VIDEO_FORMAT_Y800;
+    case GST_MAKE_FOURCC ('Y', '1', '6', ' '):
+      return GST_VIDEO_FORMAT_Y16;
+    case GST_MAKE_FOURCC ('U', 'Y', 'V', 'P'):
+      return GST_VIDEO_FORMAT_UYVP;
+    case GST_MAKE_FOURCC ('A', '4', '2', '0'):
+      return GST_VIDEO_FORMAT_A420;
+    case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
+      return GST_VIDEO_FORMAT_YUV9;
+    case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
+      return GST_VIDEO_FORMAT_YVU9;
+    case GST_MAKE_FOURCC ('I', 'Y', 'U', '1'):
+      return GST_VIDEO_FORMAT_IYU1;
+    case GST_MAKE_FOURCC ('A', 'Y', '6', '4'):
+      return GST_VIDEO_FORMAT_AYUV64;
+    default:
+      return GST_VIDEO_FORMAT_UNKNOWN;
   }
+}
 
-  if (width) {
-    ok &= gst_structure_get_int (structure, "width", width);
-  }
+/**
+ * gst_video_format_from_string:
+ * @format: a format string
+ *
+ * Convert the @format string to its #GstVideoFormat.
+ *
+ * Returns: the #GstVideoFormat for @format or GST_VIDEO_FORMAT_UNKNOWN when the
+ * string is not a known format.
+ */
+GstVideoFormat
+gst_video_format_from_string (const gchar * format)
+{
+  guint i;
 
-  if (height) {
-    ok &= gst_structure_get_int (structure, "height", height);
+  for (i = 0; i < G_N_ELEMENTS (formats); i++) {
+    if (strcmp (GST_VIDEO_FORMAT_INFO_NAME (&formats[i].info), format) == 0)
+      return GST_VIDEO_FORMAT_INFO_FORMAT (&formats[i].info);
   }
-
-  return ok;
+  return GST_VIDEO_FORMAT_UNKNOWN;
 }
 
 
 /**
- * gst_video_parse_caps_framerate:
- * @caps: pointer to a #GstCaps instance
- * @fps_n: pointer to integer to hold numerator of frame rate (output)
- * @fps_d: pointer to integer to hold denominator of frame rate (output)
- *
- * Extracts the frame rate from @caps and places the values in the locations
- * pointed to by @fps_n and @fps_d.  Returns TRUE if the values could be
- * parsed correctly, FALSE if not.
+ * gst_video_format_to_fourcc:
+ * @format: a #GstVideoFormat video format
  *
- * This function can be used with #GstCaps that have any media type; it
- * is not limited to formats handled by #GstVideoFormat.
+ * Converts a #GstVideoFormat value into the corresponding FOURCC.  Only
+ * a few YUV formats have corresponding FOURCC values.  If @format has
+ * no corresponding FOURCC value, 0 is returned.
  *
  * Since: 0.10.16
  *
- * Returns: TRUE if @caps was parsed correctly.
+ * Returns: the FOURCC corresponding to @format
  */
-gboolean
-gst_video_parse_caps_framerate (GstCaps * caps, int *fps_n, int *fps_d)
+guint32
+gst_video_format_to_fourcc (GstVideoFormat format)
 {
-  GstStructure *structure;
-
-  if (!gst_caps_is_fixed (caps))
-    return FALSE;
+  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
 
-  structure = gst_caps_get_structure (caps, 0);
+  if (format >= G_N_ELEMENTS (formats))
+    return 0;
 
-  return gst_structure_get_fraction (structure, "framerate", fps_n, fps_d);
+  return formats[format].fourcc;
 }
 
-/**
- * gst_video_parse_caps_pixel_aspect_ratio:
- * @caps: pointer to a #GstCaps instance
- * @par_n: pointer to numerator of pixel aspect ratio (output)
- * @par_d: pointer to denominator of pixel aspect ratio (output)
- *
- * Extracts the pixel aspect ratio from @caps and places the values in
- * the locations pointed to by @par_n and @par_d.  Returns TRUE if the
- * values could be parsed correctly, FALSE if not.
- *
- * This function can be used with #GstCaps that have any media type; it
- * is not limited to formats handled by #GstVideoFormat.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @caps was parsed correctly.
- */
-gboolean
-gst_video_parse_caps_pixel_aspect_ratio (GstCaps * caps, int *par_n, int *par_d)
+const gchar *
+gst_video_format_to_string (GstVideoFormat format)
 {
-  GstStructure *structure;
-
-  if (!gst_caps_is_fixed (caps))
-    return FALSE;
+  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
 
-  structure = gst_caps_get_structure (caps, 0);
+  if (format >= G_N_ELEMENTS (formats))
+    return NULL;
 
-  if (!gst_structure_get_fraction (structure, "pixel-aspect-ratio",
-          par_n, par_d)) {
-    *par_n = 1;
-    *par_d = 1;
-  }
-  return TRUE;
+  return GST_VIDEO_FORMAT_INFO_NAME (&formats[format].info);
 }
 
 /**
- * gst_video_format_new_caps_interlaced:
- * @format: the #GstVideoFormat describing the raw video format
- * @width: width of video
- * @height: height of video
- * @framerate_n: numerator of frame rate
- * @framerate_d: denominator of frame rate
- * @par_n: numerator of pixel aspect ratio
- * @par_d: denominator of pixel aspect ratio
- * @interlaced: #TRUE if the format is interlaced
- *
- * Creates a new #GstCaps object based on the parameters provided.
+ * gst_video_format_get_info:
+ * @format: a #GstVideoFormat
  *
- * Since: 0.10.23
+ * Get the #GstVideoFormatInfo for @format
  *
- * Returns: a new #GstCaps object, or NULL if there was an error
+ * Returns: The #GstVideoFormatInfo for @format.
  */
-GstCaps *
-gst_video_format_new_caps_interlaced (GstVideoFormat format,
-    int width, int height, int framerate_n, int framerate_d, int par_n,
-    int par_d, gboolean interlaced)
+const GstVideoFormatInfo *
+gst_video_format_get_info (GstVideoFormat format)
 {
-  GstCaps *res;
-
-  res =
-      gst_video_format_new_caps (format, width, height, framerate_n,
-      framerate_d, par_n, par_d);
-  if (interlaced && (res != NULL))
-    gst_caps_set_simple (res, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
+  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
+  g_return_val_if_fail (format < G_N_ELEMENTS (formats), NULL);
 
-  return res;
+  return &formats[format].info;
 }
 
-static GstCaps *
-gst_video_format_new_caps_raw (GstVideoFormat format)
+/**
+ * gst_video_info_init:
+ * @info: a #GstVideoInfo
+ *
+ * Initialize @info with default values.
+ */
+void
+gst_video_info_init (GstVideoInfo * info)
 {
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
-
-  if (gst_video_format_is_yuv (format)) {
-    return gst_caps_new_simple ("video/x-raw-yuv",
-        "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format), NULL);
-  }
-  if (gst_video_format_is_rgb (format)) {
-    GstCaps *caps;
-    int red_mask = 0;
-    int blue_mask = 0;
-    int green_mask = 0;
-    int alpha_mask;
-    int depth;
-    int bpp;
-    gboolean have_alpha;
-    unsigned int mask = 0;
-
-    switch (format) {
-      case GST_VIDEO_FORMAT_RGBx:
-      case GST_VIDEO_FORMAT_BGRx:
-      case GST_VIDEO_FORMAT_xRGB:
-      case GST_VIDEO_FORMAT_xBGR:
-        bpp = 32;
-        depth = 24;
-        have_alpha = FALSE;
-        break;
-      case GST_VIDEO_FORMAT_RGBA:
-      case GST_VIDEO_FORMAT_BGRA:
-      case GST_VIDEO_FORMAT_ARGB:
-      case GST_VIDEO_FORMAT_ABGR:
-        bpp = 32;
-        depth = 32;
-        have_alpha = TRUE;
-        break;
-      case GST_VIDEO_FORMAT_RGB:
-      case GST_VIDEO_FORMAT_BGR:
-        bpp = 24;
-        depth = 24;
-        have_alpha = FALSE;
-        break;
-      case GST_VIDEO_FORMAT_RGB16:
-      case GST_VIDEO_FORMAT_BGR16:
-        bpp = 16;
-        depth = 16;
-        have_alpha = FALSE;
-        break;
-      case GST_VIDEO_FORMAT_RGB15:
-      case GST_VIDEO_FORMAT_BGR15:
-        bpp = 16;
-        depth = 15;
-        have_alpha = FALSE;
-        break;
-      case GST_VIDEO_FORMAT_RGB8_PALETTED:
-        bpp = 8;
-        depth = 8;
-        have_alpha = FALSE;
-        break;
-      case GST_VIDEO_FORMAT_ARGB64:
-        bpp = 64;
-        depth = 64;
-        have_alpha = TRUE;
-        break;
-      case GST_VIDEO_FORMAT_r210:
-        bpp = 32;
-        depth = 30;
-        have_alpha = FALSE;
-        break;
-      default:
-        return NULL;
-    }
-    if (bpp == 32 && depth == 30) {
-      red_mask = 0x3ff00000;
-      green_mask = 0x000ffc00;
-      blue_mask = 0x000003ff;
-      have_alpha = FALSE;
-    } else if (bpp == 32 || bpp == 24 || bpp == 64) {
-      if (bpp == 32) {
-        mask = 0xff000000;
-      } else {
-        mask = 0xff0000;
-      }
-      red_mask =
-          mask >> (8 * gst_video_format_get_component_offset (format, 0, 0, 0));
-      green_mask =
-          mask >> (8 * gst_video_format_get_component_offset (format, 1, 0, 0));
-      blue_mask =
-          mask >> (8 * gst_video_format_get_component_offset (format, 2, 0, 0));
-    } else if (bpp == 16) {
-      switch (format) {
-        case GST_VIDEO_FORMAT_RGB16:
-          red_mask = GST_VIDEO_COMP1_MASK_16_INT;
-          green_mask = GST_VIDEO_COMP2_MASK_16_INT;
-          blue_mask = GST_VIDEO_COMP3_MASK_16_INT;
-          break;
-        case GST_VIDEO_FORMAT_BGR16:
-          red_mask = GST_VIDEO_COMP3_MASK_16_INT;
-          green_mask = GST_VIDEO_COMP2_MASK_16_INT;
-          blue_mask = GST_VIDEO_COMP1_MASK_16_INT;
-          break;
-          break;
-        case GST_VIDEO_FORMAT_RGB15:
-          red_mask = GST_VIDEO_COMP1_MASK_15_INT;
-          green_mask = GST_VIDEO_COMP2_MASK_15_INT;
-          blue_mask = GST_VIDEO_COMP3_MASK_15_INT;
-          break;
-        case GST_VIDEO_FORMAT_BGR15:
-          red_mask = GST_VIDEO_COMP3_MASK_15_INT;
-          green_mask = GST_VIDEO_COMP2_MASK_15_INT;
-          blue_mask = GST_VIDEO_COMP1_MASK_15_INT;
-          break;
-        default:
-          g_assert_not_reached ();
-      }
-    } else if (bpp != 8) {
-      g_assert_not_reached ();
-    }
-
-    caps = gst_caps_new_simple ("video/x-raw-rgb",
-        "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL);
-
-    if (bpp != 8) {
-      gst_caps_set_simple (caps,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN,
-          "red_mask", G_TYPE_INT, red_mask,
-          "green_mask", G_TYPE_INT, green_mask,
-          "blue_mask", G_TYPE_INT, blue_mask, NULL);
-    }
-
-    if (have_alpha) {
-      alpha_mask =
-          mask >> (8 * gst_video_format_get_component_offset (format, 3, 0, 0));
-      gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL);
-    }
-    return caps;
-  }
-
-  if (gst_video_format_is_gray (format)) {
-    GstCaps *caps;
-    int bpp;
-    int depth;
-    int endianness;
-
-    switch (format) {
-      case GST_VIDEO_FORMAT_GRAY8:
-        bpp = depth = 8;
-        endianness = G_BIG_ENDIAN;
-        break;
-      case GST_VIDEO_FORMAT_GRAY16_BE:
-        bpp = depth = 16;
-        endianness = G_BIG_ENDIAN;
-        break;
-      case GST_VIDEO_FORMAT_GRAY16_LE:
-        bpp = depth = 16;
-        endianness = G_LITTLE_ENDIAN;
-        break;
-      default:
-        return NULL;
-        break;
-    }
-
-    if (bpp <= 8) {
-      caps = gst_caps_new_simple ("video/x-raw-gray",
-          "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL);
-    } else {
-      caps = gst_caps_new_simple ("video/x-raw-gray",
-          "bpp", G_TYPE_INT, bpp,
-          "depth", G_TYPE_INT, depth,
-          "endianness", G_TYPE_INT, endianness, NULL);
-    }
-
-    return caps;
-  }
-
-  return NULL;
+  g_return_if_fail (info != NULL);
+
+  memset (info, 0, sizeof (GstVideoInfo));
+  /* arrange for sensible defaults, e.g. if turned into caps */
+  info->fps_n = 0;
+  info->fps_d = 1;
+  info->par_n = 1;
+  info->par_d = 1;
 }
 
 /**
- * gst_video_format_new_template_caps:
- * @format: the #GstVideoFormat describing the raw video format
+ * gst_video_info_set_format:
+ * @info: a #GstVideoInfo
+ * @format: the format
+ * @width: a width
+ * @height: a height
  *
- * Creates a new #GstCaps object based on the parameters provided.
- * Size, frame rate, and pixel aspect ratio are set to the full
- * range.
- *
- * Since: 0.10.33
- *
- * Returns: a new #GstCaps object, or NULL if there was an error
+ * Set the default info for a video frame of @format and @width and @height.
  */
-GstCaps *
-gst_video_format_new_template_caps (GstVideoFormat format)
+void
+gst_video_info_set_format (GstVideoInfo * info, GstVideoFormat format,
+    guint width, guint height)
 {
-  GstCaps *caps;
-  GstStructure *structure;
-
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
-
-  caps = gst_video_format_new_caps_raw (format);
-  if (caps) {
-    GValue value = { 0 };
-    GValue v = { 0 };
+  const GstVideoFormatInfo *finfo;
 
-    structure = gst_caps_get_structure (caps, 0);
+  g_return_if_fail (info != NULL);
+  g_return_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN);
 
-    gst_structure_set (structure,
-        "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1,
-        "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+  finfo = &formats[format].info;
 
-    g_value_init (&value, GST_TYPE_LIST);
-    g_value_init (&v, G_TYPE_BOOLEAN);
-    g_value_set_boolean (&v, TRUE);
-    gst_value_list_append_value (&value, &v);
-    g_value_set_boolean (&v, FALSE);
-    gst_value_list_append_value (&value, &v);
+  info->flags = 0;
+  info->finfo = finfo;
+  info->width = width;
+  info->height = height;
 
-    gst_structure_set_value (structure, "interlaced", &value);
-
-    g_value_reset (&value);
-    g_value_reset (&v);
-  }
-
-  return caps;
+  fill_planes (info);
 }
 
 /**
- * gst_video_format_new_caps:
- * @format: the #GstVideoFormat describing the raw video format
- * @width: width of video
- * @height: height of video
- * @framerate_n: numerator of frame rate
- * @framerate_d: denominator of frame rate
- * @par_n: numerator of pixel aspect ratio
- * @par_d: denominator of pixel aspect ratio
+ * gst_video_info_from_caps:
+ * @info: a #GstVideoInfo
+ * @caps: a #GstCaps
  *
- * Creates a new #GstCaps object based on the parameters provided.
+ * Parse @caps and update @info.
  *
- * Since: 0.10.16
- *
- * Returns: a new #GstCaps object, or NULL if there was an error
+ * Returns: TRUE if @caps could be parsed
  */
-GstCaps *
-gst_video_format_new_caps (GstVideoFormat format, int width,
-    int height, int framerate_n, int framerate_d, int par_n, int par_d)
+gboolean
+gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
 {
-  GstCaps *caps;
   GstStructure *structure;
+  const gchar *s;
+  GstVideoFormat format;
+  gint width, height;
+  gint fps_n, fps_d;
+  gboolean interlaced;
+  gint par_n, par_d;
+
+  g_return_val_if_fail (info != NULL, FALSE);
+  g_return_val_if_fail (caps != NULL, FALSE);
+  g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
 
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
-  g_return_val_if_fail (width > 0 && height > 0, NULL);
-
-  caps = gst_video_format_new_caps_raw (format);
-  if (caps) {
-    structure = gst_caps_get_structure (caps, 0);
+  GST_DEBUG ("parsing caps %" GST_PTR_FORMAT, caps);
 
-    gst_structure_set (structure,
-        "width", G_TYPE_INT, width,
-        "height", G_TYPE_INT, height,
-        "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
-        "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
-  }
+  structure = gst_caps_get_structure (caps, 0);
 
-  return caps;
-}
+  if (!gst_structure_has_name (structure, "video/x-raw"))
+    goto wrong_name;
 
+  if (!(s = gst_structure_get_string (structure, "format")))
+    goto no_format;
 
-/**
- * gst_video_format_from_fourcc:
- * @fourcc: a FOURCC value representing raw YUV video
- *
- * Converts a FOURCC value into the corresponding #GstVideoFormat.
- * If the FOURCC cannot be represented by #GstVideoFormat,
- * #GST_VIDEO_FORMAT_UNKNOWN is returned.
- *
- * Since: 0.10.16
- *
- * Returns: the #GstVideoFormat describing the FOURCC value
- */
-GstVideoFormat
-gst_video_format_from_fourcc (guint32 fourcc)
-{
-  switch (fourcc) {
-    case GST_MAKE_FOURCC ('I', '4', '2', '0'):
-      return GST_VIDEO_FORMAT_I420;
-    case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
-      return GST_VIDEO_FORMAT_YV12;
-    case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
-      return GST_VIDEO_FORMAT_YUY2;
-    case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
-      return GST_VIDEO_FORMAT_YVYU;
-    case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
-      return GST_VIDEO_FORMAT_UYVY;
-    case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
-      return GST_VIDEO_FORMAT_AYUV;
-    case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
-      return GST_VIDEO_FORMAT_Y41B;
-    case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
-      return GST_VIDEO_FORMAT_Y42B;
-    case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
-      return GST_VIDEO_FORMAT_Y444;
-    case GST_MAKE_FOURCC ('v', '2', '1', '0'):
-      return GST_VIDEO_FORMAT_v210;
-    case GST_MAKE_FOURCC ('v', '2', '1', '6'):
-      return GST_VIDEO_FORMAT_v216;
-    case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
-      return GST_VIDEO_FORMAT_NV12;
-    case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
-      return GST_VIDEO_FORMAT_NV21;
-    case GST_MAKE_FOURCC ('v', '3', '0', '8'):
-      return GST_VIDEO_FORMAT_v308;
-    case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
-    case GST_MAKE_FOURCC ('Y', '8', ' ', ' '):
-    case GST_MAKE_FOURCC ('G', 'R', 'E', 'Y'):
-      return GST_VIDEO_FORMAT_Y800;
-    case GST_MAKE_FOURCC ('Y', '1', '6', ' '):
-      return GST_VIDEO_FORMAT_Y16;
-    case GST_MAKE_FOURCC ('U', 'Y', 'V', 'P'):
-      return GST_VIDEO_FORMAT_UYVP;
-    case GST_MAKE_FOURCC ('A', '4', '2', '0'):
-      return GST_VIDEO_FORMAT_A420;
-    case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
-      return GST_VIDEO_FORMAT_YUV9;
-    case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
-      return GST_VIDEO_FORMAT_YVU9;
-    case GST_MAKE_FOURCC ('I', 'Y', 'U', '1'):
-      return GST_VIDEO_FORMAT_IYU1;
-    case GST_MAKE_FOURCC ('A', 'Y', '6', '4'):
-      return GST_VIDEO_FORMAT_AYUV64;
-    default:
-      return GST_VIDEO_FORMAT_UNKNOWN;
-  }
-}
+  format = gst_video_format_from_string (s);
+  if (format == GST_VIDEO_FORMAT_UNKNOWN)
+    goto unknown_format;
 
-/**
- * gst_video_format_to_fourcc:
- * @format: a #GstVideoFormat video format
- *
- * Converts a #GstVideoFormat value into the corresponding FOURCC.  Only
- * a few YUV formats have corresponding FOURCC values.  If @format has
- * no corresponding FOURCC value, 0 is returned.
- *
- * Since: 0.10.16
- *
- * Returns: the FOURCC corresponding to @format
- */
-guint32
-gst_video_format_to_fourcc (GstVideoFormat format)
-{
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
+  if (!gst_structure_get_int (structure, "width", &width))
+    goto no_width;
+  if (!gst_structure_get_int (structure, "height", &height))
+    goto no_height;
 
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-      return GST_MAKE_FOURCC ('I', '4', '2', '0');
-    case GST_VIDEO_FORMAT_YV12:
-      return GST_MAKE_FOURCC ('Y', 'V', '1', '2');
-    case GST_VIDEO_FORMAT_YUY2:
-      return GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
-    case GST_VIDEO_FORMAT_YVYU:
-      return GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
-    case GST_VIDEO_FORMAT_UYVY:
-      return GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
-    case GST_VIDEO_FORMAT_AYUV:
-      return GST_MAKE_FOURCC ('A', 'Y', 'U', 'V');
-    case GST_VIDEO_FORMAT_Y41B:
-      return GST_MAKE_FOURCC ('Y', '4', '1', 'B');
-    case GST_VIDEO_FORMAT_Y42B:
-      return GST_MAKE_FOURCC ('Y', '4', '2', 'B');
-    case GST_VIDEO_FORMAT_Y444:
-      return GST_MAKE_FOURCC ('Y', '4', '4', '4');
-    case GST_VIDEO_FORMAT_v210:
-      return GST_MAKE_FOURCC ('v', '2', '1', '0');
-    case GST_VIDEO_FORMAT_v216:
-      return GST_MAKE_FOURCC ('v', '2', '1', '6');
-    case GST_VIDEO_FORMAT_NV12:
-      return GST_MAKE_FOURCC ('N', 'V', '1', '2');
-    case GST_VIDEO_FORMAT_NV21:
-      return GST_MAKE_FOURCC ('N', 'V', '2', '1');
-    case GST_VIDEO_FORMAT_v308:
-      return GST_MAKE_FOURCC ('v', '3', '0', '8');
-    case GST_VIDEO_FORMAT_Y800:
-      return GST_MAKE_FOURCC ('Y', '8', '0', '0');
-    case GST_VIDEO_FORMAT_Y16:
-      return GST_MAKE_FOURCC ('Y', '1', '6', ' ');
-    case GST_VIDEO_FORMAT_UYVP:
-      return GST_MAKE_FOURCC ('U', 'Y', 'V', 'P');
-    case GST_VIDEO_FORMAT_A420:
-      return GST_MAKE_FOURCC ('A', '4', '2', '0');
-    case GST_VIDEO_FORMAT_YUV9:
-      return GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
-    case GST_VIDEO_FORMAT_YVU9:
-      return GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
-    case GST_VIDEO_FORMAT_IYU1:
-      return GST_MAKE_FOURCC ('I', 'Y', 'U', '1');
-    case GST_VIDEO_FORMAT_AYUV64:
-      return GST_MAKE_FOURCC ('A', 'Y', '6', '4');
-    default:
-      return 0;
-  }
-}
+  gst_video_info_set_format (info, format, width, height);
 
-/*
- * gst_video_format_from_rgb32_masks:
- * @red_mask: red bit mask
- * @green_mask: green bit mask
- * @blue_mask: blue bit mask
- *
- * Converts red, green, blue bit masks into the corresponding
- * #GstVideoFormat.
- *
- * Since: 0.10.16
- *
- * Returns: the #GstVideoFormat corresponding to the bit masks
- */
-static GstVideoFormat
-gst_video_format_from_rgb32_masks (int red_mask, int green_mask, int blue_mask)
-{
-  if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
-      blue_mask == 0x0000ff00) {
-    return GST_VIDEO_FORMAT_RGBx;
-  }
-  if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
-      blue_mask == 0xff000000) {
-    return GST_VIDEO_FORMAT_BGRx;
-  }
-  if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
-      blue_mask == 0x000000ff) {
-    return GST_VIDEO_FORMAT_xRGB;
-  }
-  if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
-      blue_mask == 0x00ff0000) {
-    return GST_VIDEO_FORMAT_xBGR;
+  if (gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d)) {
+    info->fps_n = fps_n;
+    info->fps_d = fps_d;
+  } else {
+    info->fps_n = 0;
+    info->fps_d = 1;
   }
 
-  return GST_VIDEO_FORMAT_UNKNOWN;
-}
-
-static GstVideoFormat
-gst_video_format_from_rgba32_masks (int red_mask, int green_mask,
-    int blue_mask, int alpha_mask)
-{
-  if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
-      blue_mask == 0x0000ff00 && alpha_mask == 0x000000ff) {
-    return GST_VIDEO_FORMAT_RGBA;
-  }
-  if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
-      blue_mask == 0xff000000 && alpha_mask == 0x000000ff) {
-    return GST_VIDEO_FORMAT_BGRA;
-  }
-  if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
-      blue_mask == 0x000000ff && alpha_mask == 0xff000000) {
-    return GST_VIDEO_FORMAT_ARGB;
-  }
-  if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
-      blue_mask == 0x00ff0000 && alpha_mask == 0xff000000) {
-    return GST_VIDEO_FORMAT_ABGR;
-  }
+  if (!gst_structure_get_boolean (structure, "interlaced", &interlaced))
+    interlaced = FALSE;
+  if (interlaced)
+    info->flags |= GST_VIDEO_FLAG_INTERLACED;
+  else
+    info->flags &= ~GST_VIDEO_FLAG_INTERLACED;
 
-  return GST_VIDEO_FORMAT_UNKNOWN;
-}
+  s = gst_structure_get_string (structure, "color-matrix");
+  if (s)
+    info->color_matrix = s;
+  else
+    info->color_matrix = "sdtv";
 
-static GstVideoFormat
-gst_video_format_from_rgb24_masks (int red_mask, int green_mask, int blue_mask)
-{
-  if (red_mask == 0xff0000 && green_mask == 0x00ff00 && blue_mask == 0x0000ff) {
-    return GST_VIDEO_FORMAT_RGB;
-  }
-  if (red_mask == 0x0000ff && green_mask == 0x00ff00 && blue_mask == 0xff0000) {
-    return GST_VIDEO_FORMAT_BGR;
-  }
-
-  return GST_VIDEO_FORMAT_UNKNOWN;
-}
-
-static GstVideoFormat
-gst_video_format_from_rgb16_masks (int red_mask, int green_mask, int blue_mask)
-{
-  if (red_mask == GST_VIDEO_COMP1_MASK_16_INT
-      && green_mask == GST_VIDEO_COMP2_MASK_16_INT
-      && blue_mask == GST_VIDEO_COMP3_MASK_16_INT) {
-    return GST_VIDEO_FORMAT_RGB16;
-  }
-  if (red_mask == GST_VIDEO_COMP3_MASK_16_INT
-      && green_mask == GST_VIDEO_COMP2_MASK_16_INT
-      && blue_mask == GST_VIDEO_COMP1_MASK_16_INT) {
-    return GST_VIDEO_FORMAT_BGR16;
-  }
-  if (red_mask == GST_VIDEO_COMP1_MASK_15_INT
-      && green_mask == GST_VIDEO_COMP2_MASK_15_INT
-      && blue_mask == GST_VIDEO_COMP3_MASK_15_INT) {
-    return GST_VIDEO_FORMAT_RGB15;
-  }
-  if (red_mask == GST_VIDEO_COMP3_MASK_15_INT
-      && green_mask == GST_VIDEO_COMP2_MASK_15_INT
-      && blue_mask == GST_VIDEO_COMP1_MASK_15_INT) {
-    return GST_VIDEO_FORMAT_BGR15;
-  }
-
-  return GST_VIDEO_FORMAT_UNKNOWN;
-}
-
-/**
- * gst_video_format_is_rgb:
- * @format: a #GstVideoFormat
- *
- * Determine whether the video format is an RGB format.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @format represents RGB video
- */
-gboolean
-gst_video_format_is_rgb (GstVideoFormat format)
-{
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_v216:
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-    case GST_VIDEO_FORMAT_v308:
-    case GST_VIDEO_FORMAT_UYVP:
-    case GST_VIDEO_FORMAT_A420:
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-    case GST_VIDEO_FORMAT_IYU1:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return FALSE;
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_r210:
-      return TRUE;
-    default:
-      return FALSE;
-  }
-}
-
-/**
- * gst_video_format_is_yuv:
- * @format: a #GstVideoFormat
- *
- * Determine whether the video format is a YUV format.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @format represents YUV video
- */
-gboolean
-gst_video_format_is_yuv (GstVideoFormat format)
-{
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_v216:
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-    case GST_VIDEO_FORMAT_v308:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_Y16:
-    case GST_VIDEO_FORMAT_UYVP:
-    case GST_VIDEO_FORMAT_A420:
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-    case GST_VIDEO_FORMAT_IYU1:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return TRUE;
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_r210:
-      return FALSE;
-    default:
-      return FALSE;
-  }
-}
-
-/**
- * gst_video_format_is_gray:
- * @format: a #GstVideoFormat
- *
- * Determine whether the video format is a grayscale format.
- *
- * Since: 0.10.29
- *
- * Returns: TRUE if @format represents grayscale video
- */
-gboolean
-gst_video_format_is_gray (GstVideoFormat format)
-{
-  switch (format) {
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_GRAY16_BE:
-    case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_Y16:
-      return TRUE;
-    default:
-      return FALSE;
-  }
-}
-
-/**
- * gst_video_format_has_alpha:
- * @format: a #GstVideoFormat
- *
- * Returns TRUE or FALSE depending on if the video format provides an
- * alpha channel.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @format has an alpha channel
- */
-gboolean
-gst_video_format_has_alpha (GstVideoFormat format)
-{
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_v216:
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-    case GST_VIDEO_FORMAT_v308:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_Y16:
-    case GST_VIDEO_FORMAT_UYVP:
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-    case GST_VIDEO_FORMAT_IYU1:
-      return FALSE;
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_A420:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return TRUE;
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-    case GST_VIDEO_FORMAT_r210:
-      return FALSE;
-    default:
-      return FALSE;
-  }
-}
-
-/**
- * gst_video_format_get_component_depth:
- * @format: a #GstVideoFormat
- * @component: the video component (e.g. 0 for 'R' in RGB)
- *
- * Returns the number of bits used to encode an individual pixel of
- * a given @component.  Typically this is 8, although higher and lower
- * values are possible for some formats.
- *
- * Since: 0.10.33
- *
- * Returns: depth of component
- */
-int
-gst_video_format_get_component_depth (GstVideoFormat format, int component)
-{
-  if (component == 3 && !gst_video_format_has_alpha (format))
-    return 0;
-
-  switch (format) {
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-      if (component == 1)
-        return 6;
-      return 5;
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-      return 5;
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-    case GST_VIDEO_FORMAT_v308:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-    case GST_VIDEO_FORMAT_IYU1:
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_A420:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    default:
-      return 8;
-    case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_UYVP:
-    case GST_VIDEO_FORMAT_r210:
-      return 10;
-    case GST_VIDEO_FORMAT_Y16:
-    case GST_VIDEO_FORMAT_v216:
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return 16;
-  }
-
-}
-
-/**
- * gst_video_format_get_row_stride:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @width: the width of video
- *
- * Calculates the row stride (number of bytes from one row of pixels to
- * the next) for the video component with an index of @component.  For
- * YUV video, Y, U, and V have component indices of 0, 1, and 2,
- * respectively.  For RGB video, R, G, and B have component indicies of
- * 0, 1, and 2, respectively.  Alpha channels, if present, have a component
- * index of 3.  The @width parameter always represents the width of the
- * video, not the component.
- *
- * Since: 0.10.16
- *
- * Returns: row stride of component @component
- */
-int
-gst_video_format_get_row_stride (GstVideoFormat format, int component,
-    int width)
-{
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (component >= 0 && component <= 3, 0);
-  g_return_val_if_fail (width > 0, 0);
-
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-      if (component == 0) {
-        return GST_ROUND_UP_4 (width);
-      } else {
-        return GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
-      }
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-      return GST_ROUND_UP_4 (width * 2);
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_r210:
-      return width * 4;
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-      return GST_ROUND_UP_4 (width * 2);
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_v308:
-      return GST_ROUND_UP_4 (width * 3);
-    case GST_VIDEO_FORMAT_Y41B:
-      if (component == 0) {
-        return GST_ROUND_UP_4 (width);
-      } else {
-        return GST_ROUND_UP_16 (width) / 4;
-      }
-    case GST_VIDEO_FORMAT_Y42B:
-      if (component == 0) {
-        return GST_ROUND_UP_4 (width);
-      } else {
-        return GST_ROUND_UP_8 (width) / 2;
-      }
-    case GST_VIDEO_FORMAT_Y444:
-      return GST_ROUND_UP_4 (width);
-    case GST_VIDEO_FORMAT_v210:
-      return ((width + 47) / 48) * 128;
-    case GST_VIDEO_FORMAT_v216:
-      return GST_ROUND_UP_8 (width * 4);
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-      return GST_ROUND_UP_4 (width);
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_Y800:
-      return GST_ROUND_UP_4 (width);
-    case GST_VIDEO_FORMAT_GRAY16_BE:
-    case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y16:
-      return GST_ROUND_UP_4 (width * 2);
-    case GST_VIDEO_FORMAT_UYVP:
-      return GST_ROUND_UP_4 ((width * 2 * 5 + 3) / 4);
-    case GST_VIDEO_FORMAT_A420:
-      if (component == 0 || component == 3) {
-        return GST_ROUND_UP_4 (width);
-      } else {
-        return GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
-      }
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-      return GST_ROUND_UP_4 (width);
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-      if (component == 0) {
-        return GST_ROUND_UP_4 (width);
-      } else {
-        return GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4);
-      }
-    case GST_VIDEO_FORMAT_IYU1:
-      return GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) +
-          GST_ROUND_UP_4 (width) / 2);
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return width * 8;
-    default:
-      return 0;
-  }
-}
-
-/**
- * gst_video_format_get_pixel_stride:
- * @format: a #GstVideoFormat
- * @component: the component index
- *
- * Calculates the pixel stride (number of bytes from one pixel to the
- * pixel to its immediate left) for the video component with an index
- * of @component.  See @gst_video_format_get_row_stride for a description
- * of the component index.
- *
- * Since: 0.10.16
- *
- * Returns: pixel stride of component @component
- */
-int
-gst_video_format_get_pixel_stride (GstVideoFormat format, int component)
-{
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (component >= 0 && component <= 3, 0);
-
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_A420:
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-      return 1;
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-      if (component == 0) {
-        return 2;
-      } else {
-        return 4;
-      }
-    case GST_VIDEO_FORMAT_IYU1:
-      /* doesn't make much sense for IYU1 because it's 1 or 3
-       * for luma depending on position */
-      return 0;
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_r210:
-      return 4;
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-      return 2;
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_v308:
-      return 3;
-    case GST_VIDEO_FORMAT_v210:
-      /* v210 is packed at the bit level, so pixel stride doesn't make sense */
-      return 0;
-    case GST_VIDEO_FORMAT_v216:
-      if (component == 0) {
-        return 4;
-      } else {
-        return 8;
-      }
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-      if (component == 0) {
-        return 1;
-      } else {
-        return 2;
-      }
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_Y800:
-      return 1;
-    case GST_VIDEO_FORMAT_GRAY16_BE:
-    case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y16:
-      return 2;
-    case GST_VIDEO_FORMAT_UYVP:
-      /* UYVP is packed at the bit level, so pixel stride doesn't make sense */
-      return 0;
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-      return 1;
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return 8;
-    default:
-      return 0;
-  }
-}
-
-/**
- * gst_video_format_get_component_width:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @width: the width of video
- *
- * Calculates the width of the component.  See
- * @gst_video_format_get_row_stride for a description
- * of the component index.
- *
- * Since: 0.10.16
- *
- * Returns: width of component @component
- */
-int
-gst_video_format_get_component_width (GstVideoFormat format,
-    int component, int width)
-{
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (component >= 0 && component <= 3, 0);
-  g_return_val_if_fail (width > 0, 0);
-
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_v216:
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-    case GST_VIDEO_FORMAT_UYVP:
-      if (component == 0) {
-        return width;
-      } else {
-        return GST_ROUND_UP_2 (width) / 2;
-      }
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-    case GST_VIDEO_FORMAT_IYU1:
-      if (component == 0) {
-        return width;
-      } else {
-        return GST_ROUND_UP_4 (width) / 4;
-      }
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_v308:
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_GRAY16_BE:
-    case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_Y16:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-    case GST_VIDEO_FORMAT_r210:
-      return width;
-    case GST_VIDEO_FORMAT_A420:
-      if (component == 0 || component == 3) {
-        return width;
-      } else {
-        return GST_ROUND_UP_2 (width) / 2;
-      }
-    default:
-      return 0;
+  s = gst_structure_get_string (structure, "chroma-site");
+  if (s)
+    info->chroma_site = s;
+  else
+    info->chroma_site = "mpeg2";
+
+  if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",
+          &par_n, &par_d)) {
+    info->par_n = par_n;
+    info->par_d = par_d;
+  } else {
+    info->par_n = 1;
+    info->par_d = 1;
+  }
+  return TRUE;
+
+  /* ERROR */
+wrong_name:
+  {
+    GST_ERROR ("wrong name, expected video/x-raw");
+    return FALSE;
+  }
+no_format:
+  {
+    GST_ERROR ("no format given");
+    return FALSE;
+  }
+unknown_format:
+  {
+    GST_ERROR ("unknown format given");
+    return FALSE;
+  }
+no_width:
+  {
+    GST_ERROR ("no width property given");
+    return FALSE;
+  }
+no_height:
+  {
+    GST_ERROR ("no height property given");
+    return FALSE;
   }
 }
 
 /**
- * gst_video_format_get_component_height:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @height: the height of video
+ * gst_video_info_to_caps:
+ * @info: a #GstVideoInfo
  *
- * Calculates the height of the component.  See
- * @gst_video_format_get_row_stride for a description
- * of the component index.
+ * Convert the values of @info into a #GstCaps.
  *
- * Since: 0.10.16
+ * Returns: a new #GstCaps containing the info of @info.
+ */
+GstCaps *
+gst_video_info_to_caps (GstVideoInfo * info)
+{
+  GstCaps *caps;
+  const gchar *format;
+
+  g_return_val_if_fail (info != NULL, NULL);
+  g_return_val_if_fail (info->finfo != NULL, NULL);
+  g_return_val_if_fail (info->finfo->format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
+
+  format = gst_video_format_to_string (info->finfo->format);
+  g_return_val_if_fail (format != NULL, NULL);
+
+  caps = gst_caps_new_simple ("video/x-raw",
+      "format", G_TYPE_STRING, format,
+      "width", G_TYPE_INT, info->width,
+      "height", G_TYPE_INT, info->height,
+      "framerate", GST_TYPE_FRACTION, info->fps_n, info->fps_d,
+      "pixel-aspect-ratio", GST_TYPE_FRACTION, info->par_n, info->par_d, NULL);
+  if (info->flags & GST_VIDEO_FLAG_INTERLACED)
+    gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
+  if (info->color_matrix)
+    gst_caps_set_simple (caps, "color-matrix", G_TYPE_STRING,
+        info->color_matrix, NULL);
+  if (info->chroma_site)
+    gst_caps_set_simple (caps, "chroma-site", G_TYPE_STRING, info->chroma_site,
+        NULL);
+
+  return caps;
+}
+
+/**
+ * gst_video_frame_map:
+ * @frame: pointer to #GstVideoFrame
+ * @info: a #GstVideoInfo
+ * @buffer: the buffer to map
  *
- * Returns: height of component @component
+ * Use @info and @buffer to fill in the values of @frame.
+ *
+ * All video planes of @buffer will be mapped and the pointers will be set in
+ * @frame->data.
+ *
+ * Returns: %TRUE on success.
  */
-int
-gst_video_format_get_component_height (GstVideoFormat format,
-    int component, int height)
+gboolean
+gst_video_frame_map (GstVideoFrame * frame, GstVideoInfo * info,
+    GstBuffer * buffer, GstMapFlags flags)
 {
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (component >= 0 && component <= 3, 0);
-  g_return_val_if_fail (height > 0, 0);
+  GstMetaVideo *meta;
+  guint8 *data;
+  gsize size;
+  gint i;
+
+  g_return_val_if_fail (frame != NULL, FALSE);
+  g_return_val_if_fail (info != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
+
+  frame->buffer = buffer;
+  meta = gst_buffer_get_meta_video (buffer);
+  frame->meta = meta;
+
+  if (meta) {
+    frame->info.flags = meta->flags;
+    frame->info.finfo = &formats[meta->format].info;
+    frame->info.width = meta->width;
+    frame->info.height = meta->height;
+
+    for (i = 0; i < info->finfo->n_planes; i++) {
+      frame->data[i] =
+          gst_meta_video_map (meta, i, &frame->info.stride[i], flags);
+    }
+  } else {
+    /* copy the info */
+    frame->info = *info;
 
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-    case GST_VIDEO_FORMAT_NV12:
-    case GST_VIDEO_FORMAT_NV21:
-      if (component == 0) {
-        return height;
-      } else {
-        return GST_ROUND_UP_2 (height) / 2;
-      }
-    case GST_VIDEO_FORMAT_Y41B:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_v216:
-    case GST_VIDEO_FORMAT_v308:
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_GRAY16_BE:
-    case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_Y16:
-    case GST_VIDEO_FORMAT_UYVP:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-    case GST_VIDEO_FORMAT_IYU1:
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-    case GST_VIDEO_FORMAT_r210:
-      return height;
-    case GST_VIDEO_FORMAT_A420:
-      if (component == 0 || component == 3) {
-        return height;
-      } else {
-        return GST_ROUND_UP_2 (height) / 2;
-      }
-    case GST_VIDEO_FORMAT_YUV9:
-    case GST_VIDEO_FORMAT_YVU9:
-      if (component == 0) {
-        return height;
-      } else {
-        return GST_ROUND_UP_4 (height) / 4;
-      }
-    default:
-      return 0;
+    data = gst_buffer_map (buffer, &size, NULL, flags);
+
+    /* do some sanity checks */
+    if (size < info->size)
+      goto invalid_size;
+
+    /* set up pointers */
+    for (i = 0; i < info->finfo->n_planes; i++) {
+      frame->data[i] = data + info->offset[i];
+    }
+  }
+  return TRUE;
+
+  /* ERRORS */
+invalid_size:
+  {
+    GST_ERROR ("invalid buffer size %" G_GSIZE_FORMAT " < %" G_GSIZE_FORMAT,
+        size, info->size);
+    gst_buffer_unmap (buffer, data, size);
+    return FALSE;
   }
 }
 
 /**
- * gst_video_format_get_component_offset:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @width: the width of video
- * @height: the height of video
+ * gst_video_frame_unmap:
+ * @frame: a #GstVideoFrame
  *
- * Calculates the offset (in bytes) of the first pixel of the component
- * with index @component.  For packed formats, this will typically be a
- * small integer (0, 1, 2, 3).  For planar formats, this will be a
- * (relatively) large offset to the beginning of the second or third
- * component planes.  See @gst_video_format_get_row_stride for a description
- * of the component index.
+ * Unmap the memory previously mapped with gst_video_frame_map.
+ */
+void
+gst_video_frame_unmap (GstVideoFrame * frame)
+{
+  GstBuffer *buffer;
+  GstMetaVideo *meta;
+  gint i;
+
+  g_return_if_fail (frame != NULL);
+
+  buffer = frame->buffer;
+  meta = frame->meta;
+
+  if (meta) {
+    for (i = 0; i < frame->info.finfo->n_planes; i++) {
+      gst_meta_video_unmap (meta, i, frame->data[i]);
+    }
+  } else {
+    guint8 *data;
+
+    data = frame->data[0];
+    data -= frame->info.offset[0];
+    gst_buffer_unmap (buffer, data, -1);
+  }
+}
+
+/**
+ * gst_video_frame_copy:
+ * @dest: a #GstVideoFrame
+ * @src: a #GstVideoFrame
  *
- * Since: 0.10.16
+ * Copy the contents from @src to @dest.
  *
- * Returns: offset of component @component
+ * Returns: TRUE if the contents could be copied.
  */
-int
-gst_video_format_get_component_offset (GstVideoFormat format,
-    int component, int width, int height)
+gboolean
+gst_video_frame_copy (GstVideoFrame * dest, const GstVideoFrame * src)
 {
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (component >= 0 && component <= 3, 0);
-  g_return_val_if_fail ((!gst_video_format_is_yuv (format)) || (width > 0
-          && height > 0), 0);
+  guint i, n_planes;
+  const GstVideoInfo *sinfo;
+  GstVideoInfo *dinfo;
 
-  switch (format) {
-    case GST_VIDEO_FORMAT_I420:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
-      if (component == 2) {
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
-            GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
-            (GST_ROUND_UP_2 (height) / 2);
-      }
-      break;
-    case GST_VIDEO_FORMAT_YV12:        /* same as I420, but components 1+2 swapped */
-      if (component == 0)
-        return 0;
-      if (component == 2)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
-      if (component == 1) {
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
-            GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
-            (GST_ROUND_UP_2 (height) / 2);
-      }
-      break;
+  sinfo = &src->info;
+  dinfo = &dest->info;
+
+  g_return_val_if_fail (dinfo->finfo->format == sinfo->finfo->format, FALSE);
+  g_return_val_if_fail (dinfo->width == sinfo->width
+      && dinfo->height == sinfo->height, FALSE);
+
+  n_planes = dinfo->finfo->n_planes;
+
+  for (i = 0; i < n_planes; i++) {
+    guint w, h, j;
+    guint8 *sp, *dp;
+    gint ss, ds;
+
+    sp = src->data[i];
+    dp = dest->data[i];
+
+    ss = sinfo->stride[i];
+    ds = dinfo->stride[i];
+
+    w = MIN (ABS (ss), ABS (ds));
+    h = GST_VIDEO_FRAME_COMP_HEIGHT (dest, i);
+
+    GST_DEBUG ("w %d h %d", w, h);
+
+    for (j = 0; j < h; j++) {
+      memcpy (dp, sp, w);
+      dp += ds;
+      sp += ss;
+    }
+  }
+  return TRUE;
+}
+
+static int
+fill_planes (GstVideoInfo * info)
+{
+  gint width, height;
+
+  width = info->width;
+  height = info->height;
+
+  switch (info->finfo->format) {
     case GST_VIDEO_FORMAT_YUY2:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return 1;
-      if (component == 2)
-        return 3;
-      break;
     case GST_VIDEO_FORMAT_YVYU:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return 3;
-      if (component == 2)
-        return 1;
-      break;
     case GST_VIDEO_FORMAT_UYVY:
-      if (component == 0)
-        return 1;
-      if (component == 1)
-        return 0;
-      if (component == 2)
-        return 2;
+      info->stride[0] = GST_ROUND_UP_4 (width * 2);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
     case GST_VIDEO_FORMAT_AYUV:
-      if (component == 0)
-        return 1;
-      if (component == 1)
-        return 2;
-      if (component == 2)
-        return 3;
-      if (component == 3)
-        return 0;
-      break;
     case GST_VIDEO_FORMAT_RGBx:
     case GST_VIDEO_FORMAT_RGBA:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return 1;
-      if (component == 2)
-        return 2;
-      if (component == 3)
-        return 3;
-      break;
     case GST_VIDEO_FORMAT_BGRx:
     case GST_VIDEO_FORMAT_BGRA:
-      if (component == 0)
-        return 2;
-      if (component == 1)
-        return 1;
-      if (component == 2)
-        return 0;
-      if (component == 3)
-        return 3;
-      break;
     case GST_VIDEO_FORMAT_xRGB:
     case GST_VIDEO_FORMAT_ARGB:
-      if (component == 0)
-        return 1;
-      if (component == 1)
-        return 2;
-      if (component == 2)
-        return 3;
-      if (component == 3)
-        return 0;
-      break;
     case GST_VIDEO_FORMAT_xBGR:
     case GST_VIDEO_FORMAT_ABGR:
-      if (component == 0)
-        return 3;
-      if (component == 1)
-        return 2;
-      if (component == 2)
-        return 1;
-      if (component == 3)
-        return 0;
+    case GST_VIDEO_FORMAT_r210:
+      info->stride[0] = width * 4;
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_v308:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return 1;
-      if (component == 2)
-        return 2;
+    case GST_VIDEO_FORMAT_RGB16:
+    case GST_VIDEO_FORMAT_BGR16:
+    case GST_VIDEO_FORMAT_RGB15:
+    case GST_VIDEO_FORMAT_BGR15:
+      info->stride[0] = GST_ROUND_UP_4 (width * 2);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
+    case GST_VIDEO_FORMAT_RGB:
     case GST_VIDEO_FORMAT_BGR:
-      if (component == 0)
-        return 2;
-      if (component == 1)
-        return 1;
-      if (component == 2)
-        return 0;
-      break;
-    case GST_VIDEO_FORMAT_Y41B:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * height;
-      if (component == 2)
-        return (GST_ROUND_UP_4 (width) +
-            (GST_ROUND_UP_16 (width) / 4)) * height;
-      break;
-    case GST_VIDEO_FORMAT_Y42B:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * height;
-      if (component == 2)
-        return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 2)) * height;
+    case GST_VIDEO_FORMAT_v308:
+      info->stride[0] = GST_ROUND_UP_4 (width * 3);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
-    case GST_VIDEO_FORMAT_Y444:
-      return GST_ROUND_UP_4 (width) * height * component;
     case GST_VIDEO_FORMAT_v210:
-    case GST_VIDEO_FORMAT_r210:
-      /* v210 is bit-packed, so this doesn't make sense */
-      return 0;
-    case GST_VIDEO_FORMAT_v216:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return 2;
-      if (component == 2)
-        return 6;
-      break;
-    case GST_VIDEO_FORMAT_NV12:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
-      if (component == 2)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
+      info->stride[0] = ((width + 47) / 48) * 128;
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
-    case GST_VIDEO_FORMAT_NV21:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
-      if (component == 2)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
+    case GST_VIDEO_FORMAT_v216:
+      info->stride[0] = GST_ROUND_UP_8 (width * 4);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
     case GST_VIDEO_FORMAT_GRAY8:
+    case GST_VIDEO_FORMAT_Y800:
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
+      break;
     case GST_VIDEO_FORMAT_GRAY16_BE:
     case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y800:
     case GST_VIDEO_FORMAT_Y16:
-      return 0;
+      info->stride[0] = GST_ROUND_UP_4 (width * 2);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
+      break;
     case GST_VIDEO_FORMAT_UYVP:
-      /* UYVP is bit-packed, so this doesn't make sense */
-      return 0;
-    case GST_VIDEO_FORMAT_A420:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
-      if (component == 2) {
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
-            GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
-            (GST_ROUND_UP_2 (height) / 2);
-      }
-      if (component == 3) {
-        return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
-            2 * GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
-            (GST_ROUND_UP_2 (height) / 2);
-      }
+      info->stride[0] = GST_ROUND_UP_4 ((width * 2 * 5 + 3) / 4);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
     case GST_VIDEO_FORMAT_RGB8_PALETTED:
-      return 0;
-    case GST_VIDEO_FORMAT_YUV9:
-      if (component == 0)
-        return 0;
-      if (component == 1)
-        return GST_ROUND_UP_4 (width) * height;
-      if (component == 2) {
-        return GST_ROUND_UP_4 (width) * height +
-            GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
-            (GST_ROUND_UP_4 (height) / 4);
-      }
-      break;
-    case GST_VIDEO_FORMAT_YVU9:
-      if (component == 0)
-        return 0;
-      if (component == 1) {
-        return GST_ROUND_UP_4 (width) * height +
-            GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
-            (GST_ROUND_UP_4 (height) / 4);
-      }
-      if (component == 2)
-        return GST_ROUND_UP_4 (width) * height;
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
     case GST_VIDEO_FORMAT_IYU1:
-      if (component == 0)
-        return 1;
-      if (component == 1)
-        return 0;
-      if (component == 2)
-        return 4;
+      info->stride[0] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) +
+          GST_ROUND_UP_4 (width) / 2);
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
     case GST_VIDEO_FORMAT_ARGB64:
     case GST_VIDEO_FORMAT_AYUV64:
-      if (component == 0)
-        return 2;
-      if (component == 1)
-        return 4;
-      if (component == 2)
-        return 6;
-      if (component == 3)
-        return 0;
-      break;
-    default:
+      info->stride[0] = width * 8;
+      info->offset[0] = 0;
+      info->size = info->stride[0] * height;
       break;
-  }
-  GST_WARNING ("unhandled format %d or component %d", format, component);
-  return 0;
-}
-
-/**
- * gst_video_format_get_size:
- * @format: a #GstVideoFormat
- * @width: the width of video
- * @height: the height of video
- *
- * Calculates the total number of bytes in the raw video format.  This
- * number should be used when allocating a buffer for raw video.
- *
- * Since: 0.10.16
- *
- * Returns: size (in bytes) of raw video format
- */
-int
-gst_video_format_get_size (GstVideoFormat format, int width, int height)
-{
-  int size;
-
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (width > 0 && height > 0, 0);
-
-  switch (format) {
     case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_YV12:
-      size = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
-      size += GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
-          (GST_ROUND_UP_2 (height) / 2) * 2;
-      return size;
-    case GST_VIDEO_FORMAT_IYU1:
-      return GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) +
-          GST_ROUND_UP_4 (width) / 2) * height;
-    case GST_VIDEO_FORMAT_YUY2:
-    case GST_VIDEO_FORMAT_YVYU:
-    case GST_VIDEO_FORMAT_UYVY:
-      return GST_ROUND_UP_4 (width * 2) * height;
-    case GST_VIDEO_FORMAT_AYUV:
-    case GST_VIDEO_FORMAT_RGBx:
-    case GST_VIDEO_FORMAT_BGRx:
-    case GST_VIDEO_FORMAT_xRGB:
-    case GST_VIDEO_FORMAT_xBGR:
-    case GST_VIDEO_FORMAT_RGBA:
-    case GST_VIDEO_FORMAT_BGRA:
-    case GST_VIDEO_FORMAT_ARGB:
-    case GST_VIDEO_FORMAT_ABGR:
-    case GST_VIDEO_FORMAT_r210:
-      return width * 4 * height;
-    case GST_VIDEO_FORMAT_RGB16:
-    case GST_VIDEO_FORMAT_BGR16:
-    case GST_VIDEO_FORMAT_RGB15:
-    case GST_VIDEO_FORMAT_BGR15:
-      return GST_ROUND_UP_4 (width * 2) * height;
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_v308:
-      return GST_ROUND_UP_4 (width * 3) * height;
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
+      info->stride[2] = info->stride[1];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
+      info->offset[2] = info->offset[1] +
+          info->stride[1] * (GST_ROUND_UP_2 (height) / 2);
+      info->size = info->offset[2] +
+          info->stride[2] * (GST_ROUND_UP_2 (height) / 2);
+      break;
+    case GST_VIDEO_FORMAT_YV12:        /* same as I420, but plane 1+2 swapped */
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
+      info->stride[2] = info->stride[1];
+      info->offset[0] = 0;
+      info->offset[2] = info->stride[0] * GST_ROUND_UP_2 (height);
+      info->offset[1] = info->offset[2] +
+          info->stride[1] * (GST_ROUND_UP_2 (height) / 2);
+      info->size = info->offset[1] +
+          info->stride[2] * (GST_ROUND_UP_2 (height) / 2);
+      break;
     case GST_VIDEO_FORMAT_Y41B:
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_16 (width) / 4;
+      info->stride[2] = info->stride[1];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * height;
+      info->offset[2] = info->offset[1] + info->stride[1] * height;
       /* simplification of ROUNDUP4(w)*h + 2*((ROUNDUP16(w)/4)*h */
-      return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_16 (width) / 2)) * height;
+      info->size = (info->stride[0] + (GST_ROUND_UP_16 (width) / 2)) * height;
+      break;
     case GST_VIDEO_FORMAT_Y42B:
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_8 (width) / 2;
+      info->stride[2] = info->stride[1];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * height;
+      info->offset[2] = info->offset[1] + info->stride[1] * height;
       /* simplification of ROUNDUP4(w)*h + 2*(ROUNDUP8(w)/2)*h */
-      return (GST_ROUND_UP_4 (width) + GST_ROUND_UP_8 (width)) * height;
+      info->size = (info->stride[0] + GST_ROUND_UP_8 (width)) * height;
+      break;
     case GST_VIDEO_FORMAT_Y444:
-      return GST_ROUND_UP_4 (width) * height * 3;
-    case GST_VIDEO_FORMAT_v210:
-      return ((width + 47) / 48) * 128 * height;
-    case GST_VIDEO_FORMAT_v216:
-      return GST_ROUND_UP_8 (width * 4) * height;
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = info->stride[0];
+      info->stride[2] = info->stride[0];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * height;
+      info->offset[2] = info->offset[1] * 2;
+      info->size = info->stride[0] * height * 3;
+      break;
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_NV21:
-      return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) * 3 / 2;
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_Y800:
-    case GST_VIDEO_FORMAT_RGB8_PALETTED:
-      return GST_ROUND_UP_4 (width) * height;
-    case GST_VIDEO_FORMAT_GRAY16_BE:
-    case GST_VIDEO_FORMAT_GRAY16_LE:
-    case GST_VIDEO_FORMAT_Y16:
-      return GST_ROUND_UP_4 (width * 2) * height;
-    case GST_VIDEO_FORMAT_UYVP:
-      return GST_ROUND_UP_4 ((width * 2 * 5 + 3) / 4) * height;
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = info->stride[0];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
+      info->size = info->stride[0] * GST_ROUND_UP_2 (height) * 3 / 2;
+      break;
     case GST_VIDEO_FORMAT_A420:
-      size = 2 * GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
-      size += GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
-          (GST_ROUND_UP_2 (height) / 2) * 2;
-      return size;
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
+      info->stride[2] = info->stride[1];
+      info->stride[3] = info->stride[0];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
+      info->offset[2] = info->offset[1] +
+          info->stride[1] * (GST_ROUND_UP_2 (height) / 2);
+      info->offset[3] = info->offset[2] +
+          info->stride[2] * (GST_ROUND_UP_2 (height) / 2);
+      info->size = info->offset[3] + info->stride[0];
+      break;
     case GST_VIDEO_FORMAT_YUV9:
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4);
+      info->stride[2] = info->stride[1];
+      info->offset[0] = 0;
+      info->offset[1] = info->stride[0] * height;
+      info->offset[2] = info->offset[1] +
+          info->stride[1] * (GST_ROUND_UP_4 (height) / 4);
+      info->size = info->offset[2] +
+          info->stride[2] * (GST_ROUND_UP_4 (height) / 4);
+      break;
     case GST_VIDEO_FORMAT_YVU9:
-      size = GST_ROUND_UP_4 (width) * height;
-      size += GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
-          (GST_ROUND_UP_4 (height) / 4) * 2;
-      return size;
-    case GST_VIDEO_FORMAT_ARGB64:
-    case GST_VIDEO_FORMAT_AYUV64:
-      return width * 8 * height;
-    default:
-      return 0;
-  }
-}
-
-/**
- * gst_video_get_size_from_caps:
- * @caps: a pointer to #GstCaps
- * @size: a pointer to a gint that will be assigned the size (in bytes) of a video frame with the given caps
- *
- * Calculates the total number of bytes in the raw video format for the given
- * caps.  This number should be used when allocating a buffer for raw video.
- *
- * Since: 0.10.34
- *
- * Returns: %TRUE if the size could be calculated from the caps
- */
-gboolean
-gst_video_get_size_from_caps (const GstCaps * caps, gint * size)
-{
-  GstVideoFormat format = 0;
-  gint width = 0, height = 0;
-
-  g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
-  g_return_val_if_fail (size != NULL, FALSE);
-
-  if (gst_video_format_parse_caps (caps, &format, &width, &height) == FALSE) {
-    GST_WARNING ("Could not parse caps: %" GST_PTR_FORMAT, caps);
-    return FALSE;
+      info->stride[0] = GST_ROUND_UP_4 (width);
+      info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4);
+      info->stride[2] = info->stride[1];
+      info->offset[0] = 0;
+      info->offset[2] = info->stride[0] * height;
+      info->offset[1] = info->offset[2] +
+          info->stride[1] * (GST_ROUND_UP_4 (height) / 4);
+      info->size = info->offset[2] +
+          info->stride[2] * (GST_ROUND_UP_4 (height) / 4);
+      break;
+    case GST_VIDEO_FORMAT_UNKNOWN:
+      GST_ERROR ("invalid format");
+      g_warning ("invalid format");
+      break;
   }
-
-  *size = gst_video_format_get_size (format, width, height);
-  return TRUE;
+  return 0;
 }
 
 /**
  * gst_video_format_convert:
- * @format: a #GstVideoFormat
- * @width: the width of video
- * @height: the height of video
- * @fps_n: frame rate numerator
- * @fps_d: frame rate denominator
+ * @info: a #GstVideoInfo
  * @src_format: #GstFormat of the @src_value
  * @src_value: value to convert
  * @dest_format: #GstFormat of the @dest_value
@@ -2118,25 +1107,28 @@ gst_video_get_size_from_caps (const GstCaps * caps, gint * size)
  * Converts among various #GstFormat types.  This function handles
  * GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT.  For
  * raw video, GST_FORMAT_DEFAULT corresponds to video frames.  This
- * function can be to handle pad queries of the type GST_QUERY_CONVERT.
+ * function can be used to handle pad queries of the type GST_QUERY_CONVERT.
  *
  * Since: 0.10.16
  *
  * Returns: TRUE if the conversion was successful.
  */
 gboolean
-gst_video_format_convert (GstVideoFormat format, int width, int height,
-    int fps_n, int fps_d,
+gst_video_info_convert (GstVideoInfo * info,
     GstFormat src_format, gint64 src_value,
     GstFormat dest_format, gint64 * dest_value)
 {
   gboolean ret = FALSE;
-  int size;
+  int size, fps_n, fps_d;
 
-  g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-  g_return_val_if_fail (width > 0 && height > 0, 0);
+  g_return_val_if_fail (info != NULL, 0);
+  g_return_val_if_fail (info->finfo != NULL, 0);
+  g_return_val_if_fail (info->finfo->format != GST_VIDEO_FORMAT_UNKNOWN, 0);
+  g_return_val_if_fail (info->size > 0, 0);
 
-  size = gst_video_format_get_size (format, width, height);
+  size = info->size;
+  fps_n = info->fps_n;
+  fps_d = info->fps_d;
 
   GST_DEBUG ("converting value %" G_GINT64_FORMAT " from %s to %s",
       src_value, gst_format_get_name (src_format),
@@ -2300,6 +1292,36 @@ gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still)
 }
 
 /**
+ * gst_video_parse_caps_framerate:
+ * @caps: pointer to a #GstCaps instance
+ * @fps_n: pointer to integer to hold numerator of frame rate (output)
+ * @fps_d: pointer to integer to hold denominator of frame rate (output)
+ *
+ * Extracts the frame rate from @caps and places the values in the locations
+ * pointed to by @fps_n and @fps_d.  Returns TRUE if the values could be
+ * parsed correctly, FALSE if not.
+ *
+ * This function can be used with #GstCaps that have any media type; it
+ * is not limited to formats handled by #GstVideoFormat.
+ *
+ * Since: 0.10.16
+ *
+ * Returns: TRUE if @caps was parsed correctly.
+ */
+gboolean
+gst_video_parse_caps_framerate (GstCaps * caps, int *fps_n, int *fps_d)
+{
+  GstStructure *structure;
+
+  if (!gst_caps_is_fixed (caps))
+    return FALSE;
+
+  structure = gst_caps_get_structure (caps, 0);
+
+  return gst_structure_get_fraction (structure, "framerate", fps_n, fps_d);
+}
+
+/**
  * gst_video_parse_caps_palette:
  * @caps: #GstCaps to parse
  *
index 52e0fea..290da71 100644 (file)
@@ -1,6 +1,5 @@
 /* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Library       <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -33,7 +32,7 @@ G_BEGIN_DECLS
  * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV
  * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped)
  * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
- * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) 
+ * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
  * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...)
  * @GST_VIDEO_FORMAT_RGBx: sparse rgb packed into 32 bit, space last
  * @GST_VIDEO_FORMAT_BGRx: sparse reverse rgb packed into 32 bit, space last
@@ -121,277 +120,375 @@ typedef enum {
   GST_VIDEO_FORMAT_r210
 } GstVideoFormat;
 
-#define GST_VIDEO_BYTE1_MASK_32  "0xFF000000"
-#define GST_VIDEO_BYTE2_MASK_32  "0x00FF0000"
-#define GST_VIDEO_BYTE3_MASK_32  "0x0000FF00"
-#define GST_VIDEO_BYTE4_MASK_32  "0x000000FF"
+#define GST_VIDEO_MAX_PLANES 4
+#define GST_VIDEO_MAX_COMPONENTS 4
 
-#define GST_VIDEO_BYTE1_MASK_24  "0x00FF0000"
-#define GST_VIDEO_BYTE2_MASK_24  "0x0000FF00"
-#define GST_VIDEO_BYTE3_MASK_24  "0x000000FF"
+typedef struct _GstVideoFormatInfo GstVideoFormatInfo;
 
-#define GST_VIDEO_BYTE1_MASK_32_INT  0xFF000000
-#define GST_VIDEO_BYTE2_MASK_32_INT  0x00FF0000
-#define GST_VIDEO_BYTE3_MASK_32_INT  0x0000FF00
-#define GST_VIDEO_BYTE4_MASK_32_INT  0x000000FF
-
-#define GST_VIDEO_BYTE1_MASK_24_INT  0x00FF0000
-#define GST_VIDEO_BYTE2_MASK_24_INT  0x0000FF00
-#define GST_VIDEO_BYTE3_MASK_24_INT  0x000000FF
-
-#define GST_VIDEO_COMP1_MASK_16 "0xf800"
-#define GST_VIDEO_COMP2_MASK_16 "0x07e0"
-#define GST_VIDEO_COMP3_MASK_16 "0x001f"
-
-#define GST_VIDEO_COMP1_MASK_15 "0x7c00"
-#define GST_VIDEO_COMP2_MASK_15 "0x03e0"
-#define GST_VIDEO_COMP3_MASK_15 "0x001f"
-
-#define GST_VIDEO_COMP1_MASK_16_INT 0xf800
-#define GST_VIDEO_COMP2_MASK_16_INT 0x07e0
-#define GST_VIDEO_COMP3_MASK_16_INT 0x001f
-
-#define GST_VIDEO_COMP1_MASK_15_INT 0x7c00
-#define GST_VIDEO_COMP2_MASK_15_INT 0x03e0
-#define GST_VIDEO_COMP3_MASK_15_INT 0x001f
-
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_VIDEO_RED_MASK_16 GST_VIDEO_COMP1_MASK_16
-#define GST_VIDEO_GREEN_MASK_16 GST_VIDEO_COMP2_MASK_16
-#define GST_VIDEO_BLUE_MASK_16 GST_VIDEO_COMP3_MASK_16
-
-#define GST_VIDEO_RED_MASK_15 GST_VIDEO_COMP1_MASK_15
-#define GST_VIDEO_GREEN_MASK_15 GST_VIDEO_COMP2_MASK_15
-#define GST_VIDEO_BLUE_MASK_15 GST_VIDEO_COMP3_MASK_15
-
-#define GST_VIDEO_RED_MASK_16_INT GST_VIDEO_COMP1_MASK_16_INT
-#define GST_VIDEO_GREEN_MASK_16_INT GST_VIDEO_COMP2_MASK_16_INT
-#define GST_VIDEO_BLUE_MASK_16_INT GST_VIDEO_COMP3_MASK_16_INT
-
-#define GST_VIDEO_RED_MASK_15_INT GST_VIDEO_COMP1_MASK_15_INT
-#define GST_VIDEO_GREEN_MASK_15_INT GST_VIDEO_COMP2_MASK_15_INT
-#define GST_VIDEO_BLUE_MASK_15_INT GST_VIDEO_COMP3_MASK_15_INT
-#endif
-
-#define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
-#define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
-
-/* consider the next 2 protected */
-#define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A)                           \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 32, "                                                  \
-    "depth = (int) 32, "                                                \
-    "endianness = (int) BIG_ENDIAN, "                                   \
-    "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
-    "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
-    "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
-    "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
-
-#define __GST_VIDEO_CAPS_MAKE_32(R, G, B)                               \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 32, "                                                  \
-    "depth = (int) 24, "                                                \
-    "endianness = (int) BIG_ENDIAN, "                                   \
-    "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
-    "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
-    "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
-
-#define __GST_VIDEO_CAPS_MAKE_24(R, G, B)                               \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 24, "                                                  \
-    "depth = (int) 24, "                                                \
-    "endianness = (int) BIG_ENDIAN, "                                   \
-    "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", "            \
-    "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", "          \
-    "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", "           \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
+/**
+ * GstVideoFormatFlags:
+ * @GST_VIDEO_FORMAT_FLAG_YUV: The video format is YUV, components are numbered
+ *   0=Y, 1=U, 2=V.
+ * @GST_VIDEO_FORMAT_FLAG_RGB: The video format is RGB, components are numbered
+ *   0=R, 1=G, 2=B.
+ * @GST_VIDEO_FORMAT_FLAG_GRAY: The video is gray, there is one gray component
+ *   with index 0.
+ * @GST_VIDEO_FORMAT_FLAG_ALPHA: The video format has an alpha components with
+ *   the number 3.
+ * @GST_VIDEO_FORMAT_FLAG_LE: The video format has data stored in little
+ *   endianness.
+ * @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette.
+ * @GST_VIDEO_FORMAT_FLAG_COMPLEX: The video format has a complex layout that
+ *   can't be described with the usual information in the #GstVideoFormatInfo.
+ *
+ * The different video flags that a format info can have.
+ */
+typedef enum
+{
+  GST_VIDEO_FORMAT_FLAG_YUV      = (1 << 0),
+  GST_VIDEO_FORMAT_FLAG_RGB      = (1 << 1),
+  GST_VIDEO_FORMAT_FLAG_GRAY     = (1 << 2),
+  GST_VIDEO_FORMAT_FLAG_ALPHA    = (1 << 3),
+  GST_VIDEO_FORMAT_FLAG_LE       = (1 << 4),
+  GST_VIDEO_FORMAT_FLAG_PALETTE  = (1 << 5),
+  GST_VIDEO_FORMAT_FLAG_COMPLEX  = (1 << 6)
+} GstVideoFormatFlags;
+
+#define GST_VIDEO_COMP_Y  0
+#define GST_VIDEO_COMP_U  1
+#define GST_VIDEO_COMP_V  2
+
+#define GST_VIDEO_COMP_R  0
+#define GST_VIDEO_COMP_G  1
+#define GST_VIDEO_COMP_B  2
+
+#define GST_VIDEO_COMP_A  3
 
-#define __GST_VIDEO_CAPS_MAKE_16(R, G, B)                               \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 16, "                                                  \
-    "depth = (int) 16, "                                                \
-    "endianness = (int) BYTE_ORDER, "                                   \
-    "red_mask = (int) " GST_VIDEO_COMP ## R ## _MASK_16 ", "            \
-    "green_mask = (int) " GST_VIDEO_COMP ## G ## _MASK_16 ", "          \
-    "blue_mask = (int) " GST_VIDEO_COMP ## B ## _MASK_16 ", "           \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
+/**
+ * GstVideoFormatUnpack:
+ * @info: a #GstVideoFormatInfo
+ * @dest: a destination array
+ * @data: pointers to the data planes
+ * @stride: strides of the planes
+ * @x: the x position in the image to start from
+ * @y: the y position in the image to start from
+ * @width: the amount of pixels to unpack.
+ *
+ * Unpacks @width pixels from the given planes and strides containing data of
+ * format @info. The pixels will be unpacked into @dest which each component
+ * interleaved. @dest should at least be big enough to hold @width *
+ * n_components * unpack_size bytes.
+ */
+typedef void (*GstVideoFormatUnpack)         (GstVideoFormatInfo *info, gpointer dest,
+                                              const gpointer data[GST_VIDEO_MAX_PLANES],
+                                              const gint stride[GST_VIDEO_MAX_PLANES],
+                                              gint x, gint y, gint width);
+/**
+ * GstVideoFormatPack:
+ * @info: a #GstVideoFormatInfo
+ * @src: a source array
+ * @data: pointers to the destination data planes
+ * @stride: strides of the destination planes
+ * @x: the x position in the image to pack to
+ * @y: the y position in the image to pack to
+ * @width: the amount of pixels to pack.
+ *
+ * Packs @width pixels from @src to the given planes and strides in the
+ * format @info. The pixels from source have each component interleaved
+ * and will be packed into the planes in @data.
+ */
+typedef void (*GstVideoFormatPack)           (GstVideoFormatInfo *info, const gpointer src,
+                                              gpointer data[GST_VIDEO_MAX_PLANES],
+                                              const gint stride[GST_VIDEO_MAX_PLANES],
+                                              gint x, gint y, gint width);
 
-#define __GST_VIDEO_CAPS_MAKE_15(R, G, B)                               \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 16, "                                                  \
-    "depth = (int) 15, "                                                \
-    "endianness = (int) BYTE_ORDER, "                                   \
-    "red_mask = (int) " GST_VIDEO_COMP ## R ## _MASK_15 ", "            \
-    "green_mask = (int) " GST_VIDEO_COMP ## G ## _MASK_15 ", "          \
-    "blue_mask = (int) " GST_VIDEO_COMP ## B ## _MASK_15 ", "           \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
+/**
+ * GstVideoFormatInfo:
+ * @format: #GstVideoFormat
+ * @name: string representation of the format
+ * @flags: #GstVideoFormatFlags
+ * @bits: The number of bits used to pack data items. This can be 8 when the
+ *    pixels are stored in bytes. for values > 8 multiple bytes should be read
+ *    according to the endianness flag before applying the shift and mask.
+ * @n_components: the number of components in the video format.
+ * @shift: the number of bits to shift away to get the component data
+ * @depth: the depth in bits for each component
+ * @pixel_stride: the pixel stride of each component. This is the amount of
+ *    bytes to the pixel immediately to the right. When bits < 8, the stride is
+ *    expressed in bits.
+ * @n_planes: the number of planes for this format. The number of planes can be
+ *    less than the amount of components when multiple components are packed into
+ *    one plane.
+ * @plane: the plane number where a component can be found
+ * @offset: the offset in the plane where the first pixel of the components
+ *    can be found. If bits < 8 the amount is specified in bits.
+ * @w_sub: subsampling factor of the width for the component. Use
+ *     GST_VIDEO_SUB_SCALE to scale a width.
+ * @h_sub: subsampling factor of the height for the component. Use
+ *     GST_VIDEO_SUB_SCALE to scale a height.
+ * @unpack_size: the size in bytes of each component item in the unpacked
+ *     format.
+ * @unpack_func: an unpack function for this format
+ * @pack_func: an pack function for this format
+ *
+ * Information for a video format.
+ */
+struct _GstVideoFormatInfo {
+  GstVideoFormat format;
+  const gchar *name;
+  GstVideoFormatFlags flags;
+  guint bits;
+  guint n_components;
+  guint shift[GST_VIDEO_MAX_COMPONENTS];
+  guint depth[GST_VIDEO_MAX_COMPONENTS];
+  gint  pixel_stride[GST_VIDEO_MAX_COMPONENTS];
+  guint n_planes;
+  guint plane[GST_VIDEO_MAX_COMPONENTS];
+  guint offset[GST_VIDEO_MAX_COMPONENTS];
+  guint w_sub[GST_VIDEO_MAX_COMPONENTS];
+  guint h_sub[GST_VIDEO_MAX_COMPONENTS];
+
+  guint unpack_size;
+  GstVideoFormatUnpack unpack_func;
+  GstVideoFormatPack pack_func;
+};
+
+#define GST_VIDEO_FORMAT_INFO_FORMAT(info)       ((info)->format)
+#define GST_VIDEO_FORMAT_INFO_NAME(info)         ((info)->name)
+#define GST_VIDEO_FORMAT_INFO_FLAGS(info)        ((info)->flags)
+
+#define GST_VIDEO_FORMAT_INFO_IS_YUV(info)       ((info)->flags & GST_VIDEO_FORMAT_FLAG_YUV)
+#define GST_VIDEO_FORMAT_INFO_IS_RGB(info)       ((info)->flags & GST_VIDEO_FORMAT_FLAG_RGB)
+#define GST_VIDEO_FORMAT_INFO_IS_GRAY(info)      ((info)->flags & GST_VIDEO_FORMAT_FLAG_GRAY)
+#define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info)    ((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)
+#define GST_VIDEO_FORMAT_INFO_IS_LE(info)        ((info)->flags & GST_VIDEO_FORMAT_FLAG_LE)
+#define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info)  ((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE)
+
+#define GST_VIDEO_FORMAT_INFO_BITS(info)         ((info)->bits)
+#define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
+#define GST_VIDEO_FORMAT_INFO_SHIFT(info,c)      ((info)->shift[c])
+#define GST_VIDEO_FORMAT_INFO_DEPTH(info,c)      ((info)->depth[c])
+#define GST_VIDEO_FORMAT_INFO_PSTRIDE(info,c)    ((info)->pixel_stride[c])
+#define GST_VIDEO_FORMAT_INFO_N_PLANES(info)     ((info)->n_planes)
+#define GST_VIDEO_FORMAT_INFO_PLANE(info,c)      ((info)->plane[c])
+#define GST_VIDEO_FORMAT_INFO_OFFSET(info,c)     ((info)->offset[c])
+#define GST_VIDEO_FORMAT_INFO_W_SUB(info,c)      ((info)->w_sub[c])
+#define GST_VIDEO_FORMAT_INFO_H_SUB(info,c)      ((info)->h_sub[c])
+
+#define GST_VIDEO_SUB_SCALE(scale,val)   (-((-((gint)val))>>(scale)))
+
+#define GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(info,c,w)  GST_VIDEO_SUB_SCALE ((info)->w_sub[(c)],(w))
+#define GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT(info,c,h) GST_VIDEO_SUB_SCALE ((info)->h_sub[(c)],(h))
+
+#define GST_VIDEO_FORMAT_INFO_DATA(info,planes,comp) \
+  (((guint8*)(planes)[info->plane[comp]]) + info->offset[comp])
+#define GST_VIDEO_FORMAT_INFO_STRIDE(info,strides,comp) ((strides)[info->plane[comp]])
 
-#define __GST_VIDEO_CAPS_MAKE_64A(R, G, B, A)                           \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 64, "                                                  \
-    "depth = (int) 64, "                                                \
-    "endianness = (int) BIG_ENDIAN, "                                   \
-    "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
-    "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
-    "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
-    "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
+/* format properties */
+GstVideoFormat gst_video_format_from_masks           (gint depth, gint bpp, gint endianness,
+                                                      gint red_mask, gint green_mask,
+                                                      gint blue_mask, gint alpha_mask) G_GNUC_CONST;
 
+GstVideoFormat gst_video_format_from_fourcc          (guint32 fourcc) G_GNUC_CONST;
+GstVideoFormat gst_video_format_from_string          (const gchar *format) G_GNUC_CONST;
 
-/* 24 bit */
-
-#define GST_VIDEO_CAPS_RGB \
-    __GST_VIDEO_CAPS_MAKE_24 (1, 2, 3)
-
-#define GST_VIDEO_CAPS_BGR \
-    __GST_VIDEO_CAPS_MAKE_24 (3, 2, 1)
-
-/* 32 bit */
-
-#define GST_VIDEO_CAPS_RGBx \
-    __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
-  
-#define GST_VIDEO_CAPS_xRGB \
-    __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
-  
-#define GST_VIDEO_CAPS_BGRx \
-    __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
-  
-#define GST_VIDEO_CAPS_xBGR \
-    __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
-
-/* 32 bit alpha */
-
-#define GST_VIDEO_CAPS_RGBA \
-    __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4)
-  
-#define GST_VIDEO_CAPS_ARGB \
-    __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1)
-  
-#define GST_VIDEO_CAPS_BGRA \
-    __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4)
-  
-#define GST_VIDEO_CAPS_ABGR \
-    __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1)
-
-/* note: the macro name uses the order on BE systems */
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-  #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
-      GST_VIDEO_CAPS_xRGB
-  #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
-      GST_VIDEO_CAPS_BGRx
-#else
-  #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
-      GST_VIDEO_CAPS_BGRx
-  #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
-      GST_VIDEO_CAPS_xRGB
-#endif
-      
-/* 15/16 bit */
-  
-#define GST_VIDEO_CAPS_RGB_16 \
-    __GST_VIDEO_CAPS_MAKE_16 (1, 2, 3)
-
-#define GST_VIDEO_CAPS_BGR_16 \
-    __GST_VIDEO_CAPS_MAKE_16 (3, 2, 1)
-
-#define GST_VIDEO_CAPS_RGB_15 \
-    __GST_VIDEO_CAPS_MAKE_15 (1, 2, 3)
-
-#define GST_VIDEO_CAPS_BGR_15 \
-    __GST_VIDEO_CAPS_MAKE_15 (3, 2, 1)
-
-/* 30 bit */
-#define GST_VIDEO_CAPS_r210 \
-    "video/x-raw-rgb, "                                                 \
-    "bpp = (int) 32, "                                                  \
-    "depth = (int) 30, "                                                \
-    "endianness = (int) BIG_ENDIAN, "                                   \
-    "red_mask = (int) 0x3ff00000, "                                     \
-    "green_mask = (int) 0x000ffc00, "                                   \
-    "blue_mask = (int) 0x000003ff, "                                    \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE
+guint32        gst_video_format_to_fourcc            (GstVideoFormat format) G_GNUC_CONST;
+const gchar *  gst_video_format_to_string            (GstVideoFormat format) G_GNUC_CONST;
 
-/* 64 bit alpha */
+const GstVideoFormatInfo *
+               gst_video_format_get_info             (GstVideoFormat format) G_GNUC_CONST;
 
-#define GST_VIDEO_CAPS_ARGB_64 \
-    __GST_VIDEO_CAPS_MAKE_64A (2, 3, 4, 1)
+typedef struct _GstVideoInfo GstVideoInfo;
+typedef struct _GstVideoFrame GstVideoFrame;
 
 /**
- * GST_VIDEO_CAPS_RGB8_PALETTED:
- *
- * Generic caps string for 8-bit paletted RGB video, for use in pad templates.
+ * GstVideoFlags:
+ * @GST_META_VIDEO_FLAG_NONE: no flags
+ * @GST_META_VIDEO_FLAG_INTERLACED:
+ * @GST_META_VIDEO_FLAG_TTF:
+ * @GST_META_VIDEO_FLAG_RFF:
+ * @GST_META_VIDEO_FLAG_ONEFIELD:
+ * @GST_META_VIDEO_FLAG_TELECINE:
+ * @GST_META_VIDEO_FLAG_PROGRESSIVE:
  *
- * Since: 0.10.32
+ * Extra video flags
  */
-#define GST_VIDEO_CAPS_RGB8_PALETTED \
-  "video/x-raw-rgb, bpp = (int)8, depth = (int)8, "                     \
-      "width = "GST_VIDEO_SIZE_RANGE" , "                              \
-      "height = " GST_VIDEO_SIZE_RANGE ", "                             \
-      "framerate = "GST_VIDEO_FPS_RANGE
+typedef enum {
+  GST_VIDEO_FLAG_NONE        = 0,
+  GST_VIDEO_FLAG_INTERLACED  = (1 << 0),
+  GST_VIDEO_FLAG_TTF         = (1 << 1),
+  GST_VIDEO_FLAG_RFF         = (1 << 2),
+  GST_VIDEO_FLAG_ONEFIELD    = (1 << 3),
+  GST_VIDEO_FLAG_TELECINE    = (1 << 4),
+  GST_VIDEO_FLAG_PROGRESSIVE = (1 << 5)
+} GstVideoFlags;
 
 /**
- * GST_VIDEO_CAPS_YUV:
- * @fourcc: YUV fourcc format that describes the pixel layout, as string
- *     (e.g. "I420", "YV12", "YUY2", "AYUV", etc.)
+ * GstVideoInfo:
+ * @finfo: the format info of the video
+ * @flags: additional video flags
+ * @width: the width of the video
+ * @height: the height of the video
+ * @size: the default size of one frame
+ * @color_matrix: the color matrix.  Possible values are
+ *   "sdtv" for the standard definition color matrix (as specified in
+ *   Rec. ITU-R BT.470-6) or "hdtv" for the high definition color
+ *   matrix (as specified in Rec. ITU-R BT.709)
+ * @chroma_site: the chroma siting. Possible values are
+ *   "mpeg2" for MPEG-2 style chroma siting (co-sited horizontally,
+ *   halfway-sited vertically), "jpeg" for JPEG and Theora style
+ *   chroma siting (halfway-sited both horizontally and vertically).
+ *   Other chroma site values are possible, but uncommon.
+ * @palette: a buffer with palette data
+ * @par_n: the pixel-aspect-ratio numerator
+ * @par_d: the pixel-aspect-ratio demnominator
+ * @fps_n: the framerate numerator
+ * @fps_d: the framerate demnominator
+ * @offset: offsets of the planes
+ * @stride: strides of the planes
+ *
+ * Information describing image properties. This information can be filled
+ * in from GstCaps with gst_video_info_from_caps(). The information is also used
+ * to store the specific video info when mapping a video frame with
+ * gst_video_frame_map().
  *
- * Generic caps string for YUV video, for use in pad templates.
+ * Use the provided macros to access the info in this structure.
  */
-#define GST_VIDEO_CAPS_YUV(fourcc)                                      \
-        "video/x-raw-yuv, "                                             \
-        "format = (fourcc) " fourcc ", "                                \
-        "width = " GST_VIDEO_SIZE_RANGE ", "                            \
-        "height = " GST_VIDEO_SIZE_RANGE ", "                           \
-        "framerate = " GST_VIDEO_FPS_RANGE
+struct _GstVideoInfo {
+  const GstVideoFormatInfo *finfo;
+  GstVideoFlags             flags;
+  gint                      width;
+  gint                      height;
+  gsize                     size;
+
+  const gchar              *color_matrix;
+  const gchar              *chroma_site;
+  GstBuffer                *palette;
+
+  gint                      par_n;
+  gint                      par_d;
+  gint                      fps_n;
+  gint                      fps_d;
+
+  gsize                     offset[GST_VIDEO_MAX_PLANES];
+  gint                      stride[GST_VIDEO_MAX_PLANES];
+};
+
+/* general info */
+#define GST_VIDEO_INFO_FORMAT(i)         (GST_VIDEO_FORMAT_INFO_FORMAT((i)->finfo))
+#define GST_VIDEO_INFO_NAME(i)           (GST_VIDEO_FORMAT_INFO_NAME((i)->finfo))
+#define GST_VIDEO_INFO_IS_YUV(i)         (GST_VIDEO_FORMAT_INFO_IS_YUV((i)->finfo))
+#define GST_VIDEO_INFO_IS_RGB(i)         (GST_VIDEO_FORMAT_INFO_IS_RGB((i)->finfo))
+#define GST_VIDEO_INFO_IS_GRAY(i)        (GST_VIDEO_FORMAT_INFO_IS_GRAY((i)->finfo))
+#define GST_VIDEO_INFO_HAS_ALPHA(i)      (GST_VIDEO_FORMAT_INFO_HAS_ALPHA((i)->finfo))
+
+#define GST_VIDEO_INFO_FLAGS(i)          ((i)->flags)
+#define GST_VIDEO_INFO_WIDTH(i)          ((i)->width)
+#define GST_VIDEO_INFO_HEIGHT(i)         ((i)->height)
+#define GST_VIDEO_INFO_SIZE(i)           ((i)->size)
+#define GST_VIDEO_INFO_PAR_N(i)          ((i)->par_n)
+#define GST_VIDEO_INFO_PAR_D(i)          ((i)->par_d)
+#define GST_VIDEO_INFO_FPS_N(i)          ((i)->fps_n)
+#define GST_VIDEO_INFO_FPS_D(i)          ((i)->fps_d)
+
+/* dealing with planes */
+#define GST_VIDEO_INFO_N_PLANES(i)       (GST_VIDEO_FORMAT_INFO_N_PLANES((i)->finfo))
+#define GST_VIDEO_INFO_PLANE_OFFSET(i,p) ((i)->offset[p])
+#define GST_VIDEO_INFO_PLANE_STRIDE(i,p) ((i)->stride[p])
+
+/* dealing with components */
+#define GST_VIDEO_INFO_N_COMPONENTS(i)   GST_VIDEO_FORMAT_INFO_N_COMPONENTS((i)->finfo)
+#define GST_VIDEO_INFO_COMP_DATA(i,d,c)  GST_VIDEO_FORMAT_INFO_DATA((i)->finfo,d,c)
+#define GST_VIDEO_INFO_COMP_STRIDE(i,c)  GST_VIDEO_FORMAT_INFO_STRIDE((i)->finfo,(i)->stride,c)
+#define GST_VIDEO_INFO_COMP_WIDTH(i,c)   GST_VIDEO_FORMAT_INFO_SCALE_WIDTH((i)->finfo,c,(i)->width)
+#define GST_VIDEO_INFO_COMP_HEIGHT(i,c)  GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT((i)->finfo,c,(i)->height)
+#define GST_VIDEO_INFO_COMP_PLANE(i,c)   GST_VIDEO_FORMAT_INFO_PLANE((i)->finfo,c)
+#define GST_VIDEO_INFO_COMP_OFFSET(i,c)  GST_VIDEO_FORMAT_INFO_OFFSET((i)->finfo,c)
+#define GST_VIDEO_INFO_COMP_PSTRIDE(i,c) GST_VIDEO_FORMAT_INFO_PSTRIDE((i)->finfo,c)
+
+void         gst_video_info_init        (GstVideoInfo *info);
+
+void         gst_video_info_set_format  (GstVideoInfo *info, GstVideoFormat format,
+                                         guint width, guint height);
+
+gboolean     gst_video_info_from_caps   (GstVideoInfo *info, const GstCaps  * caps);
+
+GstCaps *    gst_video_info_to_caps     (GstVideoInfo *info);
+
+gboolean     gst_video_info_convert     (GstVideoInfo *info,
+                                         GstFormat     src_format,
+                                         gint64        src_value,
+                                         GstFormat     dest_format,
+                                         gint64       *dest_value);
 
 /**
- * GST_VIDEO_CAPS_GRAY8:
- *
- * Generic caps string for 8-bit grayscale video, for use in pad templates.
+ * GstVideoFrame:
+ * @info: the #GstVideoInfo
+ * @buffer: the mapped buffer
+ * @meta: pointer to metadata if any
+ * @data: pointers to the plane data
  *
- * Since: 0.10.29
+ * A video frame obtained from gst_video_frame_map()
  */
-#define GST_VIDEO_CAPS_GRAY8                                            \
-        "video/x-raw-gray, "                                            \
-        "bpp = (int) 8, "                                               \
-        "depth = (int) 8, "                                             \
-        "width = " GST_VIDEO_SIZE_RANGE ", "                            \
-        "height = " GST_VIDEO_SIZE_RANGE ", "                           \
-        "framerate = " GST_VIDEO_FPS_RANGE
+struct _GstVideoFrame {
+  GstVideoInfo info;
+
+  GstBuffer *buffer;
+  gpointer   meta;
+
+  gpointer   data[GST_VIDEO_MAX_PLANES];
+};
+
+gboolean    gst_video_frame_map           (GstVideoFrame *frame, GstVideoInfo *info,
+                                           GstBuffer *buffer, GstMapFlags flags);
+void        gst_video_frame_unmap         (GstVideoFrame *frame);
+
+gboolean    gst_video_frame_copy          (GstVideoFrame *dest, const GstVideoFrame *src);
+
+/* general info */
+#define GST_VIDEO_FRAME_FORMAT(f)         (GST_VIDEO_INFO_FORMAT(&(f)->info))
+#define GST_VIDEO_FRAME_WIDTH(f)          (GST_VIDEO_INFO_WIDTH(&(f)->info))
+#define GST_VIDEO_FRAME_HEIGHT(f)         (GST_VIDEO_INFO_HEIGHT(&(f)->info))
+#define GST_VIDEO_FRAME_SIZE(f)           (GST_VIDEO_INFO_SIZE(&(f)->info))
+
+/* dealing with planes */
+#define GST_VIDEO_FRAME_N_PLANES(f)       (GST_VIDEO_INFO_N_PLANES(&(f)->info))
+#define GST_VIDEO_FRAME_PLANE_DATA(f,p)   ((f)->data[p])
+#define GST_VIDEO_FRAME_PLANE_OFFSET(f,p) (GST_VIDEO_INFO_PLANE_OFFSET(&(f)->info,p))
+#define GST_VIDEO_FRAME_PLANE_STRIDE(f,p) (GST_VIDEO_INFO_PLANE_STRIDE(&(f)->info,p))
+
+/* dealing with components */
+#define GST_VIDEO_FRAME_N_COMPONENTS(f)   GST_VIDEO_INFO_N_COMPONENTS(&(f)->info)
+#define GST_VIDEO_FRAME_COMP_DATA(f,c)    GST_VIDEO_INFO_COMP_DATA(&(f)->info,(f)->data,c)
+#define GST_VIDEO_FRAME_COMP_STRIDE(f,c)  GST_VIDEO_INFO_COMP_STRIDE(&(f)->info,c)
+#define GST_VIDEO_FRAME_COMP_WIDTH(f,c)   GST_VIDEO_INFO_COMP_WIDTH(&(f)->info,c)
+#define GST_VIDEO_FRAME_COMP_HEIGHT(f,c)  GST_VIDEO_INFO_COMP_HEIGHT(&(f)->info,c)
+#define GST_VIDEO_FRAME_COMP_PLANE(f,c)   GST_VIDEO_INFO_COMP_PLANE(&(f)->info,c)
+#define GST_VIDEO_FRAME_COMP_OFFSET(f,c)  GST_VIDEO_INFO_COMP_OFFSET(&(f)->info,c)
+#define GST_VIDEO_FRAME_COMP_PSTRIDE(f,c) GST_VIDEO_INFO_COMP_PSTRIDE(&(f)->info,c)
+
+#define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
+#define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
+
+#define GST_VIDEO_FORMATS_ALL "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, "  \
+    "BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, "  \
+    "YVYU, Y444, v210, v216, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, " \
+    "v308, Y800, Y16, RGB16, BGR16, RGB15, BGR15, UYVP, A420, "         \
+    "RGB8_PALETTED, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210 }"
 
 /**
- * GST_VIDEO_CAPS_GRAY16:
- * @endianness: endianness as string, ie. either "1234", "4321", "BIG_ENDIAN"
- *     or "LITTLE_ENDIAN"
- *
- * Generic caps string for 16-bit grayscale video, for use in pad templates.
+ * GST_VIDEO_CAPS_MAKE:
+ * @format: string format that describes the pixel layout, as string
+ *     (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
  *
- * Since: 0.10.29
+ * Generic caps string for video, for use in pad templates.
  */
-#define GST_VIDEO_CAPS_GRAY16(endianness)                               \
-        "video/x-raw-gray, "                                            \
-        "bpp = (int) 16, "                                              \
-        "depth = (int) 16, "                                            \
-        "endianness = (int) " endianness ", "                           \
-        "width = " GST_VIDEO_SIZE_RANGE ", "                            \
-        "height = " GST_VIDEO_SIZE_RANGE ", "                           \
-        "framerate = " GST_VIDEO_FPS_RANGE
+#define GST_VIDEO_CAPS_MAKE(format)                                     \
+    "video/x-raw, "                                                     \
+    "format = (string) " format ", "                                    \
+    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
+    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
+    "framerate = " GST_VIDEO_FPS_RANGE
 
 /* buffer flags */
 
@@ -435,14 +532,7 @@ typedef enum {
  */
 #define GST_VIDEO_BUFFER_PROGRESSIVE GST_BUFFER_FLAG_MEDIA4
 
-/* functions */
-
-const GValue * gst_video_frame_rate (GstPad * pad);
-
-gboolean       gst_video_get_size   (GstPad * pad,
-                                     gint   * width,
-                                     gint   * height);
-
+/* some helper functions */
 gboolean       gst_video_calculate_display_ratio (guint * dar_n,
                                                   guint * dar_d,
                                                   guint   video_width,
@@ -452,100 +542,9 @@ gboolean       gst_video_calculate_display_ratio (guint * dar_n,
                                                   guint   display_par_n,
                                                   guint   display_par_d);
 
-gboolean       gst_video_format_parse_caps (const GstCaps  * caps,
-                                            GstVideoFormat * format,
-                                            int            * width,
-                                            int            * height);
-
-gboolean       gst_video_format_parse_caps_interlaced  (GstCaps  * caps,
-                                                        gboolean * interlaced);
-
-
-gboolean       gst_video_parse_caps_pixel_aspect_ratio (GstCaps  * caps,
-                                                        int      * par_n,
-                                                        int      * par_d);
-
-gboolean       gst_video_parse_caps_framerate    (GstCaps * caps,
-                                                  int     * fps_n,
-                                                  int     * fps_d);
-
-const char *   gst_video_parse_caps_color_matrix (GstCaps * caps);
-
-const char *   gst_video_parse_caps_chroma_site  (GstCaps * caps);
-
+gboolean       gst_video_parse_caps_framerate    (GstCaps * caps, int *fps_n, int *fps_d);
 GstBuffer *    gst_video_parse_caps_palette      (GstCaps * caps);
 
-/* create caps given format and details */
-
-GstCaps *      gst_video_format_new_caps (GstVideoFormat format,
-                                          int width, int height,
-                                          int framerate_n,
-                                          int framerate_d,
-                                          int par_n, int par_d);
-
-GstCaps *      gst_video_format_new_caps_interlaced (GstVideoFormat format,
-                                                     int width, int height,
-                                                     int framerate_n,
-                                                     int framerate_d,
-                                                     int par_n, int par_d,
-                                                     gboolean interlaced);
-
-GstCaps *      gst_video_format_new_template_caps (GstVideoFormat format);
-
-/* format properties */
-
-GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc) G_GNUC_CONST;
-
-guint32        gst_video_format_to_fourcc (GstVideoFormat format) G_GNUC_CONST;
-
-gboolean       gst_video_format_is_rgb    (GstVideoFormat format) G_GNUC_CONST;
-
-gboolean       gst_video_format_is_yuv    (GstVideoFormat format) G_GNUC_CONST;
-
-gboolean       gst_video_format_is_gray   (GstVideoFormat format) G_GNUC_CONST;
-
-gboolean       gst_video_format_has_alpha (GstVideoFormat format) G_GNUC_CONST;
-
-
-int            gst_video_format_get_component_depth  (GstVideoFormat format,
-                                                      int            component) G_GNUC_CONST;
-
-int            gst_video_format_get_row_stride       (GstVideoFormat format,
-                                                      int            component,
-                                                      int            width) G_GNUC_CONST;
-
-int            gst_video_format_get_pixel_stride     (GstVideoFormat format,
-                                                      int            component) G_GNUC_CONST;
-
-int            gst_video_format_get_component_width  (GstVideoFormat format,
-                                                      int            component,
-                                                      int            width) G_GNUC_CONST;
-
-int            gst_video_format_get_component_height (GstVideoFormat format,
-                                                      int            component,
-                                                      int            height) G_GNUC_CONST;
-
-int            gst_video_format_get_component_offset (GstVideoFormat format,
-                                                      int            component,
-                                                      int            width,
-                                                      int            height) G_GNUC_CONST;
-
-int            gst_video_format_get_size             (GstVideoFormat format,
-                                                      int            width,
-                                                      int            height) G_GNUC_CONST;
-
-gboolean       gst_video_get_size_from_caps (const GstCaps * caps, gint * size);
-
-gboolean       gst_video_format_convert (GstVideoFormat  format,
-                                         int             width,
-                                         int             height,
-                                         int             fps_n,
-                                         int             fps_d,
-                                         GstFormat       src_format,
-                                         gint64          src_value,
-                                         GstFormat       dest_format,
-                                         gint64        * dest_value);
-
 /* video still frame event creation and parsing */
 
 GstEvent *     gst_video_event_new_still_frame   (gboolean in_still);
@@ -558,6 +557,7 @@ gboolean       gst_video_event_parse_still_frame (GstEvent * event, gboolean * i
 typedef void (*GstVideoConvertFrameCallback) (GstBuffer * buf, GError *error, gpointer user_data);
 
 void           gst_video_convert_frame_async (GstBuffer                    * buf,
+                                              GstCaps                      * from_caps,
                                               const GstCaps                * to_caps,
                                               GstClockTime                   timeout,
                                               GstVideoConvertFrameCallback   callback,
@@ -565,10 +565,10 @@ void           gst_video_convert_frame_async (GstBuffer                    * buf
                                               GDestroyNotify                 destroy_notify);
 
 GstBuffer *    gst_video_convert_frame       (GstBuffer     * buf,
+                                              GstCaps       * from_caps,
                                               const GstCaps * to_caps,
                                               GstClockTime    timeout,
                                               GError       ** error);
-
 G_END_DECLS
 
 #endif /* __GST_VIDEO_H__ */
index 4f0ff3a..0543587 100644 (file)
@@ -36,6 +36,17 @@ A wide range of video and audio decoders, encoders, and filters are included.
 
  <release>
   <Version>
+   <revision>0.11.0</revision>
+   <branch>0.11</branch>
+   <name>Just like a pacifier</name>
+   <created>2011-08-02</created>
+   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.11.0.tar.bz2" />
+   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.11.0.tar.gz" />
+  </Version>
+ </release>
+
+ <release>
+  <Version>
    <revision>0.10.35</revision>
    <branch>0.10</branch>
    <name>Short Notice</name>
index 278add1..9a9d421 100644 (file)
@@ -1,7 +1,7 @@
 %define majorminor  @GST_MAJORMINOR@
-%define gstreamer   gstreamer
+%define gstreamer   gstreamer011
 
-%define gst_minver  0.10.0
+%define gst_minver  0.11.0
 
 Name:          %{gstreamer}-plugins-base
 Version:       @VERSION@
@@ -15,16 +15,15 @@ Vendor:         GStreamer Backpackers Team <package@gstreamer.freedesktop.org>
 Source:         http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-Requires:        %{gstreamer} >= %{gst_minver}
-BuildRequires:           %{gstreamer}-devel >= %{gst_minver}
+Requires:      %{gstreamer} >= %{gst_minver}
+BuildRequires:         %{gstreamer}-devel >= %{gst_minver}
+BuildRequires:  gobject-introspection-devel >= 0.9.12
 
 BuildRequires:  gcc-c++
 BuildRequires:  gtk-doc >= 1.3
 BuildRequires:  orc-devel
 Requires:       orc
 
-@USE_GNOME_VFS_TRUE@Requires:      gnome-vfs2 > 1.9.4.00
-@USE_GNOME_VFS_TRUE@BuildRequires: gnome-vfs2-devel > 1.9.4.00
 @USE_VORBIS_TRUE@Requires:      libogg >= 1.0
 @USE_VORBIS_TRUE@Requires:      libvorbis >= 1.0
 @USE_VORBIS_TRUE@BuildRequires: libogg-devel >= 1.0
@@ -102,15 +101,13 @@ rm -rf $RPM_BUILD_ROOT
 # base plugins without external dependencies
 %{_libdir}/gstreamer-%{majorminor}/libgstadder.so
 %{_libdir}/gstreamer-%{majorminor}/libgstaudioconvert.so
-%{_libdir}/gstreamer-%{majorminor}/libgstffmpegcolorspace.so
-%{_libdir}/gstreamer-%{majorminor}/libgstdecodebin.so
-%{_libdir}/gstreamer-%{majorminor}/libgstdecodebin2.so
-%{_libdir}/gstreamer-%{majorminor}/libgstplaybin.so
+%{_libdir}/gstreamer-%{majorminor}/libgstplayback.so
 %{_libdir}/gstreamer-%{majorminor}/libgsttypefindfunctions.so
 %{_libdir}/gstreamer-%{majorminor}/libgstvideotestsrc.so
 %{_libdir}/gstreamer-%{majorminor}/libgstaudiorate.so
 %{_libdir}/gstreamer-%{majorminor}/libgstsubparse.so
 %{_libdir}/gstreamer-%{majorminor}/libgstvolume.so
+%{_libdir}/gstreamer-%{majorminor}/libgstvideoconvert.so
 %{_libdir}/gstreamer-%{majorminor}/libgstvideorate.so
 %{_libdir}/gstreamer-%{majorminor}/libgstvideoscale.so
 %{_libdir}/gstreamer-%{majorminor}/libgsttcp.so
@@ -128,7 +125,6 @@ rm -rf $RPM_BUILD_ROOT
 # base plugins with dependencies
 @USE_ALSA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstalsa.so
 @USE_THEORA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgsttheora.so
-@USE_GNOME_VFS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstgnomevfs.so
 @USE_VORBIS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstvorbis.so
 @USE_VORBIS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstogg.so
 @USE_XVIDEO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstximage*.so
@@ -157,6 +153,8 @@ GStreamer Plugins Base library development and header files.
 %{_includedir}/gstreamer-%{majorminor}/gst/riff/riff-media.h
 %{_includedir}/gstreamer-%{majorminor}/gst/riff/riff-read.h
 %{_includedir}/gstreamer-%{majorminor}/gst/video/video.h
+%{_includedir}/gstreamer-%{majorminor}/gst/video/gstmetavideo.h
+%{_includedir}/gstreamer-%{majorminor}/gst/video/gstvideopool.h
 %{_includedir}/gstreamer-%{majorminor}/gst/interfaces/colorbalance.h
 %{_includedir}/gstreamer-%{majorminor}/gst/interfaces/colorbalancechannel.h
 %{_includedir}/gstreamer-%{majorminor}/gst/interfaces/interfaces-enumtypes.h
@@ -168,7 +166,7 @@ GStreamer Plugins Base library development and header files.
 %{_includedir}/gstreamer-%{majorminor}/gst/interfaces/tuner.h
 %{_includedir}/gstreamer-%{majorminor}/gst/interfaces/tunerchannel.h
 %{_includedir}/gstreamer-%{majorminor}/gst/interfaces/tunernorm.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/xoverlay.h
+%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/videooverlay.h
 %{_includedir}/gstreamer-%{majorminor}/gst/audio/gstaudiosrc.h
 %{_includedir}/gstreamer-%{majorminor}/gst/audio/gstbaseaudiosrc.h
 %{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstbasertpaudiopayload.h
@@ -210,7 +208,6 @@ GStreamer Plugins Base library development and header files.
 %{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstrtppayloads.h
 %{_includedir}/gstreamer-%{majorminor}/gst/tag/gsttagdemux.h
 %{_includedir}/gstreamer-%{majorminor}/gst/pbutils/pbutils-enumtypes.h
-%{_includedir}/gstreamer-%{majorminor}/gst/app/gstappbuffer.h
 %{_includedir}/gstreamer-%{majorminor}/gst/app/gstappsink.h
 %{_includedir}/gstreamer-%{majorminor}/gst/app/gstappsrc.h
 %{_includedir}/gstreamer-%{majorminor}/gst/audio/audio-enumtypes.h
@@ -255,36 +252,44 @@ GStreamer Plugins Base library development and header files.
 %{_libdir}/pkgconfig/gstreamer-video-%{majorminor}.pc
 %{_libdir}/pkgconfig/gstreamer-app-%{majorminor}.pc
 
-%{_libdir}/girepository-1.0/GstApp-0.10.typelib
-%{_libdir}/girepository-1.0/GstAudio-0.10.typelib
-%{_libdir}/girepository-1.0/GstFft-0.10.typelib
-%{_libdir}/girepository-1.0/GstInterfaces-0.10.typelib
-%{_libdir}/girepository-1.0/GstNetbuffer-0.10.typelib
-%{_libdir}/girepository-1.0/GstPbutils-0.10.typelib
-%{_libdir}/girepository-1.0/GstRiff-0.10.typelib
-%{_libdir}/girepository-1.0/GstRtp-0.10.typelib
-%{_libdir}/girepository-1.0/GstRtsp-0.10.typelib
-%{_libdir}/girepository-1.0/GstSdp-0.10.typelib
-%{_libdir}/girepository-1.0/GstTag-0.10.typelib
-%{_libdir}/girepository-1.0/GstVideo-0.10.typelib
-%{_datadir}/gir-1.0/GstApp-0.10.gir
-%{_datadir}/gir-1.0/GstAudio-0.10.gir
-%{_datadir}/gir-1.0/GstFft-0.10.gir
-%{_datadir}/gir-1.0/GstInterfaces-0.10.gir
-%{_datadir}/gir-1.0/GstNetbuffer-0.10.gir
-%{_datadir}/gir-1.0/GstPbutils-0.10.gir
-%{_datadir}/gir-1.0/GstRiff-0.10.gir
-%{_datadir}/gir-1.0/GstRtp-0.10.gir
-%{_datadir}/gir-1.0/GstRtsp-0.10.gir
-%{_datadir}/gir-1.0/GstSdp-0.10.gir
-%{_datadir}/gir-1.0/GstTag-0.10.gir
-%{_datadir}/gir-1.0/GstVideo-0.10.gir
+%{_libdir}/girepository-1.0/GstApp-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstAudio-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstFft-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstInterfaces-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstNetbuffer-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstPbutils-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstRiff-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstRtp-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstRtsp-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstSdp-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstTag-%{majorminor}.typelib
+%{_libdir}/girepository-1.0/GstVideo-%{majorminor}.typelib
+%{_datadir}/gir-1.0/GstApp-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstAudio-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstFft-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstInterfaces-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstNetbuffer-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstPbutils-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstRiff-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstRtp-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstRtsp-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstSdp-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstTag-%{majorminor}.gir
+%{_datadir}/gir-1.0/GstVideo-%{majorminor}.gir
 
 # gtk-doc documentation
 %doc %{_datadir}/gtk-doc/html/gst-plugins-base-libs-%{majorminor}
 %doc %{_datadir}/gtk-doc/html/gst-plugins-base-plugins-%{majorminor}
 
 %changelog
+* Sun Aug 07 2011 Thomas Vander Stichele <thomas at apestaart dot org>
+- rename to gstreamer011
+- require 0.11 gstreamer
+- properly use majorminor macro
+- libgstplayback.so now contains playbin/decodebin elements.
+- gstappbuffer is gone
+- added metavideo and videopool headers
+
 * Fri Dec 15 2006 Thomas Vander Stichele <thomas at apestaart dot org>
 - add doap file
 - cleanups
index 7d06239..296170a 100644 (file)
@@ -44,7 +44,6 @@
 #include "config.h"
 #endif
 #include "gstadder.h"
-#include <gst/audio/audio.h>
 #include <string.h>             /* strcmp */
 #include "gstadderorc.h"
 
@@ -75,32 +74,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
 /* elementfactory information */
 
 #define CAPS \
-  "audio/x-raw-int, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) [ 1, MAX ], " \
-  "endianness = (int) BYTE_ORDER, " \
-  "width = (int) 32, " \
-  "depth = (int) 32, " \
-  "signed = (boolean) { true, false } ;" \
-  "audio/x-raw-int, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) [ 1, MAX ], " \
-  "endianness = (int) BYTE_ORDER, " \
-  "width = (int) 16, " \
-  "depth = (int) 16, " \
-  "signed = (boolean) { true, false } ;" \
-  "audio/x-raw-int, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) [ 1, MAX ], " \
-  "endianness = (int) BYTE_ORDER, " \
-  "width = (int) 8, " \
-  "depth = (int) 8, " \
-  "signed = (boolean) { true, false } ;" \
-  "audio/x-raw-float, " \
-  "rate = (int) [ 1, MAX ], " \
-  "channels = (int) [ 1, MAX ], " \
-  "endianness = (int) BYTE_ORDER, " \
-  "width = (int) { 32, 64 }"
+  GST_AUDIO_CAPS_MAKE ("{ S32, U32, S16, U16, S8, U8, F32, F64 }")
 
 static GstStaticPadTemplate gst_adder_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
@@ -116,7 +90,8 @@ GST_STATIC_PAD_TEMPLATE ("sink%d",
     GST_STATIC_CAPS (CAPS)
     );
 
-GST_BOILERPLATE (GstAdder, gst_adder, GstElement, GST_TYPE_ELEMENT);
+#define gst_adder_parent_class parent_class
+G_DEFINE_TYPE (GstAdder, gst_adder, GST_TYPE_ELEMENT);
 
 static void gst_adder_dispose (GObject * object);
 static void gst_adder_set_property (GObject * object, guint prop_id,
@@ -124,13 +99,14 @@ static void gst_adder_set_property (GObject * object, guint prop_id,
 static void gst_adder_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static gboolean gst_adder_setcaps (GstPad * pad, GstCaps * caps);
+static gboolean gst_adder_setcaps (GstAdder * adder, GstPad * pad,
+    GstCaps * caps);
 static gboolean gst_adder_query (GstPad * pad, GstQuery * query);
 static gboolean gst_adder_src_event (GstPad * pad, GstEvent * event);
 static gboolean gst_adder_sink_event (GstPad * pad, GstEvent * event);
 
 static GstPad *gst_adder_request_new_pad (GstElement * element,
-    GstPadTemplate * temp, const gchar * unused);
+    GstPadTemplate * temp, const gchar * unused, const GstCaps * caps);
 static void gst_adder_release_pad (GstElement * element, GstPad * pad);
 
 static GstStateChangeReturn gst_adder_change_state (GstElement * element,
@@ -157,7 +133,7 @@ MAKE_FUNC_NC (add_float64, gdouble)
  * if we have filtercaps set, use those to constrain the target caps.
  */
 static GstCaps *
-gst_adder_sink_getcaps (GstPad * pad)
+gst_adder_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstAdder *adder;
   GstCaps *result, *peercaps, *sinkcaps, *filter_caps;
@@ -166,27 +142,39 @@ gst_adder_sink_getcaps (GstPad * pad)
 
   GST_OBJECT_LOCK (adder);
   /* take filter */
-  if ((filter_caps = adder->filter_caps))
-    gst_caps_ref (filter_caps);
+  if ((filter_caps = adder->filter_caps)) {
+    if (filter)
+      filter_caps =
+          gst_caps_intersect_full (filter, filter_caps,
+          GST_CAPS_INTERSECT_FIRST);
+    else
+      gst_caps_ref (filter_caps);
+  } else {
+    filter_caps = gst_caps_ref (filter);
+  }
   GST_OBJECT_UNLOCK (adder);
 
+  if (filter_caps && gst_caps_is_empty (filter_caps)) {
+    GST_WARNING_OBJECT (pad, "Empty filter caps");
+    return filter_caps;
+  }
+
   /* get the downstream possible caps */
-  peercaps = gst_pad_peer_get_caps (adder->srcpad);
+  peercaps = gst_pad_peer_get_caps (adder->srcpad, filter_caps);
+
+  /* get the allowed caps on this sinkpad */
+  sinkcaps = gst_pad_get_current_caps (pad);
+  if (sinkcaps == NULL) {
+    sinkcaps = gst_pad_get_pad_template_caps (pad);
+    if (!sinkcaps)
+      sinkcaps = gst_caps_new_any ();
+  }
 
-  /* get the allowed caps on this sinkpad, we use the fixed caps function so
-   * that it does not call recursively in this function. */
-  sinkcaps = gst_pad_get_fixed_caps_func (pad);
   if (peercaps) {
-    /* restrict with filter-caps if any */
-    if (filter_caps) {
-      GST_DEBUG_OBJECT (adder, "filtering peer caps");
-      result = gst_caps_intersect (peercaps, filter_caps);
-      gst_caps_unref (peercaps);
-      peercaps = result;
-    }
     /* if the peer has caps, intersect */
     GST_DEBUG_OBJECT (adder, "intersecting peer and template caps");
-    result = gst_caps_intersect (peercaps, sinkcaps);
+    result =
+        gst_caps_intersect_full (peercaps, sinkcaps, GST_CAPS_INTERSECT_FIRST);
     gst_caps_unref (peercaps);
     gst_caps_unref (sinkcaps);
   } else {
@@ -195,7 +183,9 @@ gst_adder_sink_getcaps (GstPad * pad)
     /* restrict with filter-caps if any */
     if (filter_caps) {
       GST_DEBUG_OBJECT (adder, "no peer caps, using filtered sinkcaps");
-      result = gst_caps_intersect (sinkcaps, filter_caps);
+      result =
+          gst_caps_intersect_full (filter_caps, sinkcaps,
+          GST_CAPS_INTERSECT_FIRST);
       gst_caps_unref (sinkcaps);
     } else {
       GST_DEBUG_OBJECT (adder, "no peer caps, using sinkcaps");
@@ -212,109 +202,95 @@ gst_adder_sink_getcaps (GstPad * pad)
   return result;
 }
 
+typedef struct
+{
+  GstPad *pad;
+  GstCaps *caps;
+} IterData;
+
+static void
+setcapsfunc (const GValue * item, IterData * data)
+{
+  GstPad *otherpad = g_value_get_object (item);
+
+  if (otherpad != data->pad)
+    gst_pad_set_caps (data->pad, data->caps);
+}
+
 /* the first caps we receive on any of the sinkpads will define the caps for all
  * the other sinkpads because we can only mix streams with the same caps.
  */
 static gboolean
-gst_adder_setcaps (GstPad * pad, GstCaps * caps)
+gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
 {
-  GstAdder *adder;
-  GList *pads;
-  GstStructure *structure;
-  const char *media_type;
-
-  adder = GST_ADDER (GST_PAD_PARENT (pad));
+  GstAudioInfo info;
+  GstIterator *it;
+  GstIteratorResult ires;
+  IterData idata;
+  gboolean done;
 
-  GST_LOG_OBJECT (adder, "setting caps on pad %p,%s to %" GST_PTR_FORMAT, pad,
+  GST_LOG_OBJECT (adder, "setting caps pad %p,%s to %" GST_PTR_FORMAT, pad,
       GST_PAD_NAME (pad), caps);
 
+  it = gst_element_iterate_pads (GST_ELEMENT_CAST (adder));
+
   /* FIXME, see if the other pads can accept the format. Also lock the
    * format on the other pads to this new format. */
-  GST_OBJECT_LOCK (adder);
-  pads = GST_ELEMENT (adder)->pads;
-  while (pads) {
-    GstPad *otherpad = GST_PAD (pads->data);
+  idata.caps = caps;
+  idata.pad = pad;
 
-    if (otherpad != pad) {
-      gst_caps_replace (&GST_PAD_CAPS (otherpad), caps);
-    }
-    pads = g_list_next (pads);
-  }
-  GST_OBJECT_UNLOCK (adder);
+  done = FALSE;
+  while (!done) {
+    ires = gst_iterator_foreach (it, (GstIteratorForeachFunction) setcapsfunc,
+        &idata);
 
-  /* parse caps now */
-  structure = gst_caps_get_structure (caps, 0);
-  media_type = gst_structure_get_name (structure);
-  if (strcmp (media_type, "audio/x-raw-int") == 0) {
-    adder->format = GST_ADDER_FORMAT_INT;
-    gst_structure_get_int (structure, "width", &adder->width);
-    gst_structure_get_int (structure, "depth", &adder->depth);
-    gst_structure_get_int (structure, "endianness", &adder->endianness);
-    gst_structure_get_boolean (structure, "signed", &adder->is_signed);
-
-    GST_INFO_OBJECT (pad, "parse_caps sets adder to format int, %d bit",
-        adder->width);
-
-    if (adder->endianness != G_BYTE_ORDER)
-      goto not_supported;
-
-    switch (adder->width) {
-      case 8:
-        adder->func = (adder->is_signed ?
-            (GstAdderFunction) add_int8 : (GstAdderFunction) add_uint8);
-        adder->sample_size = 1;
-        break;
-      case 16:
-        adder->func = (adder->is_signed ?
-            (GstAdderFunction) add_int16 : (GstAdderFunction) add_uint16);
-        adder->sample_size = 2;
-        break;
-      case 32:
-        adder->func = (adder->is_signed ?
-            (GstAdderFunction) add_int32 : (GstAdderFunction) add_uint32);
-        adder->sample_size = 4;
+    switch (ires) {
+      case GST_ITERATOR_RESYNC:
+        gst_iterator_resync (it);
         break;
       default:
-        goto not_supported;
-    }
-  } else if (strcmp (media_type, "audio/x-raw-float") == 0) {
-    adder->format = GST_ADDER_FORMAT_FLOAT;
-    gst_structure_get_int (structure, "width", &adder->width);
-    gst_structure_get_int (structure, "endianness", &adder->endianness);
-
-    GST_INFO_OBJECT (pad, "parse_caps sets adder to format float, %d bit",
-        adder->width);
-
-    if (adder->endianness != G_BYTE_ORDER)
-      goto not_supported;
-
-    switch (adder->width) {
-      case 32:
-        adder->func = (GstAdderFunction) add_float32;
-        adder->sample_size = 4;
-        break;
-      case 64:
-        adder->func = (GstAdderFunction) add_float64;
-        adder->sample_size = 8;
+        done = TRUE;
         break;
-      default:
-        goto not_supported;
     }
-  } else {
-    goto not_supported;
   }
 
-  gst_structure_get_int (structure, "channels", &adder->channels);
-  gst_structure_get_int (structure, "rate", &adder->rate);
-  /* precalc bps */
-  adder->bps = (adder->width / 8) * adder->channels;
+  if (!gst_audio_info_from_caps (&info, caps))
+    goto invalid_format;
 
+  switch (GST_AUDIO_INFO_FORMAT (&info)) {
+    case GST_AUDIO_FORMAT_S8:
+      adder->func = (GstAdderFunction) add_int8;
+      break;
+    case GST_AUDIO_FORMAT_U8:
+      adder->func = (GstAdderFunction) add_uint8;
+      break;
+    case GST_AUDIO_FORMAT_S16:
+      adder->func = (GstAdderFunction) add_int16;
+      break;
+    case GST_AUDIO_FORMAT_U16:
+      adder->func = (GstAdderFunction) add_uint16;
+      break;
+    case GST_AUDIO_FORMAT_S32:
+      adder->func = (GstAdderFunction) add_int32;
+      break;
+    case GST_AUDIO_FORMAT_U32:
+      adder->func = (GstAdderFunction) add_uint32;
+      break;
+    case GST_AUDIO_FORMAT_F32:
+      adder->func = (GstAdderFunction) add_float32;
+      break;
+    case GST_AUDIO_FORMAT_F64:
+      adder->func = (GstAdderFunction) add_float64;
+      break;
+    default:
+      goto invalid_format;
+  }
   return TRUE;
 
   /* ERRORS */
-not_supported:
+invalid_format:
   {
-    GST_DEBUG_OBJECT (adder, "unsupported format set as caps");
+    GST_DEBUG_OBJECT (adder, "invalid format set as caps");
     return FALSE;
   }
 }
@@ -343,6 +319,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
   GstFormat format;
   GstIterator *it;
   gboolean done;
+  GValue item = { 0, };
 
   /* parse format */
   gst_query_parse_duration (query, &format, NULL);
@@ -355,8 +332,6 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
   while (!done) {
     GstIteratorResult ires;
 
-    gpointer item;
-
     ires = gst_iterator_next (it, &item);
     switch (ires) {
       case GST_ITERATOR_DONE:
@@ -364,12 +339,11 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
         break;
       case GST_ITERATOR_OK:
       {
-        GstPad *pad = GST_PAD_CAST (item);
-
+        GstPad *pad = g_value_get_object (&item);
         gint64 duration;
 
         /* ask sink peer for duration */
-        res &= gst_pad_query_peer_duration (pad, &format, &duration);
+        res &= gst_pad_query_peer_duration (pad, format, &duration);
         /* take max from all valid return values */
         if (res) {
           /* valid unknown length, stop searching */
@@ -381,7 +355,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
           else if (duration > max)
             max = duration;
         }
-        gst_object_unref (pad);
+        g_value_reset (&item);
         break;
       }
       case GST_ITERATOR_RESYNC:
@@ -395,6 +369,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
         break;
     }
   }
+  g_value_unset (&item);
   gst_iterator_free (it);
 
   if (res) {
@@ -415,6 +390,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
   gboolean res;
   GstIterator *it;
   gboolean done;
+  GValue item = { 0, };
 
   res = TRUE;
   done = FALSE;
@@ -428,8 +404,6 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
   while (!done) {
     GstIteratorResult ires;
 
-    gpointer item;
-
     ires = gst_iterator_next (it, &item);
     switch (ires) {
       case GST_ITERATOR_DONE:
@@ -437,7 +411,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
         break;
       case GST_ITERATOR_OK:
       {
-        GstPad *pad = GST_PAD_CAST (item);
+        GstPad *pad = g_value_get_object (&item);
         GstQuery *peerquery;
         GstClockTime min_cur, max_cur;
         gboolean live_cur;
@@ -463,7 +437,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
         }
 
         gst_query_unref (peerquery);
-        gst_object_unref (pad);
+        g_value_reset (&item);
         break;
       }
       case GST_ITERATOR_RESYNC:
@@ -479,6 +453,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
         break;
     }
   }
+  g_value_unset (&item);
   gst_iterator_free (it);
 
   if (res) {
@@ -508,7 +483,7 @@ gst_adder_query (GstPad * pad, GstQuery * query)
       switch (format) {
         case GST_FORMAT_TIME:
           /* FIXME, bring to stream time, might be tricky */
-          gst_query_set_position (query, format, adder->timestamp);
+          gst_query_set_position (query, format, adder->segment.position);
           res = TRUE;
           break;
         case GST_FORMAT_DEFAULT:
@@ -544,8 +519,9 @@ typedef struct
 } EventData;
 
 static gboolean
-forward_event_func (GstPad * pad, GValue * ret, EventData * data)
+forward_event_func (const GValue * val, GValue * ret, EventData * data)
 {
+  GstPad *pad = g_value_get_object (val);
   GstEvent *event = data->event;
 
   gst_event_ref (event);
@@ -556,13 +532,12 @@ forward_event_func (GstPad * pad, GValue * ret, EventData * data)
     /* quick hack to unflush the pads, ideally we need a way to just unflush
      * this single collect pad */
     if (data->flush)
-      gst_pad_send_event (pad, gst_event_new_flush_stop ());
+      gst_pad_send_event (pad, gst_event_new_flush_stop (TRUE));
   } else {
     g_value_set_boolean (ret, TRUE);
     GST_LOG_OBJECT (pad, "Sent event  %p (%s).",
         event, GST_EVENT_TYPE_NAME (event));
   }
-  gst_object_unref (pad);
 
   /* continue on other pads, even if one failed */
   return TRUE;
@@ -593,7 +568,8 @@ forward_event (GstAdder * adder, GstEvent * event, gboolean flush)
   g_value_set_boolean (&vret, FALSE);
   it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
   while (TRUE) {
-    ires = gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func,
+    ires =
+        gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func,
         &vret, &data);
     switch (ires) {
       case GST_ITERATOR_RESYNC:
@@ -634,12 +610,13 @@ gst_adder_src_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_SEEK:
     {
       GstSeekFlags flags;
+      gdouble rate;
       GstSeekType curtype, endtype;
       gint64 cur, end;
       gboolean flush;
 
       /* parse the seek parameters */
-      gst_event_parse_seek (event, &adder->segment_rate, NULL, &flags, &curtype,
+      gst_event_parse_seek (event, &rate, NULL, &flags, &curtype,
           &cur, &endtype, &end);
 
       if ((curtype != GST_SEEK_TYPE_NONE) && (curtype != GST_SEEK_TYPE_SET)) {
@@ -680,14 +657,15 @@ gst_adder_src_event (GstPad * pad, GstEvent * event)
        * segment. After we have the lock, no collect function is running and no
        * new collect function will be called for as long as we're flushing. */
       GST_OBJECT_LOCK (adder->collect);
+      adder->segment.rate = rate;
       if (curtype == GST_SEEK_TYPE_SET)
-        adder->segment_start = cur;
+        adder->segment.start = cur;
       else
-        adder->segment_start = 0;
+        adder->segment.start = 0;
       if (endtype == GST_SEEK_TYPE_SET)
-        adder->segment_end = end;
+        adder->segment.stop = end;
       else
-        adder->segment_end = GST_CLOCK_TIME_NONE;
+        adder->segment.stop = GST_CLOCK_TIME_NONE;
       if (flush) {
         /* Yes, we need to call _set_flushing again *WHEN* the streaming threads
          * have stopped so that the cookie gets properly updated. */
@@ -708,7 +686,7 @@ gst_adder_src_event (GstPad * pad, GstEvent * event)
       if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
               TRUE, FALSE)) {
         GST_DEBUG_OBJECT (adder, "pending flush stop");
-        gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop ());
+        gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE));
       }
       break;
     }
@@ -746,6 +724,16 @@ gst_adder_sink_event (GstPad * pad, GstEvent * event)
       GST_EVENT_TYPE_NAME (event));
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_adder_setcaps (adder, pad, caps);
+      gst_event_unref (event);
+
+      goto beach;
+    }
     case GST_EVENT_FLUSH_STOP:
       /* we received a flush-stop. The collect_event function will push the
        * event past our element. We simply forward all flush-stop events, even
@@ -771,7 +759,7 @@ gst_adder_sink_event (GstPad * pad, GstEvent * event)
       adder->pending_events = g_list_append (adder->pending_events, event);
       GST_OBJECT_UNLOCK (adder->collect);
       goto beach;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
       if (g_atomic_int_compare_and_exchange (&adder->wait_for_new_segment,
               TRUE, FALSE)) {
         /* make sure we push a new segment, to inform about new basetime
@@ -792,21 +780,6 @@ beach:
 }
 
 static void
-gst_adder_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&gst_adder_src_template));
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&gst_adder_sink_template));
-  gst_element_class_set_details_simple (gstelement_class, "Adder",
-      "Generic/Audio",
-      "Add N audio channels together",
-      "Thomas Vander Stichele <thomas at apestaart dot org>");
-}
-
-static void
 gst_adder_class_init (GstAdderClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
@@ -828,6 +801,15 @@ gst_adder_class_init (GstAdderClass * klass)
           "object.", GST_TYPE_CAPS,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_adder_src_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_adder_sink_template));
+  gst_element_class_set_details_simple (gstelement_class, "Adder",
+      "Generic/Audio",
+      "Add N audio channels together",
+      "Thomas Vander Stichele <thomas at apestaart dot org>");
+
   gstelement_class->request_new_pad =
       GST_DEBUG_FUNCPTR (gst_adder_request_new_pad);
   gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_adder_release_pad);
@@ -835,7 +817,7 @@ gst_adder_class_init (GstAdderClass * klass)
 }
 
 static void
-gst_adder_init (GstAdder * adder, GstAdderClass * klass)
+gst_adder_init (GstAdder * adder)
 {
   GstPadTemplate *template;
 
@@ -845,15 +827,13 @@ gst_adder_init (GstAdder * adder, GstAdderClass * klass)
 
   gst_pad_set_getcaps_function (adder->srcpad,
       GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
-  gst_pad_set_setcaps_function (adder->srcpad,
-      GST_DEBUG_FUNCPTR (gst_adder_setcaps));
   gst_pad_set_query_function (adder->srcpad,
       GST_DEBUG_FUNCPTR (gst_adder_query));
   gst_pad_set_event_function (adder->srcpad,
       GST_DEBUG_FUNCPTR (gst_adder_src_event));
   gst_element_add_pad (GST_ELEMENT (adder), adder->srcpad);
 
-  adder->format = GST_ADDER_FORMAT_UNSET;
+  gst_audio_info_init (&adder->info);
   adder->padcount = 0;
   adder->func = NULL;
 
@@ -941,7 +921,7 @@ gst_adder_get_property (GObject * object, guint prop_id, GValue * value,
 
 static GstPad *
 gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
-    const gchar * unused)
+    const gchar * unused, const GstCaps * caps)
 {
   gchar *name;
   GstAdder *adder;
@@ -967,7 +947,6 @@ gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
 
   gst_pad_set_getcaps_function (newpad,
       GST_DEBUG_FUNCPTR (gst_adder_sink_getcaps));
-  gst_pad_set_setcaps_function (newpad, GST_DEBUG_FUNCPTR (gst_adder_setcaps));
   gst_collect_pads_add_pad (adder->collect, newpad, sizeof (GstCollectData));
 
   /* FIXME: hacked way to override/extend the event function of
@@ -1015,9 +994,12 @@ gst_adder_do_clip (GstCollectPads * pads, GstCollectData * data,
     GstBuffer * buffer, gpointer user_data)
 {
   GstAdder *adder = GST_ADDER (user_data);
+  gint rate, bpf;
+
+  rate = GST_AUDIO_INFO_RATE (&adder->info);
+  bpf = GST_AUDIO_INFO_BPF (&adder->info);
 
-  buffer = gst_audio_buffer_clip (buffer, &data->segment, adder->rate,
-      adder->bps);
+  buffer = gst_audio_buffer_clip (buffer, &data->segment, rate, bpf);
 
   return buffer;
 }
@@ -1049,6 +1031,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
   guint outsize;
   gint64 next_offset;
   gint64 next_timestamp;
+  gint rate, bps, bpf;
 
   adder = GST_ADDER (user_data);
 
@@ -1059,7 +1042,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
   if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
           TRUE, FALSE)) {
     GST_DEBUG_OBJECT (adder, "pending flush stop");
-    gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop ());
+    gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE));
   }
 
   /* get available bytes for reading, this can be 0 which could mean empty
@@ -1069,9 +1052,13 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
   if (outsize == 0)
     goto eos;
 
+  rate = GST_AUDIO_INFO_RATE (&adder->info);
+  bps = GST_AUDIO_INFO_BPS (&adder->info);
+  bpf = GST_AUDIO_INFO_BPF (&adder->info);
+
   GST_LOG_OBJECT (adder,
       "starting to cycle through channels, %d bytes available (bps = %d)",
-      outsize, adder->bps);
+      outsize, bpf);
 
   for (collected = pads->data; collected; collected = next) {
     GstCollectData *collect_data;
@@ -1113,31 +1100,26 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
 
       GST_LOG_OBJECT (adder, "channel %p: preparing output buffer of %d bytes",
           collect_data, outsize);
-      /* make data and metadata writable, can simply return the inbuf when we
-       * are the only one referencing this buffer. If this is the last (and
-       * only) GAP buffer, it will automatically copy the GAP flag. */
-      outbuf = gst_buffer_make_writable (inbuf);
-      outdata = GST_BUFFER_DATA (outbuf);
-      gst_buffer_set_caps (outbuf, GST_PAD_CAPS (adder->srcpad));
+
+      outdata = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE);
     } else {
       if (!is_gap) {
         /* we had a previous output buffer, mix this non-GAP buffer */
         guint8 *indata;
-        guint insize;
+        gsize insize;
 
-        indata = GST_BUFFER_DATA (inbuf);
-        insize = GST_BUFFER_SIZE (inbuf);
+        indata = gst_buffer_map (inbuf, &insize, NULL, GST_MAP_READ);
 
         /* all buffers should have outsize, there are no short buffers because we
          * asked for the max size above */
         g_assert (insize == outsize);
 
-        GST_LOG_OBJECT (adder, "channel %p: mixing %d bytes from data %p",
-            collect_data, insize, indata);
+        GST_LOG_OBJECT (adder, "channel %p: mixing %" G_GSIZE_FORMAT " bytes"
+            " from data %p", collect_data, insize, indata);
 
         /* further buffers, need to add them */
-        adder->func ((gpointer) outdata, (gpointer) indata,
-            insize / adder->sample_size);
+        adder->func ((gpointer) outdata, (gpointer) indata, insize / bps);
+        gst_buffer_unmap (inbuf, indata, insize);
       } else {
         /* skip gap buffer */
         GST_LOG_OBJECT (adder, "channel %p: skipping GAP buffer", collect_data);
@@ -1145,6 +1127,8 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
       gst_buffer_unref (inbuf);
     }
   }
+  if (outbuf)
+    gst_buffer_unmap (outbuf, outdata, outsize);
 
   if (outbuf == NULL) {
     /* no output buffer, reuse one of the GAP buffers then if we have one */
@@ -1169,20 +1153,19 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
      * event. We also adjust offset & timestamp acordingly.
      * This basically ignores all newsegments sent by upstream.
      */
-    event = gst_event_new_new_segment_full (FALSE, adder->segment_rate,
-        1.0, GST_FORMAT_TIME, adder->segment_start, adder->segment_end,
-        adder->segment_start);
-    if (adder->segment_rate > 0.0) {
-      adder->timestamp = adder->segment_start;
+    event = gst_event_new_segment (&adder->segment);
+
+    if (adder->segment.rate > 0.0) {
+      adder->segment.position = adder->segment.start;
     } else {
-      adder->timestamp = adder->segment_end;
+      adder->segment.position = adder->segment.stop;
     }
-    adder->offset = gst_util_uint64_scale (adder->timestamp,
-        adder->rate, GST_SECOND);
+    adder->offset = gst_util_uint64_scale (adder->segment.position,
+        rate, GST_SECOND);
     GST_INFO_OBJECT (adder, "seg_start %" G_GUINT64_FORMAT ", seg_end %"
-        G_GUINT64_FORMAT, adder->segment_start, adder->segment_end);
+        G_GUINT64_FORMAT, adder->segment.start, adder->segment.stop);
     GST_INFO_OBJECT (adder, "timestamp %" G_GINT64_FORMAT ",new offset %"
-        G_GINT64_FORMAT, adder->timestamp, adder->offset);
+        G_GINT64_FORMAT, adder->segment.position, adder->offset);
 
     if (event) {
       if (!gst_pad_push_event (adder->srcpad, event)) {
@@ -1192,7 +1175,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
     } else {
       GST_WARNING_OBJECT (adder->srcpad, "Creating new segment event for "
           "start:%" G_GINT64_FORMAT "  end:%" G_GINT64_FORMAT " failed",
-          adder->segment_start, adder->segment_end);
+          adder->segment.start, adder->segment.stop);
     }
   }
 
@@ -1211,29 +1194,29 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
 
   /* for the next timestamp, use the sample counter, which will
    * never accumulate rounding errors */
-  if (adder->segment_rate > 0.0) {
-    next_offset = adder->offset + outsize / adder->bps;
+  if (adder->segment.rate > 0.0) {
+    next_offset = adder->offset + outsize / bpf;
   } else {
-    next_offset = adder->offset - outsize / adder->bps;
+    next_offset = adder->offset - outsize / bpf;
   }
-  next_timestamp = gst_util_uint64_scale (next_offset, GST_SECOND, adder->rate);
+  next_timestamp = gst_util_uint64_scale (next_offset, GST_SECOND, rate);
 
 
   /* set timestamps on the output buffer */
-  if (adder->segment_rate > 0.0) {
-    GST_BUFFER_TIMESTAMP (outbuf) = adder->timestamp;
+  if (adder->segment.rate > 0.0) {
+    GST_BUFFER_TIMESTAMP (outbuf) = adder->segment.position;
     GST_BUFFER_OFFSET (outbuf) = adder->offset;
     GST_BUFFER_OFFSET_END (outbuf) = next_offset;
-    GST_BUFFER_DURATION (outbuf) = next_timestamp - adder->timestamp;
+    GST_BUFFER_DURATION (outbuf) = next_timestamp - adder->segment.position;
   } else {
     GST_BUFFER_TIMESTAMP (outbuf) = next_timestamp;
     GST_BUFFER_OFFSET (outbuf) = next_offset;
     GST_BUFFER_OFFSET_END (outbuf) = adder->offset;
-    GST_BUFFER_DURATION (outbuf) = adder->timestamp - next_timestamp;
+    GST_BUFFER_DURATION (outbuf) = adder->segment.position - next_timestamp;
   }
 
   adder->offset = next_offset;
-  adder->timestamp = next_timestamp;
+  adder->segment.position = next_timestamp;
 
   /* send it out */
   GST_LOG_OBJECT (adder, "pushing outbuf %p, timestamp %" GST_TIME_FORMAT
@@ -1273,15 +1256,12 @@ gst_adder_change_state (GstElement * element, GstStateChange transition)
     case GST_STATE_CHANGE_NULL_TO_READY:
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
-      adder->timestamp = 0;
+      adder->segment.position = 0;
       adder->offset = 0;
       adder->flush_stop_pending = FALSE;
       adder->new_segment_pending = TRUE;
       adder->wait_for_new_segment = FALSE;
-      adder->segment_start = 0;
-      adder->segment_end = GST_CLOCK_TIME_NONE;
-      adder->segment_rate = 1.0;
-      gst_segment_init (&adder->segment, GST_FORMAT_UNDEFINED);
+      gst_segment_init (&adder->segment, GST_FORMAT_TIME);
       gst_collect_pads_start (adder->collect);
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
index 7fbdde6..5a50c03 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <gst/gst.h>
 #include <gst/base/gstcollectpads.h>
+#include <gst/audio/audio.h>
 
 G_BEGIN_DECLS
 
@@ -39,12 +40,6 @@ typedef struct _GstAdder             GstAdder;
 typedef struct _GstAdderClass        GstAdderClass;
 typedef struct _GstAdderInputChannel GstAdderInputChannel;
 
-typedef enum {
-  GST_ADDER_FORMAT_UNSET,
-  GST_ADDER_FORMAT_INT,
-  GST_ADDER_FORMAT_FLOAT
-} GstAdderFormat;
-
 typedef void (*GstAdderFunction) (gpointer out, gpointer in, guint size);
 
 /**
@@ -61,37 +56,22 @@ struct _GstAdder {
   gint            padcount;
 
   /* the next are valid for both int and float */
-  GstAdderFormat  format;
-  gint            rate;
-  gint            channels;
-  gint            width;
-  gint            endianness;
-  int             sample_size;
-
-  /* the next are valid only for format == GST_ADDER_FORMAT_INT */
-  gint            depth;
-  gboolean        is_signed;
-
-  /* number of bytes per sample, actually width/8 * channels */
-  gint            bps;
+  GstAudioInfo    info;
 
   /* function to add samples */
   GstAdderFunction func;
 
   /* counters to keep track of timestamps */
-  gint64          timestamp;
   gint64          offset;
 
   /* sink event handling */
   GstPadEventFunction  collect_event;
   GstSegment      segment;
-  guint64         segment_start, segment_end;
-  gdouble         segment_rate;
   volatile gboolean new_segment_pending;
   volatile gboolean wait_for_new_segment;
   /* src event handling */
   volatile gboolean flush_stop_pending;
-  
+
   /* target caps */
   GstCaps *filter_caps;
 
index 524098c..69829a1 100644 (file)
@@ -556,24 +556,27 @@ static AudioConvertPack pack_funcs[] = {
   (AudioConvertPack) MAKE_PACK_FUNC_NAME (s32_be_float),
 };
 
-#define DOUBLE_INTERMEDIATE_FORMAT(ctx)                                 \
-    ((!ctx->in.is_int && !ctx->out.is_int) || (ctx->ns != NOISE_SHAPING_NONE))
+#define DOUBLE_INTERMEDIATE_FORMAT(ctx)                   \
+    ((!GST_AUDIO_FORMAT_INFO_IS_INTEGER (ctx->in.finfo) &&    \
+      !GST_AUDIO_FORMAT_INFO_IS_INTEGER (ctx->out.finfo)) ||  \
+     (ctx->ns != NOISE_SHAPING_NONE))
 
 static gint
-audio_convert_get_func_index (AudioConvertCtx * ctx, AudioConvertFmt * fmt)
+audio_convert_get_func_index (AudioConvertCtx * ctx,
+    const GstAudioFormatInfo * fmt)
 {
   gint index = 0;
 
-  if (fmt->is_int) {
-    index += (fmt->width / 8 - 1) * 4;
-    index += fmt->endianness == G_LITTLE_ENDIAN ? 0 : 2;
-    index += fmt->sign ? 1 : 0;
+  if (GST_AUDIO_FORMAT_INFO_IS_INTEGER (fmt)) {
+    index += (GST_AUDIO_FORMAT_INFO_WIDTH (fmt) / 8 - 1) * 4;
+    index += GST_AUDIO_FORMAT_INFO_IS_LE (fmt) ? 0 : 2;
+    index += GST_AUDIO_FORMAT_INFO_IS_SIGNED (fmt) ? 1 : 0;
     index += (ctx->ns == NOISE_SHAPING_NONE) ? 0 : 24;
   } else {
     /* this is float/double */
     index = 16;
-    index += (fmt->width == 32) ? 0 : 2;
-    index += (fmt->endianness == G_LITTLE_ENDIAN) ? 0 : 1;
+    index += (GST_AUDIO_FORMAT_INFO_WIDTH (fmt) == 32) ? 0 : 2;
+    index += GST_AUDIO_FORMAT_INFO_IS_LE (fmt) ? 0 : 1;
     index += (DOUBLE_INTERMEDIATE_FORMAT (ctx)) ? 4 : 0;
   }
 
@@ -581,34 +584,22 @@ audio_convert_get_func_index (AudioConvertCtx * ctx, AudioConvertFmt * fmt)
 }
 
 static inline gboolean
-check_default (AudioConvertCtx * ctx, AudioConvertFmt * fmt)
+check_default (AudioConvertCtx * ctx, const GstAudioFormatInfo * fmt)
 {
   if (!DOUBLE_INTERMEDIATE_FORMAT (ctx)) {
-    return (fmt->width == 32 && fmt->depth == 32 &&
-        fmt->endianness == G_BYTE_ORDER && fmt->sign == TRUE);
+    return GST_AUDIO_FORMAT_INFO_FORMAT (fmt) == GST_AUDIO_FORMAT_S32;
   } else {
-    return (fmt->width == 64 && fmt->endianness == G_BYTE_ORDER);
+    return GST_AUDIO_FORMAT_INFO_FORMAT (fmt) == GST_AUDIO_FORMAT_F64;
   }
 }
 
 gboolean
-audio_convert_clean_fmt (AudioConvertFmt * fmt)
-{
-  g_return_val_if_fail (fmt != NULL, FALSE);
-
-  g_free (fmt->pos);
-  fmt->pos = NULL;
-
-  return TRUE;
-}
-
-
-gboolean
-audio_convert_prepare_context (AudioConvertCtx * ctx, AudioConvertFmt * in,
-    AudioConvertFmt * out, GstAudioConvertDithering dither,
+audio_convert_prepare_context (AudioConvertCtx * ctx, GstAudioInfo * in,
+    GstAudioInfo * out, GstAudioConvertDithering dither,
     GstAudioConvertNoiseShaping ns)
 {
   gint idx_in, idx_out;
+  gint in_depth, out_depth;
 
   g_return_val_if_fail (ctx != NULL, FALSE);
   g_return_val_if_fail (in != NULL, FALSE);
@@ -617,18 +608,21 @@ audio_convert_prepare_context (AudioConvertCtx * ctx, AudioConvertFmt * in,
   /* first clean the existing context */
   audio_convert_clean_context (ctx);
 
-  g_return_val_if_fail (in->unpositioned_layout == out->unpositioned_layout,
-      FALSE);
+  g_return_val_if_fail (GST_AUDIO_INFO_IS_UNPOSITIONED (in) ==
+      GST_AUDIO_INFO_IS_UNPOSITIONED (out), FALSE);
 
   ctx->in = *in;
   ctx->out = *out;
 
+  in_depth = GST_AUDIO_FORMAT_INFO_DEPTH (in->finfo);
+  out_depth = GST_AUDIO_FORMAT_INFO_DEPTH (out->finfo);
+
   /* Don't dither or apply noise shaping if target depth is bigger than 20 bits
    * as DA converters only can do a SNR up to 20 bits in reality.
    * Also don't dither or apply noise shaping if target depth is larger than
    * source depth. */
-  if (ctx->out.depth <= 20 && (!ctx->in.is_int
-          || ctx->in.depth >= ctx->out.depth)) {
+  if (out_depth <= 20 && (!GST_AUDIO_FORMAT_INFO_IS_INTEGER (in->finfo)
+          || in_depth >= out_depth)) {
     ctx->dither = dither;
     ctx->ns = ns;
   } else {
@@ -638,15 +632,15 @@ audio_convert_prepare_context (AudioConvertCtx * ctx, AudioConvertFmt * in,
 
   /* Use simple error feedback when output sample rate is smaller than
    * 32000 as the other methods might move the noise to audible ranges */
-  if (ctx->ns > NOISE_SHAPING_ERROR_FEEDBACK && ctx->out.rate < 32000)
+  if (ctx->ns > NOISE_SHAPING_ERROR_FEEDBACK && out->rate < 32000)
     ctx->ns = NOISE_SHAPING_ERROR_FEEDBACK;
 
   gst_channel_mix_setup_matrix (ctx);
 
-  idx_in = audio_convert_get_func_index (ctx, in);
+  idx_in = audio_convert_get_func_index (ctx, in->finfo);
   ctx->unpack = unpack_funcs[idx_in];
 
-  idx_out = audio_convert_get_func_index (ctx, out);
+  idx_out = audio_convert_get_func_index (ctx, out->finfo);
   ctx->pack = pack_funcs[idx_out];
 
   /* if both formats are float/double or we use noise shaping use double as
@@ -658,20 +652,22 @@ audio_convert_prepare_context (AudioConvertCtx * ctx, AudioConvertFmt * in,
     GST_INFO ("use float mixing");
     ctx->channel_mix = (AudioConvertMix) gst_channel_mix_mix_float;
   }
-  GST_INFO ("unitsizes: %d -> %d", in->unit_size, out->unit_size);
+  GST_INFO ("unitsizes: %d -> %d", in->bpf, out->bpf);
 
   /* check if input is in default format */
-  ctx->in_default = check_default (ctx, in);
+  ctx->in_default = check_default (ctx, in->finfo);
   /* check if channel mixer is passthrough */
   ctx->mix_passthrough = gst_channel_mix_passthrough (ctx);
   /* check if output is in default format */
-  ctx->out_default = check_default (ctx, out);
+  ctx->out_default = check_default (ctx, out->finfo);
 
   GST_INFO ("in default %d, mix passthrough %d, out default %d",
       ctx->in_default, ctx->mix_passthrough, ctx->out_default);
 
-  ctx->in_scale = (in->is_int) ? (32 - in->depth) : 0;
-  ctx->out_scale = (out->is_int) ? (32 - out->depth) : 0;
+  ctx->in_scale =
+      GST_AUDIO_FORMAT_INFO_IS_INTEGER (in->finfo) ? (32 - in_depth) : 0;
+  ctx->out_scale =
+      GST_AUDIO_FORMAT_INFO_IS_INTEGER (out->finfo) ? (32 - out_depth) : 0;
 
   gst_audio_quantize_setup (ctx);
 
@@ -684,8 +680,8 @@ audio_convert_clean_context (AudioConvertCtx * ctx)
   g_return_val_if_fail (ctx != NULL, FALSE);
 
   gst_audio_quantize_free (ctx);
-  audio_convert_clean_fmt (&ctx->in);
-  audio_convert_clean_fmt (&ctx->out);
+  gst_audio_info_init (&ctx->in);
+  gst_audio_info_init (&ctx->out);
   gst_channel_mix_unset_matrix (ctx);
 
   g_free (ctx->tmpbuf);
@@ -702,9 +698,9 @@ audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples, gint * srcsize,
   g_return_val_if_fail (ctx != NULL, FALSE);
 
   if (srcsize)
-    *srcsize = samples * ctx->in.unit_size;
+    *srcsize = samples * ctx->in.bpf;
   if (dstsize)
-    *dstsize = samples * ctx->out.unit_size;
+    *dstsize = samples * ctx->out.bpf;
 
   return TRUE;
 }
@@ -716,6 +712,7 @@ audio_convert_convert (AudioConvertCtx * ctx, gpointer src,
   guint insize, outsize, size;
   gpointer outbuf, tmpbuf;
   guint intemp = 0, outtemp = 0, biggest;
+  gint in_width, out_width;
 
   g_return_val_if_fail (ctx != NULL, FALSE);
   g_return_val_if_fail (src != NULL, FALSE);
@@ -725,23 +722,26 @@ audio_convert_convert (AudioConvertCtx * ctx, gpointer src,
   if (samples == 0)
     return TRUE;
 
-  insize = ctx->in.unit_size * samples;
-  outsize = ctx->out.unit_size * samples;
+  insize = ctx->in.bpf * samples;
+  outsize = ctx->out.bpf * samples;
+
+  in_width = GST_AUDIO_FORMAT_INFO_WIDTH (ctx->in.finfo);
+  out_width = GST_AUDIO_FORMAT_INFO_WIDTH (ctx->out.finfo);
 
   /* find biggest temp buffer size */
   size = (DOUBLE_INTERMEDIATE_FORMAT (ctx)) ? sizeof (gdouble)
       : sizeof (gint32);
 
   if (!ctx->in_default)
-    intemp = gst_util_uint64_scale (insize, size * 8, ctx->in.width);
+    intemp = gst_util_uint64_scale (insize, size * 8, in_width);
   if (!ctx->mix_passthrough || !ctx->out_default)
-    outtemp = gst_util_uint64_scale (outsize, size * 8, ctx->out.width);
+    outtemp = gst_util_uint64_scale (outsize, size * 8, out_width);
   biggest = MAX (intemp, outtemp);
 
   /* see if one of the buffers can be used as temp */
-  if ((outsize >= biggest) && (ctx->out.unit_size <= size))
+  if ((outsize >= biggest) && (ctx->out.bpf <= size))
     tmpbuf = dst;
-  else if ((insize >= biggest) && src_writable && (ctx->in.unit_size >= size))
+  else if ((insize >= biggest) && src_writable && (ctx->in.bpf >= size))
     tmpbuf = src;
   else {
     if (biggest > ctx->tmpbufsize) {
@@ -779,7 +779,7 @@ audio_convert_convert (AudioConvertCtx * ctx, gpointer src,
   }
 
   /* we only need to quantize if output format is int */
-  if (ctx->out.is_int) {
+  if (GST_AUDIO_FORMAT_INFO_IS_INTEGER (ctx->out.finfo)) {
     if (ctx->out_default)
       outbuf = dst;
     else
index ccc4014..638a42a 100644 (file)
@@ -23,7 +23,7 @@
 #define __AUDIO_CONVERT_H__
 
 #include <gst/gst.h>
-#include <gst/audio/multichannel.h>
+#include <gst/audio/audio.h>
 
 GST_DEBUG_CATEGORY_EXTERN (audio_convert_debug);
 #define GST_CAT_DEFAULT (audio_convert_debug)
@@ -65,6 +65,7 @@ typedef enum
 } GstAudioConvertNoiseShaping;
 
 typedef struct _AudioConvertCtx AudioConvertCtx;
+#if 0
 typedef struct _AudioConvertFmt AudioConvertFmt;
 
 struct _AudioConvertFmt
@@ -84,6 +85,7 @@ struct _AudioConvertFmt
 
   gint unit_size;
 };
+#endif
 
 typedef void (*AudioConvertUnpack) (gpointer src, gpointer dst, gint scale,
     gint count);
@@ -96,8 +98,8 @@ typedef void (*AudioConvertQuantize) (AudioConvertCtx * ctx, gpointer src,
 
 struct _AudioConvertCtx
 {
-  AudioConvertFmt in;
-  AudioConvertFmt out;
+  GstAudioInfo in;
+  GstAudioInfo out;
 
   AudioConvertUnpack unpack;
   AudioConvertPack pack;
@@ -130,10 +132,8 @@ struct _AudioConvertCtx
   gdouble *error_buf;
 };
 
-gboolean audio_convert_clean_fmt (AudioConvertFmt * fmt);
-
 gboolean audio_convert_prepare_context (AudioConvertCtx * ctx,
-    AudioConvertFmt * in, AudioConvertFmt * out,
+    GstAudioInfo * in, GstAudioInfo * out,
     GstAudioConvertDithering dither, GstAudioConvertNoiseShaping ns);
 gboolean audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples,
     gint * srcsize, gint * dstsize);
index 096a683..595a139 100644 (file)
@@ -41,12 +41,12 @@ main (gint argc, gchar ** argv)
   } tests[] = {
     /* stereo => mono */
     {
-      "audio/x-raw-int, channels=2", "audio/x-raw-int, channels=1", { {
+      "audio/x-raw, channels=2", "audio/x-raw, channels=1", { {
       0.5,}, {
     0.5,},}},
         /* mono => stereo */
     {
-      "audio/x-raw-int, channels=1", "audio/x-raw-int, channels=2", { {
+      "audio/x-raw, channels=1", "audio/x-raw, channels=2", { {
     1, 1,},}}
   };
 
index 188c191..6cf8775 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
  * Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2005 Wim Taymans <wim at fluendo dot com>
+ * Copyright (C) 2011 Wim Taymans <wim.taymans at gmail dot com>
  *
  * gstaudioconvert.c: Convert audio to different audio formats automatically
  *
@@ -31,7 +31,7 @@
  * <refsect2>
  * <title>Example launch line</title>
  * |[
- * gst-launch -v -m audiotestsrc ! audioconvert ! audio/x-raw-int,channels=2,width=8,depth=8 ! level ! fakesink silent=TRUE
+ * gst-launch -v -m audiotestsrc ! audioconvert ! audio/x-raw,format=S8,channels=2 ! level ! fakesink silent=TRUE
  * ]| This pipeline converts audio to 8-bit.  The level element shows that
  * the output levels still match the one for a sine wave.
  * |[
@@ -76,9 +76,9 @@ static void gst_audio_convert_dispose (GObject * obj);
 
 /* gstreamer functions */
 static gboolean gst_audio_convert_get_unit_size (GstBaseTransform * base,
-    GstCaps * caps, guint * size);
+    GstCaps * caps, gsize * size);
 static GstCaps *gst_audio_convert_transform_caps (GstBaseTransform * base,
-    GstPadDirection direction, GstCaps * caps);
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter);
 static void gst_audio_convert_fixate_caps (GstBaseTransform * base,
     GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
 static gboolean gst_audio_convert_set_caps (GstBaseTransform * base,
@@ -91,8 +91,6 @@ static void gst_audio_convert_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_audio_convert_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static gboolean structure_has_fixed_channel_positions (GstStructure * s,
-    gboolean * unpositioned_layout);
 
 /* AudioConvert signals and args */
 enum
@@ -108,55 +106,17 @@ enum
   ARG_NOISE_SHAPING,
 };
 
-#define DEBUG_INIT(bla) \
+#define DEBUG_INIT \
   GST_DEBUG_CATEGORY_INIT (audio_convert_debug, "audioconvert", 0, "audio conversion element"); \
   GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
-
-GST_BOILERPLATE_FULL (GstAudioConvert, gst_audio_convert, GstBaseTransform,
+#define gst_audio_convert_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAudioConvert, gst_audio_convert,
     GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
 
 /*** GSTREAMER PROTOTYPES *****************************************************/
 
 #define STATIC_CAPS \
-GST_STATIC_CAPS ( \
-  "audio/x-raw-float, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 64;" \
-  "audio/x-raw-float, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 32;" \
-  "audio/x-raw-int, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 32, " \
-    "depth = (int) [ 1, 32 ], " \
-    "signed = (boolean) { true, false }; " \
-  "audio/x-raw-int, "   \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], "       \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "        \
-    "width = (int) 24, "        \
-    "depth = (int) [ 1, 24 ], " "signed = (boolean) { true, false }; "  \
-  "audio/x-raw-int, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 16, " \
-    "depth = (int) [ 1, 16 ], " \
-    "signed = (boolean) { true, false }; " \
-  "audio/x-raw-int, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 8, " \
-    "depth = (int) [ 1, 8 ], " \
-    "signed = (boolean) { true, false } " \
-)
+GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL))
 
 static GstStaticPadTemplate gst_audio_convert_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
@@ -215,25 +175,11 @@ gst_audio_convert_ns_get_type (void)
 
 
 /*** TYPE FUNCTIONS ***********************************************************/
-
-static void
-gst_audio_convert_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_audio_convert_src_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_audio_convert_sink_template));
-  gst_element_class_set_details_simple (element_class,
-      "Audio converter", "Filter/Converter/Audio",
-      "Convert audio to different formats", "Benjamin Otte <otte@gnome.org>");
-}
-
 static void
 gst_audio_convert_class_init (GstAudioConvertClass * klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
   GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
 
   gobject_class->dispose = gst_audio_convert_dispose;
@@ -252,6 +198,14 @@ gst_audio_convert_class_init (GstAudioConvertClass * klass)
           GST_TYPE_AUDIO_CONVERT_NOISE_SHAPING, NOISE_SHAPING_NONE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_audio_convert_src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_audio_convert_sink_template));
+  gst_element_class_set_details_simple (element_class,
+      "Audio converter", "Filter/Converter/Audio",
+      "Convert audio to different formats", "Benjamin Otte <otte@gnome.org>");
+
   basetransform_class->get_unit_size =
       GST_DEBUG_FUNCPTR (gst_audio_convert_get_unit_size);
   basetransform_class->transform_caps =
@@ -269,7 +223,7 @@ gst_audio_convert_class_init (GstAudioConvertClass * klass)
 }
 
 static void
-gst_audio_convert_init (GstAudioConvert * this, GstAudioConvertClass * g_class)
+gst_audio_convert_init (GstAudioConvert * this)
 {
   this->dither = DITHER_TPDF;
   this->ns = NOISE_SHAPING_NONE;
@@ -290,90 +244,20 @@ gst_audio_convert_dispose (GObject * obj)
 
 /*** GSTREAMER FUNCTIONS ******************************************************/
 
-/* convert the given GstCaps to our format */
-static gboolean
-gst_audio_convert_parse_caps (const GstCaps * caps, AudioConvertFmt * fmt)
-{
-  GstStructure *structure = gst_caps_get_structure (caps, 0);
-
-  GST_DEBUG ("parse caps %p and %" GST_PTR_FORMAT, caps, caps);
-
-  g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
-  g_return_val_if_fail (fmt != NULL, FALSE);
-
-  /* cleanup old */
-  audio_convert_clean_fmt (fmt);
-
-  fmt->endianness = G_BYTE_ORDER;
-  fmt->is_int =
-      (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0);
-
-  /* parse common fields */
-  if (!gst_structure_get_int (structure, "channels", &fmt->channels))
-    goto no_values;
-  if (!(fmt->pos = gst_audio_get_channel_positions (structure)))
-    goto no_values;
-
-  fmt->unpositioned_layout = FALSE;
-  structure_has_fixed_channel_positions (structure, &fmt->unpositioned_layout);
-
-  if (!gst_structure_get_int (structure, "width", &fmt->width))
-    goto no_values;
-  if (!gst_structure_get_int (structure, "rate", &fmt->rate))
-    goto no_values;
-  /* width != 8 needs an endianness field */
-  if (fmt->width != 8) {
-    if (!gst_structure_get_int (structure, "endianness", &fmt->endianness))
-      goto no_values;
-  }
-
-  if (fmt->is_int) {
-    /* int specific fields */
-    if (!gst_structure_get_boolean (structure, "signed", &fmt->sign))
-      goto no_values;
-    if (!gst_structure_get_int (structure, "depth", &fmt->depth))
-      goto no_values;
-
-    /* depth cannot be bigger than the width */
-    if (fmt->depth > fmt->width)
-      goto not_allowed;
-  }
-
-  fmt->unit_size = (fmt->width * fmt->channels) / 8;
-
-  return TRUE;
-
-  /* ERRORS */
-no_values:
-  {
-    GST_DEBUG ("could not get some values from structure");
-    audio_convert_clean_fmt (fmt);
-    return FALSE;
-  }
-not_allowed:
-  {
-    GST_DEBUG ("width > depth, not allowed - make us advertise correct fmt");
-    audio_convert_clean_fmt (fmt);
-    return FALSE;
-  }
-}
-
 /* BaseTransform vmethods */
 static gboolean
 gst_audio_convert_get_unit_size (GstBaseTransform * base, GstCaps * caps,
-    guint * size)
+    gsize * size)
 {
-  AudioConvertFmt fmt = { 0 };
+  GstAudioInfo info;
 
   g_assert (size);
 
-  if (!gst_audio_convert_parse_caps (caps, &fmt))
+  if (!gst_audio_info_from_caps (&info, caps))
     goto parse_error;
 
-  GST_INFO_OBJECT (base, "unit_size = %u", fmt.unit_size);
-  *size = fmt.unit_size;
-
-  audio_convert_clean_fmt (&fmt);
+  *size = info.bpf;
+  GST_INFO_OBJECT (base, "unit_size = %" G_GSIZE_FORMAT, *size);
 
   return TRUE;
 
@@ -384,327 +268,61 @@ parse_error:
   }
 }
 
-/* Set widths (a list); multiples of 8 between min and max */
-static void
-set_structure_widths (GstStructure * s, int min, int max)
-{
-  GValue list = { 0 };
-  GValue val = { 0 };
-  int width;
-
-  if (min == max) {
-    gst_structure_set (s, "width", G_TYPE_INT, min, NULL);
-    return;
-  }
-
-  g_value_init (&list, GST_TYPE_LIST);
-  g_value_init (&val, G_TYPE_INT);
-  for (width = min; width <= max; width += 8) {
-    g_value_set_int (&val, width);
-    gst_value_list_append_value (&list, &val);
-  }
-  gst_structure_set_value (s, "width", &list);
-  g_value_unset (&val);
-  g_value_unset (&list);
-}
-
-/* Set widths of 32 bits and 64 bits (as list) */
-static void
-set_structure_widths_32_and_64 (GstStructure * s)
-{
-  GValue list = { 0 };
-  GValue val = { 0 };
-
-  g_value_init (&list, GST_TYPE_LIST);
-  g_value_init (&val, G_TYPE_INT);
-  g_value_set_int (&val, 32);
-  gst_value_list_append_value (&list, &val);
-  g_value_set_int (&val, 64);
-  gst_value_list_append_value (&list, &val);
-  gst_structure_set_value (s, "width", &list);
-  g_value_unset (&val);
-  g_value_unset (&list);
-}
-
-/* Modify the structure so that things that must always have a single
- * value (for float), or can always be losslessly converted (for int), have
- * appropriate values.
- */
-static GstStructure *
-make_lossless_changes (GstStructure * s, gboolean isfloat)
+/* copies the given caps */
+static GstCaps *
+gst_audio_convert_caps_remove_format_info (GstCaps * caps)
 {
-  GValue list = { 0 };
-  GValue val = { 0 };
-  int i;
-  const gint endian[] = { G_LITTLE_ENDIAN, G_BIG_ENDIAN };
-  const gboolean booleans[] = { TRUE, FALSE };
-
-  g_value_init (&list, GST_TYPE_LIST);
-  g_value_init (&val, G_TYPE_INT);
-  for (i = 0; i < 2; i++) {
-    g_value_set_int (&val, endian[i]);
-    gst_value_list_append_value (&list, &val);
-  }
-  gst_structure_set_value (s, "endianness", &list);
-  g_value_unset (&val);
-  g_value_unset (&list);
-
-  if (isfloat) {
-    /* float doesn't have a depth or signedness field and only supports
-     * widths of 32 and 64 bits */
-    gst_structure_remove_field (s, "depth");
-    gst_structure_remove_field (s, "signed");
-    set_structure_widths_32_and_64 (s);
-  } else {
-    /* int supports signed and unsigned. GValues are a pain */
-    g_value_init (&list, GST_TYPE_LIST);
-    g_value_init (&val, G_TYPE_BOOLEAN);
-    for (i = 0; i < 2; i++) {
-      g_value_set_boolean (&val, booleans[i]);
-      gst_value_list_append_value (&list, &val);
-    }
-    gst_structure_set_value (s, "signed", &list);
-    g_value_unset (&val);
-    g_value_unset (&list);
-  }
-
-  return s;
-}
+  GstStructure *st;
+  gint i, n;
+  GstCaps *res;
 
-static void
-strip_width_64 (GstStructure * s)
-{
-  const GValue *v = gst_structure_get_value (s, "width");
-  GValue widths = { 0 };
+  res = gst_caps_new_empty ();
 
-  if (GST_VALUE_HOLDS_LIST (v)) {
-    int i;
-    int len = gst_value_list_get_size (v);
+  n = gst_caps_get_size (caps);
+  for (i = 0; i < n; i++) {
+    st = gst_caps_get_structure (caps, i);
 
-    g_value_init (&widths, GST_TYPE_LIST);
+    /* If this is already expressed by the existing caps
+     * skip this structure */
+    if (i > 0 && gst_caps_is_subset_structure (res, st))
+      continue;
 
-    for (i = 0; i < len; i++) {
-      const GValue *width = gst_value_list_get_value (v, i);
+    st = gst_structure_copy (st);
+    gst_structure_remove_fields (st, "format", "channel-positions", NULL);
 
-      if (g_value_get_int (width) != 64)
-        gst_value_list_append_value (&widths, width);
-    }
-    gst_structure_set_value (s, "width", &widths);
-    g_value_unset (&widths);
+    gst_caps_append_structure (res, st);
   }
-}
 
-/* Little utility function to create a related structure for float/int */
-static void
-append_with_other_format (GstCaps * caps, GstStructure * s, gboolean isfloat)
-{
-  GstStructure *s2;
-
-  if (isfloat) {
-    s2 = gst_structure_copy (s);
-    gst_structure_set_name (s2, "audio/x-raw-int");
-    make_lossless_changes (s2, FALSE);
-    /* If 64 bit float was allowed; remove width 64: we don't support it for 
-     * integer*/
-    strip_width_64 (s2);
-    gst_caps_append_structure (caps, s2);
-  } else {
-    s2 = gst_structure_copy (s);
-    gst_structure_set_name (s2, "audio/x-raw-float");
-    make_lossless_changes (s2, TRUE);
-    gst_caps_append_structure (caps, s2);
-  }
+  return res;
 }
 
-static gboolean
-structure_has_fixed_channel_positions (GstStructure * s,
-    gboolean * unpositioned_layout)
-{
-  GstAudioChannelPosition *pos;
-  const GValue *val;
-  gint channels = 0;
-
-  if (!gst_structure_get_int (s, "channels", &channels))
-    return FALSE;               /* probably a range */
-
-  val = gst_structure_get_value (s, "channel-positions");
-  if ((val == NULL || !gst_value_is_fixed (val)) && channels <= 8) {
-    GST_LOG ("no or unfixed channel-positions in %" GST_PTR_FORMAT, s);
-    return FALSE;
-  } else if (val == NULL || !gst_value_is_fixed (val)) {
-    GST_LOG ("implicit undefined channel-positions");
-    *unpositioned_layout = TRUE;
-    return TRUE;
-  }
-
-  pos = gst_audio_get_channel_positions (s);
-  if (pos && pos[0] == GST_AUDIO_CHANNEL_POSITION_NONE) {
-    GST_LOG ("fixed undefined channel-positions in %" GST_PTR_FORMAT, s);
-    *unpositioned_layout = TRUE;
-  } else {
-    GST_LOG ("fixed defined channel-positions in %" GST_PTR_FORMAT, s);
-    *unpositioned_layout = FALSE;
-  }
-  g_free (pos);
-
-  return TRUE;
-}
-
-/* Audioconvert can perform all conversions on audio except for resampling. 
- * However, there are some conversions we _prefer_ not to do. For example, it's
- * better to convert format (float<->int, endianness, etc) than the number of
- * channels, as the latter conversion is not lossless.
- *
- * So, we return, in order (assuming input caps have only one structure; 
- * which is enforced by basetransform):
- *  - input caps with a different format (lossless conversions).
- *  - input caps with a different format (slightly lossy conversions).
- *  - input caps with a different number of channels (very lossy!)
- */
+/* The caps can be transformed into any other caps with format info removed.
+ * However, we should prefer passthrough, so if passthrough is possible,
+ * put it first in the list. */
 static GstCaps *
-gst_audio_convert_transform_caps (GstBaseTransform * base,
-    GstPadDirection direction, GstCaps * caps)
+gst_audio_convert_transform_caps (GstBaseTransform * btrans,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
 {
-  GstCaps *ret;
-  GstStructure *s, *structure;
-  gboolean isfloat, allow_mixing;
-  gint width, depth, channels = 0;
-  const gchar *fields_used[] = {
-    "width", "depth", "rate", "channels", "endianness", "signed"
-  };
-  const gchar *structure_name;
-  int i;
-
-  g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL);
-
-  structure = gst_caps_get_structure (caps, 0);
-  structure_name = gst_structure_get_name (structure);
-
-  isfloat = strcmp (structure_name, "audio/x-raw-float") == 0;
-
-  /* We operate on a version of the original structure with any additional
-   * fields absent */
-  s = gst_structure_empty_new (structure_name);
-  for (i = 0; i < sizeof (fields_used) / sizeof (*fields_used); i++) {
-    if (gst_structure_has_field (structure, fields_used[i]))
-      gst_structure_set_value (s, fields_used[i],
-          gst_structure_get_value (structure, fields_used[i]));
-  }
-
-  if (!isfloat) {
-    /* Commonly, depth is left out: set it equal to width if we have a fixed
-     * width, if so */
-    if (!gst_structure_has_field (s, "depth") &&
-        gst_structure_get_int (s, "width", &width))
-      gst_structure_set (s, "depth", G_TYPE_INT, width, NULL);
-  }
+  GstCaps *tmp, *tmp2;
+  GstCaps *result;
 
-  ret = gst_caps_new_empty ();
-
-  /* All lossless conversions */
-  s = make_lossless_changes (s, isfloat);
-  gst_caps_append_structure (ret, s);
-
-  /* Same, plus a float<->int conversion */
-  append_with_other_format (ret, s, isfloat);
-  GST_DEBUG_OBJECT (base, "  step1: (%d) %" GST_PTR_FORMAT,
-      gst_caps_get_size (ret), ret);
-
-  /* We don't mind increasing width/depth/channels, but reducing them is 
-   * Very Bad. Only available if width, depth, channels are already fixed. */
-  s = gst_structure_copy (s);
-  if (!isfloat) {
-    if (gst_structure_get_int (structure, "width", &width))
-      set_structure_widths (s, width, 32);
-    if (gst_structure_get_int (structure, "depth", &depth)) {
-      if (depth == 32)
-        gst_structure_set (s, "depth", G_TYPE_INT, 32, NULL);
-      else
-        gst_structure_set (s, "depth", GST_TYPE_INT_RANGE, depth, 32, NULL);
-    }
-  }
+  result = gst_caps_copy (caps);
 
-  allow_mixing = TRUE;
-  if (gst_structure_get_int (structure, "channels", &channels)) {
-    gboolean unpositioned;
+  /* Get all possible caps that we can transform to */
+  tmp = gst_audio_convert_caps_remove_format_info (caps);
 
-    /* we don't support mixing for channels without channel positions */
-    if (structure_has_fixed_channel_positions (structure, &unpositioned))
-      allow_mixing = (unpositioned == FALSE);
+  if (filter) {
+    tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+    tmp = tmp2;
   }
 
-  if (!allow_mixing) {
-    gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
-    if (gst_structure_has_field (structure, "channel-positions"))
-      gst_structure_set_value (s, "channel-positions",
-          gst_structure_get_value (structure, "channel-positions"));
-  } else {
-    if (channels == 0)
-      gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, 11, NULL);
-    else if (channels == 11)
-      gst_structure_set (s, "channels", G_TYPE_INT, 11, NULL);
-    else
-      gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, channels, 11, NULL);
-    gst_structure_remove_field (s, "channel-positions");
-  }
-  gst_caps_append_structure (ret, s);
-
-  /* Same, plus a float<->int conversion */
-  append_with_other_format (ret, s, isfloat);
-
-  /* We'll reduce depth if we must. We reduce as low as 16 bits (for integer); 
-   * reducing to less than this is even worse than dropping channels. We only 
-   * do this if we haven't already done the equivalent above. */
-  if (!gst_structure_get_int (structure, "width", &width) || width > 16) {
-    if (isfloat) {
-      GstStructure *s2 = gst_structure_copy (s);
-
-      set_structure_widths_32_and_64 (s2);
-      append_with_other_format (ret, s2, TRUE);
-      gst_structure_free (s2);
-    } else {
-      s = gst_structure_copy (s);
-      set_structure_widths (s, 16, 32);
-      gst_structure_set (s, "depth", GST_TYPE_INT_RANGE, 16, 32, NULL);
-      gst_caps_append_structure (ret, s);
-    }
-  }
+  result = tmp;
 
-  /* Channel conversions to fewer channels is only done if needed - generally
-   * it's very bad to drop channels entirely.
-   */
-  s = gst_structure_copy (s);
-  if (allow_mixing) {
-    gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, 11, NULL);
-    gst_structure_remove_field (s, "channel-positions");
-  } else {
-    /* allow_mixing can only be FALSE if we got a fixed number of channels */
-    gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
-    if (gst_structure_has_field (structure, "channel-positions"))
-      gst_structure_set_value (s, "channel-positions",
-          gst_structure_get_value (structure, "channel-positions"));
-  }
-  gst_caps_append_structure (ret, s);
-
-  /* Same, plus a float<->int conversion */
-  append_with_other_format (ret, s, isfloat);
-
-  /* And, finally, for integer only, we allow conversion to any width/depth we
-   * support: this should be equivalent to our (non-float) template caps. (the
-   * floating point case should be being handled just above) */
-  s = gst_structure_copy (s);
-  set_structure_widths (s, 8, 32);
-  gst_structure_set (s, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
-
-  if (isfloat) {
-    append_with_other_format (ret, s, TRUE);
-    gst_structure_free (s);
-  } else
-    gst_caps_append_structure (ret, s);
-
-  GST_DEBUG_OBJECT (base, "Caps transformed to %" GST_PTR_FORMAT, ret);
+  GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %"
+      GST_PTR_FORMAT, caps, result);
 
-  return ret;
+  return result;
 }
 
 static const GstAudioChannelPosition default_positions[8][8] = {
@@ -906,8 +524,8 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base,
     GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
 {
   GstStructure *ins, *outs;
-  gint rate, endianness, depth, width;
-  gboolean signedness;
+  gint rate;
+  const gchar *fmt;
 
   g_return_if_fail (gst_caps_is_fixed (caps));
 
@@ -919,41 +537,16 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base,
 
   gst_audio_convert_fixate_channels (base, ins, outs);
 
+  if ((fmt = gst_structure_get_string (ins, "format"))) {
+    /* FIXME, find the best format */
+    gst_structure_fixate_field_string (outs, "format", fmt);
+  }
+
   if (gst_structure_get_int (ins, "rate", &rate)) {
     if (gst_structure_has_field (outs, "rate")) {
       gst_structure_fixate_field_nearest_int (outs, "rate", rate);
     }
   }
-  if (gst_structure_get_int (ins, "endianness", &endianness)) {
-    if (gst_structure_has_field (outs, "endianness")) {
-      gst_structure_fixate_field_nearest_int (outs, "endianness", endianness);
-    }
-  }
-  if (gst_structure_get_int (ins, "width", &width)) {
-    if (gst_structure_has_field (outs, "width")) {
-      gst_structure_fixate_field_nearest_int (outs, "width", width);
-    }
-  } else {
-    /* this is not allowed */
-  }
-
-  if (gst_structure_get_int (ins, "depth", &depth)) {
-    if (gst_structure_has_field (outs, "depth")) {
-      gst_structure_fixate_field_nearest_int (outs, "depth", depth);
-    }
-  } else {
-    /* set depth as width */
-    if (gst_structure_has_field (outs, "depth")) {
-      gst_structure_fixate_field_nearest_int (outs, "depth", width);
-    }
-  }
-
-  if (gst_structure_get_boolean (ins, "signed", &signedness)) {
-    if (gst_structure_has_field (outs, "signed")) {
-      gst_structure_fixate_field_boolean (outs, "signed", signedness);
-    }
-  }
-
   GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
 }
 
@@ -961,26 +554,38 @@ static gboolean
 gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
     GstCaps * outcaps)
 {
-  AudioConvertFmt in_ac_caps = { 0 };
-  AudioConvertFmt out_ac_caps = { 0 };
   GstAudioConvert *this = GST_AUDIO_CONVERT (base);
+  GstAudioInfo in_info;
+  GstAudioInfo out_info;
 
   GST_DEBUG_OBJECT (base, "incaps %" GST_PTR_FORMAT ", outcaps %"
       GST_PTR_FORMAT, incaps, outcaps);
 
-  if (!gst_audio_convert_parse_caps (incaps, &in_ac_caps))
-    return FALSE;
-  if (!gst_audio_convert_parse_caps (outcaps, &out_ac_caps))
-    return FALSE;
+  if (!gst_audio_info_from_caps (&in_info, incaps))
+    goto invalid_in;
+  if (!gst_audio_info_from_caps (&out_info, outcaps))
+    goto invalid_out;
 
-  if (!audio_convert_prepare_context (&this->ctx, &in_ac_caps, &out_ac_caps,
+  if (!audio_convert_prepare_context (&this->ctx, &in_info, &out_info,
           this->dither, this->ns))
     goto no_converter;
 
   return TRUE;
 
+  /* ERRORS */
+invalid_in:
+  {
+    GST_ERROR_OBJECT (base, "invalid input caps");
+    return FALSE;
+  }
+invalid_out:
+  {
+    GST_ERROR_OBJECT (base, "invalid output caps");
+    return FALSE;
+  }
 no_converter:
   {
+    GST_ERROR_OBJECT (base, "could not find converter");
     return FALSE;
   }
 }
@@ -992,94 +597,19 @@ gst_audio_convert_transform_ip (GstBaseTransform * base, GstBuffer * buf)
   return GST_FLOW_OK;
 }
 
-static void
-gst_audio_convert_create_silence_buffer (GstAudioConvert * this, gpointer dst,
-    gint size)
-{
-  if (this->ctx.out.is_int && !this->ctx.out.sign) {
-    gint i;
-
-    switch (this->ctx.out.width) {
-      case 8:{
-        guint8 zero = 0x80 >> (8 - this->ctx.out.depth);
-
-        memset (dst, zero, size);
-        break;
-      }
-      case 16:{
-        guint16 *data = (guint16 *) dst;
-        guint16 zero = 0x8000 >> (16 - this->ctx.out.depth);
-
-        if (this->ctx.out.endianness == G_LITTLE_ENDIAN)
-          zero = GUINT16_TO_LE (zero);
-        else
-          zero = GUINT16_TO_BE (zero);
-
-        size /= 2;
-
-        for (i = 0; i < size; i++)
-          data[i] = zero;
-        break;
-      }
-      case 24:{
-        guint32 zero = 0x800000 >> (24 - this->ctx.out.depth);
-        guint8 *data = (guint8 *) dst;
-
-        if (this->ctx.out.endianness == G_LITTLE_ENDIAN) {
-          for (i = 0; i < size; i += 3) {
-            data[i] = zero & 0xff;
-            data[i + 1] = (zero >> 8) & 0xff;
-            data[i + 2] = (zero >> 16) & 0xff;
-          }
-        } else {
-          for (i = 0; i < size; i += 3) {
-            data[i + 2] = zero & 0xff;
-            data[i + 1] = (zero >> 8) & 0xff;
-            data[i] = (zero >> 16) & 0xff;
-          }
-        }
-        break;
-      }
-      case 32:{
-        guint32 *data = (guint32 *) dst;
-        guint32 zero = (0x80000000 >> (32 - this->ctx.out.depth));
-
-        if (this->ctx.out.endianness == G_LITTLE_ENDIAN)
-          zero = GUINT32_TO_LE (zero);
-        else
-          zero = GUINT32_TO_BE (zero);
-
-        size /= 4;
-
-        for (i = 0; i < size; i++)
-          data[i] = zero;
-        break;
-      }
-      default:
-        memset (dst, 0, size);
-        g_return_if_reached ();
-        break;
-    }
-  } else {
-    memset (dst, 0, size);
-  }
-}
-
 static GstFlowReturn
 gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
     GstBuffer * outbuf)
 {
+  GstFlowReturn ret;
   GstAudioConvert *this = GST_AUDIO_CONVERT (base);
+  gsize srcsize, dstsize;
   gint insize, outsize;
   gint samples;
   gpointer src, dst;
 
-  GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, base, "converting audio from %"
-      GST_PTR_FORMAT " to %" GST_PTR_FORMAT, GST_BUFFER_CAPS (inbuf),
-      GST_BUFFER_CAPS (outbuf));
-
   /* get amount of samples to convert. */
-  samples = GST_BUFFER_SIZE (inbuf) / this->ctx.in.unit_size;
+  samples = gst_buffer_get_size (inbuf) / this->ctx.in.bpf;
 
   /* get in/output sizes, to see if the buffers we got are of correct
    * sizes */
@@ -1089,16 +619,16 @@ gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
   if (insize == 0 || outsize == 0)
     return GST_FLOW_OK;
 
+  /* get src and dst data */
+  src = gst_buffer_map (inbuf, &srcsize, NULL, GST_MAP_READ);
+  dst = gst_buffer_map (outbuf, &dstsize, NULL, GST_MAP_WRITE);
+
   /* check in and outsize */
-  if (GST_BUFFER_SIZE (inbuf) < insize)
+  if (srcsize < insize)
     goto wrong_size;
-  if (GST_BUFFER_SIZE (outbuf) < outsize)
+  if (dstsize < outsize)
     goto wrong_size;
 
-  /* get src and dst data */
-  src = GST_BUFFER_DATA (inbuf);
-  dst = GST_BUFFER_DATA (outbuf);
-
   /* and convert the samples */
   if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
     if (!audio_convert_convert (&this->ctx, src, dst,
@@ -1106,12 +636,15 @@ gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
       goto convert_error;
   } else {
     /* Create silence buffer */
-    gst_audio_convert_create_silence_buffer (this, dst, outsize);
+    gst_audio_format_fill_silence (this->ctx.out.finfo, dst, outsize);
   }
+  ret = GST_FLOW_OK;
 
-  GST_BUFFER_SIZE (outbuf) = outsize;
+done:
+  gst_buffer_unmap (outbuf, dst, outsize);
+  gst_buffer_unmap (inbuf, src, srcsize);
 
-  return GST_FLOW_OK;
+  return ret;
 
   /* ERRORS */
 error:
@@ -1124,16 +657,18 @@ wrong_size:
   {
     GST_ELEMENT_ERROR (this, STREAM, FORMAT,
         (NULL),
-        ("input/output buffers are of wrong size in: %d < %d or out: %d < %d",
-            GST_BUFFER_SIZE (inbuf), insize, GST_BUFFER_SIZE (outbuf),
-            outsize));
-    return GST_FLOW_ERROR;
+        ("input/output buffers are of wrong size in: %" G_GSIZE_FORMAT " < %d"
+            " or out: %" G_GSIZE_FORMAT " < %d",
+            srcsize, insize, dstsize, outsize));
+    ret = GST_FLOW_ERROR;
+    goto done;
   }
 convert_error:
   {
     GST_ELEMENT_ERROR (this, STREAM, FORMAT,
         (NULL), ("error while converting"));
-    return GST_FLOW_ERROR;
+    ret = GST_FLOW_ERROR;
+    goto done;
   }
 }
 
index 9370d38..62f324f 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <gst/gst.h>
 #include <gst/base/gstbasetransform.h>
-#include <gst/audio/multichannel.h>
+#include <gst/audio/audio.h>
 
 #include "audioconvert.h"
 
index 4bf8e55..8080b1b 100644 (file)
@@ -191,8 +191,6 @@ void orc_audio_convert_pack_double_u32_swap (guint8 * ORC_RESTRICT d1,
 void orc_audio_convert_pack_double_s32_swap (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n);
 
-void gst_audio_convert_orc_init (void);
-
 
 /* begin Orc C target preamble */
 #define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
@@ -315,15 +313,43 @@ _backup_orc_audio_convert_unpack_u8 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u8;
 void
 orc_audio_convert_unpack_u8 (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u8;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u8");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_u8);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_C1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -402,15 +428,40 @@ _backup_orc_audio_convert_unpack_s8 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s8;
 void
 orc_audio_convert_unpack_s8 (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s8;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s8");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_s8);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -495,15 +546,40 @@ _backup_orc_audio_convert_unpack_u16 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u16;
 void
 orc_audio_convert_unpack_u16 (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u16;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u16");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_u16);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -576,15 +652,37 @@ _backup_orc_audio_convert_unpack_s16 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s16;
 void
 orc_audio_convert_unpack_s16 (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s16;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s16");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_s16);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -675,15 +773,44 @@ _backup_orc_audio_convert_unpack_u16_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u16_swap;
 void
 orc_audio_convert_unpack_u16_swap (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u16_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u16_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u16_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_C1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -762,15 +889,41 @@ _backup_orc_audio_convert_unpack_s16_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s16_swap;
 void
 orc_audio_convert_unpack_s16_swap (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s16_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s16_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s16_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -849,15 +1002,38 @@ _backup_orc_audio_convert_unpack_u32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u32;
 void
 orc_audio_convert_unpack_u32 (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u32");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_u32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -924,15 +1100,34 @@ _backup_orc_audio_convert_unpack_s32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s32;
 void
 orc_audio_convert_unpack_s32 (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s32");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_s32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1017,15 +1212,41 @@ _backup_orc_audio_convert_unpack_u32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u32_swap;
 void
 orc_audio_convert_unpack_u32_swap (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1098,15 +1319,38 @@ _backup_orc_audio_convert_unpack_s32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s32_swap;
 void
 orc_audio_convert_unpack_s32_swap (gint32 * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1241,15 +1485,43 @@ _backup_orc_audio_convert_unpack_float_s32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_float_s32;
 void
 orc_audio_convert_unpack_float_s32 (guint32 * ORC_RESTRICT d1,
     const gfloat * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_float_s32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_float_s32");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_float_s32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x4f000000, "c1");
+      orc_program_add_constant (p, 4, 0x3f000000, "c2");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "loadl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mulf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convfl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1389,15 +1661,43 @@ _backup_orc_audio_convert_unpack_float_s32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_float_s32_swap;
 void
 orc_audio_convert_unpack_float_s32_swap (guint32 * ORC_RESTRICT d1,
     const gfloat * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_float_s32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_float_s32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_float_s32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x4f000000, "c1");
+      orc_program_add_constant (p, 4, 0x3f000000, "c2");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mulf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convfl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1531,15 +1831,43 @@ _backup_orc_audio_convert_unpack_double_s32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_double_s32;
 void
 orc_audio_convert_unpack_double_s32 (guint32 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_double_s32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_double_s32");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_double_s32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
+      orc_program_add_constant_int64 (p, 8, 0x3fe0000000000000ULL, "c2");
+      orc_program_add_temporary (p, 8, "t1");
+
+      orc_program_append_2 (p, "loadq", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "muld", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1679,15 +2007,43 @@ _backup_orc_audio_convert_unpack_double_s32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_double_s32_swap;
 void
 orc_audio_convert_unpack_double_s32_swap (guint32 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_double_s32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_double_s32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_double_s32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
+      orc_program_add_constant_int64 (p, 8, 0x3fe0000000000000ULL, "c2");
+      orc_program_add_temporary (p, 8, "t1");
+
+      orc_program_append_2 (p, "swapq", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "muld", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1761,15 +2117,34 @@ _backup_orc_audio_convert_unpack_float_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_float_double;
 void
 orc_audio_convert_unpack_float_double (gdouble * ORC_RESTRICT d1,
     const gfloat * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_float_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_float_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_float_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+
+      orc_program_append_2 (p, "convfd", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1850,15 +2225,37 @@ _backup_orc_audio_convert_unpack_float_double_swap (OrcExecutor *
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_float_double_swap;
 void
 orc_audio_convert_unpack_float_double_swap (gdouble * ORC_RESTRICT d1,
     const gfloat * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_float_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_float_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_float_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convfd", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1924,15 +2321,34 @@ _backup_orc_audio_convert_unpack_double_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_double_double;
 void
 orc_audio_convert_unpack_double_double (gdouble * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_double_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_double_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_double_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 8, "s1");
+
+      orc_program_append_2 (p, "copyq", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -1999,15 +2415,34 @@ _backup_orc_audio_convert_unpack_double_double_swap (OrcExecutor *
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_double_double_swap;
 void
 orc_audio_convert_unpack_double_double_swap (gdouble * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_double_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_double_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_double_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 8, "s1");
+
+      orc_program_append_2 (p, "swapq", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2103,15 +2538,46 @@ _backup_orc_audio_convert_unpack_u8_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u8_double;
 void
 orc_audio_convert_unpack_u8_double (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u8_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u8_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u8_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2196,15 +2662,43 @@ _backup_orc_audio_convert_unpack_s8_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s8_double;
 void
 orc_audio_convert_unpack_s8_double (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s8_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s8_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s8_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2295,15 +2789,43 @@ _backup_orc_audio_convert_unpack_u16_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u16_double;
 void
 orc_audio_convert_unpack_u16_double (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u16_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u16_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u16_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2382,15 +2904,40 @@ _backup_orc_audio_convert_unpack_s16_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s16_double;
 void
 orc_audio_convert_unpack_s16_double (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s16_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s16_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s16_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2487,15 +3034,46 @@ _backup_orc_audio_convert_unpack_u16_double_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u16_double_swap;
 void
 orc_audio_convert_unpack_u16_double_swap (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u16_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u16_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u16_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2580,15 +3158,43 @@ _backup_orc_audio_convert_unpack_s16_double_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s16_double_swap;
 void
 orc_audio_convert_unpack_s16_double_swap (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s16_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s16_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s16_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2673,15 +3279,41 @@ _backup_orc_audio_convert_unpack_u32_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u32_double;
 void
 orc_audio_convert_unpack_u32_double (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u32_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u32_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u32_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2754,15 +3386,38 @@ _backup_orc_audio_convert_unpack_s32_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s32_double;
 void
 orc_audio_convert_unpack_s32_double (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s32_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s32_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s32_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2853,15 +3508,43 @@ _backup_orc_audio_convert_unpack_u32_double_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_u32_double_swap;
 void
 orc_audio_convert_unpack_u32_double_swap (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_u32_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_u32_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_u32_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -2940,15 +3623,40 @@ _backup_orc_audio_convert_unpack_s32_double_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_unpack_s32_double_swap;
 void
 orc_audio_convert_unpack_s32_double_swap (gdouble * ORC_RESTRICT d1,
     const guint8 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_unpack_s32_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_unpack_s32_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_unpack_s32_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3039,15 +3747,43 @@ _backup_orc_audio_convert_pack_u8 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_u8;
 void
 orc_audio_convert_pack_u8 (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_u8;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_u8");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3126,15 +3862,40 @@ _backup_orc_audio_convert_pack_s8 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s8;
 void
 orc_audio_convert_pack_s8 (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s8;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s8");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_s8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3219,15 +3980,40 @@ _backup_orc_audio_convert_pack_u16 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_u16;
 void
 orc_audio_convert_pack_u16 (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_u16;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_u16");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_u16);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3300,15 +4086,37 @@ _backup_orc_audio_convert_pack_s16 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s16;
 void
 orc_audio_convert_pack_s16 (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s16;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s16");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_s16);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3399,15 +4207,44 @@ _backup_orc_audio_convert_pack_u16_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_u16_swap;
 void
 orc_audio_convert_pack_u16_swap (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_u16_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_u16_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_u16_swap);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3486,15 +4323,41 @@ _backup_orc_audio_convert_pack_s16_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s16_swap;
 void
 orc_audio_convert_pack_s16_swap (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s16_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s16_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_s16_swap);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3573,15 +4436,38 @@ _backup_orc_audio_convert_pack_u32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_u32;
 void
 orc_audio_convert_pack_u32 (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_u32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_u32");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_u32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3648,15 +4534,34 @@ _backup_orc_audio_convert_pack_s32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s32;
 void
 orc_audio_convert_pack_s32 (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s32");
+      orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_s32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3741,15 +4646,41 @@ _backup_orc_audio_convert_pack_u32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_u32_swap;
 void
 orc_audio_convert_pack_u32_swap (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_u32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_u32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_u32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3822,15 +4753,38 @@ _backup_orc_audio_convert_pack_s32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s32_swap;
 void
 orc_audio_convert_pack_s32_swap (guint8 * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_s32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -3925,15 +4879,40 @@ _backup_orc_audio_convert_pack_s32_float (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s32_float;
 void
 orc_audio_convert_pack_s32_float (gfloat * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s32_float;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s32_float");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_s32_float);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x4f000000, "c1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convlf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "divf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storel", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4033,15 +5012,40 @@ _backup_orc_audio_convert_pack_s32_float_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s32_float_swap;
 void
 orc_audio_convert_pack_s32_float_swap (gfloat * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s32_float_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s32_float_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_s32_float_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x4f000000, "c1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convlf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "divf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4135,15 +5139,40 @@ _backup_orc_audio_convert_pack_s32_double (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s32_double;
 void
 orc_audio_convert_pack_s32_double (gdouble * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s32_double;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s32_double");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_s32_double);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
+      orc_program_add_temporary (p, 8, "t1");
+
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "divd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storeq", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4243,15 +5272,40 @@ _backup_orc_audio_convert_pack_s32_double_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_s32_double_swap;
 void
 orc_audio_convert_pack_s32_double_swap (gdouble * ORC_RESTRICT d1,
     const gint32 * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_s32_double_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_s32_double_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_s32_double_swap);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
+      orc_program_add_temporary (p, 8, "t1");
+
+      orc_program_append_2 (p, "convld", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "divd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapq", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4329,15 +5383,34 @@ _backup_orc_audio_convert_pack_double_float (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_float;
 void
 orc_audio_convert_pack_double_float (gfloat * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_float;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_float");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_float);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+
+      orc_program_append_2 (p, "convdf", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4421,15 +5494,37 @@ _backup_orc_audio_convert_pack_double_float_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_float_swap;
 void
 orc_audio_convert_pack_double_float_swap (gfloat * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_float_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_float_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_float_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4537,15 +5632,46 @@ _backup_orc_audio_convert_pack_double_u8 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_u8;
 void
 orc_audio_convert_pack_double_u8 (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_u8;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_u8");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4642,15 +5768,43 @@ _backup_orc_audio_convert_pack_double_s8 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_s8;
 void
 orc_audio_convert_pack_double_s8 (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_s8;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_s8");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_s8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4753,15 +5907,43 @@ _backup_orc_audio_convert_pack_double_u16 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_u16;
 void
 orc_audio_convert_pack_double_u16 (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_u16;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_u16");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_u16);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4852,15 +6034,40 @@ _backup_orc_audio_convert_pack_double_s16 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_s16;
 void
 orc_audio_convert_pack_double_s16 (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_s16;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_s16");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_s16);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -4969,15 +6176,46 @@ _backup_orc_audio_convert_pack_double_u16_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_u16_swap;
 void
 orc_audio_convert_pack_double_u16_swap (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_u16_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_u16_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_u16_swap);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -5074,15 +6312,43 @@ _backup_orc_audio_convert_pack_double_s16_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_s16_swap;
 void
 orc_audio_convert_pack_double_s16_swap (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_s16_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_s16_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_s16_swap);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -5179,15 +6445,41 @@ _backup_orc_audio_convert_pack_double_u32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_u32;
 void
 orc_audio_convert_pack_double_u32 (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_u32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_u32");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_u32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -5272,15 +6564,38 @@ _backup_orc_audio_convert_pack_double_s32 (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_s32;
 void
 orc_audio_convert_pack_double_s32 (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_s32;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_s32");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_s32);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -5383,15 +6698,43 @@ _backup_orc_audio_convert_pack_double_u32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_u32_swap;
 void
 orc_audio_convert_pack_double_u32_swap (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_u32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_u32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_u32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_constant (p, 4, 0x80000000, "c1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -5482,15 +6825,40 @@ _backup_orc_audio_convert_pack_double_s32_swap (OrcExecutor * ORC_RESTRICT ex)
 
 }
 
-static OrcProgram *_orc_program_orc_audio_convert_pack_double_s32_swap;
 void
 orc_audio_convert_pack_double_s32_swap (guint8 * ORC_RESTRICT d1,
     const gdouble * ORC_RESTRICT s1, int p1, int n)
 {
   OrcExecutor _ex, *ex = &_ex;
-  OrcProgram *p = _orc_program_orc_audio_convert_pack_double_s32_swap;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
   void (*func) (OrcExecutor *);
 
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_audio_convert_pack_double_s32_swap");
+      orc_program_set_backup_function (p,
+          _backup_orc_audio_convert_pack_double_s32_swap);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_parameter (p, 4, "p1");
+      orc_program_add_temporary (p, 4, "t1");
+
+      orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
   ex->program = p;
 
   ex->n = n;
@@ -5502,1327 +6870,3 @@ orc_audio_convert_pack_double_s32_swap (guint8 * ORC_RESTRICT d1,
   func (ex);
 }
 #endif
-
-
-void
-gst_audio_convert_orc_init (void)
-{
-#ifndef DISABLE_ORC
-  {
-    /* orc_audio_convert_unpack_u8 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u8");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_u8);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 1, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_C1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u8 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s8 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s8");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_s8);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 1, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s8 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u16 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u16");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_u16);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u16 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s16 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s16");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_s16);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s16 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u16_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u16_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u16_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_C1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u16_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s16_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s16_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s16_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s16_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u32");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_u32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u32 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s32");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_unpack_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s32 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u32_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s32_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_float_s32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_float_s32");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_float_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x4f000000, "c1");
-    orc_program_add_constant (p, 4, 0x3f000000, "c2");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "loadl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "mulf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "addf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convfl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_float_s32 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_float_s32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_float_s32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_float_s32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x4f000000, "c1");
-    orc_program_add_constant (p, 4, 0x3f000000, "c2");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "mulf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "addf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convfl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_float_s32_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_double_s32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_double_s32");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_double_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
-    orc_program_add_constant_int64 (p, 8, 0x3fe0000000000000ULL, "c2");
-    orc_program_add_temporary (p, 8, "t1");
-
-    orc_program_append_2 (p, "loadq", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "muld", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "addd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_double_s32 = p;
-  }
-  {
-    /* orc_audio_convert_unpack_double_s32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_double_s32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_double_s32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
-    orc_program_add_constant_int64 (p, 8, 0x3fe0000000000000ULL, "c2");
-    orc_program_add_temporary (p, 8, "t1");
-
-    orc_program_append_2 (p, "swapq", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "muld", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "addd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_double_s32_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_float_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_float_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_float_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-
-    orc_program_append_2 (p, "convfd", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_float_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_float_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_float_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_float_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convfd", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_float_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_double_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_double_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_double_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 8, "s1");
-
-    orc_program_append_2 (p, "copyq", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_double_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_double_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_double_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_double_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 8, "s1");
-
-    orc_program_append_2 (p, "swapq", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_double_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u8_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u8_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u8_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 1, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u8_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s8_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s8_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s8_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 1, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s8_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u16_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u16_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u16_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u16_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s16_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s16_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s16_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s16_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u16_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u16_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u16_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u16_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s16_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s16_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s16_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 2, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convuwl", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s16_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u32_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u32_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u32_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u32_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s32_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s32_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s32_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s32_double = p;
-  }
-  {
-    /* orc_audio_convert_unpack_u32_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_u32_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_u32_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_u32_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_unpack_s32_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_unpack_s32_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_unpack_s32_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shll", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_unpack_s32_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_u8 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_u8");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_u8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_u8 = p;
-  }
-  {
-    /* orc_audio_convert_pack_s8 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s8");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_s8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s8 = p;
-  }
-  {
-    /* orc_audio_convert_pack_u16 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_u16");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_u16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_u16 = p;
-  }
-  {
-    /* orc_audio_convert_pack_s16 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s16");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_s16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s16 = p;
-  }
-  {
-    /* orc_audio_convert_pack_u16_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_u16_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_u16_swap);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_u16_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_s16_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s16_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_s16_swap);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s16_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_u32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_u32");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_u32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_u32 = p;
-  }
-  {
-    /* orc_audio_convert_pack_s32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s32");
-    orc_program_set_backup_function (p, _backup_orc_audio_convert_pack_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s32 = p;
-  }
-  {
-    /* orc_audio_convert_pack_u32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_u32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_u32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_u32_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_s32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_s32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s32_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_s32_float */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s32_float");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_s32_float);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x4f000000, "c1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convlf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "divf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "storel", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s32_float = p;
-  }
-  {
-    /* orc_audio_convert_pack_s32_float_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s32_float_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_s32_float_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant (p, 4, 0x4f000000, "c1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convlf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "divf", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s32_float_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_s32_double */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s32_double");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_s32_double);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
-    orc_program_add_temporary (p, 8, "t1");
-
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "divd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "storeq", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s32_double = p;
-  }
-  {
-    /* orc_audio_convert_pack_s32_double_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_s32_double_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_s32_double_swap);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_constant_int64 (p, 8, 0x41dfffffffc00000ULL, "c1");
-    orc_program_add_temporary (p, 8, "t1");
-
-    orc_program_append_2 (p, "convld", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "divd", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapq", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_s32_double_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_float */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_float");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_float);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-
-    orc_program_append_2 (p, "convdf", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_float = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_float_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_float_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_float_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_float_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_u8 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_u8");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_u8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_u8 = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_s8 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_s8");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_s8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_s8 = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_u16 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_u16");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_u16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_u16 = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_s16 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_s16");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_s16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_s16 = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_u16_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_u16_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_u16_swap);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_u16_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_s16_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_s16_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_s16_swap);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapw", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_s16_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_u32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_u32");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_u32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_u32 = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_s32 */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_s32");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_s32 = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_u32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_u32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_u32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_constant (p, 4, 0x80000000, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "xorl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrul", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_u32_swap = p;
-  }
-  {
-    /* orc_audio_convert_pack_double_s32_swap */
-    OrcProgram *p;
-
-    p = orc_program_new ();
-    orc_program_set_name (p, "orc_audio_convert_pack_double_s32_swap");
-    orc_program_set_backup_function (p,
-        _backup_orc_audio_convert_pack_double_s32_swap);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-    orc_program_append_2 (p, "convdl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-        ORC_VAR_D1);
-    orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
-        ORC_VAR_D1);
-
-    orc_program_compile (p);
-
-    _orc_program_orc_audio_convert_pack_double_s32_swap = p;
-  }
-#endif
-}
index 3d74e1a..85121fa 100644 (file)
@@ -10,8 +10,6 @@
 extern "C" {
 #endif
 
-void gst_audio_convert_orc_init (void);
-
 
 
 #ifndef _ORC_INTEGER_TYPEDEFS_
index 23da7fd..aea1376 100644 (file)
@@ -1,6 +1,4 @@
 
-.init gst_audio_convert_orc_init
-
 .function orc_audio_convert_unpack_u8
 .dest 4 d1 gint32
 .source 1 s1 guint8
index 2155397..5d45d85 100644 (file)
@@ -439,7 +439,7 @@ gst_audio_quantize_setup_dither (AudioConvertCtx * ctx)
 {
   switch (ctx->dither) {
     case DITHER_TPDF_HF:
-      if (ctx->out.is_int)
+      if (GST_AUDIO_FORMAT_INFO_IS_INTEGER (ctx->out.finfo))
         ctx->last_random = g_new0 (gint32, ctx->out.channels);
       else
         ctx->last_random = g_new0 (gdouble, ctx->out.channels);
@@ -469,14 +469,14 @@ gst_audio_quantize_setup_quantize_func (AudioConvertCtx * ctx)
 {
   gint index = 0;
 
-  if (!ctx->out.is_int) {
+  if (!GST_AUDIO_FORMAT_INFO_IS_INTEGER (ctx->out.finfo)) {
     ctx->quantize = NULL;
     return;
   }
 
   if (ctx->ns == NOISE_SHAPING_NONE) {
     index += ctx->dither;
-    index += (ctx->out.sign) ? 0 : 4;
+    index += GST_AUDIO_FORMAT_INFO_IS_SIGNED (ctx->out.finfo) ? 0 : 4;
   } else {
     index += 8 + (4 * ctx->dither);
     index += ctx->ns - 1;
index 055f28d..f4b350a 100644 (file)
@@ -70,7 +70,7 @@ gst_channel_mix_fill_identical (AudioConvertCtx * this)
   for (co = 0; co < this->out.channels; co++) {
     /* find a channel in input with same position */
     for (ci = 0; ci < this->in.channels; ci++) {
-      if (this->in.pos[ci] == this->out.pos[co]) {
+      if (this->in.position[ci] == this->out.position[co]) {
         this->matrix[ci][co] = 1.0;
       }
     }
@@ -118,19 +118,19 @@ gst_channel_mix_fill_compatible (AudioConvertCtx * this)
     gint n;
 
     for (n = 0; n < this->in.channels; n++) {
-      if (this->in.pos[n] == conv[c].pos1[0])
+      if (this->in.position[n] == conv[c].pos1[0])
         pos1_0 = n;
-      else if (this->in.pos[n] == conv[c].pos1[1])
+      else if (this->in.position[n] == conv[c].pos1[1])
         pos1_1 = n;
-      else if (this->in.pos[n] == conv[c].pos2[0])
+      else if (this->in.position[n] == conv[c].pos2[0])
         pos1_2 = n;
     }
     for (n = 0; n < this->out.channels; n++) {
-      if (this->out.pos[n] == conv[c].pos1[0])
+      if (this->out.position[n] == conv[c].pos1[0])
         pos2_0 = n;
-      else if (this->out.pos[n] == conv[c].pos1[1])
+      else if (this->out.position[n] == conv[c].pos1[1])
         pos2_1 = n;
-      else if (this->out.pos[n] == conv[c].pos2[0])
+      else if (this->out.position[n] == conv[c].pos2[0])
         pos2_2 = n;
     }
 
@@ -182,15 +182,15 @@ gst_channel_mix_fill_compatible (AudioConvertCtx * this)
  */
 
 static void
-gst_channel_mix_detect_pos (AudioConvertFmt * caps,
+gst_channel_mix_detect_pos (GstAudioInfo * info,
     gint * f, gboolean * has_f,
     gint * c, gboolean * has_c, gint * r, gboolean * has_r,
     gint * s, gboolean * has_s, gint * b, gboolean * has_b)
 {
   gint n;
 
-  for (n = 0; n < caps->channels; n++) {
-    switch (caps->pos[n]) {
+  for (n = 0; n < info->channels; n++) {
+    switch (info->position[n]) {
       case GST_AUDIO_CHANNEL_POSITION_FRONT_MONO:
         f[1] = n;
         *has_f = TRUE;
@@ -247,8 +247,8 @@ gst_channel_mix_detect_pos (AudioConvertFmt * caps,
 
 static void
 gst_channel_mix_fill_one_other (gfloat ** matrix,
-    AudioConvertFmt * from_caps, gint * from_idx,
-    AudioConvertFmt * to_caps, gint * to_idx, gfloat ratio)
+    GstAudioInfo * from_info, gint * from_idx,
+    GstAudioInfo * to_info, gint * to_idx, gfloat ratio)
 {
 
   /* src & dst have center => passthrough */
@@ -542,26 +542,26 @@ gst_channel_mix_fill_normalize (AudioConvertCtx * this)
 static gboolean
 gst_channel_mix_fill_special (AudioConvertCtx * this)
 {
-  AudioConvertFmt *in = &this->in, *out = &this->out;
+  GstAudioInfo *in = &this->in, *out = &this->out;
 
   /* Special, standard conversions here */
 
   /* Mono<->Stereo, just a fast-path */
   if (in->channels == 2 && out->channels == 1 &&
-      ((in->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT &&
-              in->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) ||
-          (in->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT &&
-              in->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT)) &&
-      out->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) {
+      ((in->position[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT &&
+              in->position[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) ||
+          (in->position[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT &&
+              in->position[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT)) &&
+      out->position[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) {
     this->matrix[0][0] = 0.5;
     this->matrix[1][0] = 0.5;
     return TRUE;
   } else if (in->channels == 1 && out->channels == 2 &&
-      ((out->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT &&
-              out->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) ||
-          (out->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT &&
-              out->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT)) &&
-      in->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) {
+      ((out->position[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT &&
+              out->position[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) ||
+          (out->position[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT &&
+              out->position[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT)) &&
+      in->position[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) {
     this->matrix[0][0] = 1.0;
     this->matrix[0][1] = 1.0;
     return TRUE;
@@ -584,7 +584,7 @@ gst_channel_mix_fill_matrix (AudioConvertCtx * this)
 
   gst_channel_mix_fill_identical (this);
 
-  if (!this->in.unpositioned_layout) {
+  if (!GST_AUDIO_INFO_IS_UNPOSITIONED (&this->in)) {
     gst_channel_mix_fill_compatible (this);
     gst_channel_mix_fill_others (this);
     gst_channel_mix_fill_normalize (this);
@@ -601,7 +601,8 @@ gst_channel_mix_setup_matrix (AudioConvertCtx * this)
   gst_channel_mix_unset_matrix (this);
 
   /* temp storage */
-  if (this->in.is_int || this->out.is_int) {
+  if (GST_AUDIO_FORMAT_INFO_IS_INTEGER (this->in.finfo) ||
+      GST_AUDIO_FORMAT_INFO_IS_INTEGER (this->out.finfo)) {
     this->tmp = (gpointer) g_new (gint32, this->out.channels);
   } else {
     this->tmp = (gpointer) g_new (gdouble, this->out.channels);
index 45882dc..105f0e9 100644 (file)
@@ -31,8 +31,6 @@
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  gst_audio_convert_orc_init ();
-
   /* ensure GstAudioChannelPosition type is registered */
   if (!gst_audio_channel_position_get_type ())
     return FALSE;
index 72c3355..bcb6625 100644 (file)
@@ -5,7 +5,9 @@ plugin_LTLIBRARIES = libgstaudiorate.la
 libgstaudiorate_la_SOURCES = gstaudiorate.c
 libgstaudiorate_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
 libgstaudiorate_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudiorate_la_LIBADD = $(GST_LIBS)
+libgstaudiorate_la_LIBADD = $(GST_LIBS) \
+        $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la
+
 libgstaudiorate_la_LIBTOOLFLAGS = --tag=disable-static
 
 Android.mk: Makefile.am $(BUILT_SOURCES)
index 40d3467..8661c24 100644 (file)
@@ -93,24 +93,19 @@ enum
 };
 
 static GstStaticPadTemplate gst_audio_rate_src_template =
-    GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS ";"
-        GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
+    GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL))
     );
 
 static GstStaticPadTemplate gst_audio_rate_sink_template =
-    GST_STATIC_PAD_TEMPLATE ("sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS ";"
-        GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
+    GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL))
     );
 
-static void gst_audio_rate_base_init (gpointer g_class);
-static void gst_audio_rate_class_init (GstAudioRateClass * klass);
-static void gst_audio_rate_init (GstAudioRate * audiorate);
 static gboolean gst_audio_rate_sink_event (GstPad * pad, GstEvent * event);
 static gboolean gst_audio_rate_src_event (GstPad * pad, GstEvent * event);
 static GstFlowReturn gst_audio_rate_chain (GstPad * pad, GstBuffer * buf);
@@ -123,53 +118,13 @@ static void gst_audio_rate_get_property (GObject * object,
 static GstStateChangeReturn gst_audio_rate_change_state (GstElement * element,
     GstStateChange transition);
 
-static GstElementClass *parent_class = NULL;
-
 /*static guint gst_audio_rate_signals[LAST_SIGNAL] = { 0 }; */
 
 static GParamSpec *pspec_drop = NULL;
 static GParamSpec *pspec_add = NULL;
 
-static GType
-gst_audio_rate_get_type (void)
-{
-  static GType audio_rate_type = 0;
-
-  if (!audio_rate_type) {
-    static const GTypeInfo audio_rate_info = {
-      sizeof (GstAudioRateClass),
-      gst_audio_rate_base_init,
-      NULL,
-      (GClassInitFunc) gst_audio_rate_class_init,
-      NULL,
-      NULL,
-      sizeof (GstAudioRate),
-      0,
-      (GInstanceInitFunc) gst_audio_rate_init,
-    };
-
-    audio_rate_type = g_type_register_static (GST_TYPE_ELEMENT,
-        "GstAudioRate", &audio_rate_info, 0);
-  }
-
-  return audio_rate_type;
-}
-
-static void
-gst_audio_rate_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Audio rate adjuster", "Filter/Effect/Audio",
-      "Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream",
-      "Wim Taymans <wim@fluendo.com>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_audio_rate_sink_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_audio_rate_src_template));
-}
+#define gst_audio_rate_parent_class parent_class
+G_DEFINE_TYPE (GstAudioRate, gst_audio_rate, GST_TYPE_ELEMENT);
 
 static void
 gst_audio_rate_class_init (GstAudioRateClass * klass)
@@ -177,8 +132,6 @@ gst_audio_rate_class_init (GstAudioRateClass * klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
-  parent_class = g_type_class_peek_parent (klass);
-
   object_class->set_property = gst_audio_rate_set_property;
   object_class->get_property = gst_audio_rate_get_property;
 
@@ -225,6 +178,16 @@ gst_audio_rate_class_init (GstAudioRateClass * klass)
           "Don't produce buffers before the first one we receive",
           DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (element_class,
+      "Audio rate adjuster", "Filter/Effect/Audio",
+      "Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream",
+      "Wim Taymans <wim@fluendo.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_audio_rate_sink_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_audio_rate_src_template));
+
   element_class->change_state = gst_audio_rate_change_state;
 }
 
@@ -241,51 +204,22 @@ gst_audio_rate_reset (GstAudioRate * audiorate)
 }
 
 static gboolean
-gst_audio_rate_setcaps (GstPad * pad, GstCaps * caps)
+gst_audio_rate_setcaps (GstAudioRate * audiorate, GstCaps * caps)
 {
-  GstAudioRate *audiorate;
-  GstStructure *structure;
-  GstPad *otherpad;
-  gboolean ret = FALSE;
-  gint channels, width, rate;
+  GstAudioInfo info;
 
-  audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (!gst_structure_get_int (structure, "channels", &channels))
-    goto wrong_caps;
-  if (!gst_structure_get_int (structure, "width", &width))
-    goto wrong_caps;
-  if (!gst_structure_get_int (structure, "rate", &rate))
+  if (!gst_audio_info_from_caps (&info, caps))
     goto wrong_caps;
 
-  audiorate->bytes_per_sample = channels * (width / 8);
-  if (audiorate->bytes_per_sample == 0)
-    goto wrong_format;
+  audiorate->info = info;
 
-  audiorate->rate = rate;
-
-  /* the format is correct, configure caps on other pad */
-  otherpad = (pad == audiorate->srcpad) ? audiorate->sinkpad :
-      audiorate->srcpad;
-
-  ret = gst_pad_set_caps (otherpad, caps);
-
-done:
-  gst_object_unref (audiorate);
-  return ret;
+  return TRUE;
 
   /* ERRORS */
 wrong_caps:
   {
-    GST_DEBUG_OBJECT (audiorate, "could not get channels/width from caps");
-    goto done;
-  }
-wrong_format:
-  {
-    GST_DEBUG_OBJECT (audiorate, "bytes_per_samples gave 0");
-    goto done;
+    GST_DEBUG_OBJECT (audiorate, "could not parse caps");
+    return FALSE;
   }
 }
 
@@ -296,14 +230,12 @@ gst_audio_rate_init (GstAudioRate * audiorate)
       gst_pad_new_from_static_template (&gst_audio_rate_sink_template, "sink");
   gst_pad_set_event_function (audiorate->sinkpad, gst_audio_rate_sink_event);
   gst_pad_set_chain_function (audiorate->sinkpad, gst_audio_rate_chain);
-  gst_pad_set_setcaps_function (audiorate->sinkpad, gst_audio_rate_setcaps);
   gst_pad_set_getcaps_function (audiorate->sinkpad, gst_pad_proxy_getcaps);
   gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->sinkpad);
 
   audiorate->srcpad =
       gst_pad_new_from_static_template (&gst_audio_rate_src_template, "src");
   gst_pad_set_event_function (audiorate->srcpad, gst_audio_rate_src_event);
-  gst_pad_set_setcaps_function (audiorate->srcpad, gst_audio_rate_setcaps);
   gst_pad_set_getcaps_function (audiorate->srcpad, gst_pad_proxy_getcaps);
   gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->srcpad);
 
@@ -344,46 +276,52 @@ gst_audio_rate_sink_event (GstPad * pad, GstEvent * event)
   audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      if ((res = gst_audio_rate_setcaps (audiorate, caps))) {
+        res = gst_pad_push_event (audiorate->srcpad, event);
+      } else {
+        gst_event_unref (event);
+      }
+      break;
+    }
     case GST_EVENT_FLUSH_STOP:
       GST_DEBUG_OBJECT (audiorate, "handling FLUSH_STOP");
       gst_audio_rate_reset (audiorate);
       res = gst_pad_push_event (audiorate->srcpad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      GstFormat format;
-      gdouble rate, arate;
-      gint64 start, stop, time;
-      gboolean update;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
+      gst_event_copy_segment (event, &audiorate->sink_segment);
 
       GST_DEBUG_OBJECT (audiorate, "handle NEWSEGMENT");
+#if 0
       /* FIXME: bad things will likely happen if rate < 0 ... */
       if (!update) {
         /* a new segment starts. We need to figure out what will be the next
          * sample offset. We mark the offsets as invalid so that the _chain
          * function will perform this calculation. */
         gst_audio_rate_fill_to_time (audiorate, audiorate->src_segment.stop);
+#endif
         audiorate->next_offset = -1;
         audiorate->next_ts = -1;
+#if 0
       } else {
         gst_audio_rate_fill_to_time (audiorate, audiorate->src_segment.start);
       }
-
-      /* we accept all formats */
-      gst_segment_set_newsegment_full (&audiorate->sink_segment, update, rate,
-          arate, format, start, stop, time);
+#endif
 
       GST_DEBUG_OBJECT (audiorate, "updated segment: %" GST_SEGMENT_FORMAT,
           &audiorate->sink_segment);
 
-      if (format == GST_FORMAT_TIME) {
+      if (audiorate->sink_segment.format == GST_FORMAT_TIME) {
         /* TIME formats can be copied to src and forwarded */
         res = gst_pad_push_event (audiorate->srcpad, event);
-        memcpy (&audiorate->src_segment, &audiorate->sink_segment,
-            sizeof (GstSegment));
+        gst_segment_copy_into (&audiorate->sink_segment,
+            &audiorate->src_segment);
       } else {
         /* other formats will be handled in the _chain function */
         gst_event_unref (event);
@@ -428,22 +366,26 @@ gst_audio_rate_src_event (GstPad * pad, GstEvent * event)
 
 static gboolean
 gst_audio_rate_convert (GstAudioRate * audiorate,
-    GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val)
+    GstFormat src_fmt, guint64 src_val, GstFormat dest_fmt, guint64 * dest_val)
 {
+  gint rate, bpf;
+
   if (src_fmt == dest_fmt) {
     *dest_val = src_val;
     return TRUE;
   }
 
+  rate = GST_AUDIO_INFO_RATE (&audiorate->info);
+  bpf = GST_AUDIO_INFO_BPF (&audiorate->info);
+
   switch (src_fmt) {
     case GST_FORMAT_DEFAULT:
       switch (dest_fmt) {
         case GST_FORMAT_BYTES:
-          *dest_val = src_val * audiorate->bytes_per_sample;
+          *dest_val = src_val * bpf;
           break;
         case GST_FORMAT_TIME:
-          *dest_val =
-              gst_util_uint64_scale_int (src_val, GST_SECOND, audiorate->rate);
+          *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, rate);
           break;
         default:
           return FALSE;;
@@ -452,11 +394,11 @@ gst_audio_rate_convert (GstAudioRate * audiorate,
     case GST_FORMAT_BYTES:
       switch (dest_fmt) {
         case GST_FORMAT_DEFAULT:
-          *dest_val = src_val / audiorate->bytes_per_sample;
+          *dest_val = src_val / bpf;
           break;
         case GST_FORMAT_TIME:
           *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND,
-              audiorate->rate * audiorate->bytes_per_sample);
+              rate * bpf);
           break;
         default:
           return FALSE;;
@@ -466,14 +408,13 @@ gst_audio_rate_convert (GstAudioRate * audiorate,
       switch (dest_fmt) {
         case GST_FORMAT_BYTES:
           *dest_val = gst_util_uint64_scale_int (src_val,
-              audiorate->rate * audiorate->bytes_per_sample, GST_SECOND);
+              rate * bpf, GST_SECOND);
           break;
         case GST_FORMAT_DEFAULT:
-          *dest_val =
-              gst_util_uint64_scale_int (src_val, audiorate->rate, GST_SECOND);
+          *dest_val = gst_util_uint64_scale_int (src_val, rate, GST_SECOND);
           break;
         default:
-          return FALSE;;
+          return FALSE;
       }
       break;
     default:
@@ -496,14 +437,13 @@ gst_audio_rate_convert_segments (GstAudioRate * audiorate)
                dst_fmt, &audiorate->src_segment.field);
 
   audiorate->sink_segment.rate = audiorate->src_segment.rate;
-  audiorate->sink_segment.abs_rate = audiorate->src_segment.abs_rate;
   audiorate->sink_segment.flags = audiorate->src_segment.flags;
   audiorate->sink_segment.applied_rate = audiorate->src_segment.applied_rate;
   CONVERT_VAL (start);
   CONVERT_VAL (stop);
   CONVERT_VAL (time);
-  CONVERT_VAL (accum);
-  CONVERT_VAL (last_stop);
+  CONVERT_VAL (base);
+  CONVERT_VAL (position);
 #undef CONVERT_VAL
 
   return TRUE;
@@ -538,11 +478,15 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
   guint in_size;
   GstFlowReturn ret = GST_FLOW_OK;
   GstClockTimeDiff diff;
+  gint rate, bpf;
 
   audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
 
+  rate = GST_AUDIO_INFO_RATE (&audiorate->info);
+  bpf = GST_AUDIO_INFO_BPF (&audiorate->info);
+
   /* need to be negotiated now */
-  if (audiorate->bytes_per_sample == 0)
+  if (bpf == 0)
     goto not_negotiated;
 
   /* we have a new pending segment */
@@ -559,7 +503,7 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
      */
     /* convert first timestamp of segment to sample position */
     pos = gst_util_uint64_scale_int (audiorate->src_segment.start,
-        audiorate->rate, GST_SECOND);
+        GST_AUDIO_INFO_RATE (&audiorate->info), GST_SECOND);
 
     GST_DEBUG_OBJECT (audiorate, "resync to offset %" G_GINT64_FORMAT, pos);
 
@@ -568,12 +512,12 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
 
     audiorate->next_offset = pos;
     audiorate->next_ts = gst_util_uint64_scale_int (audiorate->next_offset,
-        GST_SECOND, audiorate->rate);
+        GST_SECOND, GST_AUDIO_INFO_RATE (&audiorate->info));
 
     if (audiorate->skip_to_first && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
       GST_DEBUG_OBJECT (audiorate, "but skipping to first buffer instead");
       pos = gst_util_uint64_scale_int (GST_BUFFER_TIMESTAMP (buf),
-          audiorate->rate, GST_SECOND);
+          GST_AUDIO_INFO_RATE (&audiorate->info), GST_SECOND);
       GST_DEBUG_OBJECT (audiorate, "so resync to offset %" G_GINT64_FORMAT,
           pos);
       audiorate->next_offset = pos;
@@ -589,12 +533,11 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
     in_time = audiorate->next_ts;
   }
 
-  in_size = GST_BUFFER_SIZE (buf);
-  in_samples = in_size / audiorate->bytes_per_sample;
+  in_size = gst_buffer_get_size (buf);
+  in_samples = in_size / bpf;
 
   /* calculate the buffer offset */
-  in_offset = gst_util_uint64_scale_int_round (in_time, audiorate->rate,
-      GST_SECOND);
+  in_offset = gst_util_uint64_scale_int_round (in_time, rate, GST_SECOND);
   in_offset_end = in_offset + in_samples;
 
   GST_LOG_OBJECT (audiorate,
@@ -602,7 +545,7 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
       ", in_size:%u, in_offset:%" G_GUINT64_FORMAT ", in_offset_end:%"
       G_GUINT64_FORMAT ", ->next_offset:%" G_GUINT64_FORMAT ", ->next_ts:%"
       GST_TIME_FORMAT, GST_TIME_ARGS (in_time),
-      GST_TIME_ARGS (GST_FRAMES_TO_CLOCK_TIME (in_samples, audiorate->rate)),
+      GST_TIME_ARGS (GST_FRAMES_TO_CLOCK_TIME (in_samples, rate)),
       in_size, in_offset, in_offset_end, audiorate->next_offset,
       GST_TIME_ARGS (audiorate->next_ts));
 
@@ -632,14 +575,18 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
     fillsamples = in_offset - audiorate->next_offset;
 
     while (fillsamples > 0) {
-      guint64 cursamples = MIN (fillsamples, audiorate->rate);
+      guint64 cursamples = MIN (fillsamples, rate);
+      guint8 *data;
 
       fillsamples -= cursamples;
-      fillsize = cursamples * audiorate->bytes_per_sample;
+      fillsize = cursamples * bpf;
 
       fill = gst_buffer_new_and_alloc (fillsize);
+
+      data = gst_buffer_map (fill, NULL, NULL, GST_MAP_WRITE);
       /* FIXME, 0 might not be the silence byte for the negotiated format. */
-      memset (GST_BUFFER_DATA (fill), 0, fillsize);
+      memset (data, 0, fillsize);
+      gst_buffer_unmap (fill, data, fillsize);
 
       GST_DEBUG_OBJECT (audiorate, "inserting %" G_GUINT64_FORMAT " samples",
           cursamples);
@@ -653,7 +600,7 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
        * streams */
       GST_BUFFER_TIMESTAMP (fill) = audiorate->next_ts;
       audiorate->next_ts = gst_util_uint64_scale_int (audiorate->next_offset,
-          GST_SECOND, audiorate->rate);
+          GST_SECOND, rate);
       GST_BUFFER_DURATION (fill) = audiorate->next_ts -
           GST_BUFFER_TIMESTAMP (fill);
 
@@ -665,7 +612,6 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
         GST_BUFFER_FLAG_SET (fill, GST_BUFFER_FLAG_DISCONT);
         audiorate->discont = FALSE;
       }
-      gst_buffer_set_caps (fill, GST_PAD_CAPS (audiorate->srcpad));
 
       ret = gst_pad_push (audiorate->srcpad, fill);
       if (ret != GST_FLOW_OK)
@@ -680,7 +626,7 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
   } else if (in_offset < audiorate->next_offset) {
     /* need to remove samples */
     if (in_offset_end <= audiorate->next_offset) {
-      guint64 drop = in_size / audiorate->bytes_per_sample;
+      guint64 drop = in_size / bpf;
 
       audiorate->drop += drop;
 
@@ -702,16 +648,16 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
 
       /* truncate buffer */
       truncsamples = audiorate->next_offset - in_offset;
-      truncsize = truncsamples * audiorate->bytes_per_sample;
+      truncsize = truncsamples * bpf;
       leftsize = in_size - truncsize;
 
-      trunc = gst_buffer_create_sub (buf, truncsize, leftsize);
+      trunc =
+          gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, truncsize,
+          leftsize);
 
       gst_buffer_unref (buf);
       buf = trunc;
 
-      gst_buffer_set_caps (buf, GST_PAD_CAPS (audiorate->srcpad));
-
       audiorate->drop += truncsamples;
       GST_DEBUG_OBJECT (audiorate, "truncating %" G_GUINT64_FORMAT " samples",
           truncsamples);
@@ -722,7 +668,7 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
   }
 
 send:
-  if (GST_BUFFER_SIZE (buf) == 0)
+  if (gst_buffer_get_size (buf) == 0)
     goto beach;
 
   /* Now calculate parameters for whichever buffer (either the original
@@ -732,26 +678,26 @@ send:
 
   GST_BUFFER_TIMESTAMP (buf) = audiorate->next_ts;
   audiorate->next_ts = gst_util_uint64_scale_int (in_offset_end,
-      GST_SECOND, audiorate->rate);
+      GST_SECOND, rate);
   GST_BUFFER_DURATION (buf) = audiorate->next_ts - GST_BUFFER_TIMESTAMP (buf);
 
   if (audiorate->discont) {
     /* we need to output a discont buffer, do so now */
     GST_DEBUG_OBJECT (audiorate, "marking DISCONT on output buffer");
-    buf = gst_buffer_make_metadata_writable (buf);
+    buf = gst_buffer_make_writable (buf);
     GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
     audiorate->discont = FALSE;
   } else if (GST_BUFFER_IS_DISCONT (buf)) {
     /* else we make everything continuous so we can safely remove the DISCONT
      * flag from the buffer if there was one */
     GST_DEBUG_OBJECT (audiorate, "removing DISCONT from buffer");
-    buf = gst_buffer_make_metadata_writable (buf);
+    buf = gst_buffer_make_writable (buf);
     GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT);
   }
 
   /* set last_stop on segment */
-  gst_segment_set_last_stop (&audiorate->src_segment, GST_FORMAT_TIME,
-      GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf));
+  audiorate->src_segment.position =
+      GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
 
   ret = gst_pad_push (audiorate->srcpad, buf);
   buf = NULL;
@@ -846,18 +792,15 @@ gst_audio_rate_change_state (GstElement * element, GstStateChange transition)
       audiorate->in = 0;
       audiorate->out = 0;
       audiorate->drop = 0;
-      audiorate->bytes_per_sample = 0;
       audiorate->add = 0;
+      gst_audio_info_init (&audiorate->info);
       gst_audio_rate_reset (audiorate);
       break;
     default:
       break;
   }
 
-  if (parent_class->change_state)
-    return parent_class->change_state (element, transition);
-
-  return GST_STATE_CHANGE_SUCCESS;
+  return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 }
 
 static gboolean
index e55bbcf..b0b191e 100644 (file)
@@ -51,8 +51,7 @@ struct _GstAudioRate
   GstPad *sinkpad, *srcpad;
 
   /* audio format */
-  gint bytes_per_sample;
-  gint rate;
+  GstAudioInfo info;
 
   /* stats */
   guint64 in, out, add, drop;
@@ -78,6 +77,8 @@ struct _GstAudioRateClass
   GstElementClass parent_class;
 };
 
+GType gst_audio_rate_get_type (void);
+
 G_END_DECLS
 
 #endif /* __GST_AUDIO_RATE_H__ */
index f2be5c7..9c2999c 100644 (file)
@@ -20,6 +20,7 @@ libgstaudioresample_la_CFLAGS = \
        $(ORC_CFLAGS)
 
 libgstaudioresample_la_LIBADD = \
+       $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
        $(GST_BASE_LIBS) \
        $(GST_LIBS) \
        $(ORC_LIBS) $(ORC_TEST_LIBS) \
index e63d106..29464b0 100644 (file)
@@ -28,7 +28,7 @@
  * <refsect2>
  * <title>Example launch line</title>
  * |[
- * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! audio/x-raw-int, rate=8000 ! alsasink
+ * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! audio/x-raw, rate=8000 ! alsasink
  * ]| Decode an Ogg/Vorbis downsample to 8Khz and play sound through alsa.
  * To create the Ogg/Vorbis file refer to the documentation of vorbisenc.
  * </refsect2>
@@ -62,46 +62,16 @@ GST_DEBUG_CATEGORY (audio_resample_debug);
 enum
 {
   PROP_0,
-  PROP_QUALITY,
-  PROP_FILTER_LENGTH
+  PROP_QUALITY
 };
 
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
 #define SUPPORTED_CAPS \
-GST_STATIC_CAPS ( \
-    "audio/x-raw-float, " \
-      "rate = (int) [ 1, MAX ], "      \
-      "channels = (int) [ 1, MAX ], " \
-      "endianness = (int) BYTE_ORDER, " \
-      "width = (int) { 32, 64 }; " \
-    "audio/x-raw-int, " \
-      "rate = (int) [ 1, MAX ], " \
-      "channels = (int) [ 1, MAX ], " \
-      "endianness = (int) BYTE_ORDER, " \
-      "width = (int) 32, " \
-      "depth = (int) 32, " \
-      "signed = (boolean) true; " \
-    "audio/x-raw-int, " \
-      "rate = (int) [ 1, MAX ], " \
-      "channels = (int) [ 1, MAX ], " \
-      "endianness = (int) BYTE_ORDER, " \
-      "width = (int) 24, " \
-      "depth = (int) 24, " \
-      "signed = (boolean) true; " \
-    "audio/x-raw-int, " \
-      "rate = (int) [ 1, MAX ], " \
-      "channels = (int) [ 1, MAX ], " \
-      "endianness = (int) BYTE_ORDER, " \
-      "width = (int) 16, " \
-      "depth = (int) 16, " \
-      "signed = (boolean) true; " \
-    "audio/x-raw-int, " \
-      "rate = (int) [ 1, MAX ], " \
-      "channels = (int) [ 1, MAX ], " \
-      "endianness = (int) BYTE_ORDER, " \
-      "width = (int) 8, " \
-      "depth = (int) 8, " \
-      "signed = (boolean) true" \
-)
+  GST_AUDIO_CAPS_MAKE ("{ F32_LE, F64_LE, S32_LE, S24_3LE, S16_LE, S8 }")
+#else
+#define SUPPORTED_CAPS \
+  GST_AUDIO_CAPS_MAKE ("{ F32_BE, F64_BE, S32_BE, S24_3BE, S16_BE, S8 }")
+#endif
 
 /* If TRUE integer arithmetic resampling is faster and will be used if appropiate */
 #if defined AUDIORESAMPLE_FORMAT_INT
@@ -114,11 +84,15 @@ static gboolean gst_audio_resample_use_int = FALSE;
 
 static GstStaticPadTemplate gst_audio_resample_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK, GST_PAD_ALWAYS, SUPPORTED_CAPS);
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (SUPPORTED_CAPS));
 
 static GstStaticPadTemplate gst_audio_resample_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC, GST_PAD_ALWAYS, SUPPORTED_CAPS);
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (SUPPORTED_CAPS));
 
 static void gst_audio_resample_set_property (GObject * object,
     guint prop_id, const GValue * value, GParamSpec * pspec);
@@ -127,47 +101,33 @@ static void gst_audio_resample_get_property (GObject * object,
 
 /* vmethods */
 static gboolean gst_audio_resample_get_unit_size (GstBaseTransform * base,
-    GstCaps * caps, guint * size);
+    GstCaps * caps, gsize * size);
 static GstCaps *gst_audio_resample_transform_caps (GstBaseTransform * base,
-    GstPadDirection direction, GstCaps * caps);
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter);
 static void gst_audio_resample_fixate_caps (GstBaseTransform * base,
     GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
 static gboolean gst_audio_resample_transform_size (GstBaseTransform * trans,
-    GstPadDirection direction, GstCaps * incaps, guint insize,
-    GstCaps * outcaps, guint * outsize);
+    GstPadDirection direction, GstCaps * incaps, gsize insize,
+    GstCaps * outcaps, gsize * outsize);
 static gboolean gst_audio_resample_set_caps (GstBaseTransform * base,
     GstCaps * incaps, GstCaps * outcaps);
 static GstFlowReturn gst_audio_resample_transform (GstBaseTransform * base,
     GstBuffer * inbuf, GstBuffer * outbuf);
-static gboolean gst_audio_resample_event (GstBaseTransform * base,
+static gboolean gst_audio_resample_sink_event (GstBaseTransform * base,
     GstEvent * event);
 static gboolean gst_audio_resample_start (GstBaseTransform * base);
 static gboolean gst_audio_resample_stop (GstBaseTransform * base);
 static gboolean gst_audio_resample_query (GstPad * pad, GstQuery * query);
 static const GstQueryType *gst_audio_resample_query_type (GstPad * pad);
 
-GST_BOILERPLATE (GstAudioResample, gst_audio_resample, GstBaseTransform,
-    GST_TYPE_BASE_TRANSFORM);
-
-static void
-gst_audio_resample_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&gst_audio_resample_src_template));
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&gst_audio_resample_sink_template));
-
-  gst_element_class_set_details_simple (gstelement_class, "Audio resampler",
-      "Filter/Converter/Audio", "Resamples audio",
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
+#define gst_audio_resample_parent_class parent_class
+G_DEFINE_TYPE (GstAudioResample, gst_audio_resample, GST_TYPE_BASE_TRANSFORM);
 
 static void
 gst_audio_resample_class_init (GstAudioResampleClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
 
   gobject_class->set_property = gst_audio_resample_set_property;
   gobject_class->get_property = gst_audio_resample_get_property;
@@ -179,20 +139,14 @@ gst_audio_resample_class_init (GstAudioResampleClass * klass)
           SPEEX_RESAMPLER_QUALITY_DEFAULT,
           G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
 
-  /* FIXME 0.11: Remove this property, it's just for compatibility
-   * with old audioresample
-   */
-  /**
-   * GstAudioResample:filter-length:
-   *
-   * Length of the resample filter
-   *
-   * Deprectated: Use #GstAudioResample:quality property instead
-   */
-  g_object_class_install_property (gobject_class, PROP_FILTER_LENGTH,
-      g_param_spec_int ("filter-length", "Filter length",
-          "Length of the resample filter", 0, G_MAXINT, 64,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_audio_resample_src_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_audio_resample_sink_template));
+
+  gst_element_class_set_details_simple (gstelement_class, "Audio resampler",
+      "Filter/Converter/Audio", "Resamples audio",
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
 
   GST_BASE_TRANSFORM_CLASS (klass)->start =
       GST_DEBUG_FUNCPTR (gst_audio_resample_start);
@@ -210,15 +164,14 @@ gst_audio_resample_class_init (GstAudioResampleClass * klass)
       GST_DEBUG_FUNCPTR (gst_audio_resample_set_caps);
   GST_BASE_TRANSFORM_CLASS (klass)->transform =
       GST_DEBUG_FUNCPTR (gst_audio_resample_transform);
-  GST_BASE_TRANSFORM_CLASS (klass)->event =
-      GST_DEBUG_FUNCPTR (gst_audio_resample_event);
+  GST_BASE_TRANSFORM_CLASS (klass)->sink_event =
+      GST_DEBUG_FUNCPTR (gst_audio_resample_sink_event);
 
   GST_BASE_TRANSFORM_CLASS (klass)->passthrough_on_same_caps = TRUE;
 }
 
 static void
-gst_audio_resample_init (GstAudioResample * resample,
-    GstAudioResampleClass * klass)
+gst_audio_resample_init (GstAudioResample * resample)
 {
   GstBaseTransform *trans = GST_BASE_TRANSFORM (resample);
 
@@ -274,68 +227,82 @@ gst_audio_resample_stop (GstBaseTransform * base)
   resample->tmp_out = NULL;
   resample->tmp_out_size = 0;
 
-  gst_caps_replace (&resample->sinkcaps, NULL);
-  gst_caps_replace (&resample->srccaps, NULL);
-
   return TRUE;
 }
 
 static gboolean
 gst_audio_resample_get_unit_size (GstBaseTransform * base, GstCaps * caps,
-    guint * size)
+    gsize * size)
 {
-  gint width, channels;
-  GstStructure *structure;
-  gboolean ret;
-
-  g_return_val_if_fail (size != NULL, FALSE);
+  GstAudioInfo info;
 
-  /* this works for both float and int */
-  structure = gst_caps_get_structure (caps, 0);
-  ret = gst_structure_get_int (structure, "width", &width);
-  ret &= gst_structure_get_int (structure, "channels", &channels);
+  if (!gst_audio_info_from_caps (&info, caps))
+    goto invalid_caps;
 
-  if (G_UNLIKELY (!ret))
-    return FALSE;
-
-  *size = (width / 8) * channels;
+  *size = GST_AUDIO_INFO_BPF (&info);
 
   return TRUE;
+
+  /* ERRORS */
+invalid_caps:
+  {
+    GST_ERROR_OBJECT (base, "invalid caps");
+    return FALSE;
+  }
 }
 
 static GstCaps *
 gst_audio_resample_transform_caps (GstBaseTransform * base,
-    GstPadDirection direction, GstCaps * caps)
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
 {
   const GValue *val;
   GstStructure *s;
   GstCaps *res;
+  gint i, n;
 
   /* transform single caps into input_caps + input_caps with the rate
    * field set to our supported range. This ensures that upstream knows
    * about downstream's prefered rate(s) and can negotiate accordingly. */
-  res = gst_caps_copy (caps);
-
-  /* first, however, check if the caps contain a range for the rate field, in
-   * which case that side isn't going to care much about the exact sample rate
-   * chosen and we should just assume things will get fixated to something sane
-   * and we may just as well offer our full range instead of the range in the
-   * caps. If the rate is not an int range value, it's likely to express a
-   * real preference or limitation and we should maintain that structure as
-   * preference by putting it first into the transformed caps, and only add
-   * our full rate range as second option  */
-  s = gst_caps_get_structure (res, 0);
-  val = gst_structure_get_value (s, "rate");
-  if (val == NULL || GST_VALUE_HOLDS_INT_RANGE (val)) {
-    /* overwrite existing range, or add field if it doesn't exist yet */
-    gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-  } else {
-    /* append caps with full range to existing caps with non-range rate field */
+  res = gst_caps_new_empty ();
+  n = gst_caps_get_size (caps);
+  for (i = 0; i < n; i++) {
+    s = gst_caps_get_structure (caps, i);
+
+    /* If this is already expressed by the existing caps
+     * skip this structure */
+    if (i > 0 && gst_caps_is_subset_structure (res, s))
+      continue;
+
+    /* first, however, check if the caps contain a range for the rate field, in
+     * which case that side isn't going to care much about the exact sample rate
+     * chosen and we should just assume things will get fixated to something sane
+     * and we may just as well offer our full range instead of the range in the
+     * caps. If the rate is not an int range value, it's likely to express a
+     * real preference or limitation and we should maintain that structure as
+     * preference by putting it first into the transformed caps, and only add
+     * our full rate range as second option  */
     s = gst_structure_copy (s);
-    gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+    val = gst_structure_get_value (s, "rate");
+    if (val == NULL || GST_VALUE_HOLDS_INT_RANGE (val)) {
+      /* overwrite existing range, or add field if it doesn't exist yet */
+      gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+    } else {
+      /* append caps with full range to existing caps with non-range rate field */
+      gst_caps_append_structure (res, gst_structure_copy (s));
+      gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+    }
     gst_caps_append_structure (res, s);
   }
 
+  if (filter) {
+    GstCaps *intersection;
+
+    intersection =
+        gst_caps_intersect_full (filter, res, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (res);
+    res = intersection;
+  }
+
   return res;
 }
 
@@ -458,63 +425,6 @@ gst_audio_resample_reset_state (GstAudioResample * resample)
     resample->funcs->reset_mem (resample->state);
 }
 
-static gboolean
-gst_audio_resample_parse_caps (GstCaps * incaps,
-    GstCaps * outcaps, gint * width, gint * channels, gint * inrate,
-    gint * outrate, gboolean * fp)
-{
-  GstStructure *structure;
-  gboolean ret;
-  gint mywidth, myinrate, myoutrate, mychannels;
-  gboolean myfp;
-
-  GST_DEBUG ("incaps %" GST_PTR_FORMAT ", outcaps %"
-      GST_PTR_FORMAT, incaps, outcaps);
-
-  structure = gst_caps_get_structure (incaps, 0);
-
-  if (gst_structure_has_name (structure, "audio/x-raw-float"))
-    myfp = TRUE;
-  else
-    myfp = FALSE;
-
-  ret = gst_structure_get_int (structure, "rate", &myinrate);
-  ret &= gst_structure_get_int (structure, "channels", &mychannels);
-  ret &= gst_structure_get_int (structure, "width", &mywidth);
-  if (G_UNLIKELY (!ret))
-    goto no_in_rate_channels;
-
-  structure = gst_caps_get_structure (outcaps, 0);
-  ret = gst_structure_get_int (structure, "rate", &myoutrate);
-  if (G_UNLIKELY (!ret))
-    goto no_out_rate;
-
-  if (channels)
-    *channels = mychannels;
-  if (inrate)
-    *inrate = myinrate;
-  if (outrate)
-    *outrate = myoutrate;
-  if (width)
-    *width = mywidth;
-  if (fp)
-    *fp = myfp;
-
-  return TRUE;
-
-  /* ERRORS */
-no_in_rate_channels:
-  {
-    GST_DEBUG ("could not get input rate and channels");
-    return FALSE;
-  }
-no_out_rate:
-  {
-    GST_DEBUG ("could not get output rate");
-    return FALSE;
-  }
-}
-
 static gint
 _gcd (gint a, gint b)
 {
@@ -530,30 +440,33 @@ _gcd (gint a, gint b)
 
 static gboolean
 gst_audio_resample_transform_size (GstBaseTransform * base,
-    GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps,
-    guint * othersize)
+    GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps,
+    gsize * othersize)
 {
   gboolean ret = TRUE;
+  GstAudioInfo in, out;
   guint32 ratio_den, ratio_num;
   gint inrate, outrate, gcd;
-  gint bytes_per_samp, channels;
+  gint bpf;
 
-  GST_LOG_OBJECT (base, "asked to transform size %d in direction %s",
-      size, direction == GST_PAD_SINK ? "SINK" : "SRC");
+  GST_LOG_OBJECT (base, "asked to transform size %" G_GSIZE_FORMAT
+      " in direction %s", size, direction == GST_PAD_SINK ? "SINK" : "SRC");
 
   /* Get sample width -> bytes_per_samp, channels, inrate, outrate */
-  ret =
-      gst_audio_resample_parse_caps (caps, othercaps, &bytes_per_samp,
-      &channels, &inrate, &outrate, NULL);
+  ret = gst_audio_info_from_caps (&in, caps);
+  ret &= gst_audio_info_from_caps (&out, othercaps);
   if (G_UNLIKELY (!ret)) {
     GST_ERROR_OBJECT (base, "Wrong caps");
     return FALSE;
   }
   /* Number of samples in either buffer is size / (width*channels) ->
    * calculate the factor */
-  bytes_per_samp = bytes_per_samp * channels / 8;
+  bpf = GST_AUDIO_INFO_BPF (&in);
+  inrate = GST_AUDIO_INFO_RATE (&in);
+  outrate = GST_AUDIO_INFO_RATE (&out);
+
   /* Convert source buffer size to samples */
-  size /= bytes_per_samp;
+  size /= bpf;
 
   /* Simplify the conversion ratio factors */
   gcd = _gcd (inrate, outrate);
@@ -563,15 +476,16 @@ gst_audio_resample_transform_size (GstBaseTransform * base,
   if (direction == GST_PAD_SINK) {
     /* asked to convert size of an incoming buffer. Round up the output size */
     *othersize = gst_util_uint64_scale_int_ceil (size, ratio_den, ratio_num);
-    *othersize *= bytes_per_samp;
+    *othersize *= bpf;
   } else {
     /* asked to convert size of an outgoing buffer. Round down the input size */
     *othersize = gst_util_uint64_scale_int (size, ratio_num, ratio_den);
-    *othersize *= bytes_per_samp;
+    *othersize *= bpf;
   }
 
-  GST_LOG_OBJECT (base, "transformed size %d to %d", size * bytes_per_samp,
-      *othersize);
+  GST_LOG_OBJECT (base,
+      "transformed size %" G_GSIZE_FORMAT " to %" G_GSIZE_FORMAT,
+      size * bpf, *othersize);
 
   return ret;
 }
@@ -581,18 +495,27 @@ gst_audio_resample_set_caps (GstBaseTransform * base, GstCaps * incaps,
     GstCaps * outcaps)
 {
   gboolean ret;
-  gint width = 0, inrate = 0, outrate = 0, channels = 0;
+  gint width, inrate, outrate, channels;
   gboolean fp;
   GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
+  GstAudioInfo in, out;
 
   GST_LOG ("incaps %" GST_PTR_FORMAT ", outcaps %"
       GST_PTR_FORMAT, incaps, outcaps);
 
-  ret = gst_audio_resample_parse_caps (incaps, outcaps,
-      &width, &channels, &inrate, &outrate, &fp);
+  if (!gst_audio_info_from_caps (&in, incaps))
+    goto invalid_incaps;
+  if (!gst_audio_info_from_caps (&out, outcaps))
+    goto invalid_outcaps;
 
-  if (G_UNLIKELY (!ret))
-    return FALSE;
+  /* FIXME do some checks */
+
+  /* take new values */
+  width = GST_AUDIO_FORMAT_INFO_WIDTH (in.finfo);
+  channels = GST_AUDIO_INFO_CHANNELS (&in);
+  inrate = GST_AUDIO_INFO_RATE (&in);
+  outrate = GST_AUDIO_INFO_RATE (&out);
+  fp = GST_AUDIO_FORMAT_INFO_IS_FLOAT (in.finfo);
 
   ret =
       gst_audio_resample_update_state (resample, width, channels, inrate,
@@ -601,12 +524,19 @@ gst_audio_resample_set_caps (GstBaseTransform * base, GstCaps * incaps,
   if (G_UNLIKELY (!ret))
     return FALSE;
 
-  /* save caps so we can short-circuit in the size_transform if the caps
-   * are the same */
-  gst_caps_replace (&resample->sinkcaps, incaps);
-  gst_caps_replace (&resample->srccaps, outcaps);
-
   return TRUE;
+
+  /* ERROR */
+invalid_incaps:
+  {
+    GST_ERROR_OBJECT (base, "invalid incaps");
+    return FALSE;
+  }
+invalid_outcaps:
+  {
+    GST_ERROR_OBJECT (base, "invalid outcaps");
+    return FALSE;
+  }
 }
 
 #define GST_MAXINT24 (8388607)
@@ -824,6 +754,7 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
   guint out_len, out_processed;
   gint err;
   guint num, den;
+  guint8 *data;
 
   g_assert (resample->state != NULL);
 
@@ -841,15 +772,9 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
   if (out_len == 0)
     return;
 
-  res =
-      gst_pad_alloc_buffer_and_set_caps (GST_BASE_TRANSFORM_SRC_PAD (resample),
-      GST_BUFFER_OFFSET_NONE, outsize,
-      GST_PAD_CAPS (GST_BASE_TRANSFORM_SRC_PAD (resample)), &outbuf);
-  if (G_UNLIKELY (res != GST_FLOW_OK)) {
-    GST_WARNING_OBJECT (resample, "failed allocating buffer of %d bytes",
-        outsize);
-    return;
-  }
+  outbuf = gst_buffer_new_and_alloc (outsize);
+
+  data = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE);
 
   if (resample->funcs->width != resample->width) {
     /* need to convert data format;  allocate workspace */
@@ -866,17 +791,20 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
 
     /* convert output format */
     gst_audio_resample_convert_buffer (resample, resample->tmp_out,
-        GST_BUFFER_DATA (outbuf), out_processed, TRUE);
+        data, out_processed, TRUE);
   } else {
     /* don't need to convert data format;  process */
     err = resample->funcs->process (resample->state, NULL, &in_processed,
-        GST_BUFFER_DATA (outbuf), &out_processed);
+        data, &out_processed);
   }
 
   /* If we wrote more than allocated something is really wrong now
    * and we should better abort immediately */
   g_assert (out_len >= out_processed);
 
+  outsize = out_processed * resample->channels * (resample->width / 8);
+  gst_buffer_unmap (outbuf, data, outsize);
+
   if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS)) {
     GST_WARNING_OBJECT (resample, "Failed to process drain: %s",
         resample->funcs->strerror (err));
@@ -914,13 +842,10 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
     return;
   }
 
-  GST_BUFFER_SIZE (outbuf) =
-      out_processed * resample->channels * (resample->width / 8);
-
   GST_LOG_OBJECT (resample,
       "Pushing drain buffer of %u bytes with timestamp %" GST_TIME_FORMAT
       " duration %" GST_TIME_FORMAT " offset %" G_GUINT64_FORMAT " offset_end %"
-      G_GUINT64_FORMAT, GST_BUFFER_SIZE (outbuf),
+      G_GUINT64_FORMAT, outsize,
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
       GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)), GST_BUFFER_OFFSET (outbuf),
       GST_BUFFER_OFFSET_END (outbuf));
@@ -935,7 +860,7 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
 }
 
 static gboolean
-gst_audio_resample_event (GstBaseTransform * base, GstEvent * event)
+gst_audio_resample_sink_event (GstBaseTransform * base, GstEvent * event)
 {
   GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
 
@@ -953,7 +878,7 @@ gst_audio_resample_event (GstBaseTransform * base, GstEvent * event)
       resample->samples_out = 0;
       resample->need_discont = TRUE;
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
       if (resample->state) {
         guint latency = resample->funcs->get_input_latency (resample->state);
         gst_audio_resample_push_drain (resample, latency);
@@ -981,7 +906,7 @@ gst_audio_resample_event (GstBaseTransform * base, GstEvent * event)
       break;
   }
 
-  return parent_class->event (base, event);
+  return GST_BASE_TRANSFORM_CLASS (parent_class)->sink_event (base, event);
 }
 
 static gboolean
@@ -1025,12 +950,17 @@ static GstFlowReturn
 gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
     GstBuffer * outbuf)
 {
+  gsize in_size, out_size;
+  guint8 *in_data, *out_data;
   guint32 in_len, in_processed;
   guint32 out_len, out_processed;
   guint filt_len = resample->funcs->get_filt_len (resample->state);
 
-  in_len = GST_BUFFER_SIZE (inbuf) / resample->channels;
-  out_len = GST_BUFFER_SIZE (outbuf) / resample->channels;
+  in_data = gst_buffer_map (inbuf, &in_size, NULL, GST_MAP_READ);
+  out_data = gst_buffer_map (outbuf, &out_size, NULL, GST_MAP_WRITE);
+
+  in_len = in_size / resample->channels;
+  out_len = out_size / resample->channels;
 
   in_len /= (resample->width / 8);
   out_len /= (resample->width / 8);
@@ -1062,7 +992,7 @@ gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
       else
         out_processed = 0;
 
-      memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
+      memset (out_data, 0, out_size);
       GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
       resample->num_gap_samples += in_len;
       in_processed = in_len;
@@ -1095,11 +1025,13 @@ gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
               &resample->tmp_out_size, out_len * resample->channels *
               (resample->funcs->width / 8))) {
         GST_ERROR_OBJECT (resample, "failed to allocate workspace");
+        gst_buffer_unmap (inbuf, in_data, in_size);
+        gst_buffer_unmap (outbuf, out_data, out_size);
         return GST_FLOW_ERROR;
       }
 
       /* convert input */
-      gst_audio_resample_convert_buffer (resample, GST_BUFFER_DATA (inbuf),
+      gst_audio_resample_convert_buffer (resample, in_data,
           resample->tmp_in, in_len, FALSE);
 
       /* process */
@@ -1108,17 +1040,18 @@ gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
 
       /* convert output */
       gst_audio_resample_convert_buffer (resample, resample->tmp_out,
-          GST_BUFFER_DATA (outbuf), out_processed, TRUE);
+          out_data, out_processed, TRUE);
     } else {
       /* no format conversion required;  process */
       err = resample->funcs->process (resample->state,
-          GST_BUFFER_DATA (inbuf), &in_processed,
-          GST_BUFFER_DATA (outbuf), &out_processed);
+          in_data, &in_processed, out_data, &out_processed);
     }
 
     if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS)) {
       GST_ERROR_OBJECT (resample, "Failed to convert data: %s",
           resample->funcs->strerror (err));
+      gst_buffer_unmap (inbuf, in_data, in_size);
+      gst_buffer_unmap (outbuf, out_data, out_size);
       return GST_FLOW_ERROR;
     }
   }
@@ -1156,14 +1089,15 @@ gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
   resample->samples_out += out_processed;
   resample->samples_in += in_len;
 
-  GST_BUFFER_SIZE (outbuf) =
-      out_processed * resample->channels * (resample->width / 8);
+  out_size = out_processed * resample->channels * (resample->width / 8);
+  gst_buffer_unmap (inbuf, in_data, in_size);
+  gst_buffer_unmap (outbuf, out_data, out_size);
 
   GST_LOG_OBJECT (resample,
       "Converted to buffer of %" G_GUINT32_FORMAT
-      " samples (%u bytes) with timestamp %" GST_TIME_FORMAT ", duration %"
-      GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT ", offset_end %"
-      G_GUINT64_FORMAT, out_processed, GST_BUFFER_SIZE (outbuf),
+      " samples (%" G_GSIZE_FORMAT " bytes) with timestamp %" GST_TIME_FORMAT
+      ", duration %" GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT
+      ", offset_end %" G_GUINT64_FORMAT, out_processed, out_size,
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
       GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)),
       GST_BUFFER_OFFSET (outbuf), GST_BUFFER_OFFSET_END (outbuf));
@@ -1180,7 +1114,6 @@ gst_audio_resample_transform (GstBaseTransform * base, GstBuffer * inbuf,
     GstBuffer * outbuf)
 {
   GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
-  gulong size;
   GstFlowReturn ret;
 
   if (resample->state == NULL) {
@@ -1194,12 +1127,10 @@ gst_audio_resample_transform (GstBaseTransform * base, GstBuffer * inbuf,
         gst_audio_resample_get_funcs (resample->width, resample->fp);
   }
 
-  size = GST_BUFFER_SIZE (inbuf);
-
   GST_LOG_OBJECT (resample, "transforming buffer of %ld bytes, ts %"
       GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", offset %"
       G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
-      size, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (inbuf)),
+      gst_buffer_get_size (inbuf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (inbuf)),
       GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)),
       GST_BUFFER_OFFSET (inbuf), GST_BUFFER_OFFSET_END (inbuf));
 
@@ -1361,41 +1292,6 @@ gst_audio_resample_set_property (GObject * object, guint prop_id,
           quality, resample->fp);
       GST_BASE_TRANSFORM_UNLOCK (resample);
       break;
-    case PROP_FILTER_LENGTH:{
-      gint filter_length = g_value_get_int (value);
-
-      GST_BASE_TRANSFORM_LOCK (resample);
-      if (filter_length <= 8)
-        quality = 0;
-      else if (filter_length <= 16)
-        quality = 1;
-      else if (filter_length <= 32)
-        quality = 2;
-      else if (filter_length <= 48)
-        quality = 3;
-      else if (filter_length <= 64)
-        quality = 4;
-      else if (filter_length <= 80)
-        quality = 5;
-      else if (filter_length <= 96)
-        quality = 6;
-      else if (filter_length <= 128)
-        quality = 7;
-      else if (filter_length <= 160)
-        quality = 8;
-      else if (filter_length <= 192)
-        quality = 9;
-      else
-        quality = 10;
-
-      GST_DEBUG_OBJECT (resample, "new quality %d", quality);
-
-      gst_audio_resample_update_state (resample, resample->width,
-          resample->channels, resample->inrate, resample->outrate,
-          quality, resample->fp);
-      GST_BASE_TRANSFORM_UNLOCK (resample);
-      break;
-    }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1414,43 +1310,6 @@ gst_audio_resample_get_property (GObject * object, guint prop_id,
     case PROP_QUALITY:
       g_value_set_int (value, resample->quality);
       break;
-    case PROP_FILTER_LENGTH:
-      switch (resample->quality) {
-        case 0:
-          g_value_set_int (value, 8);
-          break;
-        case 1:
-          g_value_set_int (value, 16);
-          break;
-        case 2:
-          g_value_set_int (value, 32);
-          break;
-        case 3:
-          g_value_set_int (value, 48);
-          break;
-        case 4:
-          g_value_set_int (value, 64);
-          break;
-        case 5:
-          g_value_set_int (value, 80);
-          break;
-        case 6:
-          g_value_set_int (value, 96);
-          break;
-        case 7:
-          g_value_set_int (value, 128);
-          break;
-        case 8:
-          g_value_set_int (value, 160);
-          break;
-        case 9:
-          g_value_set_int (value, 192);
-          break;
-        case 10:
-          g_value_set_int (value, 256);
-          break;
-      }
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index f5f7464..da75b64 100644 (file)
@@ -53,9 +53,6 @@ struct _GstAudioResample {
   GstBaseTransform element;
 
   /* <private> */
-
-  GstCaps *srccaps, *sinkcaps;
-
   gboolean need_discont;
 
   GstClockTime t0;
@@ -67,12 +64,18 @@ struct _GstAudioResample {
   guint64 num_gap_samples;
   guint64 num_nongap_samples;
 
+  GstAudioInfo in;
+  GstAudioInfo out;
+
+  /* properties */
+  gint quality;
+
+  /* state */
+  gboolean fp;
+  gint width;
   gint channels;
   gint inrate;
   gint outrate;
-  gint quality;
-  gint width;
-  gboolean fp;
 
   guint8 *tmp_in;
   guint tmp_in_size;
index 7cc04d6..66c2c6d 100644 (file)
@@ -456,7 +456,7 @@ resampler_basic_direct_single (SpeexResamplerState * st,
     const spx_word16_t *iptr = &in[last_sample];
 
     SSE_FALLBACK (INNER_PRODUCT_SINGLE)
-    sum = 0;
+        sum = 0;
     for (j = 0; j < N; j++)
       sum += MULT16_16 (sinc[j], iptr[j]);
 
@@ -474,11 +474,10 @@ resampler_basic_direct_single (SpeexResamplerState * st,
 */
 #ifdef OVERRIDE_INNER_PRODUCT_SINGLE
     SSE_IMPLEMENTATION (INNER_PRODUCT_SINGLE)
-    sum = inner_product_single (sinc, iptr, N);
-    SSE_END(INNER_PRODUCT_SINGLE)
+        sum = inner_product_single (sinc, iptr, N);
+    SSE_END (INNER_PRODUCT_SINGLE)
 #endif
-
-    out[out_stride * out_sample++] = SATURATE32 (PSHR32 (sum, 15), 32767);
+        out[out_stride * out_sample++] = SATURATE32 (PSHR32 (sum, 15), 32767);
     last_sample += int_advance;
     samp_frac_num += frac_advance;
     if (samp_frac_num >= den_rate) {
@@ -530,11 +529,10 @@ resampler_basic_direct_double (SpeexResamplerState * st,
     sum = accum[0] + accum[1] + accum[2] + accum[3];
 #ifdef OVERRIDE_INNER_PRODUCT_DOUBLE
     SSE2_IMPLEMENTATION (INNER_PRODUCT_DOUBLE)
-    sum = inner_product_double (sinc, iptr, N);
+        sum = inner_product_double (sinc, iptr, N);
     SSE2_END (INNER_PRODUCT_DOUBLE)
 #endif
-
-    out[out_stride * out_sample++] = PSHR32 (sum, 15);
+        out[out_stride * out_sample++] = PSHR32 (sum, 15);
     last_sample += int_advance;
     samp_frac_num += frac_advance;
     if (samp_frac_num >= den_rate) {
@@ -610,15 +608,14 @@ resampler_basic_interpolate_single (SpeexResamplerState * st,
             1)) + MULT16_32_Q15 (interp[3], SHR32 (accum[3], 1));
 #ifdef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
     SSE_IMPLEMENTATION (INTERPOLATE_PRODUCT_SINGLE)
-    cubic_coef (frac, interp);
+        cubic_coef (frac, interp);
     sum =
         interpolate_product_single (iptr,
         st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample,
         interp);
     SSE_END (INTERPOLATE_PRODUCT_SINGLE)
 #endif
-
-    out[out_stride * out_sample++] = SATURATE32 (PSHR32 (sum, 14), 32767);
+        out[out_stride * out_sample++] = SATURATE32 (PSHR32 (sum, 14), 32767);
     last_sample += int_advance;
     samp_frac_num += frac_advance;
     if (samp_frac_num >= den_rate) {
@@ -701,15 +698,14 @@ resampler_basic_interpolate_double (SpeexResamplerState * st,
         accum[2]) + MULT16_32_Q15 (interp[3], accum[3]);
 #ifdef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
     SSE2_IMPLEMENTATION (INTERPOLATE_PRODUCT_DOUBLE)
-    cubic_coef (frac, interp);
+        cubic_coef (frac, interp);
     sum =
         interpolate_product_double (iptr,
         st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample,
         interp);
     SSE2_END (INTERPOLATE_PRODUCT_DOUBLE)
 #endif
-
-    out[out_stride * out_sample++] = PSHR32 (sum, 15);
+        out[out_stride * out_sample++] = PSHR32 (sum, 15);
     last_sample += int_advance;
     samp_frac_num += frac_advance;
     if (samp_frac_num >= den_rate) {
index 67a2c0b..c00f9ff 100644 (file)
@@ -1,9 +1,11 @@
 plugin_LTLIBRARIES = libgstaudiotestsrc.la
 
 libgstaudiotestsrc_la_SOURCES = gstaudiotestsrc.c
-libgstaudiotestsrc_la_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS)
+libgstaudiotestsrc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS)
 libgstaudiotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudiotestsrc_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(GST_CONTROLLER_LIBS) $(LIBM)
+libgstaudiotestsrc_la_LIBADD = \
+       $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
+       $(GST_BASE_LIBS) $(GST_LIBS) $(GST_CONTROLLER_LIBS) $(LIBM)
 libgstaudiotestsrc_la_LIBTOOLFLAGS = --tag=disable-static
 
 noinst_HEADERS = gstaudiotestsrc.h
index 91ace92..b545787 100644 (file)
@@ -29,7 +29,7 @@
  * ]| This pipeline produces a sine with default frequency, 440 Hz, and the
  * default volume, 0.8 (relative to a maximum 1.0).
  * |[
- * gst-launch audiotestsrc wave=2 freq=200 ! audioconvert ! tee name=t ! queue ! alsasink t. ! queue ! libvisual_lv_scope ! ffmpegcolorspace ! xvimagesink
+ * gst-launch audiotestsrc wave=2 freq=200 ! audioconvert ! tee name=t ! queue ! alsasink t. ! queue ! libvisual_lv_scope ! videoconvert ! xvimagesink
  * ]| In this example a saw wave is generated. The wave is shown using a
  * scope visualizer from libvisual, allowing you to visually verify that
  * the saw wave is correct.
@@ -76,34 +76,25 @@ enum
   PROP_LAST
 };
 
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define FORMAT_STR "{ S16_LE, S32_LE, F32_LE, F64_LE }"
+#define DEFAULT_FORMAT_STR "S16_LE"
+#else
+#define FORMAT_STR "{ S16_BE, S32_BE, F32_BE, F64_BE }"
+#define DEFAULT_FORMAT_STR "S16_BE"
+#endif
 
 static GstStaticPadTemplate gst_audio_test_src_src_template =
-    GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "endianness = (int) BYTE_ORDER, "
-        "signed = (boolean) true, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, 2 ]; "
-        "audio/x-raw-int, "
-        "endianness = (int) BYTE_ORDER, "
-        "signed = (boolean) true, "
-        "width = (int) 32, "
-        "depth = (int) 32,"
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, 2 ]; "
-        "audio/x-raw-float, "
-        "endianness = (int) BYTE_ORDER, "
-        "width = (int) { 32, 64 }, "
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " FORMAT_STR ", "
         "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
     );
 
-
-GST_BOILERPLATE (GstAudioTestSrc, gst_audio_test_src, GstBaseSrc,
-    GST_TYPE_BASE_SRC);
+#define gst_audio_test_src_parent_class parent_class
+G_DEFINE_TYPE (GstAudioTestSrc, gst_audio_test_src, GST_TYPE_BASE_SRC);
 
 #define GST_TYPE_AUDIO_TEST_SRC_WAVE (gst_audiostestsrc_wave_get_type())
 static GType
@@ -144,10 +135,9 @@ static void gst_audio_test_src_get_property (GObject * object,
 
 static gboolean gst_audio_test_src_setcaps (GstBaseSrc * basesrc,
     GstCaps * caps);
-static void gst_audio_test_src_src_fixate (GstPad * pad, GstCaps * caps);
+static void gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
 
 static gboolean gst_audio_test_src_is_seekable (GstBaseSrc * basesrc);
-static gboolean gst_audio_test_src_check_get_range (GstBaseSrc * basesrc);
 static gboolean gst_audio_test_src_do_seek (GstBaseSrc * basesrc,
     GstSegment * segment);
 static gboolean gst_audio_test_src_query (GstBaseSrc * basesrc,
@@ -162,27 +152,15 @@ static gboolean gst_audio_test_src_stop (GstBaseSrc * basesrc);
 static GstFlowReturn gst_audio_test_src_create (GstBaseSrc * basesrc,
     guint64 offset, guint length, GstBuffer ** buffer);
 
-
-static void
-gst_audio_test_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_audio_test_src_src_template));
-  gst_element_class_set_details_simple (element_class,
-      "Audio test source", "Source/Audio",
-      "Creates audio test signals of given frequency and volume",
-      "Stefan Kost <ensonic@users.sf.net>");
-}
-
 static void
 gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   GstBaseSrcClass *gstbasesrc_class;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
 
   gobject_class->set_property = gst_audio_test_src_set_property;
@@ -225,11 +203,17 @@ gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
           "Can activate in pull mode", DEFAULT_CAN_ACTIVATE_PULL,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_audio_test_src_src_template));
+  gst_element_class_set_details_simple (gstelement_class,
+      "Audio test source", "Source/Audio",
+      "Creates audio test signals of given frequency and volume",
+      "Stefan Kost <ensonic@users.sf.net>");
+
   gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_test_src_setcaps);
+  gstbasesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_audio_test_src_fixate);
   gstbasesrc_class->is_seekable =
       GST_DEBUG_FUNCPTR (gst_audio_test_src_is_seekable);
-  gstbasesrc_class->check_get_range =
-      GST_DEBUG_FUNCPTR (gst_audio_test_src_check_get_range);
   gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_audio_test_src_do_seek);
   gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_audio_test_src_query);
   gstbasesrc_class->get_times =
@@ -240,15 +224,8 @@ gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
 }
 
 static void
-gst_audio_test_src_init (GstAudioTestSrc * src, GstAudioTestSrcClass * g_class)
+gst_audio_test_src_init (GstAudioTestSrc * src)
 {
-  GstPad *pad = GST_BASE_SRC_PAD (src);
-
-  gst_pad_set_fixatecaps_function (pad, gst_audio_test_src_src_fixate);
-
-  src->samplerate = 44100;
-  src->format = GST_AUDIO_TEST_SRC_FORMAT_NONE;
-
   src->volume = DEFAULT_VOLUME;
   src->freq = DEFAULT_FREQ;
 
@@ -280,79 +257,49 @@ gst_audio_test_src_finalize (GObject * object)
 }
 
 static void
-gst_audio_test_src_src_fixate (GstPad * pad, GstCaps * caps)
+gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 {
-  GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (GST_PAD_PARENT (pad));
-  const gchar *name;
+  GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (bsrc);
   GstStructure *structure;
 
   structure = gst_caps_get_structure (caps, 0);
 
-  GST_DEBUG_OBJECT (src, "fixating samplerate to %d", src->samplerate);
+  GST_DEBUG_OBJECT (src, "fixating samplerate to %d", GST_AUDIO_DEF_RATE);
 
-  gst_structure_fixate_field_nearest_int (structure, "rate", src->samplerate);
+  gst_structure_fixate_field_nearest_int (structure, "rate",
+      GST_AUDIO_DEF_RATE);
 
-  name = gst_structure_get_name (structure);
-  if (strcmp (name, "audio/x-raw-int") == 0)
-    gst_structure_fixate_field_nearest_int (structure, "width", 32);
-  else if (strcmp (name, "audio/x-raw-float") == 0)
-    gst_structure_fixate_field_nearest_int (structure, "width", 64);
+  gst_structure_fixate_field_string (structure, "format", DEFAULT_FORMAT_STR);
 
   /* fixate to mono unless downstream requires stereo, for backwards compat */
   gst_structure_fixate_field_nearest_int (structure, "channels", 1);
+
+  GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 }
 
 static gboolean
 gst_audio_test_src_setcaps (GstBaseSrc * basesrc, GstCaps * caps)
 {
   GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (basesrc);
-  const GstStructure *structure;
-  const gchar *name;
-  gint width;
-  gboolean ret;
+  GstAudioInfo info;
 
-  structure = gst_caps_get_structure (caps, 0);
-  ret = gst_structure_get_int (structure, "rate", &src->samplerate);
+  if (!gst_audio_info_from_caps (&info, caps))
+    goto invalid_caps;
 
-  GST_DEBUG_OBJECT (src, "negotiated to samplerate %d", src->samplerate);
+  GST_DEBUG_OBJECT (src, "negotiated to caps %" GST_PTR_FORMAT, caps);
 
-  name = gst_structure_get_name (structure);
-  if (strcmp (name, "audio/x-raw-int") == 0) {
-    ret &= gst_structure_get_int (structure, "width", &width);
-    src->format = (width == 32) ? GST_AUDIO_TEST_SRC_FORMAT_S32 :
-        GST_AUDIO_TEST_SRC_FORMAT_S16;
-  } else {
-    ret &= gst_structure_get_int (structure, "width", &width);
-    src->format = (width == 32) ? GST_AUDIO_TEST_SRC_FORMAT_F32 :
-        GST_AUDIO_TEST_SRC_FORMAT_F64;
-  }
-
-  /* allocate a new buffer suitable for this pad */
-  switch (src->format) {
-    case GST_AUDIO_TEST_SRC_FORMAT_S16:
-      src->sample_size = sizeof (gint16);
-      break;
-    case GST_AUDIO_TEST_SRC_FORMAT_S32:
-      src->sample_size = sizeof (gint32);
-      break;
-    case GST_AUDIO_TEST_SRC_FORMAT_F32:
-      src->sample_size = sizeof (gfloat);
-      break;
-    case GST_AUDIO_TEST_SRC_FORMAT_F64:
-      src->sample_size = sizeof (gdouble);
-      break;
-    default:
-      /* can't really happen */
-      ret = FALSE;
-      break;
-  }
-
-  ret &= gst_structure_get_int (structure, "channels", &src->channels);
-  GST_DEBUG_OBJECT (src, "negotiated to %d channels", src->channels);
+  src->info = info;
 
   gst_audio_test_src_change_wave (src);
 
-  return ret;
+  return TRUE;
+
+  /* ERROR */
+invalid_caps:
+  {
+    GST_ERROR_OBJECT (basesrc, "received invalid caps");
+    return FALSE;
+  }
 }
 
 static gboolean
@@ -366,6 +313,7 @@ gst_audio_test_src_query (GstBaseSrc * basesrc, GstQuery * query)
     {
       GstFormat src_fmt, dest_fmt;
       gint64 src_val, dest_val;
+      gint rate;
 
       gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
       if (src_fmt == dest_fmt) {
@@ -373,14 +321,14 @@ gst_audio_test_src_query (GstBaseSrc * basesrc, GstQuery * query)
         goto done;
       }
 
+      rate = GST_AUDIO_INFO_RATE (&src->info);
+
       switch (src_fmt) {
         case GST_FORMAT_DEFAULT:
           switch (dest_fmt) {
             case GST_FORMAT_TIME:
               /* samples to time */
-              dest_val =
-                  gst_util_uint64_scale_int (src_val, GST_SECOND,
-                  src->samplerate);
+              dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, rate);
               break;
             default:
               goto error;
@@ -390,9 +338,7 @@ gst_audio_test_src_query (GstBaseSrc * basesrc, GstQuery * query)
           switch (dest_fmt) {
             case GST_FORMAT_DEFAULT:
               /* time to samples */
-              dest_val =
-                  gst_util_uint64_scale_int (src_val, src->samplerate,
-                  GST_SECOND);
+              dest_val = gst_util_uint64_scale_int (src_val, rate, GST_SECOND);
               break;
             default:
               goto error;
@@ -406,6 +352,14 @@ gst_audio_test_src_query (GstBaseSrc * basesrc, GstQuery * query)
       res = TRUE;
       break;
     }
+    case GST_QUERY_SCHEDULING:
+    {
+      /* if we can operate in pull mode */
+      gst_query_set_scheduling (query, src->can_activate_pull, TRUE, FALSE, 1,
+          -1, 1);
+      res = TRUE;
+      break;
+    }
     default:
       res = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
       break;
@@ -424,19 +378,20 @@ error:
 static void \
 gst_audio_test_src_create_sine_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels; \
   gdouble step, amp; \
   \
-  step = M_PI_M2 * src->freq / src->samplerate; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
+  step = M_PI_M2 * src->freq / GST_AUDIO_INFO_RATE (&src->info); \
   amp = src->volume * scale; \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
     src->accumulator += step; \
     if (src->accumulator >= M_PI_M2) \
       src->accumulator -= M_PI_M2; \
     \
-    for (c = 0; c < src->channels; ++c) { \
+    for (c = 0; c < channels; ++c) { \
       samples[i++] = (g##type) (sin (src->accumulator) * amp); \
     } \
   } \
@@ -458,19 +413,20 @@ static const ProcessFunc sine_funcs[] = {
 static void \
 gst_audio_test_src_create_square_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels; \
   gdouble step, amp; \
   \
-  step = M_PI_M2 * src->freq / src->samplerate; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
+  step = M_PI_M2 * src->freq / GST_AUDIO_INFO_RATE (&src->info); \
   amp = src->volume * scale; \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
     src->accumulator += step; \
     if (src->accumulator >= M_PI_M2) \
       src->accumulator -= M_PI_M2; \
     \
-    for (c = 0; c < src->channels; ++c) { \
+    for (c = 0; c < channels; ++c) { \
       samples[i++] = (g##type) ((src->accumulator < G_PI) ? amp : -amp); \
     } \
   } \
@@ -492,23 +448,24 @@ static const ProcessFunc square_funcs[] = {
 static void \
 gst_audio_test_src_create_saw_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels; \
   gdouble step, amp; \
   \
-  step = M_PI_M2 * src->freq / src->samplerate; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
+  step = M_PI_M2 * src->freq / GST_AUDIO_INFO_RATE (&src->info); \
   amp = (src->volume * scale) / G_PI; \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
     src->accumulator += step; \
     if (src->accumulator >= M_PI_M2) \
       src->accumulator -= M_PI_M2; \
     \
     if (src->accumulator < G_PI) { \
-      for (c = 0; c < src->channels; ++c) \
+      for (c = 0; c < channels; ++c) \
         samples[i++] = (g##type) (src->accumulator * amp); \
     } else { \
-      for (c = 0; c < src->channels; ++c) \
+      for (c = 0; c < channels; ++c) \
         samples[i++] = (g##type) ((M_PI_M2 - src->accumulator) * -amp); \
     } \
   } \
@@ -530,26 +487,27 @@ static const ProcessFunc saw_funcs[] = {
 static void \
 gst_audio_test_src_create_triangle_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels; \
   gdouble step, amp; \
   \
-  step = M_PI_M2 * src->freq / src->samplerate; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
+  step = M_PI_M2 * src->freq / GST_AUDIO_INFO_RATE (&src->info); \
   amp = (src->volume * scale) / G_PI_2; \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
     src->accumulator += step; \
     if (src->accumulator >= M_PI_M2) \
       src->accumulator -= M_PI_M2; \
     \
     if (src->accumulator < (G_PI_2)) { \
-      for (c = 0; c < src->channels; ++c) \
+      for (c = 0; c < channels; ++c) \
         samples[i++] = (g##type) (src->accumulator * amp); \
     } else if (src->accumulator < (G_PI * 1.5)) { \
-      for (c = 0; c < src->channels; ++c) \
+      for (c = 0; c < channels; ++c) \
         samples[i++] = (g##type) ((src->accumulator - G_PI) * -amp); \
     } else { \
-      for (c = 0; c < src->channels; ++c) \
+      for (c = 0; c < channels; ++c) \
         samples[i++] = (g##type) ((M_PI_M2 - src->accumulator) * -amp); \
     } \
   } \
@@ -571,7 +529,7 @@ static const ProcessFunc triangle_funcs[] = {
 static void \
 gst_audio_test_src_create_silence_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  memset (samples, 0, src->generate_samples_per_buffer * sizeof (g##type) * src->channels); \
+  memset (samples, 0, src->generate_samples_per_buffer * sizeof (g##type) * src->info.channels); \
 }
 
 DEFINE_SILENCE (int16);
@@ -592,10 +550,11 @@ gst_audio_test_src_create_white_noise_##type (GstAudioTestSrc * src, g##type * s
 { \
   gint i, c; \
   gdouble amp = (src->volume * scale); \
+  gint channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
-    for (c = 0; c < src->channels; ++c) \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
+    for (c = 0; c < channels; ++c) \
       samples[i++] = (g##type) (amp * g_rand_double_range (src->gen, -1.0, 1.0)); \
   } \
 }
@@ -683,14 +642,15 @@ gst_audio_test_src_generate_pink_noise_value (GstAudioTestSrc * src)
 static void \
 gst_audio_test_src_create_pink_noise_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels; \
   gdouble amp; \
   \
   amp = src->volume * scale; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
-    for (c = 0; c < src->channels; ++c) { \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
+    for (c = 0; c < channels; ++c) { \
       samples[i++] = \
         (g##type) (gst_audio_test_src_generate_pink_noise_value (src) * \
         amp); \
@@ -728,19 +688,20 @@ gst_audio_test_src_init_sine_table (GstAudioTestSrc * src)
 static void \
 gst_audio_test_src_create_sine_table_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels; \
   gdouble step, scl; \
   \
-  step = M_PI_M2 * src->freq / src->samplerate; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
+  step = M_PI_M2 * src->freq / GST_AUDIO_INFO_RATE (&src->info); \
   scl = 1024.0 / M_PI_M2; \
   \
   i = 0; \
-  while (i < (src->generate_samples_per_buffer * src->channels)) { \
+  while (i < (src->generate_samples_per_buffer * channels)) { \
     src->accumulator += step; \
     if (src->accumulator >= M_PI_M2) \
       src->accumulator -= M_PI_M2; \
     \
-    for (c = 0; c < src->channels; ++c) \
+    for (c = 0; c < channels; ++c) \
       samples[i++] = (g##type) scale * src->wave_table[(gint) (src->accumulator * scl)]; \
   } \
 }
@@ -761,10 +722,12 @@ static const ProcessFunc sine_table_funcs[] = {
 static void \
 gst_audio_test_src_create_tick_##type (GstAudioTestSrc * src, g##type * samples) \
 { \
-  gint i, c; \
+  gint i, c, channels, samplerate; \
   gdouble step, scl; \
   \
-  step = M_PI_M2 * src->freq / src->samplerate; \
+  channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
+  samplerate = GST_AUDIO_INFO_RATE (&src->info); \
+  step = M_PI_M2 * src->freq / samplerate; \
   scl = 1024.0 / M_PI_M2; \
   \
   for (i = 0; i < src->generate_samples_per_buffer; i++) { \
@@ -772,12 +735,12 @@ gst_audio_test_src_create_tick_##type (GstAudioTestSrc * src, g##type * samples)
     if (src->accumulator >= M_PI_M2) \
       src->accumulator -= M_PI_M2; \
     \
-    if ((src->next_sample + i)%src->samplerate < 1600) { \
-      for (c = 0; c < src->channels; ++c) \
-        samples[(i * src->channels) + c] = (g##type) scale * src->wave_table[(gint) (src->accumulator * scl)]; \
+    if ((src->next_sample + i)%samplerate < 1600) { \
+      for (c = 0; c < channels; ++c) \
+        samples[(i * channels) + c] = (g##type) scale * src->wave_table[(gint) (src->accumulator * scl)]; \
     } else { \
-      for (c = 0; c < src->channels; ++c) \
-        samples[(i * src->channels) + c] = 0; \
+      for (c = 0; c < channels; ++c) \
+        samples[(i * channels) + c] = 0; \
     } \
   } \
 }
@@ -806,14 +769,15 @@ gst_audio_test_src_create_gaussian_white_noise_##type (GstAudioTestSrc * src, g#
 { \
   gint i, c; \
   gdouble amp = (src->volume * scale); \
+  gint channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
   \
-  for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
-    for (c = 0; c < src->channels; ++c) { \
+  for (i = 0; i < src->generate_samples_per_buffer * channels; ) { \
+    for (c = 0; c < channels; ++c) { \
       gdouble mag = sqrt (-2 * log (1.0 - g_rand_double (src->gen))); \
       gdouble phs = g_rand_double_range (src->gen, 0.0, M_PI_M2); \
       \
       samples[i++] = (g##type) (amp * mag * cos (phs)); \
-      if (++c >= src->channels) \
+      if (++c >= channels) \
         break; \
       samples[i++] = (g##type) (amp * mag * sin (phs)); \
     } \
@@ -846,9 +810,10 @@ gst_audio_test_src_create_red_noise_##type (GstAudioTestSrc * src, g##type * sam
   gint i, c; \
   gdouble amp = (src->volume * scale); \
   gdouble state = src->red.state; \
+  gint channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
   \
-  for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
-    for (c = 0; c < src->channels; ++c) { \
+  for (i = 0; i < src->generate_samples_per_buffer * channels; ) { \
+    for (c = 0; c < channels; ++c) { \
       while (TRUE) { \
         gdouble  r = g_rand_double_range (src->gen, -1.0, 1.0); \
         state += r; \
@@ -881,10 +846,11 @@ gst_audio_test_src_create_blue_noise_##type (GstAudioTestSrc * src, g##type * sa
 { \
   gint i, c; \
   static gdouble flip=1.0; \
+  gint channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
   \
   gst_audio_test_src_create_pink_noise_##type (src, samples); \
-  for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
-    for (c = 0; c < src->channels; ++c) { \
+  for (i = 0; i < src->generate_samples_per_buffer * channels; ) { \
+    for (c = 0; c < channels; ++c) { \
       samples[i++] *= flip; \
     } \
     flip *= -1.0; \
@@ -912,10 +878,11 @@ gst_audio_test_src_create_violet_noise_##type (GstAudioTestSrc * src, g##type *
 { \
   gint i, c; \
   static gdouble flip=1.0; \
+  gint channels = GST_AUDIO_INFO_CHANNELS (&src->info); \
   \
   gst_audio_test_src_create_red_noise_##type (src, samples); \
-  for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
-    for (c = 0; c < src->channels; ++c) { \
+  for (i = 0; i < src->generate_samples_per_buffer * channels; ) { \
+    for (c = 0; c < channels; ++c) { \
       samples[i++] *= flip; \
     } \
     flip *= -1.0; \
@@ -942,68 +909,83 @@ static const ProcessFunc violet_noise_funcs[] = {
 static void
 gst_audio_test_src_change_wave (GstAudioTestSrc * src)
 {
-  if (src->format == -1) {
-    src->process = NULL;
-    return;
+  gint idx;
+
+  switch (GST_AUDIO_FORMAT_INFO_FORMAT (src->info.finfo)) {
+    case GST_AUDIO_FORMAT_S16:
+      idx = 0;
+      break;
+    case GST_AUDIO_FORMAT_S32:
+      idx = 1;
+      break;
+    case GST_AUDIO_FORMAT_F32:
+      idx = 2;
+      break;
+    case GST_AUDIO_FORMAT_F64:
+      idx = 3;
+      break;
+    default:
+      src->process = NULL;
+      return;
   }
 
   switch (src->wave) {
     case GST_AUDIO_TEST_SRC_WAVE_SINE:
-      src->process = sine_funcs[src->format];
+      src->process = sine_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_SQUARE:
-      src->process = square_funcs[src->format];
+      src->process = square_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_SAW:
-      src->process = saw_funcs[src->format];
+      src->process = saw_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_TRIANGLE:
-      src->process = triangle_funcs[src->format];
+      src->process = triangle_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_SILENCE:
-      src->process = silence_funcs[src->format];
+      src->process = silence_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE:
       if (!(src->gen))
         src->gen = g_rand_new ();
-      src->process = white_noise_funcs[src->format];
+      src->process = white_noise_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE:
       if (!(src->gen))
         src->gen = g_rand_new ();
       gst_audio_test_src_init_pink_noise (src);
-      src->process = pink_noise_funcs[src->format];
+      src->process = pink_noise_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_SINE_TAB:
       gst_audio_test_src_init_sine_table (src);
-      src->process = sine_table_funcs[src->format];
+      src->process = sine_table_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_TICKS:
       gst_audio_test_src_init_sine_table (src);
-      src->process = tick_funcs[src->format];
+      src->process = tick_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE:
       if (!(src->gen))
         src->gen = g_rand_new ();
-      src->process = gaussian_white_noise_funcs[src->format];
+      src->process = gaussian_white_noise_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_RED_NOISE:
       if (!(src->gen))
         src->gen = g_rand_new ();
       src->red.state = 0.0;
-      src->process = red_noise_funcs[src->format];
+      src->process = red_noise_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_BLUE_NOISE:
       if (!(src->gen))
         src->gen = g_rand_new ();
       gst_audio_test_src_init_pink_noise (src);
-      src->process = blue_noise_funcs[src->format];
+      src->process = blue_noise_funcs[idx];
       break;
     case GST_AUDIO_TEST_SRC_WAVE_VIOLET_NOISE:
       if (!(src->gen))
         src->gen = g_rand_new ();
       src->red.state = 0.0;
-      src->process = violet_noise_funcs[src->format];
+      src->process = violet_noise_funcs[idx];
     default:
       GST_ERROR ("invalid wave-form");
       break;
@@ -1078,18 +1060,24 @@ gst_audio_test_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment)
 {
   GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (basesrc);
   GstClockTime time;
+  gint samplerate, bpf;
 
   GST_DEBUG_OBJECT (src, "seeking %" GST_SEGMENT_FORMAT, segment);
 
-  time = segment->last_stop;
+  time = segment->position;
   src->reverse = (segment->rate < 0.0);
 
+  samplerate = GST_AUDIO_INFO_RATE (&src->info);
+  bpf = GST_AUDIO_INFO_BPF (&src->info);
+
   /* now move to the time indicated */
-  src->next_sample =
-      gst_util_uint64_scale_int (time, src->samplerate, GST_SECOND);
-  src->next_byte = src->next_sample * src->sample_size * src->channels;
-  src->next_time =
-      gst_util_uint64_scale_int (src->next_sample, GST_SECOND, src->samplerate);
+  src->next_sample = gst_util_uint64_scale_int (time, samplerate, GST_SECOND);
+  src->next_byte = src->next_sample * bpf;
+  if (samplerate == 0)
+    src->next_time = 0;
+  else
+    src->next_time =
+        gst_util_uint64_scale_int (src->next_sample, GST_SECOND, samplerate);
 
   GST_DEBUG_OBJECT (src, "seeking next_sample=%" G_GINT64_FORMAT
       " next_time=%" GST_TIME_FORMAT, src->next_sample,
@@ -1109,8 +1097,7 @@ gst_audio_test_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment)
 
   if (GST_CLOCK_TIME_IS_VALID (segment->stop)) {
     time = segment->stop;
-    src->sample_stop = gst_util_uint64_scale_int (time, src->samplerate,
-        GST_SECOND);
+    src->sample_stop = gst_util_uint64_scale_int (time, samplerate, GST_SECOND);
     src->check_seek_stop = TRUE;
   } else {
     src->check_seek_stop = FALSE;
@@ -1127,28 +1114,18 @@ gst_audio_test_src_is_seekable (GstBaseSrc * basesrc)
   return TRUE;
 }
 
-static gboolean
-gst_audio_test_src_check_get_range (GstBaseSrc * basesrc)
-{
-  GstAudioTestSrc *src;
-
-  src = GST_AUDIO_TEST_SRC (basesrc);
-
-  /* if we can operate in pull mode */
-  return src->can_activate_pull;
-}
-
 static GstFlowReturn
 gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
     guint length, GstBuffer ** buffer)
 {
-  GstFlowReturn res;
   GstAudioTestSrc *src;
   GstBuffer *buf;
   GstClockTime next_time;
   gint64 next_sample, next_byte;
   gint bytes, samples;
   GstElementClass *eclass;
+  guint8 *data;
+  gint samplerate, bpf;
 
   src = GST_AUDIO_TEST_SRC (basesrc);
 
@@ -1173,12 +1150,15 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
     return GST_FLOW_UNEXPECTED;
   }
 
+  samplerate = GST_AUDIO_INFO_RATE (&src->info);
+  bpf = GST_AUDIO_INFO_BPF (&src->info);
+
   /* if no length was given, use our default length in samples otherwise convert
    * the length in bytes to samples. */
   if (length == -1)
     samples = src->samples_per_buffer;
   else
-    samples = length / (src->sample_size * src->channels);
+    samples = length / bpf;
 
   /* if no offset was given, use our next logical byte */
   if (offset == -1)
@@ -1188,10 +1168,9 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
   if (offset != src->next_byte) {
     GST_DEBUG_OBJECT (src, "seek to new offset %" G_GUINT64_FORMAT, offset);
     /* we have a discont in the expected sample offset, do a 'seek' */
-    src->next_sample = offset / (src->sample_size * src->channels);
+    src->next_sample = offset / bpf;
     src->next_time =
-        gst_util_uint64_scale_int (src->next_sample, GST_SECOND,
-        src->samplerate);
+        gst_util_uint64_scale_int (src->next_sample, GST_SECOND, samplerate);
     src->next_byte = offset;
   }
 
@@ -1210,18 +1189,14 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
     next_sample = src->next_sample + (src->reverse ? (-samples) : samples);
   }
 
-  bytes = src->generate_samples_per_buffer * src->sample_size * src->channels;
+  bytes = src->generate_samples_per_buffer * bpf;
 
-  if ((res = gst_pad_alloc_buffer (basesrc->srcpad, src->next_sample,
-              bytes, GST_PAD_CAPS (basesrc->srcpad), &buf)) != GST_FLOW_OK) {
-    return res;
-  }
+  buf = gst_buffer_new_and_alloc (bytes);
 
   next_byte = src->next_byte + (src->reverse ? (-bytes) : bytes);
-  next_time = gst_util_uint64_scale_int (next_sample, GST_SECOND,
-      src->samplerate);
+  next_time = gst_util_uint64_scale_int (next_sample, GST_SECOND, samplerate);
 
-  GST_LOG_OBJECT (src, "samplerate %d", src->samplerate);
+  GST_LOG_OBJECT (src, "samplerate %d", samplerate);
   GST_LOG_OBJECT (src, "next_sample %" G_GINT64_FORMAT ", ts %" GST_TIME_FORMAT,
       next_sample, GST_TIME_ARGS (next_time));
 
@@ -1245,7 +1220,9 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
       src->generate_samples_per_buffer,
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
 
-  src->process (src, GST_BUFFER_DATA (buf));
+  data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
+  src->process (src, data);
+  gst_buffer_unmap (buf, data, bytes);
 
   if (G_UNLIKELY ((src->wave == GST_AUDIO_TEST_SRC_WAVE_SILENCE)
           || (src->volume == 0.0))) {
index 529ad63..29c4285 100644 (file)
@@ -24,6 +24,8 @@
 #include <gst/gst.h>
 #include <gst/base/gstbasesrc.h>
 
+#include <gst/audio/audio.h>
+
 G_BEGIN_DECLS
 
 
@@ -86,14 +88,6 @@ typedef struct {
   gdouble    state;         /* noise state */
 } GstRedNoise;
 
-typedef enum {
-  GST_AUDIO_TEST_SRC_FORMAT_NONE = -1,
-  GST_AUDIO_TEST_SRC_FORMAT_S16 = 0,
-  GST_AUDIO_TEST_SRC_FORMAT_S32,
-  GST_AUDIO_TEST_SRC_FORMAT_F32,
-  GST_AUDIO_TEST_SRC_FORMAT_F64
-} GstAudioTestSrcFormat;
-
 typedef struct _GstAudioTestSrc GstAudioTestSrc;
 typedef struct _GstAudioTestSrcClass GstAudioTestSrcClass;
 
@@ -115,11 +109,8 @@ struct _GstAudioTestSrc {
   gdouble freq;
 
   /* audio parameters */
-  gint channels;
-  gint samplerate;
+  GstAudioInfo info;
   gint samples_per_buffer;
-  gint sample_size;
-  GstAudioTestSrcFormat format;
 
   /*< private >*/
   gboolean tags_pushed;                        /* send tags just once ? */
index e4a5833..6618751 100644 (file)
@@ -230,11 +230,8 @@ struct _StreamGroup
 #define DEFAULT_FLAGS              0
 
 #define DEFAULT_RAW_CAPS                       \
-  "video/x-raw-yuv; "                          \
-  "video/x-raw-rgb; "                          \
-  "video/x-raw-gray; "                         \
-  "audio/x-raw-int; "                          \
-  "audio/x-raw-float; "                                \
+  "video/x-raw; "                              \
+  "audio/x-raw; "                              \
   "text/plain; "                               \
   "text/x-pango-markup; "                      \
   "video/x-dvd-subpicture; "                   \
@@ -344,7 +341,7 @@ gst_encode_bin_class_init (GstEncodeBinClass * klass)
    * to %GST_STATE_PAUSED or higher.
    */
   g_object_class_install_property (gobject_klass, PROP_PROFILE,
-      gst_param_spec_mini_object ("profile", "Profile",
+      g_param_spec_object ("profile", "Profile",
           "The GstEncodingProfile to use", GST_TYPE_ENCODING_PROFILE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
@@ -421,7 +418,7 @@ gst_encode_bin_class_init (GstEncodeBinClass * klass)
 
   gstelement_klass->change_state =
       GST_DEBUG_FUNCPTR (gst_encode_bin_change_state);
-  gstelement_klass->request_new_pad_full =
+  gstelement_klass->request_new_pad =
       GST_DEBUG_FUNCPTR (gst_encode_bin_request_new_pad);
   gstelement_klass->release_pad =
       GST_DEBUG_FUNCPTR (gst_encode_bin_release_pad);
@@ -483,10 +480,8 @@ gst_encode_bin_init (GstEncodeBin * encode_bin)
       gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_PARSER,
       GST_RANK_MARGINAL);
 
-  encode_bin->raw_video_caps =
-      gst_caps_from_string ("video/x-raw-yuv;video/x-raw-rgb;video/x-raw-gray");
-  encode_bin->raw_audio_caps =
-      gst_caps_from_string ("audio/x-raw-int;audio/x-raw-float");
+  encode_bin->raw_video_caps = gst_caps_from_string ("video/x-raw");
+  encode_bin->raw_audio_caps = gst_caps_from_string ("audio/x-raw");
   /* encode_bin->raw_text_caps = */
   /*     gst_caps_from_string ("text/plain;text/x-pango-markup"); */
 
@@ -512,7 +507,7 @@ gst_encode_bin_set_property (GObject * object, guint prop_id,
   switch (prop_id) {
     case PROP_PROFILE:
       gst_encode_bin_set_profile (ebin,
-          (GstEncodingProfile *) gst_value_get_mini_object (value));
+          (GstEncodingProfile *) g_value_get_object (value));
       break;
     case PROP_QUEUE_BUFFERS_MAX:
       ebin->queue_buffers_max = g_value_get_uint (value);
@@ -546,7 +541,7 @@ gst_encode_bin_get_property (GObject * object, guint prop_id,
 
   switch (prop_id) {
     case PROP_PROFILE:
-      gst_value_set_mini_object (value, (GstMiniObject *) ebin->profile);
+      g_value_set_object (value, (GObject *) ebin->profile);
       break;
     case PROP_QUEUE_BUFFERS_MAX:
       g_value_set_uint (value, ebin->queue_buffers_max);
@@ -823,13 +818,12 @@ _create_element_and_set_preset (GstElementFactory * factory,
 {
   GstElement *res = NULL;
 
-  GST_DEBUG ("Creating element from factory %s",
-      GST_PLUGIN_FEATURE_NAME (factory));
+  GST_DEBUG ("Creating element from factory %s", GST_OBJECT_NAME (factory));
   res = gst_element_factory_create (factory, name);
   if (preset && GST_IS_PRESET (res) &&
       !gst_preset_load_preset (GST_PRESET (res), preset)) {
     GST_WARNING ("Couldn't set preset [%s] on element [%s]",
-        preset, GST_PLUGIN_FEATURE_NAME (factory));
+        preset, GST_OBJECT_NAME (factory));
     gst_object_unref (res);
     res = NULL;
   }
@@ -882,7 +876,7 @@ beach:
 
 static GstPad *
 local_element_request_pad (GstElement * element, GstPadTemplate * templ,
-    const gchar * name)
+    const gchar * name, const GstCaps * caps)
 {
   GstPad *newpad = NULL;
   GstElementClass *oclass;
@@ -890,7 +884,7 @@ local_element_request_pad (GstElement * element, GstPadTemplate * templ,
   oclass = GST_ELEMENT_GET_CLASS (element);
 
   if (oclass->request_new_pad)
-    newpad = (oclass->request_new_pad) (element, templ, name);
+    newpad = (oclass->request_new_pad) (element, templ, name, caps);
 
   if (newpad)
     gst_object_ref (newpad);
@@ -931,7 +925,7 @@ gst_element_get_pad_from_template (GstElement * element, GstPadTemplate * templ)
 /* FIXME : Improve algorithm for finding compatible muxer sink pad */
 static inline GstPad *
 get_compatible_muxer_sink_pad (GstEncodeBin * ebin, GstElement * encoder,
-    const GstCaps * sinkcaps)
+    GstCaps * sinkcaps)
 {
   GstPad *sinkpad;
   GstPadTemplate *srctempl = NULL;
@@ -949,10 +943,11 @@ get_compatible_muxer_sink_pad (GstEncodeBin * ebin, GstElement * encoder,
 
     gst_object_unref (srcpad);
     sinktempl = gst_element_get_compatible_pad_template (ebin->muxer, srctempl);
+    gst_object_unref (srctempl);
   } else {
     srctempl =
         gst_pad_template_new ("whatever", GST_PAD_SRC, GST_PAD_ALWAYS,
-        gst_caps_copy (sinkcaps));
+        sinkcaps);
     g_assert (srctempl != NULL);
     sinktempl = gst_element_get_compatible_pad_template (ebin->muxer, srctempl);
     g_object_unref (srctempl);
@@ -976,10 +971,12 @@ static gboolean
 _has_class (GstElement * element, const gchar * classname)
 {
   GstElementClass *klass;
+  const gchar *value;
 
   klass = GST_ELEMENT_GET_CLASS (element);
+  value = gst_element_class_get_metadata (klass, GST_ELEMENT_METADATA_KLASS);
 
-  return strstr (klass->details.klass, classname) != NULL;
+  return strstr (value, classname) != NULL;
 }
 
 /* FIXME : Add handling of streams that don't need encoding  */
@@ -998,8 +995,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
   /* Element we will link to the encoder */
   GstElement *last = NULL;
   GList *tmp, *tosync = NULL;
-  const GstCaps *format;
-  const GstCaps *restriction;
+  GstCaps *format, *restriction;
   const gchar *missing_element_name;
 
   format = gst_encoding_profile_get_format (sprof);
@@ -1066,8 +1062,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
    * If we have no muxer or
    * if the muxer isn't a formatter and doesn't implement the tagsetter interface
    */
-  if (!ebin->muxer
-      || (!gst_element_implements_interface (ebin->muxer, GST_TYPE_TAG_SETTER)
+  if (!ebin->muxer || (!GST_IS_TAG_SETTER (ebin->muxer)
           || !_has_class (ebin->muxer, "Formatter"))) {
     sgroup->formatter = _get_formatter (ebin, sprof);
     if (sgroup->formatter) {
@@ -1190,7 +1185,8 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
 
   /* Path 1 : Already-encoded data */
   sinkpad =
-      local_element_request_pad (sgroup->combiner, NULL, "passthroughsink");
+      local_element_request_pad (sgroup->combiner, NULL, "passthroughsink",
+      NULL);
   if (G_UNLIKELY (sinkpad == NULL))
     goto no_combiner_sinkpad;
 
@@ -1202,7 +1198,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
 
     /* Check if stream format is compatible */
     srcpad = gst_element_get_static_pad (sgroup->smartencoder, "src");
-    tmpcaps = gst_pad_get_caps (srcpad);
+    tmpcaps = gst_pad_get_caps (srcpad, NULL);
     if (!gst_caps_can_intersect (tmpcaps, format)) {
       GST_DEBUG ("We don't have a smart encoder for the stream format");
       gst_object_unref (sgroup->smartencoder);
@@ -1217,7 +1213,9 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
     g_object_unref (srcpad);
   }
 
-  srcpad = local_element_request_pad (sgroup->splitter, NULL, "passthroughsrc");
+  srcpad =
+      local_element_request_pad (sgroup->splitter, NULL, "passthroughsrc",
+      NULL);
   if (G_UNLIKELY (srcpad == NULL))
     goto no_splitter_srcpad;
 
@@ -1236,7 +1234,8 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
   gst_bin_add ((GstBin *) ebin, sgroup->encoder);
   tosync = g_list_append (tosync, sgroup->encoder);
 
-  sinkpad = local_element_request_pad (sgroup->combiner, NULL, "encodingsink");
+  sinkpad =
+      local_element_request_pad (sgroup->combiner, NULL, "encodingsink", NULL);
   if (G_UNLIKELY (sinkpad == NULL))
     goto no_combiner_sinkpad;
   srcpad = gst_element_get_static_pad (sgroup->encoder, "src");
@@ -1269,7 +1268,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
     GST_LOG ("Adding conversion elements for video stream");
 
     if (!native_video) {
-      cspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
+      cspace = gst_element_factory_make ("videoconvert", NULL);
       scale = gst_element_factory_make ("videoscale", NULL);
       if (!scale) {
         missing_element_name = "videoscale";
@@ -1277,10 +1276,10 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
       }
       /* 4-tap scaling and black borders */
       g_object_set (scale, "method", 2, "add-borders", TRUE, NULL);
-      cspace2 = gst_element_factory_make ("ffmpegcolorspace", NULL);
+      cspace2 = gst_element_factory_make ("videoconvert", NULL);
 
       if (!cspace || !cspace2) {
-        missing_element_name = "ffmpegcolorspace";
+        missing_element_name = "videoconvert";
         goto missing_element;
       }
 
@@ -1368,7 +1367,8 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
 
   /* Link to stream splitter */
   sinkpad = gst_element_get_static_pad (last, "sink");
-  srcpad = local_element_request_pad (sgroup->splitter, NULL, "encodingsrc");
+  srcpad =
+      local_element_request_pad (sgroup->splitter, NULL, "encodingsrc", NULL);
   if (G_UNLIKELY (srcpad == NULL))
     goto no_splitter_srcpad;
   if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
@@ -1395,6 +1395,11 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
 
   ebin->streams = g_list_prepend (ebin->streams, sgroup);
 
+  if (format)
+    gst_caps_unref (format);
+  if (restriction)
+    gst_caps_unref (restriction);
+
   return sgroup;
 
 splitter_encoding_failure:
@@ -1474,6 +1479,10 @@ converter_link_failure:
 
 cleanup:
   /* FIXME : Actually properly cleanup everything */
+  if (format)
+    gst_caps_unref (format);
+  if (restriction)
+    gst_caps_unref (restriction);
   g_slice_free (StreamGroup, sgroup);
   return NULL;
 }
@@ -1527,7 +1536,7 @@ _get_formatter (GstEncodeBin * ebin, GstEncodingProfile * sprof)
     formatterfact = (GstElementFactory *) tmpfmtr->data;
 
     GST_DEBUG_OBJECT (ebin, "Trying formatter %s",
-        GST_PLUGIN_FEATURE_NAME (formatterfact));
+        GST_OBJECT_NAME (formatterfact));
 
     if ((formatter =
             _create_element_and_set_preset (formatterfact, preset, NULL)))
@@ -1576,7 +1585,7 @@ _get_muxer (GstEncodeBin * ebin)
 
     muxerfact = (GstElementFactory *) tmpmux->data;
 
-    GST_DEBUG ("Trying muxer %s", GST_PLUGIN_FEATURE_NAME (muxerfact));
+    GST_DEBUG ("Trying muxer %s", GST_OBJECT_NAME (muxerfact));
 
     /* See if the muxer can sink all of our stream profile caps */
     for (tmp = profiles; tmp; tmp = tmp->next) {
@@ -1703,8 +1712,9 @@ stream_error:
 }
 
 static void
-release_pads (GstPad * pad, GstElement * elt)
+release_pads (const GValue * item, GstElement * elt)
 {
+  GstPad *pad = g_value_get_object (item);
   GstPad *peer = NULL;
 
   GST_DEBUG_OBJECT (elt, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
@@ -1720,9 +1730,6 @@ release_pads (GstPad * pad, GstElement * elt)
 
   /* Release it from the object */
   gst_element_release_request_pad (elt, pad);
-
-  /* And remove the reference added by the iterator */
-  gst_object_unref (pad);
 }
 
 static void inline
@@ -1804,7 +1811,9 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
     GstIteratorResult itret = GST_ITERATOR_OK;
 
     while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
-      itret = gst_iterator_foreach (it, (GFunc) release_pads, sgroup->combiner);
+      itret =
+          gst_iterator_foreach (it, (GstIteratorForeachFunction) release_pads,
+          sgroup->combiner);
       gst_iterator_resync (it);
     }
     gst_iterator_free (it);
@@ -1816,7 +1825,9 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
     GstIterator *it = gst_element_iterate_src_pads (sgroup->splitter);
     GstIteratorResult itret = GST_ITERATOR_OK;
     while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
-      itret = gst_iterator_foreach (it, (GFunc) release_pads, sgroup->splitter);
+      itret =
+          gst_iterator_foreach (it, (GstIteratorForeachFunction) release_pads,
+          sgroup->splitter);
       gst_iterator_resync (it);
     }
     gst_iterator_free (it);
index ed0e42b..bfd7289 100644 (file)
@@ -80,7 +80,7 @@ static gboolean setup_recoder_pipeline (GstSmartEncoder * smart_encoder);
 
 static GstFlowReturn gst_smart_encoder_chain (GstPad * pad, GstBuffer * buf);
 static gboolean smart_encoder_sink_event (GstPad * pad, GstEvent * event);
-static GstCaps *smart_encoder_sink_getcaps (GstPad * pad);
+static GstCaps *smart_encoder_sink_getcaps (GstPad * pad, GstCaps * filter);
 static GstStateChangeReturn
 gst_smart_encoder_change_state (GstElement * element,
     GstStateChange transition);
@@ -199,7 +199,7 @@ gst_smart_encoder_reencode_gop (GstSmartEncoder * smart_encoder)
   gst_pad_push_event (smart_encoder->internal_srcpad,
       gst_event_new_flush_start ());
   gst_pad_push_event (smart_encoder->internal_srcpad,
-      gst_event_new_flush_stop ());
+      gst_event_new_flush_stop (TRUE));
 
   /* push newsegment */
   GST_INFO ("Pushing newsegment %" GST_PTR_FORMAT, smart_encoder->newsegment);
@@ -242,7 +242,7 @@ gst_smart_encoder_reencode_gop (GstSmartEncoder * smart_encoder)
 static GstFlowReturn
 gst_smart_encoder_push_pending_gop (GstSmartEncoder * smart_encoder)
 {
-  gint64 cstart, cstop;
+  guint64 cstart, cstop;
   GList *tmp;
   GstFlowReturn res = GST_FLOW_OK;
 
@@ -350,28 +350,16 @@ smart_encoder_sink_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_FLUSH_STOP:
       smart_encoder_reset (smart_encoder);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      GstFormat format;
-      gdouble rate, arate;
-      gint64 start, stop, time;
-      gboolean update;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
-      GST_DEBUG_OBJECT (smart_encoder,
-          "newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
-          ", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
-          update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
-          GST_TIME_ARGS (time));
-      if (format != GST_FORMAT_TIME)
+      gst_event_copy_segment (event, smart_encoder->segment);
+
+      GST_DEBUG_OBJECT (smart_encoder, "segment: %" GST_SEGMENT_FORMAT,
+          smart_encoder->segment);
+      if (smart_encoder->segment->format != GST_FORMAT_TIME)
         GST_ERROR
             ("smart_encoder can not handle streams not specified in GST_FORMAT_TIME");
 
-      /* now configure the values */
-      gst_segment_set_newsegment_full (smart_encoder->segment, update,
-          rate, arate, format, start, stop, time);
-
       /* And keep a copy for further usage */
       if (smart_encoder->newsegment)
         gst_event_unref (smart_encoder->newsegment);
@@ -393,25 +381,24 @@ smart_encoder_sink_event (GstPad * pad, GstEvent * event)
 }
 
 static GstCaps *
-smart_encoder_sink_getcaps (GstPad * pad)
+smart_encoder_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstCaps *peer, *tmpl, *res;
   GstSmartEncoder *smart_encoder = GST_SMART_ENCODER (gst_pad_get_parent (pad));
 
-  /* Try getting it from downstream */
-  peer = gst_pad_peer_get_caps_reffed (smart_encoder->srcpad);
-
   /* Use computed caps */
   if (smart_encoder->available_caps)
     tmpl = gst_caps_ref (smart_encoder->available_caps);
   else
     tmpl = gst_static_pad_template_get_caps (&src_template);
 
+  /* Try getting it from downstream */
+  peer = gst_pad_peer_get_caps (smart_encoder->srcpad, tmpl);
+
   if (peer == NULL) {
     res = tmpl;
   } else {
-    res = gst_caps_intersect (peer, tmpl);
-    gst_caps_unref (peer);
+    res = peer;
     gst_caps_unref (tmpl);
   }
 
@@ -510,6 +497,7 @@ static gboolean
 setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
 {
   GstPad *tmppad;
+  GstCaps *caps;
 
   /* Fast path */
   if (G_UNLIKELY (smart_encoder->encoder))
@@ -518,14 +506,18 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
   GST_DEBUG ("Creating internal decoder and encoder");
 
   /* Create decoder/encoder */
-  smart_encoder->decoder = get_decoder (GST_PAD_CAPS (smart_encoder->sinkpad));
+  caps = gst_pad_get_current_caps (smart_encoder->sinkpad);
+  smart_encoder->decoder = get_decoder (caps);
   if (G_UNLIKELY (smart_encoder->decoder == NULL))
     goto no_decoder;
+  gst_caps_unref (caps);
   gst_element_set_bus (smart_encoder->decoder, GST_ELEMENT_BUS (smart_encoder));
 
-  smart_encoder->encoder = get_encoder (GST_PAD_CAPS (smart_encoder->sinkpad));
+  caps = gst_pad_get_current_caps (smart_encoder->sinkpad);
+  smart_encoder->encoder = get_encoder (caps);
   if (G_UNLIKELY (smart_encoder->encoder == NULL))
     goto no_encoder;
+  gst_caps_unref (caps);
   gst_element_set_bus (smart_encoder->encoder, GST_ELEMENT_BUS (smart_encoder));
 
   GST_DEBUG ("Creating internal pads");
@@ -536,8 +528,6 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
   smart_encoder->internal_srcpad = gst_pad_new ("internal_src", GST_PAD_SRC);
   g_object_set_qdata ((GObject *) smart_encoder->internal_srcpad,
       INTERNAL_ELEMENT, smart_encoder);
-  gst_pad_set_caps (smart_encoder->internal_srcpad,
-      GST_PAD_CAPS (smart_encoder->sinkpad));
   gst_pad_set_active (smart_encoder->internal_srcpad, TRUE);
 
   /* Sink pad which will get the buffers from the encoder.
@@ -546,8 +536,6 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
   smart_encoder->internal_sinkpad = gst_pad_new ("internal_sink", GST_PAD_SINK);
   g_object_set_qdata ((GObject *) smart_encoder->internal_sinkpad,
       INTERNAL_ELEMENT, smart_encoder);
-  gst_pad_set_caps (smart_encoder->internal_sinkpad,
-      GST_PAD_CAPS (smart_encoder->sinkpad));
   gst_pad_set_chain_function (smart_encoder->internal_sinkpad, internal_chain);
   gst_pad_set_active (smart_encoder->internal_sinkpad, TRUE);
 
@@ -575,15 +563,15 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
 
 no_decoder:
   {
-    GST_WARNING ("Couldn't find a decoder for %" GST_PTR_FORMAT,
-        GST_PAD_CAPS (smart_encoder->sinkpad));
+    GST_WARNING ("Couldn't find a decoder for %" GST_PTR_FORMAT, caps);
+    gst_caps_unref (caps);
     return FALSE;
   }
 
 no_encoder:
   {
-    GST_WARNING ("Couldn't find an encoder for %" GST_PTR_FORMAT,
-        GST_PAD_CAPS (smart_encoder->sinkpad));
+    GST_WARNING ("Couldn't find an encoder for %" GST_PTR_FORMAT, caps);
+    gst_caps_unref (caps);
     return FALSE;
   }
 
index 72d40fe..cc74ac5 100644 (file)
@@ -44,7 +44,7 @@ G_DEFINE_TYPE (GstStreamCombiner, gst_stream_combiner, GST_TYPE_ELEMENT);
 static void gst_stream_combiner_dispose (GObject * object);
 
 static GstPad *gst_stream_combiner_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name);
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
 static void gst_stream_combiner_release_pad (GstElement * element,
     GstPad * pad);
 
@@ -122,7 +122,7 @@ gst_stream_combiner_sink_event (GstPad * pad, GstEvent * event)
       break;
   }
 
-  /* NEW_SEGMENT : lock, wait for other stream to EOS, select stream, unlock, push */
+  /* SEGMENT : lock, wait for other stream to EOS, select stream, unlock, push */
   /* EOS : lock, mark pad as unused, unlock , drop event */
   /* CUSTOM_REAL_EOS : push EOS downstream */
   /* FLUSH_START : lock, mark as flushing, unlock. if wasn't flushing forward */
@@ -132,32 +132,12 @@ gst_stream_combiner_sink_event (GstPad * pad, GstEvent * event)
 }
 
 static GstCaps *
-gst_stream_combiner_sink_getcaps (GstPad * pad)
+gst_stream_combiner_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstStreamCombiner *stream_combiner =
       (GstStreamCombiner *) GST_PAD_PARENT (pad);
 
-  return gst_pad_peer_get_caps_reffed (stream_combiner->srcpad);
-}
-
-static gboolean
-gst_stream_combiner_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
-  GstStreamCombiner *stream_combiner =
-      (GstStreamCombiner *) GST_PAD_PARENT (pad);
-  GstPad *peer;
-  gboolean res = FALSE;
-
-  GST_DEBUG_OBJECT (pad, "caps:%" GST_PTR_FORMAT, caps);
-
-  peer = gst_pad_get_peer (stream_combiner->srcpad);
-  if (peer) {
-    GST_DEBUG_OBJECT (peer, "Setting caps");
-    res = gst_pad_set_caps (peer, caps);
-    gst_object_unref (peer);
-  } else
-    GST_WARNING_OBJECT (stream_combiner, "sourcepad has no peer !");
-  return res;
+  return gst_pad_peer_get_caps (stream_combiner->srcpad, filter);
 }
 
 static gboolean
@@ -217,7 +197,7 @@ gst_stream_combiner_init (GstStreamCombiner * stream_combiner)
 
 static GstPad *
 gst_stream_combiner_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name)
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
 {
   GstStreamCombiner *stream_combiner = (GstStreamCombiner *) element;
   GstPad *sinkpad;
@@ -225,12 +205,9 @@ gst_stream_combiner_request_new_pad (GstElement * element,
   GST_DEBUG_OBJECT (element, "templ:%p, name:%s", templ, name);
 
   sinkpad = gst_pad_new_from_static_template (&sink_template, name);
-  /* FIXME : No buffer alloc for the time being, it will resort to the fallback */
-  /* gst_pad_set_bufferalloc_function (sinkpad, gst_stream_combiner_buffer_alloc); */
   gst_pad_set_chain_function (sinkpad, gst_stream_combiner_chain);
   gst_pad_set_event_function (sinkpad, gst_stream_combiner_sink_event);
   gst_pad_set_getcaps_function (sinkpad, gst_stream_combiner_sink_getcaps);
-  gst_pad_set_setcaps_function (sinkpad, gst_stream_combiner_sink_setcaps);
 
   STREAMS_LOCK (stream_combiner);
   stream_combiner->sinkpads =
index c531b4c..ff9e679 100644 (file)
@@ -43,8 +43,10 @@ G_DEFINE_TYPE (GstStreamSplitter, gst_stream_splitter, GST_TYPE_ELEMENT);
 
 static void gst_stream_splitter_dispose (GObject * object);
 
+static gboolean gst_stream_splitter_sink_setcaps (GstPad * pad, GstCaps * caps);
+
 static GstPad *gst_stream_splitter_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name);
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
 static void gst_stream_splitter_release_pad (GstElement * element,
     GstPad * pad);
 
@@ -156,6 +158,16 @@ gst_stream_splitter_sink_event (GstPad * pad, GstEvent * event)
       GST_EVENT_TYPE_NAME (event));
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      res = gst_stream_splitter_sink_setcaps (pad, caps);
+
+      store = TRUE;
+      break;
+    }
     case GST_EVENT_FLUSH_STOP:
       flushpending = TRUE;
       toall = TRUE;
@@ -242,7 +254,7 @@ beach:
 }
 
 static GstCaps *
-gst_stream_splitter_sink_getcaps (GstPad * pad)
+gst_stream_splitter_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstStreamSplitter *stream_splitter =
       (GstStreamSplitter *) GST_PAD_PARENT (pad);
@@ -256,7 +268,7 @@ gst_stream_splitter_sink_getcaps (GstPad * pad)
 
 resync:
   if (G_UNLIKELY (stream_splitter->srcpads == NULL)) {
-    res = gst_caps_new_any ();
+    res = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
     goto beach;
   }
 
@@ -269,11 +281,11 @@ resync:
 
     STREAMS_UNLOCK (stream_splitter);
     if (res) {
-      GstCaps *peercaps = gst_pad_peer_get_caps_reffed (srcpad);
+      GstCaps *peercaps = gst_pad_peer_get_caps (srcpad, filter);
       if (peercaps)
         gst_caps_merge (res, gst_caps_make_writable (peercaps));
     } else {
-      res = gst_pad_peer_get_caps (srcpad);
+      res = gst_pad_peer_get_caps (srcpad, filter);
     }
     STREAMS_LOCK (stream_splitter);
 
@@ -319,7 +331,7 @@ resync:
     GstCaps *peercaps;
 
     STREAMS_UNLOCK (stream_splitter);
-    peercaps = gst_pad_peer_get_caps_reffed (srcpad);
+    peercaps = gst_pad_peer_get_caps (srcpad, NULL);
     if (peercaps) {
       res = gst_caps_can_intersect (caps, peercaps);
       gst_caps_unref (peercaps);
@@ -381,8 +393,6 @@ gst_stream_splitter_init (GstStreamSplitter * stream_splitter)
       gst_stream_splitter_sink_event);
   gst_pad_set_getcaps_function (stream_splitter->sinkpad,
       gst_stream_splitter_sink_getcaps);
-  gst_pad_set_setcaps_function (stream_splitter->sinkpad,
-      gst_stream_splitter_sink_setcaps);
   gst_element_add_pad (GST_ELEMENT (stream_splitter), stream_splitter->sinkpad);
 
   stream_splitter->lock = g_mutex_new ();
@@ -390,7 +400,7 @@ gst_stream_splitter_init (GstStreamSplitter * stream_splitter)
 
 static GstPad *
 gst_stream_splitter_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name)
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
 {
   GstStreamSplitter *stream_splitter = (GstStreamSplitter *) element;
   GstPad *srcpad;
diff --git a/gst/ffmpegcolorspace/Makefile.am b/gst/ffmpegcolorspace/Makefile.am
deleted file mode 100644 (file)
index 2ada4c9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-plugin_LTLIBRARIES = libgstffmpegcolorspace.la
-
-libgstffmpegcolorspace_la_SOURCES = \
-       gstffmpegcolorspace.c \
-       gstffmpegcodecmap.c \
-       dsputil.c \
-       mem.c \
-       utils.c \
-       imgconvert.c
-
-libgstffmpegcolorspace_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstffmpegcolorspace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstffmpegcolorspace_la_LIBADD = \
-       $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
-       $(GST_BASE_LIBS) $(GST_LIBS)
-libgstffmpegcolorspace_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
-       gstffmpegcolorspace.h \
-       gstffmpegcodecmap.h \
-       imgconvert_template.h \
-       dsputil.h \
-       avcodec.h
-
-Android.mk: Makefile.am $(BUILT_SOURCES)
-       androgenizer \
-       -:PROJECT libgstffmpegcolorspace -:SHARED libgstffmpegcolorspace \
-        -:TAGS eng debug \
-         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-        -:SOURCES $(libgstffmpegcolorspace_la_SOURCES) \
-        -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstffmpegcolorspace_la_CFLAGS) \
-        -:LDFLAGS $(libgstffmpegcolorspace_la_LDFLAGS) \
-                  $(libgstffmpegcolorspace_la_LIBADD) \
-                  -ldl \
-        -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
-                      LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
-       > $@
diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h
deleted file mode 100644 (file)
index 57f551c..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-#ifndef AVCODEC_H
-#define AVCODEC_H
-
-/**
- * @file avcodec.h
- * external api header.
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "_stdint.h"
-
-#include <sys/types.h> /* size_t */
-
-#define FFMPEG_VERSION_INT     0x000409
-#define FFMPEG_VERSION         "0.4.9-pre1"
-#define LIBAVCODEC_BUILD       4728
-
-#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
-#define LIBAVCODEC_VERSION     FFMPEG_VERSION
-
-#define AV_STRINGIFY(s) AV_TOSTRING(s)
-#define AV_TOSTRING(s) #s
-#define LIBAVCODEC_IDENT        "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
-
-enum CodecType {
-    CODEC_TYPE_UNKNOWN = -1,
-    CODEC_TYPE_VIDEO,
-    CODEC_TYPE_AUDIO,
-    CODEC_TYPE_DATA,
-};
-
-/*
- * Pixel format. Notes: 
- *
- * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
- * color is put together as:
- *  (A << 24) | (R << 16) | (G << 8) | B
- * This is stored as BGRA on little endian CPU architectures and ARGB on
- * big endian CPUs.
- *
- * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
- * image data is stored in AVFrame.data[0]. The palette is transported in
- * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
- * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
- * also endian-specific). Note also that the individual RGB palette
- * components stored in AVFrame.data[1] should be in the range 0..255.
- * This is important as many custom PAL8 video codecs that were designed
- * to run on the IBM VGA graphics adapter use 6-bit palette components.
- */
-enum PixelFormat {
-    PIX_FMT_YUV420P,   ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) (I420)
-    PIX_FMT_NV12,      ///< Packed YUV 4:2:0 (separate Y plane, interleaved Cb & Cr planes)
-    PIX_FMT_NV21,      ///< Packed YUV 4:2:0 (separate Y plane, interleaved Cb & Cr planes)
-    PIX_FMT_YVU420P,   ///< Planar YUV 4:2:0 (1 Cb & Cr sample per 2x2 Y samples) (YV12)
-    PIX_FMT_YUV422,    ///< Packed pixel, Y0 Cb Y1 Cr 
-    PIX_FMT_RGB24,     ///< Packed pixel, 3 bytes per pixel, RGBRGB...
-    PIX_FMT_BGR24,     ///< Packed pixel, 3 bytes per pixel, BGRBGR...
-    PIX_FMT_YUV422P,   ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
-    PIX_FMT_YUV444P,   ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
-    PIX_FMT_RGBA32,    ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
-    PIX_FMT_BGRA32,    ///< Packed pixel, 4 bytes per pixel, ARGBARGB...
-    PIX_FMT_ARGB32,    ///< Packed pixel, 4 bytes per pixel, ABGRABGR..., stored in cpu endianness
-    PIX_FMT_ABGR32,    ///< Packed pixel, 4 bytes per pixel, RGBARGBA...
-    PIX_FMT_RGB32,     ///< Packed pixel, 4 bytes per pixel, BGRxBGRx..., stored in cpu endianness
-    PIX_FMT_xRGB32,    ///< Packed pixel, 4 bytes per pixel, xBGRxBGR..., stored in cpu endianness
-    PIX_FMT_BGR32,     ///< Packed pixel, 4 bytes per pixel, xRGBxRGB...
-    PIX_FMT_BGRx32,    ///< Packed pixel, 4 bytes per pixel, RGBxRGBx...
-    PIX_FMT_YUV410P,   ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
-    PIX_FMT_YVU410P,   ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
-    PIX_FMT_YUV411P,   ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
-    PIX_FMT_Y800,      ///< 8 bit Y plane (range [16-235])
-    PIX_FMT_Y16,       ///< 16 bit Y plane (little endian)
-    PIX_FMT_RGB565,    ///< always stored in cpu endianness 
-    PIX_FMT_RGB555,    ///< always stored in cpu endianness, most significant bit to 1 
-    PIX_FMT_GRAY8,
-    PIX_FMT_GRAY16_L,
-    PIX_FMT_GRAY16_B,
-    PIX_FMT_MONOWHITE, ///< 0 is white 
-    PIX_FMT_MONOBLACK, ///< 0 is black 
-    PIX_FMT_PAL8,      ///< 8 bit with RGBA palette 
-    PIX_FMT_YUVJ420P,  ///< Planar YUV 4:2:0 full scale (jpeg)
-    PIX_FMT_YUVJ422P,  ///< Planar YUV 4:2:2 full scale (jpeg)
-    PIX_FMT_YUVJ444P,  ///< Planar YUV 4:4:4 full scale (jpeg)
-    PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
-    PIX_FMT_XVMC_MPEG2_IDCT,
-    PIX_FMT_UYVY422,   ///< Packed pixel, Cb Y0 Cr Y1 
-    PIX_FMT_YVYU422,   ///< Packed pixel, Y0 Cr Y1 Cb 
-    PIX_FMT_UYVY411,   ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
-    PIX_FMT_V308,      ///< Packed pixel, Y0 Cb Cr
-
-    PIX_FMT_AYUV4444,  ///< Packed pixel, A0 Y0 Cb Cr
-    PIX_FMT_YUVA420P,   ///< Planar YUV 4:4:2:0 (1 Cr & Cb sample per 2x2 Y & A samples) (A420)
-    PIX_FMT_NB
-};
-
-/* currently unused, may be used if 24/32 bits samples ever supported */
-enum SampleFormat {
-    SAMPLE_FMT_S16 = 0,         ///< signed 16 bits
-};
-
-/* thomas: extracted from imgconvert.c since it's also used in
- * gstffmpegcodecmap.c */
-
-/* start of extract */
-
-#define FF_COLOR_RGB      0     /* RGB color space */
-#define FF_COLOR_GRAY     1     /* gray color space */
-#define FF_COLOR_YUV      2     /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
-#define FF_COLOR_YUV_JPEG 3     /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
-
-#define FF_PIXEL_PLANAR   0     /* each channel has one component in AVPicture */
-#define FF_PIXEL_PACKED   1     /* only one components containing all the channels */
-#define FF_PIXEL_PALETTE  2     /* one components containing indexes for a palette */
-
-typedef struct PixFmtInfo
-{
-  enum PixelFormat format;
-  const char *name;
-  uint8_t nb_channels;          /* number of channels (including alpha) */
-  uint8_t color_type;           /* color type (see FF_COLOR_xxx constants) */
-  uint8_t pixel_type;           /* pixel storage type (see FF_PIXEL_xxx constants) */
-  uint8_t is_alpha:1;           /* true if alpha can be specified */
-  uint8_t x_chroma_shift;       /* X chroma subsampling factor is 2 ^ shift */
-  uint8_t y_chroma_shift;       /* Y chroma subsampling factor is 2 ^ shift */
-  uint8_t depth;                /* bit depth of the color components */
-} PixFmtInfo;
-
-PixFmtInfo * get_pix_fmt_info (enum PixelFormat format);
-/* end of extract */
-
-/**
- * main external api structure.
- */
-typedef struct AVCodecContext {
-    /* video only */
-    /**
-     * frames per sec multiplied by frame_rate_base.
-     * for variable fps this is the precission, so if the timestamps 
-     * can be specified in msec precssion then this is 1000*frame_rate_base
-     * - encoding: MUST be set by user
-     * - decoding: set by lavc. 0 or the frame_rate if available
-     */
-    int frame_rate;
-    
-    /**
-     * frame_rate_base.
-     * for variable fps this is 1
-     * - encoding: set by user.
-     * - decoding: set by lavc.
-     */
-
-    int frame_rate_base;
-    /**
-     * picture width / height.
-     * - encoding: MUST be set by user. 
-     * - decoding: set by lavc.
-     * Note, for compatibility its possible to set this instead of 
-     * coded_width/height before decoding
-     */
-    int width, height;
-
-    /**
-     * pixel format, see PIX_FMT_xxx.
-     * - encoding: FIXME: used by ffmpeg to decide whether an pix_fmt
-     *                    conversion is in order. This only works for
-     *                    codecs with one supported pix_fmt, we should
-     *                    do something for a generic case as well.
-     * - decoding: set by lavc.
-     */
-    enum PixelFormat pix_fmt;
-
-    /* audio only */
-    int sample_rate; ///< samples per sec 
-    int channels;
-    int sample_fmt;  ///< sample format, currenly unused 
-
-    /**
-     * Palette control structure
-     * - encoding: ??? (no palette-enabled encoder yet)
-     * - decoding: set by user.
-     */
-    struct AVPaletteControl *palctrl;
-} AVCodecContext;
-
-/**
- * four components are given, that's all.
- * the last component is alpha
- */
-typedef struct AVPicture {
-    uint8_t *data[4];
-    int linesize[4];       ///< number of bytes per line
-    int interlaced;
-} AVPicture;
-
-/**
- * AVPaletteControl
- * This structure defines a method for communicating palette changes
- * between and demuxer and a decoder.
- */
-#define AVPALETTE_SIZE 1024
-#define AVPALETTE_COUNT 256
-typedef struct AVPaletteControl {
-
-    /* demuxer sets this to 1 to indicate the palette has changed;
-     * decoder resets to 0 */
-    int palette_changed;
-
-    /* 4-byte ARGB palette entries, stored in native byte order; note that
-     * the individual palette components should be on a 8-bit scale; if
-     * the palette data comes from a IBM VGA native format, the component
-     * data is probably 6 bits in size and needs to be scaled */
-    unsigned int palette[AVPALETTE_COUNT];
-
-} AVPaletteControl;
-
-int avpicture_get_size(int pix_fmt, int width, int height);
-
-void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
-const char *avcodec_get_pix_fmt_name(int pix_fmt);
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
-enum PixelFormat avcodec_get_pix_fmt(const char* name);
-
-#define FF_LOSS_RESOLUTION  0x0001 /* loss due to resolution change */
-#define FF_LOSS_DEPTH       0x0002 /* loss due to color depth change */
-#define FF_LOSS_COLORSPACE  0x0004 /* loss due to color space conversion */
-#define FF_LOSS_ALPHA       0x0008 /* loss of alpha bits */
-#define FF_LOSS_COLORQUANT  0x0010 /* loss due to color quantization */
-#define FF_LOSS_CHROMA      0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
-
-int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
-                             int has_alpha);
-int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
-                              int has_alpha, int *loss_ptr);
-
-#define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
-#define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
-int img_get_alpha_info(const AVPicture *src,
-                       int pix_fmt, int width, int height);
-
-/* convert among pixel formats */
-int img_convert(AVPicture *dst, int dst_pix_fmt,
-                const AVPicture *src, int pix_fmt, 
-                int width, int height);
-
-void avcodec_init(void);
-
-void avcodec_get_context_defaults(AVCodecContext *s);
-AVCodecContext *avcodec_alloc_context(void);
-
-/* memory */
-void *av_malloc(unsigned int size);
-void *av_mallocz(unsigned int size);
-void *av_realloc(void *ptr, unsigned int size);
-void av_free(void *ptr);
-char *av_strdup(const char *s);
-void av_freep(void *ptr);
-void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
-/* for static data only */
-/* call av_free_static to release all staticaly allocated tables */
-void av_free_static(void);
-void *av_mallocz_static(unsigned int size);
-
-/* endian macros */
-#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32)
-#define BE_16(x)  ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x)  ((((uint8_t*)(x))[0] << 24) | \
-                   (((uint8_t*)(x))[1] << 16) | \
-                   (((uint8_t*)(x))[2] << 8) | \
-                    ((uint8_t*)(x))[3])
-#define LE_16(x)  ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x)  ((((uint8_t*)(x))[3] << 24) | \
-                   (((uint8_t*)(x))[2] << 16) | \
-                   (((uint8_t*)(x))[1] << 8) | \
-                    ((uint8_t*)(x))[0])
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* AVCODEC_H */
diff --git a/gst/ffmpegcolorspace/dsputil.c b/gst/ffmpegcolorspace/dsputil.c
deleted file mode 100644 (file)
index f5689c0..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard.
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at>
- */
-
-/**
- * @file dsputil.c
- * DSP utils
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-uint8_t cropTbl[256 + 2 * MAX_NEG_CROP] = { 0, };
-
-/* init static data */
-void
-dsputil_static_init (void)
-{
-  int i;
-
-  for (i = 0; i < 256; i++)
-    cropTbl[i + MAX_NEG_CROP] = i;
-  for (i = 0; i < MAX_NEG_CROP; i++) {
-    cropTbl[i] = 0;
-    cropTbl[i + MAX_NEG_CROP + 256] = 255;
-  }
-}
diff --git a/gst/ffmpegcolorspace/dsputil.h b/gst/ffmpegcolorspace/dsputil.h
deleted file mode 100644 (file)
index 69475a3..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * DSP utils
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/**
- * @file dsputil.h
- * DSP utils.
- * note, many functions in here may use MMX which trashes the FPU state, it is
- * absolutely necessary to call emms_c() between dsp & float/double code
- */
-
-#ifndef DSPUTIL_H
-#define DSPUTIL_H
-
-/* pixel operations */
-#define MAX_NEG_CROP 1024
-
-/* temporary */
-extern uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
-
-void dsputil_static_init(void);
-
-#endif
diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c
deleted file mode 100644 (file)
index 318a90e..0000000
+++ /dev/null
@@ -1,1016 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * This file:
- * Copyright (c) 2002-2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/gst.h>
-
-#include "avcodec.h"
-#include "gstffmpegcodecmap.h"
-
-GST_DEBUG_CATEGORY_EXTERN (ffmpegcolorspace_debug);
-#define GST_CAT_DEFAULT ffmpegcolorspace_debug
-
-static GstCaps *
-gst_ff_vid_caps_new (AVCodecContext * context,
-    const char *mimetype, const char *fieldname, ...)
-    G_GNUC_NULL_TERMINATED;
-     static GstCaps *gst_ff_aud_caps_new (AVCodecContext * context,
-    const char *mimetype, const char *fieldname, ...) G_GNUC_NULL_TERMINATED;
-
-/*
- * Read a palette from a caps.
- */
-
-     static void
-         gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context)
-{
-  GstStructure *str = gst_caps_get_structure (caps, 0);
-  const GValue *palette_v;
-
-  /* do we have a palette? */
-  if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) {
-    const GstBuffer *palette;
-
-    palette = gst_value_get_buffer (palette_v);
-    if (palette && GST_BUFFER_SIZE (palette) >= 256 * 4) {
-      if (context->palctrl)
-        av_free (context->palctrl);
-      context->palctrl = av_malloc (sizeof (AVPaletteControl));
-      context->palctrl->palette_changed = 1;
-      memcpy (context->palctrl->palette, GST_BUFFER_DATA (palette),
-          AVPALETTE_SIZE);
-    }
-  }
-}
-
-static void
-gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context)
-{
-  if (context->palctrl) {
-    GstBuffer *palette = gst_buffer_new_and_alloc (256 * 4);
-
-    memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette,
-        AVPALETTE_SIZE);
-    gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL);
-    gst_buffer_unref (palette);
-  }
-}
-
-/* this function creates caps with fixed or unfixed width/height
- * properties depending on whether we've got a context.
- *
- * See below for why we use this.
- *
- * We should actually do this stuff at the end, like in riff-media.c,
- * but I'm too lazy today. Maybe later.
- */
-
-static GstCaps *
-gst_ff_vid_caps_new (AVCodecContext * context, const char *mimetype,
-    const char *fieldname, ...)
-{
-  GstStructure *structure = NULL;
-  GstCaps *caps = NULL;
-  va_list var_args;
-
-  if (context != NULL) {
-    caps = gst_caps_new_simple (mimetype,
-        "width", G_TYPE_INT, context->width,
-        "height", G_TYPE_INT, context->height,
-        "framerate", GST_TYPE_FRACTION,
-        (gint) context->frame_rate, (gint) context->frame_rate_base, NULL);
-  } else {
-    caps = gst_caps_new_simple (mimetype,
-        "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
-  }
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (structure) {
-    va_start (var_args, fieldname);
-    gst_structure_set_valist (structure, fieldname, var_args);
-    va_end (var_args);
-  }
-
-  return caps;
-}
-
-/* same for audio - now with channels/sample rate
- */
-
-static GstCaps *
-gst_ff_aud_caps_new (AVCodecContext * context, const char *mimetype,
-    const char *fieldname, ...)
-{
-  GstCaps *caps = NULL;
-  GstStructure *structure = NULL;
-  va_list var_args;
-
-  if (context != NULL) {
-    caps = gst_caps_new_simple (mimetype,
-        "rate", G_TYPE_INT, context->sample_rate,
-        "channels", G_TYPE_INT, context->channels, NULL);
-  } else {
-    caps = gst_caps_new_simple (mimetype, NULL);
-  }
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (structure) {
-    va_start (var_args, fieldname);
-    gst_structure_set_valist (structure, fieldname, var_args);
-    va_end (var_args);
-  }
-
-  return caps;
-}
-
-/* Convert a FFMPEG Pixel Format and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * See below for usefulness
- */
-
-static GstCaps *
-gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
-{
-  GstCaps *caps = NULL;
-
-  int bpp = 0, depth = 0, endianness = 0;
-  gulong g_mask = 0, r_mask = 0, b_mask = 0, a_mask = 0;
-  guint32 fmt = 0;
-
-  switch (pix_fmt) {
-    case PIX_FMT_YUV420P:
-      fmt = GST_MAKE_FOURCC ('I', '4', '2', '0');
-      break;
-    case PIX_FMT_YUVA420P:
-      fmt = GST_MAKE_FOURCC ('A', '4', '2', '0');
-      break;
-    case PIX_FMT_NV12:
-      fmt = GST_MAKE_FOURCC ('N', 'V', '1', '2');
-      break;
-    case PIX_FMT_NV21:
-      fmt = GST_MAKE_FOURCC ('N', 'V', '2', '1');
-      break;
-    case PIX_FMT_YVU420P:
-      fmt = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
-      break;
-    case PIX_FMT_YUV422:
-      fmt = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
-      break;
-    case PIX_FMT_UYVY422:
-      fmt = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
-      break;
-    case PIX_FMT_YVYU422:
-      fmt = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
-      break;
-    case PIX_FMT_UYVY411:
-      fmt = GST_MAKE_FOURCC ('I', 'Y', 'U', '1');
-      break;
-    case PIX_FMT_RGB24:
-      bpp = depth = 24;
-      endianness = G_BIG_ENDIAN;
-      r_mask = 0xff0000;
-      g_mask = 0x00ff00;
-      b_mask = 0x0000ff;
-      break;
-    case PIX_FMT_BGR24:
-      bpp = depth = 24;
-      endianness = G_BIG_ENDIAN;
-      r_mask = 0x0000ff;
-      g_mask = 0x00ff00;
-      b_mask = 0xff0000;
-      break;
-    case PIX_FMT_YUV422P:
-      fmt = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
-      break;
-    case PIX_FMT_YUV444P:
-      fmt = GST_MAKE_FOURCC ('Y', '4', '4', '4');
-      break;
-    case PIX_FMT_RGB32:
-      bpp = 32;
-      depth = 24;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x00ff0000;
-      g_mask = 0x0000ff00;
-      b_mask = 0x000000ff;
-#else
-      r_mask = 0x0000ff00;
-      g_mask = 0x00ff0000;
-      b_mask = 0xff000000;
-#endif
-      break;
-    case PIX_FMT_BGR32:
-      bpp = 32;
-      depth = 24;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x0000ff00;
-      g_mask = 0x00ff0000;
-      b_mask = 0xff000000;
-#else
-      r_mask = 0x00ff0000;
-      g_mask = 0x0000ff00;
-      b_mask = 0x000000ff;
-#endif
-      break;
-    case PIX_FMT_xRGB32:
-      bpp = 32;
-      depth = 24;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0xff000000;
-      g_mask = 0x00ff0000;
-      b_mask = 0x0000ff00;
-#else
-      r_mask = 0x000000ff;
-      g_mask = 0x0000ff00;
-      b_mask = 0x00ff0000;
-#endif
-      break;
-    case PIX_FMT_BGRx32:
-      bpp = 32;
-      depth = 24;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x000000ff;
-      g_mask = 0x0000ff00;
-      b_mask = 0x00ff0000;
-#else
-      r_mask = 0xff000000;
-      g_mask = 0x00ff0000;
-      b_mask = 0x0000ff00;
-#endif
-      break;
-    case PIX_FMT_RGBA32:
-      bpp = 32;
-      depth = 32;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x00ff0000;
-      g_mask = 0x0000ff00;
-      b_mask = 0x000000ff;
-      a_mask = 0xff000000;
-#else
-      r_mask = 0x0000ff00;
-      g_mask = 0x00ff0000;
-      b_mask = 0xff000000;
-      a_mask = 0x000000ff;
-#endif
-      break;
-    case PIX_FMT_BGRA32:
-      bpp = 32;
-      depth = 32;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x0000ff00;
-      g_mask = 0x00ff0000;
-      b_mask = 0xff000000;
-      a_mask = 0x000000ff;
-#else
-      r_mask = 0x00ff0000;
-      g_mask = 0x0000ff00;
-      b_mask = 0x000000ff;
-      a_mask = 0xff000000;
-#endif
-      break;
-    case PIX_FMT_ARGB32:
-      bpp = 32;
-      depth = 32;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0xff000000;
-      g_mask = 0x00ff0000;
-      b_mask = 0x0000ff00;
-      a_mask = 0x000000ff;
-#else
-      r_mask = 0x000000ff;
-      g_mask = 0x0000ff00;
-      b_mask = 0x00ff0000;
-      a_mask = 0xff000000;
-#endif
-      break;
-    case PIX_FMT_ABGR32:
-      bpp = 32;
-      depth = 32;
-      endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x000000ff;
-      g_mask = 0x0000ff00;
-      b_mask = 0x00ff0000;
-      a_mask = 0xff000000;
-#else
-      r_mask = 0xff000000;
-      g_mask = 0x00ff0000;
-      b_mask = 0x0000ff00;
-      a_mask = 0x000000ff;
-#endif
-      break;
-    case PIX_FMT_YUV410P:
-      fmt = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
-      break;
-    case PIX_FMT_YVU410P:
-      fmt = GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
-      break;
-    case PIX_FMT_YUV411P:
-      fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
-      break;
-    case PIX_FMT_Y800:{
-      GstCaps *tmp;
-
-      caps = gst_ff_vid_caps_new (context, "video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', '8', '0', '0'),
-          NULL);
-      tmp =
-          gst_ff_vid_caps_new (context, "video/x-raw-yuv", "format",
-          GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', '8', ' ', ' '), NULL);
-      gst_caps_append (caps, tmp);
-      tmp = gst_ff_vid_caps_new (context, "video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('G', 'R', 'E', 'Y'),
-          NULL);
-      gst_caps_append (caps, tmp);
-      break;
-    }
-    case PIX_FMT_Y16:
-      fmt = GST_MAKE_FOURCC ('Y', '1', '6', ' ');
-      break;
-    case PIX_FMT_RGB565:
-      bpp = depth = 16;
-      endianness = G_BYTE_ORDER;
-      r_mask = 0xf800;
-      g_mask = 0x07e0;
-      b_mask = 0x001f;
-      break;
-    case PIX_FMT_RGB555:
-      bpp = 16;
-      depth = 15;
-      endianness = G_BYTE_ORDER;
-      r_mask = 0x7c00;
-      g_mask = 0x03e0;
-      b_mask = 0x001f;
-      break;
-    case PIX_FMT_PAL8:
-      bpp = depth = 8;
-      endianness = G_BYTE_ORDER;
-      break;
-    case PIX_FMT_V308:
-      fmt = GST_MAKE_FOURCC ('v', '3', '0', '8');
-      break;
-    case PIX_FMT_AYUV4444:
-      fmt = GST_MAKE_FOURCC ('A', 'Y', 'U', 'V');
-      break;
-    case PIX_FMT_GRAY8:
-      bpp = depth = 8;
-      caps = gst_ff_vid_caps_new (context, "video/x-raw-gray",
-          "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL);
-      break;
-    case PIX_FMT_GRAY16_L:
-      bpp = depth = 16;
-      caps = gst_ff_vid_caps_new (context, "video/x-raw-gray",
-          "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth,
-          "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
-      break;
-    case PIX_FMT_GRAY16_B:
-      bpp = depth = 16;
-      caps = gst_ff_vid_caps_new (context, "video/x-raw-gray",
-          "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth,
-          "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
-      break;
-    default:
-      /* give up ... */
-      break;
-  }
-
-  if (caps == NULL) {
-    if (bpp != 0) {
-      if (a_mask != 0) {
-        caps = gst_ff_vid_caps_new (context, "video/x-raw-rgb",
-            "bpp", G_TYPE_INT, bpp,
-            "depth", G_TYPE_INT, depth,
-            "red_mask", G_TYPE_INT, r_mask,
-            "green_mask", G_TYPE_INT, g_mask,
-            "blue_mask", G_TYPE_INT, b_mask,
-            "alpha_mask", G_TYPE_INT, a_mask,
-            "endianness", G_TYPE_INT, endianness, NULL);
-      } else if (r_mask != 0) {
-        caps = gst_ff_vid_caps_new (context, "video/x-raw-rgb",
-            "bpp", G_TYPE_INT, bpp,
-            "depth", G_TYPE_INT, depth,
-            "red_mask", G_TYPE_INT, r_mask,
-            "green_mask", G_TYPE_INT, g_mask,
-            "blue_mask", G_TYPE_INT, b_mask,
-            "endianness", G_TYPE_INT, endianness, NULL);
-      } else {
-        caps = gst_ff_vid_caps_new (context, "video/x-raw-rgb",
-            "bpp", G_TYPE_INT, bpp,
-            "depth", G_TYPE_INT, depth,
-            "endianness", G_TYPE_INT, endianness, NULL);
-        if (context && context->pix_fmt == PIX_FMT_PAL8) {
-          gst_ffmpeg_set_palette (caps, context);
-        }
-      }
-    } else if (fmt) {
-      caps = gst_ff_vid_caps_new (context, "video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, fmt, NULL);
-    }
-  }
-
-  if (caps != NULL) {
-    GST_DEBUG ("caps for pix_fmt=%d: %" GST_PTR_FORMAT, pix_fmt, caps);
-  } else {
-    GST_LOG ("No caps found for pix_fmt=%d", pix_fmt);
-  }
-
-  return caps;
-}
-
-/* Convert a FFMPEG Sample Format and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * See below for usefulness
- */
-
-static GstCaps *
-gst_ffmpeg_smpfmt_to_caps (enum SampleFormat sample_fmt,
-    AVCodecContext * context)
-{
-  GstCaps *caps = NULL;
-
-  int bpp = 0;
-  gboolean signedness = FALSE;
-
-  switch (sample_fmt) {
-    case SAMPLE_FMT_S16:
-      signedness = TRUE;
-      bpp = 16;
-      break;
-
-    default:
-      /* .. */
-      break;
-  }
-
-  if (bpp) {
-    caps = gst_ff_aud_caps_new (context, "audio/x-raw-int",
-        "signed", G_TYPE_BOOLEAN, signedness,
-        "endianness", G_TYPE_INT, G_BYTE_ORDER,
-        "width", G_TYPE_INT, bpp, "depth", G_TYPE_INT, bpp, NULL);
-  }
-
-  if (caps != NULL) {
-    GST_DEBUG ("caps for sample_fmt=%d: %" GST_PTR_FORMAT, sample_fmt, caps);
-  } else {
-    GST_LOG ("No caps found for sample_fmt=%d", sample_fmt);
-  }
-
-  return caps;
-}
-
-/* Convert a FFMPEG codec Type and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * CodecType is primarily meant for uncompressed data GstCaps!
- */
-
-GstCaps *
-gst_ffmpegcsp_codectype_to_caps (enum CodecType codec_type,
-    AVCodecContext * context)
-{
-  GstCaps *caps;
-
-  switch (codec_type) {
-    case CODEC_TYPE_VIDEO:
-      if (context) {
-        caps = gst_ffmpeg_pixfmt_to_caps (context->pix_fmt,
-            context->width == -1 ? NULL : context);
-      } else {
-        GstCaps *temp;
-        enum PixelFormat i;
-
-        caps = gst_caps_new_empty ();
-        for (i = 0; i < PIX_FMT_NB; i++) {
-          temp = gst_ffmpeg_pixfmt_to_caps (i, NULL);
-          if (temp != NULL) {
-            gst_caps_append (caps, temp);
-          }
-        }
-      }
-      break;
-
-    case CODEC_TYPE_AUDIO:
-      if (context) {
-        caps = gst_ffmpeg_smpfmt_to_caps (context->sample_fmt, context);
-      } else {
-        GstCaps *temp;
-        enum SampleFormat i;
-
-        caps = gst_caps_new_empty ();
-        for (i = 0; i <= SAMPLE_FMT_S16; i++) {
-          temp = gst_ffmpeg_smpfmt_to_caps (i, NULL);
-          if (temp != NULL) {
-            gst_caps_append (caps, temp);
-          }
-        }
-      }
-      break;
-
-    default:
-      /* .. */
-      caps = NULL;
-      break;
-  }
-
-  return caps;
-}
-
-/* Convert a GstCaps (audio/raw) to a FFMPEG SampleFmt
- * and other audio properties in a AVCodecContext.
- *
- * For usefulness, see below
- */
-
-static void
-gst_ffmpeg_caps_to_smpfmt (const GstCaps * caps,
-    AVCodecContext * context, gboolean raw)
-{
-  GstStructure *structure;
-  gint depth = 0, width = 0, endianness = 0;
-  gboolean signedness = FALSE;
-
-  g_return_if_fail (gst_caps_get_size (caps) == 1);
-  structure = gst_caps_get_structure (caps, 0);
-
-  gst_structure_get_int (structure, "channels", &context->channels);
-  gst_structure_get_int (structure, "rate", &context->sample_rate);
-
-  if (!raw)
-    return;
-
-  if (gst_structure_get_int (structure, "width", &width) &&
-      gst_structure_get_int (structure, "depth", &depth) &&
-      gst_structure_get_boolean (structure, "signed", &signedness) &&
-      gst_structure_get_int (structure, "endianness", &endianness)) {
-    if (width == 16 && depth == 16 &&
-        endianness == G_BYTE_ORDER && signedness == TRUE) {
-      context->sample_fmt = SAMPLE_FMT_S16;
-    }
-  }
-}
-
-
-/* Convert a GstCaps (video/raw) to a FFMPEG PixFmt
- * and other video properties in a AVCodecContext.
- *
- * For usefulness, see below
- */
-
-static void
-gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
-    AVCodecContext * context, gboolean raw)
-{
-  GstStructure *structure;
-  const GValue *fps;
-  gboolean ret;
-
-  g_return_if_fail (gst_caps_get_size (caps) == 1);
-  structure = gst_caps_get_structure (caps, 0);
-
-  ret = gst_structure_get_int (structure, "width", &context->width);
-  ret &= gst_structure_get_int (structure, "height", &context->height);
-  g_return_if_fail (ret == TRUE);
-
-  fps = gst_structure_get_value (structure, "framerate");
-  g_return_if_fail (GST_VALUE_HOLDS_FRACTION (fps));
-
-  /* framerate does not really matter */
-  context->frame_rate = gst_value_get_fraction_numerator (fps);
-  context->frame_rate_base = gst_value_get_fraction_denominator (fps);
-
-  if (!raw)
-    return;
-
-  if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
-    guint32 fourcc;
-
-    if (gst_structure_get_fourcc (structure, "format", &fourcc)) {
-      switch (fourcc) {
-        case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
-          context->pix_fmt = PIX_FMT_YUV422;
-          break;
-        case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
-          context->pix_fmt = PIX_FMT_UYVY422;
-          break;
-        case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
-          context->pix_fmt = PIX_FMT_YVYU422;
-          break;
-        case GST_MAKE_FOURCC ('I', 'Y', 'U', '1'):
-          context->pix_fmt = PIX_FMT_UYVY411;
-          break;
-        case GST_MAKE_FOURCC ('I', '4', '2', '0'):
-          context->pix_fmt = PIX_FMT_YUV420P;
-          break;
-        case GST_MAKE_FOURCC ('A', '4', '2', '0'):
-          context->pix_fmt = PIX_FMT_YUVA420P;
-          break;
-        case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
-          context->pix_fmt = PIX_FMT_NV12;
-          break;
-        case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
-          context->pix_fmt = PIX_FMT_NV21;
-          break;
-        case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
-          context->pix_fmt = PIX_FMT_YVU420P;
-          break;
-        case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
-          context->pix_fmt = PIX_FMT_YUV411P;
-          break;
-        case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
-          context->pix_fmt = PIX_FMT_YUV422P;
-          break;
-        case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
-          context->pix_fmt = PIX_FMT_YUV410P;
-          break;
-        case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
-          context->pix_fmt = PIX_FMT_YVU410P;
-          break;
-        case GST_MAKE_FOURCC ('v', '3', '0', '8'):
-          context->pix_fmt = PIX_FMT_V308;
-          break;
-        case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
-          context->pix_fmt = PIX_FMT_AYUV4444;
-          break;
-        case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
-          context->pix_fmt = PIX_FMT_YUV444P;
-          break;
-        case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
-        case GST_MAKE_FOURCC ('Y', '8', ' ', ' '):
-        case GST_MAKE_FOURCC ('G', 'R', 'E', 'Y'):
-          context->pix_fmt = PIX_FMT_Y800;
-          break;
-        case GST_MAKE_FOURCC ('Y', '1', '6', ' '):
-          context->pix_fmt = PIX_FMT_Y16;
-          break;
-      }
-    }
-  } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
-    gint bpp = 0, rmask = 0, endianness = 0, amask = 0, depth = 0;
-
-    if (gst_structure_get_int (structure, "bpp", &bpp) &&
-        gst_structure_get_int (structure, "endianness", &endianness)) {
-      if (gst_structure_get_int (structure, "red_mask", &rmask)) {
-        switch (bpp) {
-          case 32:
-            if (gst_structure_get_int (structure, "alpha_mask", &amask)) {
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-              if (rmask == 0x0000ff00)
-                context->pix_fmt = PIX_FMT_BGRA32;
-              else if (rmask == 0x00ff0000)
-                context->pix_fmt = PIX_FMT_RGBA32;
-              else if (rmask == 0xff000000)
-                context->pix_fmt = PIX_FMT_ARGB32;
-              else              // if (r_mask = 0x000000ff)
-                context->pix_fmt = PIX_FMT_ABGR32;
-#else
-              if (rmask == 0x00ff0000)
-                context->pix_fmt = PIX_FMT_BGRA32;
-              else if (rmask == 0x0000ff00)
-                context->pix_fmt = PIX_FMT_RGBA32;
-              else if (rmask == 0x000000ff)
-                context->pix_fmt = PIX_FMT_ARGB32;
-              else              // if (rmask == 0xff000000)
-                context->pix_fmt = PIX_FMT_ABGR32;
-#endif
-            } else {
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-              if (rmask == 0x00ff0000)
-                context->pix_fmt = PIX_FMT_RGB32;
-              else if (rmask == 0x0000ff00)
-                context->pix_fmt = PIX_FMT_BGR32;
-              else if (rmask == 0xff000000)
-                context->pix_fmt = PIX_FMT_xRGB32;
-              else              // if (rmask == 0x000000ff)
-                context->pix_fmt = PIX_FMT_BGRx32;
-#else
-              if (rmask == 0x0000ff00)
-                context->pix_fmt = PIX_FMT_RGB32;
-              else if (rmask == 0x00ff0000)
-                context->pix_fmt = PIX_FMT_BGR32;
-              else if (rmask == 0x000000ff)
-                context->pix_fmt = PIX_FMT_xRGB32;
-              else              // if (rmask == 0xff000000)
-                context->pix_fmt = PIX_FMT_BGRx32;
-#endif
-            }
-            break;
-          case 24:
-            if (rmask == 0x0000FF)
-              context->pix_fmt = PIX_FMT_BGR24;
-            else
-              context->pix_fmt = PIX_FMT_RGB24;
-            break;
-          case 16:
-            if (endianness == G_BYTE_ORDER) {
-              context->pix_fmt = PIX_FMT_RGB565;
-              if (gst_structure_get_int (structure, "depth", &depth)) {
-                if (depth == 15)
-                  context->pix_fmt = PIX_FMT_RGB555;
-              }
-            }
-            break;
-          case 15:
-            if (endianness == G_BYTE_ORDER)
-              context->pix_fmt = PIX_FMT_RGB555;
-            break;
-          default:
-            /* nothing */
-            break;
-        }
-      } else {
-        if (bpp == 8) {
-          context->pix_fmt = PIX_FMT_PAL8;
-          gst_ffmpeg_get_palette (caps, context);
-        }
-      }
-    }
-  } else if (gst_structure_has_name (structure, "video/x-raw-gray")) {
-    gint bpp = 0;
-
-    if (gst_structure_get_int (structure, "bpp", &bpp)) {
-      switch (bpp) {
-        case 8:
-          context->pix_fmt = PIX_FMT_GRAY8;
-          break;
-        case 16:{
-          gint endianness = 0;
-
-          if (gst_structure_get_int (structure, "endianness", &endianness)) {
-            if (endianness == G_LITTLE_ENDIAN)
-              context->pix_fmt = PIX_FMT_GRAY16_L;
-            else if (endianness == G_BIG_ENDIAN)
-              context->pix_fmt = PIX_FMT_GRAY16_B;
-          }
-        }
-          break;
-      }
-    }
-  }
-}
-
-/* Convert a GstCaps and a FFMPEG codec Type to a
- * AVCodecContext. If the context is ommitted, no fixed values
- * for video/audio size will be included in the context
- *
- * CodecType is primarily meant for uncompressed data GstCaps!
- */
-
-void
-gst_ffmpegcsp_caps_with_codectype (enum CodecType type,
-    const GstCaps * caps, AVCodecContext * context)
-{
-  if (context == NULL)
-    return;
-
-  switch (type) {
-    case CODEC_TYPE_VIDEO:
-      gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE);
-      break;
-
-    case CODEC_TYPE_AUDIO:
-      gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE);
-      break;
-
-    default:
-      /* unknown */
-      break;
-  }
-}
-
-#define GEN_MASK(x) ((1<<(x))-1)
-#define ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
-#define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
-
-/*
- * Fill in pointers to memory in a AVPicture, where
- * everything is aligned by 4 (as required by X).
- * This is mostly a copy from imgconvert.c with some
- * small changes.
- */
-int
-gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
-    uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height,
-    int interlaced)
-{
-  int size, w2, h2, size2;
-  int stride, stride2;
-  PixFmtInfo *pinfo;
-
-  pinfo = get_pix_fmt_info (pix_fmt);
-
-  picture->interlaced = interlaced;
-
-  switch (pix_fmt) {
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV444P:
-    case PIX_FMT_YUV410P:
-    case PIX_FMT_YUV411P:
-    case PIX_FMT_YUVJ420P:
-    case PIX_FMT_YUVJ422P:
-    case PIX_FMT_YUVJ444P:
-      stride = GST_ROUND_UP_4 (width);
-      h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size = stride * h2;
-      w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
-      stride2 = GST_ROUND_UP_4 (w2);
-      h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size2 = stride2 * h2;
-      picture->data[0] = ptr;
-      picture->data[1] = picture->data[0] + size;
-      picture->data[2] = picture->data[1] + size2;
-      picture->linesize[0] = stride;
-      picture->linesize[1] = stride2;
-      picture->linesize[2] = stride2;
-      return size + 2 * size2;
-      /* PIX_FMT_YVU420P = YV12: same as PIX_FMT_YUV420P, but
-       *  with U and V plane swapped. Strides as in videotestsrc */
-    case PIX_FMT_YUVA420P:
-      stride = GST_ROUND_UP_4 (width);
-      h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size = stride * h2;
-      w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
-      stride2 = GST_ROUND_UP_4 (w2);
-      h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size2 = stride2 * h2;
-      picture->data[0] = ptr;
-      picture->data[1] = picture->data[0] + size;
-      picture->data[2] = picture->data[1] + size2;
-      picture->data[3] = picture->data[2] + size2;
-      picture->linesize[0] = stride;
-      picture->linesize[1] = stride2;
-      picture->linesize[2] = stride2;
-      picture->linesize[3] = stride;
-      return 2 * size + 2 * size2;
-    case PIX_FMT_YVU410P:
-    case PIX_FMT_YVU420P:
-      stride = GST_ROUND_UP_4 (width);
-      h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size = stride * h2;
-      w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
-      stride2 = GST_ROUND_UP_4 (w2);
-      h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size2 = stride2 * h2;
-      picture->data[0] = ptr;
-      picture->data[2] = picture->data[0] + size;
-      picture->data[1] = picture->data[2] + size2;
-      picture->linesize[0] = stride;
-      picture->linesize[1] = stride2;
-      picture->linesize[2] = stride2;
-      return size + 2 * size2;
-    case PIX_FMT_NV12:
-    case PIX_FMT_NV21:
-      stride = GST_ROUND_UP_4 (width);
-      h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size = stride * h2;
-      w2 = 2 * DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
-      stride2 = GST_ROUND_UP_4 (w2);
-      h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size2 = stride2 * h2;
-      picture->data[0] = ptr;
-      picture->data[1] = picture->data[0] + size;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      picture->linesize[1] = stride2;
-      picture->linesize[2] = 0;
-      return size + size2;
-    case PIX_FMT_RGB24:
-    case PIX_FMT_BGR24:
-      stride = GST_ROUND_UP_4 (width * 3);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_AYUV4444:
-    case PIX_FMT_RGB32:
-    case PIX_FMT_RGBA32:
-    case PIX_FMT_ARGB32:
-    case PIX_FMT_BGR32:
-    case PIX_FMT_BGRA32:
-    case PIX_FMT_ABGR32:
-    case PIX_FMT_xRGB32:
-    case PIX_FMT_BGRx32:
-      stride = width * 4;
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_RGB555:
-    case PIX_FMT_RGB565:
-    case PIX_FMT_YUV422:
-    case PIX_FMT_UYVY422:
-    case PIX_FMT_YVYU422:
-      stride = GST_ROUND_UP_4 (width * 2);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_V308:
-      stride = GST_ROUND_UP_4 (width * 3);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_UYVY411:
-      stride =
-          GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) + GST_ROUND_UP_4 (width) / 2);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_Y800:
-    case PIX_FMT_GRAY8:
-      stride = GST_ROUND_UP_4 (width);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_Y16:
-    case PIX_FMT_GRAY16_L:
-    case PIX_FMT_GRAY16_B:
-      stride = GST_ROUND_UP_4 (width * 2);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_MONOWHITE:
-    case PIX_FMT_MONOBLACK:
-      stride = GST_ROUND_UP_4 ((width + 7) >> 3);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      return size;
-    case PIX_FMT_PAL8:
-      /* already forced to be with stride, so same result as other function */
-      stride = GST_ROUND_UP_4 (width);
-      size = stride * height;
-      picture->data[0] = ptr;
-      picture->data[1] = ptr + size;    /* palette is stored here as 256 32 bit words */
-      picture->data[2] = NULL;
-      picture->linesize[0] = stride;
-      picture->linesize[1] = 4;
-      return size + 256 * 4;
-    default:
-      picture->data[0] = NULL;
-      picture->data[1] = NULL;
-      picture->data[2] = NULL;
-      picture->data[3] = NULL;
-      return -1;
-  }
-
-  return 0;
-}
diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.h b/gst/ffmpegcolorspace/gstffmpegcodecmap.h
deleted file mode 100644 (file)
index 077fe3f..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFMPEG_CODECMAP_H__
-#define __GST_FFMPEG_CODECMAP_H__
-
-#include "avcodec.h"
-#include <gst/gst.h>
-
-/*
- * _codectype_to_caps () gets the GstCaps that belongs to
- * a certain CodecType for a pad with uncompressed data.
- */
-
-GstCaps *
-gst_ffmpegcsp_codectype_to_caps (enum CodecType  codec_type,
-                                 AVCodecContext *context);
-
-/*
- * caps_with_codectype () transforms a GstCaps that belongs to
- * a pad for uncompressed data to a filled-in context.
- */
-
-void
-gst_ffmpegcsp_caps_with_codectype (enum CodecType  type,
-                                   const GstCaps  *caps,
-                                   AVCodecContext *context);
-
-/*
- * Fill in pointers in an AVPicture, aligned by 4 (required by X).
- */
-
-int
-gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
-                              uint8_t *   ptr,
-                              enum PixelFormat pix_fmt,
-                              int         width,
-                              int         height,
-                             int         interlaced);
-
-#endif /* __GST_FFMPEG_CODECMAP_H__ */
-
diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c
deleted file mode 100644 (file)
index 4ba0204..0000000
+++ /dev/null
@@ -1,517 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * This file:
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-ffmpegcolorspace
- *
- * Convert video frames between a great variety of colorspace formats.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v videotestsrc ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! ffmpegcolorspace ! ximagesink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#include "gstffmpegcolorspace.h"
-#include "gstffmpegcodecmap.h"
-#include <gst/video/video.h>
-
-GST_DEBUG_CATEGORY (ffmpegcolorspace_debug);
-#define GST_CAT_DEFAULT ffmpegcolorspace_debug
-GST_DEBUG_CATEGORY (ffmpegcolorspace_performance);
-
-#define FFMPEGCSP_VIDEO_CAPS                                           \
-  "video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , "                 \
-  "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE","     \
-  "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, A420} ;" \
-  GST_VIDEO_CAPS_RGB";"                                                        \
-  GST_VIDEO_CAPS_BGR";"                                                        \
-  GST_VIDEO_CAPS_RGBx";"                                               \
-  GST_VIDEO_CAPS_xRGB";"                                               \
-  GST_VIDEO_CAPS_BGRx";"                                               \
-  GST_VIDEO_CAPS_xBGR";"                                               \
-  GST_VIDEO_CAPS_RGBA";"                                               \
-  GST_VIDEO_CAPS_ARGB";"                                               \
-  GST_VIDEO_CAPS_BGRA";"                                               \
-  GST_VIDEO_CAPS_ABGR";"                                               \
-  GST_VIDEO_CAPS_RGB_16";"                                             \
-  GST_VIDEO_CAPS_RGB_15";"                                             \
-  "video/x-raw-rgb, bpp = (int)8, depth = (int)8, "                     \
-      "width = "GST_VIDEO_SIZE_RANGE" , "                              \
-      "height = " GST_VIDEO_SIZE_RANGE ", "                             \
-      "framerate = "GST_VIDEO_FPS_RANGE ";"                             \
-  GST_VIDEO_CAPS_GRAY8";"                                              \
-  GST_VIDEO_CAPS_GRAY16("BIG_ENDIAN")";"                               \
-  GST_VIDEO_CAPS_GRAY16("LITTLE_ENDIAN")";"
-
-static GstStaticPadTemplate gst_ffmpegcsp_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (FFMPEGCSP_VIDEO_CAPS)
-    );
-
-static GstStaticPadTemplate gst_ffmpegcsp_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (FFMPEGCSP_VIDEO_CAPS)
-    );
-
-GType gst_ffmpegcsp_get_type (void);
-
-static gboolean gst_ffmpegcsp_set_caps (GstBaseTransform * btrans,
-    GstCaps * incaps, GstCaps * outcaps);
-static gboolean gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans,
-    GstCaps * caps, guint * size);
-static GstFlowReturn gst_ffmpegcsp_transform (GstBaseTransform * btrans,
-    GstBuffer * inbuf, GstBuffer * outbuf);
-
-static GQuark _QRAWRGB;         /* "video/x-raw-rgb" */
-static GQuark _QRAWYUV;         /* "video/x-raw-yuv" */
-static GQuark _QALPHAMASK;      /* "alpha_mask" */
-
-/* copies the given caps */
-static GstCaps *
-gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps)
-{
-  GstStructure *yuvst, *rgbst, *grayst;
-
-  /* We know there's only one structure since we're given simple caps */
-  caps = gst_caps_copy (caps);
-
-  yuvst = gst_caps_get_structure (caps, 0);
-
-  gst_structure_set_name (yuvst, "video/x-raw-yuv");
-  gst_structure_remove_fields (yuvst, "format", "endianness", "depth",
-      "bpp", "red_mask", "green_mask", "blue_mask", "alpha_mask",
-      "palette_data", NULL);
-
-  rgbst = gst_structure_copy (yuvst);
-  gst_structure_set_name (rgbst, "video/x-raw-rgb");
-  gst_structure_remove_fields (rgbst, "color-matrix", "chroma-site", NULL);
-
-  grayst = gst_structure_copy (rgbst);
-  gst_structure_set_name (grayst, "video/x-raw-gray");
-
-  gst_caps_append_structure (caps, rgbst);
-  gst_caps_append_structure (caps, grayst);
-
-  return caps;
-}
-
-
-static gboolean
-gst_ffmpegcsp_structure_is_alpha (GstStructure * s)
-{
-  GQuark name;
-
-  name = gst_structure_get_name_id (s);
-
-  if (name == _QRAWRGB) {
-    return gst_structure_id_has_field (s, _QALPHAMASK);
-  } else if (name == _QRAWYUV) {
-    guint32 fourcc;
-
-    if (!gst_structure_get_fourcc (s, "format", &fourcc))
-      return FALSE;
-
-    return (fourcc == GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'));
-  }
-
-  return FALSE;
-}
-
-/* The caps can be transformed into any other caps with format info removed.
- * However, we should prefer passthrough, so if passthrough is possible,
- * put it first in the list. */
-static GstCaps *
-gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans,
-    GstPadDirection direction, GstCaps * caps)
-{
-  GstCaps *template;
-  GstCaps *tmp, *tmp2;
-  GstCaps *result;
-  GstStructure *s;
-  GstCaps *alpha, *non_alpha;
-
-  template = gst_static_pad_template_get_caps (&gst_ffmpegcsp_src_template);
-  result = gst_caps_copy (caps);
-
-  /* Get all possible caps that we can transform to */
-  tmp = gst_ffmpegcsp_caps_remove_format_info (caps);
-  tmp2 = gst_caps_intersect (tmp, template);
-  gst_caps_unref (tmp);
-  tmp = tmp2;
-
-  /* Now move alpha formats to the beginning if caps is an alpha format
-   * or at the end if caps is no alpha format */
-  alpha = gst_caps_new_empty ();
-  non_alpha = gst_caps_new_empty ();
-
-  while ((s = gst_caps_steal_structure (tmp, 0))) {
-    if (gst_ffmpegcsp_structure_is_alpha (s))
-      gst_caps_append_structure (alpha, s);
-    else
-      gst_caps_append_structure (non_alpha, s);
-  }
-
-  s = gst_caps_get_structure (caps, 0);
-  gst_caps_unref (tmp);
-
-  if (gst_ffmpegcsp_structure_is_alpha (s)) {
-    gst_caps_append (alpha, non_alpha);
-    tmp = alpha;
-  } else {
-    gst_caps_append (non_alpha, alpha);
-    tmp = non_alpha;
-  }
-
-  gst_caps_append (result, tmp);
-
-  GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %"
-      GST_PTR_FORMAT, caps, result);
-
-  return result;
-}
-
-static gboolean
-gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
-    GstCaps * outcaps)
-{
-  GstFFMpegCsp *space;
-  GstStructure *structure;
-  gint in_height, in_width;
-  gint out_height, out_width;
-  const GValue *in_framerate = NULL;
-  const GValue *out_framerate = NULL;
-  const GValue *in_par = NULL;
-  const GValue *out_par = NULL;
-  AVCodecContext *ctx;
-  gboolean res;
-
-  space = GST_FFMPEGCSP (btrans);
-
-  /* parse in and output values */
-  structure = gst_caps_get_structure (incaps, 0);
-
-  /* we have to have width and height */
-  res = gst_structure_get_int (structure, "width", &in_width);
-  res &= gst_structure_get_int (structure, "height", &in_height);
-  if (!res)
-    goto no_width_height;
-
-  /* and framerate */
-  in_framerate = gst_structure_get_value (structure, "framerate");
-  if (in_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (in_framerate))
-    goto no_framerate;
-
-  /* this is optional */
-  in_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-
-  structure = gst_caps_get_structure (outcaps, 0);
-
-  /* we have to have width and height */
-  res = gst_structure_get_int (structure, "width", &out_width);
-  res &= gst_structure_get_int (structure, "height", &out_height);
-  if (!res)
-    goto no_width_height;
-
-  /* and framerate */
-  out_framerate = gst_structure_get_value (structure, "framerate");
-  if (out_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (out_framerate))
-    goto no_framerate;
-
-  /* this is optional */
-  out_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-
-  /* these must match */
-  if (in_width != out_width || in_height != out_height ||
-      gst_value_compare (in_framerate, out_framerate) != GST_VALUE_EQUAL)
-    goto format_mismatch;
-
-  /* if present, these must match too */
-  if (in_par && out_par
-      && gst_value_compare (in_par, out_par) != GST_VALUE_EQUAL)
-    goto format_mismatch;
-
-  ctx = avcodec_alloc_context ();
-
-  space->width = ctx->width = in_width;
-  space->height = ctx->height = in_height;
-
-  space->interlaced = FALSE;
-  gst_structure_get_boolean (structure, "interlaced", &space->interlaced);
-
-  /* get from format */
-  ctx->pix_fmt = PIX_FMT_NB;
-  gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, incaps, ctx);
-  if (ctx->pix_fmt == PIX_FMT_NB)
-    goto invalid_in_caps;
-  space->from_pixfmt = ctx->pix_fmt;
-
-  /* palette, only for from data */
-  if (space->palette)
-    av_free (space->palette);
-  space->palette = ctx->palctrl;
-  ctx->palctrl = NULL;
-
-  /* get to format */
-  ctx->pix_fmt = PIX_FMT_NB;
-  gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, outcaps, ctx);
-  if (ctx->pix_fmt == PIX_FMT_NB)
-    goto invalid_out_caps;
-  space->to_pixfmt = ctx->pix_fmt;
-
-  GST_DEBUG ("reconfigured %d %d", space->from_pixfmt, space->to_pixfmt);
-
-  av_free (ctx);
-
-  return TRUE;
-
-  /* ERRORS */
-no_width_height:
-  {
-    GST_DEBUG_OBJECT (space, "did not specify width or height");
-    space->from_pixfmt = PIX_FMT_NB;
-    space->to_pixfmt = PIX_FMT_NB;
-    return FALSE;
-  }
-no_framerate:
-  {
-    GST_DEBUG_OBJECT (space, "did not specify framerate");
-    space->from_pixfmt = PIX_FMT_NB;
-    space->to_pixfmt = PIX_FMT_NB;
-    return FALSE;
-  }
-format_mismatch:
-  {
-    GST_DEBUG_OBJECT (space, "input and output formats do not match");
-    space->from_pixfmt = PIX_FMT_NB;
-    space->to_pixfmt = PIX_FMT_NB;
-    return FALSE;
-  }
-invalid_in_caps:
-  {
-    GST_DEBUG_OBJECT (space, "could not configure context for input format");
-    av_free (ctx);
-    space->from_pixfmt = PIX_FMT_NB;
-    space->to_pixfmt = PIX_FMT_NB;
-    return FALSE;
-  }
-invalid_out_caps:
-  {
-    GST_DEBUG_OBJECT (space, "could not configure context for output format");
-    av_free (ctx);
-    space->from_pixfmt = PIX_FMT_NB;
-    space->to_pixfmt = PIX_FMT_NB;
-    return FALSE;
-  }
-}
-
-GST_BOILERPLATE (GstFFMpegCsp, gst_ffmpegcsp, GstVideoFilter,
-    GST_TYPE_VIDEO_FILTER);
-
-static void
-gst_ffmpegcsp_base_init (gpointer klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_ffmpegcsp_src_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_ffmpegcsp_sink_template));
-
-  gst_element_class_set_details_simple (element_class,
-      "FFMPEG Colorspace converter", "Filter/Converter/Video",
-      "Converts video from one colorspace to another",
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-  _QRAWRGB = g_quark_from_string ("video/x-raw-rgb");
-  _QRAWYUV = g_quark_from_string ("video/x-raw-yuv");
-  _QALPHAMASK = g_quark_from_string ("alpha_mask");
-}
-
-static void
-gst_ffmpegcsp_finalize (GObject * obj)
-{
-  GstFFMpegCsp *space = GST_FFMPEGCSP (obj);
-
-  if (space->palette)
-    av_free (space->palette);
-
-  G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass)
-{
-  GObjectClass *gobject_class = (GObjectClass *) klass;
-  GstBaseTransformClass *gstbasetransform_class =
-      (GstBaseTransformClass *) klass;
-
-  gobject_class->finalize = gst_ffmpegcsp_finalize;
-
-  gstbasetransform_class->transform_caps =
-      GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform_caps);
-  gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegcsp_set_caps);
-  gstbasetransform_class->get_unit_size =
-      GST_DEBUG_FUNCPTR (gst_ffmpegcsp_get_unit_size);
-  gstbasetransform_class->transform =
-      GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform);
-
-  gstbasetransform_class->passthrough_on_same_caps = TRUE;
-}
-
-static void
-gst_ffmpegcsp_init (GstFFMpegCsp * space, GstFFMpegCspClass * klass)
-{
-  space->from_pixfmt = space->to_pixfmt = PIX_FMT_NB;
-  space->palette = NULL;
-}
-
-static gboolean
-gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
-    guint * size)
-{
-  GstStructure *structure = NULL;
-  AVCodecContext *ctx = NULL;
-  gboolean ret = TRUE;
-  gint width, height;
-
-  g_assert (size);
-
-  structure = gst_caps_get_structure (caps, 0);
-  gst_structure_get_int (structure, "width", &width);
-  gst_structure_get_int (structure, "height", &height);
-
-  ctx = avcodec_alloc_context ();
-
-  g_assert (ctx != NULL);
-
-  ctx->pix_fmt = PIX_FMT_NB;
-
-  gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx);
-
-  if (G_UNLIKELY (ctx->pix_fmt == PIX_FMT_NB)) {
-    ret = FALSE;
-    goto beach;
-  }
-
-  *size = avpicture_get_size (ctx->pix_fmt, width, height);
-
-  /* ffmpeg frames have the palette after the frame data, whereas
-   * GStreamer currently puts it into the caps as 'palette_data' field,
-   * so for paletted data the frame size avpicture_get_size() returns is
-   * 1024 bytes larger than what GStreamer expects. */
-  if (gst_structure_has_field (structure, "palette_data") &&
-      ctx->pix_fmt == PIX_FMT_PAL8) {
-    *size -= 4 * 256;           /* = AVPALETTE_SIZE */
-  }
-
-beach:
-
-  if (ctx->palctrl)
-    av_free (ctx->palctrl);
-  av_free (ctx);
-
-  return ret;
-}
-
-static GstFlowReturn
-gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf,
-    GstBuffer * outbuf)
-{
-  GstFFMpegCsp *space;
-  gint result;
-
-  space = GST_FFMPEGCSP (btrans);
-
-  GST_DEBUG ("from %d -> to %d", space->from_pixfmt, space->to_pixfmt);
-
-  if (G_UNLIKELY (space->from_pixfmt == PIX_FMT_NB ||
-          space->to_pixfmt == PIX_FMT_NB))
-    goto unknown_format;
-
-  /* fill from with source data */
-  gst_ffmpegcsp_avpicture_fill (&space->from_frame,
-      GST_BUFFER_DATA (inbuf), space->from_pixfmt, space->width, space->height,
-      space->interlaced);
-
-  /* fill optional palette */
-  if (space->palette)
-    space->from_frame.data[1] = (uint8_t *) space->palette->palette;
-
-  /* fill target frame */
-  gst_ffmpegcsp_avpicture_fill (&space->to_frame,
-      GST_BUFFER_DATA (outbuf), space->to_pixfmt, space->width, space->height,
-      space->interlaced);
-
-  /* and convert */
-  result = img_convert (&space->to_frame, space->to_pixfmt,
-      &space->from_frame, space->from_pixfmt, space->width, space->height);
-  if (result == -1)
-    goto not_supported;
-
-  /* baseclass copies timestamps */
-  GST_DEBUG ("from %d -> to %d done", space->from_pixfmt, space->to_pixfmt);
-
-  return GST_FLOW_OK;
-
-  /* ERRORS */
-unknown_format:
-  {
-    GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
-        ("attempting to convert colorspaces between unknown formats"));
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-not_supported:
-  {
-    GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
-        ("cannot convert between formats"));
-    return GST_FLOW_NOT_SUPPORTED;
-  }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  GST_DEBUG_CATEGORY_INIT (ffmpegcolorspace_debug, "ffmpegcolorspace", 0,
-      "FFMPEG-based colorspace converter");
-  GST_DEBUG_CATEGORY_GET (ffmpegcolorspace_performance, "GST_PERFORMANCE");
-
-  avcodec_init ();
-
-  return gst_element_register (plugin, "ffmpegcolorspace",
-      GST_RANK_NONE, GST_TYPE_FFMPEGCSP);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    "ffmpegcolorspace",
-    "colorspace conversion copied from FFMpeg " FFMPEG_VERSION,
-    plugin_init, VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")
diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c
deleted file mode 100644 (file)
index cb145bb..0000000
+++ /dev/null
@@ -1,4126 +0,0 @@
-/*
- * Misc image convertion routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/**
- * @file imgconvert.c
- * Misc image convertion routines.
- */
-
-/* TODO:
- * - write 'ffimg' program to test all the image related stuff
- * - move all api to slice based system
- * - integrate deinterlacing, postprocessing and scaling in the conversion process
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "gstffmpegcodecmap.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-GST_DEBUG_CATEGORY_EXTERN (ffmpegcolorspace_performance);
-
-#define xglue(x, y) x ## y
-#define glue(x, y) xglue(x, y)
-
-/* this table gives more information about formats */
-/* FIXME, this table is also in ffmpegcodecmap */
-static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
-  /* YUV formats */
-  /* [PIX_FMT_YUV420P] = */ {
-        /* .format         = */ PIX_FMT_YUV420P,
-        /* .name           = */ "yuv420p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 1,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YVU420P] = */ {
-        /* .format         = */ PIX_FMT_YVU420P,
-        /* .name           = */ "yvu420p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 1,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_NV12] = */ {
-        /* .format         = */ PIX_FMT_NV12,
-        /* .name           = */ "nv12",
-        /* .nb_channels    = */ 2,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 1,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_NV21] = */ {
-        /* .format         = */ PIX_FMT_NV21,
-        /* .name           = */ "nv21",
-        /* .nb_channels    = */ 2,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 1,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUV422P] = */ {
-        /* .format         = */ PIX_FMT_YUV422P,
-        /* .name           = */ "yuv422p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUV444P] = */ {
-        /* .format         = */ PIX_FMT_YUV444P,
-        /* .name           = */ "yuv444p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUV422] = */ {
-        /* .format         = */ PIX_FMT_YUV422,
-        /* .name           = */ "yuv422",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_UYVY422] = */ {
-        /* .format         = */ PIX_FMT_UYVY422,
-        /* .name           = */ "uyvy422",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YVYU422] = */ {
-        /* .format         = */ PIX_FMT_YVYU422,
-        /* .name           = */ "yvyu422",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_V308] = */ {
-        /* .format         = */ PIX_FMT_V308,
-        /* .name           = */ "v308",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUV410P] = */ {
-        /* .format         = */ PIX_FMT_YUV410P,
-        /* .name           = */ "yuv410p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 2,
-        /* .y_chroma_shift = */ 2,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YVU410P] = */ {
-        /* .format         = */ PIX_FMT_YVU410P,
-        /* .name           = */ "yvu410p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 2,
-        /* .y_chroma_shift = */ 2,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUV411P] = */ {
-        /* .format         = */ PIX_FMT_YUV411P,
-        /* .name           = */ "yuv411p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 2,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_Y800] = */ {
-        /* .format         = */ PIX_FMT_Y800,
-        /* .name           = */ "y800",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_Y16] = */ {
-        /* .format         = */ PIX_FMT_Y16,
-        /* .name           = */ "y16",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 16,
-      },
-
-  /* JPEG YUV */
-  /* [PIX_FMT_YUVJ420P] = */ {
-        /* .format         = */ PIX_FMT_YUVJ420P,
-        /* .name           = */ "yuvj420p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV_JPEG,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 1,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUVJ422P] = */ {
-        /* .format         = */ PIX_FMT_YUVJ422P,
-        /* .name           = */ "yuvj422p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV_JPEG,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_YUVJ444P] = */ {
-        /* .format         = */ PIX_FMT_YUVJ444P,
-        /* .name           = */ "yuvj444p",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_YUV_JPEG,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-
-  /* RGB formats */
-  /* [PIX_FMT_RGB24] = */ {
-        /* .format         = */ PIX_FMT_RGB24,
-        /* .name           = */ "rgb24",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_BGR24] = */ {
-        /* .format         = */ PIX_FMT_BGR24,
-        /* .name           = */ "bgr24",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_RGB32] = */ {
-        /* .format         = */ PIX_FMT_RGB32,
-        /* .name           = */ "rgb32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_BGR32] = */ {
-        /* .format         = */ PIX_FMT_BGR32,
-        /* .name           = */ "bgr32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_RGB32] = */ {
-        /* .format         = */ PIX_FMT_xRGB32,
-        /* .name           = */ "xrgb32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_BGR32] = */ {
-        /* .format         = */ PIX_FMT_BGRx32,
-        /* .name           = */ "bgrx32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_RGBA32] = */ {
-        /* .format         = */ PIX_FMT_RGBA32,
-        /* .name           = */ "rgba32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_BGRA32] = */ {
-        /* .format         = */ PIX_FMT_BGRA32,
-        /* .name           = */ "bgra32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_ARGB32] = */ {
-        /* .format         = */ PIX_FMT_ARGB32,
-        /* .name           = */ "argb32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_ABGR32] = */ {
-        /* .format         = */ PIX_FMT_ABGR32,
-        /* .name           = */ "abgr32",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_RGB565] = */ {
-        /* .format         = */ PIX_FMT_RGB565,
-        /* .name           = */ "rgb565",
-        /* .nb_channels    = */ 3,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 5,
-      },
-  /* [PIX_FMT_RGB555] = */ {
-        /* .format         = */ PIX_FMT_RGB555,
-        /* .name           = */ "rgb555",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 5,
-      },
-
-  /* gray / mono formats */
-  /* [PIX_FMT_GRAY8] = */ {
-        /* .format         = */ PIX_FMT_GRAY8,
-        /* .name           = */ "gray",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_GRAY,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_GRAY16_L] = */ {
-        /* .format         = */ PIX_FMT_GRAY16_L,
-        /* .name           = */ "gray",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_GRAY,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 16,
-      },
-  /* [PIX_FMT_GRAY16_B] = */ {
-        /* .format         = */ PIX_FMT_GRAY16_B,
-        /* .name           = */ "gray",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_GRAY,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 16,
-      },
-  /* [PIX_FMT_MONOWHITE] = */ {
-        /* .format         = */ PIX_FMT_MONOWHITE,
-        /* .name           = */ "monow",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_GRAY,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 1,
-      },
-  /* [PIX_FMT_MONOBLACK] = */ {
-        /* .format         = */ PIX_FMT_MONOBLACK,
-        /* .name           = */ "monob",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_GRAY,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 1,
-      },
-
-  /* paletted formats */
-  /* [PIX_FMT_PAL8] = */ {
-        /* .format         = */ PIX_FMT_PAL8,
-        /* .name           = */ "pal8",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_RGB,
-        /* .pixel_type     = */ FF_PIXEL_PALETTE,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_XVMC_MPEG2_MC] = */ {
-        /* .format         = */ PIX_FMT_XVMC_MPEG2_MC,
-        /* .name           = */ "xvmcmc",
-      },
-  /* [PIX_FMT_XVMC_MPEG2_IDCT] = */ {
-        /* .format         = */ PIX_FMT_XVMC_MPEG2_IDCT,
-        /* .name           = */ "xvmcidct",
-      },
-  /* [PIX_FMT_UYVY411] = */ {
-        /* .format         = */ PIX_FMT_UYVY411,
-        /* .name           = */ "uyvy411",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 0,
-        /* .x_chroma_shift = */ 2,
-        /* .y_chroma_shift = */ 0,
-        /* .depth          = */ 8,
-      },
-  /* [PIX_FMT_AYUV4444] = */ {
-        /* .format         = */ PIX_FMT_AYUV4444,
-        /* .name           = */ "ayuv4444",
-        /* .nb_channels    = */ 1,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PACKED,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 0,
-        /* .y_chroma_shift = */ 0,
-        /*.depth = */ 8
-      },
-  /* [PIX_FMT_YUVA420P] = */ {
-        /* .format         = */ PIX_FMT_YUVA420P,
-        /* .name           = */ "yuva420p",
-        /* .nb_channels    = */ 4,
-        /* .color_type     = */ FF_COLOR_YUV,
-        /* .pixel_type     = */ FF_PIXEL_PLANAR,
-        /* .is_alpha       = */ 1,
-        /* .x_chroma_shift = */ 1,
-        /* .y_chroma_shift = */ 1,
-        /* .depth          = */ 8,
-      }
-};
-
-/* returns NULL if not found */
-/* undid static since this is also used in gstffmpegcodecmap.c */
-PixFmtInfo *
-get_pix_fmt_info (enum PixelFormat format)
-{
-  int i;
-
-  for (i = 0; i < sizeof (pix_fmt_info) / sizeof (pix_fmt_info[0]); i++) {
-    if (pix_fmt_info[i].format == format) {
-      return pix_fmt_info + i;
-    }
-  }
-
-  /* since this doesn't get checked *anywhere*, we might as well warn
-     here if we return NULL so you have *some* idea what's going on */
-  g_warning
-      ("Could not find info for pixel format %d out of %d known pixel formats. One segfault coming up",
-      format, PIX_FMT_NB);
-  return NULL;
-}
-
-void
-avcodec_get_chroma_sub_sample (int pix_fmt, int *h_shift, int *v_shift)
-{
-  *h_shift = get_pix_fmt_info (pix_fmt)->x_chroma_shift;
-  *v_shift = get_pix_fmt_info (pix_fmt)->y_chroma_shift;
-}
-
-const char *
-avcodec_get_pix_fmt_name (int pix_fmt)
-{
-  if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
-    return "???";
-  else
-    return get_pix_fmt_info (pix_fmt)->name;
-}
-
-enum PixelFormat
-avcodec_get_pix_fmt (const char *name)
-{
-  int i;
-
-  for (i = 0; i < PIX_FMT_NB; i++)
-    if (!strcmp (pix_fmt_info[i].name, name))
-      break;
-  return pix_fmt_info[i].format;
-}
-
-#if 0
-static int
-avpicture_layout (const AVPicture * src, int pix_fmt, int width, int height,
-    unsigned char *dest, int dest_size)
-{
-  PixFmtInfo *pf = get_pix_fmt_info (pix_fmt);
-  int i, j, w, h, data_planes;
-  const unsigned char *s;
-  int size = avpicture_get_size (pix_fmt, width, height);
-
-  if (size > dest_size)
-    return -1;
-
-  if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) {
-    if (pix_fmt == PIX_FMT_YUV422 ||
-        pix_fmt == PIX_FMT_UYVY422 ||
-        pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555)
-      w = width * 2;
-    else if (pix_fmt == PIX_FMT_UYVY411)
-      w = width + width / 2;
-    else if (pix_fmt == PIX_FMT_PAL8)
-      w = width;
-    else
-      w = width * (pf->depth * pf->nb_channels / 8);
-
-    data_planes = 1;
-    h = height;
-  } else {
-    data_planes = pf->nb_channels;
-    w = (width * pf->depth + 7) / 8;
-    h = height;
-  }
-
-  for (i = 0; i < data_planes; i++) {
-    if (i == 1) {
-      w = width >> pf->x_chroma_shift;
-      h = height >> pf->y_chroma_shift;
-    }
-    s = src->data[i];
-    for (j = 0; j < h; j++) {
-      memcpy (dest, s, w);
-      dest += w;
-      s += src->linesize[i];
-    }
-  }
-
-  if (pf->pixel_type == FF_PIXEL_PALETTE)
-    memcpy ((unsigned char *) (((size_t) dest + 3) & ~3), src->data[1],
-        256 * 4);
-
-  return size;
-}
-#endif
-
-int
-avpicture_get_size (int pix_fmt, int width, int height)
-{
-  AVPicture dummy_pict;
-
-  return gst_ffmpegcsp_avpicture_fill (&dummy_pict, NULL, pix_fmt, width,
-      height, FALSE);
-}
-
-/**
- * compute the loss when converting from a pixel format to another 
- */
-int
-avcodec_get_pix_fmt_loss (int dst_pix_fmt, int src_pix_fmt, int has_alpha)
-{
-  const PixFmtInfo *pf, *ps;
-  int loss;
-
-  ps = get_pix_fmt_info (src_pix_fmt);
-  pf = get_pix_fmt_info (dst_pix_fmt);
-
-  /* compute loss */
-  loss = 0;
-  if (pf->depth < ps->depth ||
-      (dst_pix_fmt == PIX_FMT_RGB555 && src_pix_fmt == PIX_FMT_RGB565))
-    loss |= FF_LOSS_DEPTH;
-  if (pf->x_chroma_shift > ps->x_chroma_shift ||
-      pf->y_chroma_shift > ps->y_chroma_shift)
-    loss |= FF_LOSS_RESOLUTION;
-  switch (pf->color_type) {
-    case FF_COLOR_RGB:
-      if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY)
-        loss |= FF_LOSS_COLORSPACE;
-      break;
-    case FF_COLOR_GRAY:
-      if (ps->color_type != FF_COLOR_GRAY)
-        loss |= FF_LOSS_COLORSPACE;
-      break;
-    case FF_COLOR_YUV:
-      if (ps->color_type != FF_COLOR_YUV)
-        loss |= FF_LOSS_COLORSPACE;
-      break;
-    case FF_COLOR_YUV_JPEG:
-      if (ps->color_type != FF_COLOR_YUV_JPEG &&
-          ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY)
-        loss |= FF_LOSS_COLORSPACE;
-      break;
-    default:
-      /* fail safe test */
-      if (ps->color_type != pf->color_type)
-        loss |= FF_LOSS_COLORSPACE;
-      break;
-  }
-  if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY)
-    loss |= FF_LOSS_CHROMA;
-  if (!pf->is_alpha && (ps->is_alpha && has_alpha))
-    loss |= FF_LOSS_ALPHA;
-  if (pf->pixel_type == FF_PIXEL_PALETTE &&
-      (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY))
-    loss |= FF_LOSS_COLORQUANT;
-  return loss;
-}
-
-static int
-avg_bits_per_pixel (int pix_fmt)
-{
-  int bits;
-  const PixFmtInfo *pf;
-
-  pf = get_pix_fmt_info (pix_fmt);
-  switch (pf->pixel_type) {
-    case FF_PIXEL_PACKED:
-      switch (pix_fmt) {
-        case PIX_FMT_YUV422:
-        case PIX_FMT_UYVY422:
-        case PIX_FMT_YVYU422:
-        case PIX_FMT_RGB565:
-        case PIX_FMT_RGB555:
-          bits = 16;
-          break;
-        case PIX_FMT_UYVY411:
-          bits = 12;
-          break;
-        default:
-          bits = pf->depth * pf->nb_channels;
-          break;
-      }
-      break;
-    case FF_PIXEL_PLANAR:
-      if (pf->x_chroma_shift == 0 && pf->y_chroma_shift == 0) {
-        bits = pf->depth * pf->nb_channels;
-      } else {
-        bits = pf->depth + ((2 * pf->depth) >>
-            (pf->x_chroma_shift + pf->y_chroma_shift));
-      }
-      break;
-    case FF_PIXEL_PALETTE:
-      bits = 8;
-      break;
-    default:
-      bits = -1;
-      break;
-  }
-  return bits;
-}
-
-static int
-avcodec_find_best_pix_fmt1 (int pix_fmt_mask,
-    int src_pix_fmt, int has_alpha, int loss_mask)
-{
-  int dist, i, loss, min_dist, dst_pix_fmt;
-
-  /* find exact color match with smallest size */
-  dst_pix_fmt = -1;
-  min_dist = 0x7fffffff;
-  for (i = 0; i < PIX_FMT_NB; i++) {
-    if (pix_fmt_mask & (1 << i)) {
-      loss = avcodec_get_pix_fmt_loss (i, src_pix_fmt, has_alpha) & loss_mask;
-      if (loss == 0) {
-        dist = avg_bits_per_pixel (i);
-        if (dist < min_dist) {
-          min_dist = dist;
-          dst_pix_fmt = i;
-        }
-      }
-    }
-  }
-  return dst_pix_fmt;
-}
-
-/** 
- * find best pixel format to convert to. Return -1 if none found 
- */
-int
-avcodec_find_best_pix_fmt (int pix_fmt_mask, int src_pix_fmt,
-    int has_alpha, int *loss_ptr)
-{
-  int dst_pix_fmt, loss_mask, i;
-  static const int loss_mask_order[] = {
-    ~0,                         /* no loss first */
-    ~FF_LOSS_ALPHA,
-    ~FF_LOSS_RESOLUTION,
-    ~(FF_LOSS_COLORSPACE | FF_LOSS_RESOLUTION),
-    ~FF_LOSS_COLORQUANT,
-    ~FF_LOSS_DEPTH,
-    0,
-  };
-
-  /* try with successive loss */
-  i = 0;
-  for (;;) {
-    loss_mask = loss_mask_order[i++];
-    dst_pix_fmt = avcodec_find_best_pix_fmt1 (pix_fmt_mask, src_pix_fmt,
-        has_alpha, loss_mask);
-    if (dst_pix_fmt >= 0)
-      goto found;
-    if (loss_mask == 0)
-      break;
-  }
-  return -1;
-found:
-  if (loss_ptr)
-    *loss_ptr = avcodec_get_pix_fmt_loss (dst_pix_fmt, src_pix_fmt, has_alpha);
-  return dst_pix_fmt;
-}
-
-static void
-img_copy_plane (uint8_t * dst, int dst_wrap,
-    const uint8_t * src, int src_wrap, int width, int height)
-{
-  for (; height > 0; height--) {
-    memcpy (dst, src, width);
-    dst += dst_wrap;
-    src += src_wrap;
-  }
-}
-
-/**
- * Copy image 'src' to 'dst'.
- */
-static void
-img_copy (AVPicture * dst, const AVPicture * src,
-    int pix_fmt, int width, int height)
-{
-  int bwidth, bits, i;
-  const PixFmtInfo *pf;
-
-  pf = get_pix_fmt_info (pix_fmt);
-  switch (pf->pixel_type) {
-    case FF_PIXEL_PACKED:
-      switch (pix_fmt) {
-        case PIX_FMT_YUV422:
-        case PIX_FMT_UYVY422:
-        case PIX_FMT_YVYU422:
-        case PIX_FMT_RGB565:
-        case PIX_FMT_RGB555:
-          bits = 16;
-          break;
-        case PIX_FMT_UYVY411:
-          bits = 12;
-          break;
-        default:
-          bits = pf->depth * pf->nb_channels;
-          break;
-      }
-      bwidth = (width * bits + 7) >> 3;
-      img_copy_plane (dst->data[0], dst->linesize[0],
-          src->data[0], src->linesize[0], bwidth, height);
-      break;
-    case FF_PIXEL_PLANAR:
-      for (i = 0; i < pf->nb_channels; i++) {
-        int w, h;
-
-        w = width;
-        h = height;
-        if (i == 1 || i == 2) {
-          w >>= pf->x_chroma_shift;
-          h >>= pf->y_chroma_shift;
-        }
-        bwidth = (w * pf->depth + 7) >> 3;
-        img_copy_plane (dst->data[i], dst->linesize[i],
-            src->data[i], src->linesize[i], bwidth, h);
-      }
-      break;
-    case FF_PIXEL_PALETTE:
-      img_copy_plane (dst->data[0], dst->linesize[0],
-          src->data[0], src->linesize[0], width, height);
-      /* copy the palette */
-      img_copy_plane (dst->data[1], dst->linesize[1],
-          src->data[1], src->linesize[1], 4, 256);
-      break;
-  }
-}
-
-/* XXX: totally non optimized */
-
-static void
-yuv422_to_yuv420p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-
-  for (; height >= 1; height -= 2) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[0];
-      cb[0] = p[1];
-      lum[1] = p[2];
-      cr[0] = p[3];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      lum[0] = p[0];
-      cb[0] = p[1];
-      cr[0] = p[3];
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    if (height > 1) {
-      p = p1;
-      lum = lum1;
-      for (w = width; w >= 2; w -= 2) {
-        lum[0] = p[0];
-        lum[1] = p[2];
-        p += 4;
-        lum += 2;
-      }
-      if (w) {
-        lum[0] = p[0];
-      }
-      p1 += src->linesize[0];
-      lum1 += dst->linesize[0];
-    }
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-static void
-uyvy422_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *lum1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[1];
-      lum[1] = p[3];
-      p += 4;
-      lum += 2;
-    }
-
-    if (w)
-      lum[0] = p[1];
-
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-  }
-}
-
-
-static void
-uyvy422_to_yuv420p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-
-  for (; height >= 1; height -= 2) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[1];
-      cb[0] = p[0];
-      lum[1] = p[3];
-      cr[0] = p[2];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      lum[0] = p[1];
-      cb[0] = p[0];
-      cr[0] = p[2];
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    if (height > 1) {
-      p = p1;
-      lum = lum1;
-      for (w = width; w >= 2; w -= 2) {
-        lum[0] = p[1];
-        lum[1] = p[3];
-        p += 4;
-        lum += 2;
-      }
-      if (w) {
-        lum[0] = p[1];
-      }
-      p1 += src->linesize[0];
-      lum1 += dst->linesize[0];
-    }
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-
-static void
-uyvy422_to_yuv422p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[1];
-      cb[0] = p[0];
-      lum[1] = p[3];
-      cr[0] = p[2];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      lum[0] = p[1];
-      cb[0] = p[0];
-      cr[0] = p[2];
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-static void
-yvyu422_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *lum1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[0];
-      lum[1] = p[2];
-      p += 4;
-      lum += 2;
-    }
-
-    if (w)
-      lum[0] = p[0];
-
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-  }
-}
-
-static void
-yvyu422_to_yuv420p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-
-  for (; height >= 1; height -= 2) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[0];
-      cb[0] = p[3];
-      lum[1] = p[2];
-      cr[0] = p[1];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      lum[0] = p[0];
-      cb[0] = p[3];
-      cr[0] = p[1];
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    if (height > 1) {
-      p = p1;
-      lum = lum1;
-      for (w = width; w >= 2; w -= 2) {
-        lum[0] = p[0];
-        lum[1] = p[2];
-        p += 4;
-        lum += 2;
-      }
-      if (w) {
-        lum[0] = p[0];
-      }
-      p1 += src->linesize[0];
-      lum1 += dst->linesize[0];
-    }
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-static void
-yvyu422_to_yuv422p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[0];
-      cb[0] = p[3];
-      lum[1] = p[2];
-      cr[0] = p[1];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      lum[0] = p[0];
-      cb[0] = p[3];
-      cr[0] = p[1];
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-static void
-yuv422_to_yuv422p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      lum[0] = p[0];
-      cb[0] = p[1];
-      lum[1] = p[2];
-      cr[0] = p[3];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      lum[0] = p[0];
-      cb[0] = p[1];
-      cr[0] = p[3];
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-static void
-yuv422p_to_yuv422 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *p, *p1;
-  const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = dst->data[0];
-  lum1 = src->data[0];
-  cb1 = src->data[1];
-  cr1 = src->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      p[0] = lum[0];
-      p[1] = cb[0];
-      p[2] = lum[1];
-      p[3] = cr[0];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      p[0] = lum[0];
-      p[1] = cb[0];
-      p[3] = cr[0];
-    }
-    p1 += dst->linesize[0];
-    lum1 += src->linesize[0];
-    cb1 += src->linesize[1];
-    cr1 += src->linesize[2];
-  }
-}
-
-static void
-yuv422p_to_uyvy422 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *p, *p1;
-  const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = dst->data[0];
-  lum1 = src->data[0];
-  cb1 = src->data[1];
-  cr1 = src->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      p[1] = lum[0];
-      p[0] = cb[0];
-      p[3] = lum[1];
-      p[2] = cr[0];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      p[1] = lum[0];
-      p[0] = cb[0];
-      p[2] = cr[0];
-    }
-    p1 += dst->linesize[0];
-    lum1 += src->linesize[0];
-    cb1 += src->linesize[1];
-    cr1 += src->linesize[2];
-  }
-}
-
-static void
-yuv422p_to_yvyu422 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *p, *p1;
-  const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = dst->data[0];
-  lum1 = src->data[0];
-  cb1 = src->data[1];
-  cr1 = src->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 2; w -= 2) {
-      p[0] = lum[0];
-      p[3] = cb[0];
-      p[2] = lum[1];
-      p[1] = cr[0];
-      p += 4;
-      lum += 2;
-      cb++;
-      cr++;
-    }
-    if (w) {
-      p[0] = lum[0];
-      p[3] = cb[0];
-      p[1] = cr[0];
-    }
-    p1 += dst->linesize[0];
-    lum1 += src->linesize[0];
-    cb1 += src->linesize[1];
-    cr1 += src->linesize[2];
-  }
-}
-
-static void
-uyvy411_to_yuv411p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *p, *p1;
-  uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = src->data[0];
-  lum1 = dst->data[0];
-  cb1 = dst->data[1];
-  cr1 = dst->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 4; w -= 4) {
-      cb[0] = p[0];
-      lum[0] = p[1];
-      lum[1] = p[2];
-      cr[0] = p[3];
-      lum[2] = p[4];
-      lum[3] = p[5];
-      p += 6;
-      lum += 4;
-      cb++;
-      cr++;
-    }
-    p1 += src->linesize[0];
-    lum1 += dst->linesize[0];
-    cb1 += dst->linesize[1];
-    cr1 += dst->linesize[2];
-  }
-}
-
-static void
-yuv411p_to_uyvy411 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *p, *p1;
-  const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
-  int w;
-
-  p1 = dst->data[0];
-  lum1 = src->data[0];
-  cb1 = src->data[1];
-  cr1 = src->data[2];
-  for (; height > 0; height--) {
-    p = p1;
-    lum = lum1;
-    cb = cb1;
-    cr = cr1;
-    for (w = width; w >= 4; w -= 4) {
-      p[0] = cb[0];
-      p[1] = lum[0];
-      p[2] = lum[1];
-      p[3] = cr[0];
-      p[4] = lum[2];
-      p[5] = lum[3];
-      p += 6;
-      lum += 4;
-      cb++;
-      cr++;
-    }
-    p1 += dst->linesize[0];
-    lum1 += src->linesize[0];
-    cb1 += src->linesize[1];
-    cr1 += src->linesize[2];
-  }
-}
-
-static void
-yuv420p_to_yuv422 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int w, h;
-  uint8_t *line1, *line2, *linesrc = dst->data[0];
-  uint8_t *lum1, *lum2, *lumsrc = src->data[0];
-  uint8_t *cb1, *cb2 = src->data[1];
-  uint8_t *cr1, *cr2 = src->data[2];
-
-  for (h = height / 2; h--;) {
-    line1 = linesrc;
-    line2 = linesrc + dst->linesize[0];
-
-    lum1 = lumsrc;
-    lum2 = lumsrc + src->linesize[0];
-
-    cb1 = cb2;
-    cr1 = cr2;
-
-    for (w = width / 2; w--;) {
-      *line1++ = *lum1++;
-      *line2++ = *lum2++;
-      *line1++ = *line2++ = *cb1++;
-      *line1++ = *lum1++;
-      *line2++ = *lum2++;
-      *line1++ = *line2++ = *cr1++;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      *line1++ = *lum1++;
-      *line2++ = *lum2++;
-      *line1++ = *line2++ = *cb1++;
-    }
-
-    linesrc += dst->linesize[0] * 2;
-    lumsrc += src->linesize[0] * 2;
-    cb2 += src->linesize[1];
-    cr2 += src->linesize[2];
-  }
-  /* odd height */
-  if (height % 2 != 0) {
-    line1 = linesrc;
-    lum1 = lumsrc;
-    cb1 = cb2;
-    cr1 = cr2;
-
-    for (w = width / 2; w--;) {
-      *line1++ = *lum1++;
-      *line1++ = *cb1++;
-      *line1++ = *lum1++;
-      *line1++ = *cr1++;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      *line1++ = *lum1++;
-      *line1++ = *cb1++;
-    }
-  }
-}
-
-static void
-nv12_to_nv21 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const uint8_t *s_c_ptr;
-  uint8_t *d_c_ptr;
-  int w, c_wrap;
-
-  memcpy (dst->data[0], src->data[0], src->linesize[0] * height);
-
-  s_c_ptr = src->data[1];
-  d_c_ptr = dst->data[1];
-  c_wrap = src->linesize[1] - ((width + 1) & ~0x01);
-
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      d_c_ptr[0] = s_c_ptr[1];
-      d_c_ptr[1] = s_c_ptr[0];
-      s_c_ptr += 2;
-      d_c_ptr += 2;
-    }
-
-    /* handle odd width */
-    if (w) {
-      d_c_ptr[0] = s_c_ptr[1];
-      d_c_ptr[1] = s_c_ptr[0];
-      s_c_ptr += 2;
-      d_c_ptr += 2;
-    }
-    s_c_ptr += c_wrap;
-    d_c_ptr += c_wrap;
-  }
-
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      d_c_ptr[0] = s_c_ptr[1];
-      d_c_ptr[1] = s_c_ptr[0];
-      s_c_ptr += 2;
-      d_c_ptr += 2;
-    }
-
-    /* handle odd width */
-    if (w) {
-      d_c_ptr[0] = s_c_ptr[1];
-      d_c_ptr[1] = s_c_ptr[0];
-      s_c_ptr += 2;
-      d_c_ptr += 2;
-    }
-  }
-}
-
-static void
-nv12_to_yuv444p (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  int w, h;
-  uint8_t *dst_lum1, *dst_lum2, *dst_line = dst->data[0];
-  uint8_t *dst_cb1, *dst_cb2, *dst_cb_line = dst->data[1];
-  uint8_t *dst_cr1, *dst_cr2, *dst_cr_line = dst->data[2];
-  uint8_t *lum1, *lum2, *src_lum_line = src->data[0];
-  uint8_t *src_c1, *src_c_line = src->data[1];
-  uint8_t cb, cr;
-
-  for (h = height / 2; h--;) {
-    dst_lum1 = dst_line;
-    dst_lum2 = dst_line + dst->linesize[0];
-
-    dst_cb1 = dst_cb_line;
-    dst_cb2 = dst_cb_line + dst->linesize[1];
-    dst_cr1 = dst_cr_line;
-    dst_cr2 = dst_cr_line + dst->linesize[2];
-
-    lum1 = src_lum_line;
-    lum2 = src_lum_line + src->linesize[0];
-
-    src_c1 = src_c_line;
-
-    for (w = width / 2; w--;) {
-      cb = *src_c1++;
-      cr = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_lum2++ = *lum2++;
-      *dst_cb1++ = *dst_cb2++ = cb;
-      *dst_cr1++ = *dst_cr2++ = cr;
-      *dst_lum1++ = *lum1++;
-      *dst_lum2++ = *lum2++;
-      *dst_cb1++ = *dst_cb2++ = cb;
-      *dst_cr1++ = *dst_cr2++ = cr;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      cb = *src_c1++;
-      cr = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_lum2++ = *lum2++;
-      *dst_cb1++ = *dst_cb2++ = *src_c1++;
-      *dst_cr1++ = *dst_cr2++ = *src_c1++;
-    }
-
-    dst_line += dst->linesize[0] * 2;
-    dst_cb_line += dst->linesize[1] * 2;
-    dst_cr_line += dst->linesize[2] * 2;
-    src_lum_line += src->linesize[0] * 2;
-    src_c_line += src->linesize[1];
-  }
-
-  /* odd height */
-  if (height % 2 != 0) {
-    dst_lum1 = dst_line;
-    lum1 = src_lum_line;
-    src_c1 = src_c_line;
-    dst_cb1 = dst_cb_line;
-    dst_cr1 = dst_cr_line;
-
-    for (w = width / 2; w--;) {
-      cb = *src_c1++;
-      cr = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_cb1++ = cb;
-      *dst_cr1++ = cr;
-      *dst_lum1++ = *lum1++;
-      *dst_cb1++ = cb;
-      *dst_cr1++ = cr;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      cb = *src_c1++;
-      cr = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_cb1++ = cb;
-      *dst_cr1++ = cr;
-    }
-  }
-}
-
-#define nv21_to_nv12 nv12_to_nv21
-
-static void
-nv21_to_yuv444p (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  int w, h;
-  uint8_t *dst_lum1, *dst_lum2, *dst_line = dst->data[0];
-  uint8_t *dst_cb1, *dst_cb2, *dst_cb_line = dst->data[1];
-  uint8_t *dst_cr1, *dst_cr2, *dst_cr_line = dst->data[2];
-  uint8_t *lum1, *lum2, *src_lum_line = src->data[0];
-  uint8_t *src_c1, *src_c_line = src->data[1];
-  uint8_t cb, cr;
-
-  for (h = height / 2; h--;) {
-    dst_lum1 = dst_line;
-    dst_lum2 = dst_line + dst->linesize[0];
-
-    dst_cb1 = dst_cb_line;
-    dst_cb2 = dst_cb_line + dst->linesize[1];
-    dst_cr1 = dst_cr_line;
-    dst_cr2 = dst_cr_line + dst->linesize[2];
-
-    lum1 = src_lum_line;
-    lum2 = src_lum_line + src->linesize[0];
-
-    src_c1 = src_c_line;
-
-    for (w = width / 2; w--;) {
-      cr = *src_c1++;
-      cb = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_lum2++ = *lum2++;
-      *dst_cb1++ = *dst_cb2++ = cb;
-      *dst_cr1++ = *dst_cr2++ = cr;
-      *dst_lum1++ = *lum1++;
-      *dst_lum2++ = *lum2++;
-      *dst_cb1++ = *dst_cb2++ = cb;
-      *dst_cr1++ = *dst_cr2++ = cr;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      cr = *src_c1++;
-      cb = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_lum2++ = *lum2++;
-      *dst_cb1++ = *dst_cb2++ = *src_c1++;
-      *dst_cr1++ = *dst_cr2++ = *src_c1++;
-    }
-
-    dst_line += dst->linesize[0] * 2;
-    dst_cb_line += dst->linesize[1] * 2;
-    dst_cr_line += dst->linesize[2] * 2;
-    src_lum_line += src->linesize[0] * 2;
-    src_c_line += src->linesize[1];
-  }
-
-  /* odd height */
-  if (height % 2 != 0) {
-    dst_lum1 = dst_line;
-    lum1 = src_lum_line;
-    src_c1 = src_c_line;
-
-    dst_cb1 = dst_cb_line;
-    dst_cr1 = dst_cr_line;
-
-    for (w = width / 2; w--;) {
-      cr = *src_c1++;
-      cb = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_cb1++ = cb;
-      *dst_cr1++ = cr;
-      *dst_lum1++ = *lum1++;
-      *dst_cb1++ = cb;
-      *dst_cr1++ = cr;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      cr = *src_c1++;
-      cb = *src_c1++;
-      *dst_lum1++ = *lum1++;
-      *dst_cb1++ = cb;
-      *dst_cr1++ = cr;
-    }
-  }
-}
-
-static void
-yuva420p_to_yuv420p (AVPicture * dst, const AVPicture * src, int width,
-    int height)
-{
-  memcpy (dst->data[0], src->data[0], dst->linesize[0] * height);
-  memcpy (dst->data[1], src->data[1], dst->linesize[1] * ((height + 1) / 2));
-  memcpy (dst->data[2], src->data[2], dst->linesize[2] * ((height + 1) / 2));
-}
-
-static void
-yuva420p_to_yuv422 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int w, h;
-  uint8_t *line1, *line2, *linesrc = dst->data[0];
-  uint8_t *lum1, *lum2, *lumsrc = src->data[0];
-  uint8_t *cb1, *cb2 = src->data[1];
-  uint8_t *cr1, *cr2 = src->data[2];
-
-  for (h = height / 2; h--;) {
-    line1 = linesrc;
-    line2 = linesrc + dst->linesize[0];
-
-    lum1 = lumsrc;
-    lum2 = lumsrc + src->linesize[0];
-
-    cb1 = cb2;
-    cr1 = cr2;
-
-    for (w = width / 2; w--;) {
-      *line1++ = *lum1++;
-      *line2++ = *lum2++;
-      *line1++ = *line2++ = *cb1++;
-      *line1++ = *lum1++;
-      *line2++ = *lum2++;
-      *line1++ = *line2++ = *cr1++;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      *line1++ = *lum1++;
-      *line2++ = *lum2++;
-      *line1++ = *line2++ = *cb1++;
-    }
-
-    linesrc += dst->linesize[0] * 2;
-    lumsrc += src->linesize[0] * 2;
-    cb2 += src->linesize[1];
-    cr2 += src->linesize[2];
-  }
-  /* odd height */
-  if (height % 2 != 0) {
-    line1 = linesrc;
-    lum1 = lumsrc;
-    cb1 = cb2;
-    cr1 = cr2;
-
-    for (w = width / 2; w--;) {
-      *line1++ = *lum1++;
-      *line1++ = *cb1++;
-      *line1++ = *lum1++;
-      *line1++ = *cr1++;
-    }
-    /* odd width */
-    if (width % 2 != 0) {
-      *line1++ = *lum1++;
-      *line1++ = *cb1++;
-    }
-  }
-}
-
-#define SCALEBITS 10
-#define ONE_HALF  (1 << (SCALEBITS - 1))
-#define FIX(x)    ((int) ((x) * (1<<SCALEBITS) + 0.5))
-
-#define YUV_TO_RGB1_CCIR(cb1, cr1)\
-{\
-    cb = (cb1) - 128;\
-    cr = (cr1) - 128;\
-    r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\
-    g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \
-            ONE_HALF;\
-    b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\
-}
-
-#define YUV_TO_RGB2_CCIR(r, g, b, y1)\
-{\
-    y = ((y1) - 16) * FIX(255.0/219.0);\
-    r = cm[(y + r_add) >> SCALEBITS];\
-    g = cm[(y + g_add) >> SCALEBITS];\
-    b = cm[(y + b_add) >> SCALEBITS];\
-}
-
-#define YUV_TO_RGB1(cb1, cr1)\
-{\
-    cb = (cb1) - 128;\
-    cr = (cr1) - 128;\
-    r_add = FIX(1.40200) * cr + ONE_HALF;\
-    g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\
-    b_add = FIX(1.77200) * cb + ONE_HALF;\
-}
-
-#define YUV_TO_RGB2(r, g, b, y1)\
-{\
-    y = (y1) << SCALEBITS;\
-    r = cm[(y + r_add) >> SCALEBITS];\
-    g = cm[(y + g_add) >> SCALEBITS];\
-    b = cm[(y + b_add) >> SCALEBITS];\
-}
-
-#define Y_CCIR_TO_JPEG(y)\
- cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS]
-
-#define Y_JPEG_TO_CCIR(y)\
- (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
-
-#define C_CCIR_TO_JPEG(y)\
- cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS]
-
-/* NOTE: the clamp is really necessary! */
-static inline int
-C_JPEG_TO_CCIR (int y)
-{
-  y = (((y - 128) * FIX (112.0 / 127.0) + (ONE_HALF +
-              (128 << SCALEBITS))) >> SCALEBITS);
-  if (y < 16)
-    y = 16;
-  return y;
-}
-
-
-#define RGB_TO_Y(r, g, b) \
-((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \
-  FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS)
-
-#define RGB_TO_U(r1, g1, b1, shift)\
-(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +         \
-     FIX(0.50000) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_V(r1, g1, b1, shift)\
-(((FIX(0.50000) * r1 - FIX(0.41869) * g1 -           \
-   FIX(0.08131) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_Y_CCIR(r, g, b) \
-((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \
-  FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
-
-#define RGB_TO_U_CCIR(r1, g1, b1, shift)\
-(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 +         \
-     FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_V_CCIR(r1, g1, b1, shift)\
-(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 -           \
-   FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-static uint8_t y_ccir_to_jpeg[256];
-static uint8_t y_jpeg_to_ccir[256];
-static uint8_t c_ccir_to_jpeg[256];
-static uint8_t c_jpeg_to_ccir[256];
-
-/* init various conversion tables */
-static void
-img_convert_init (void)
-{
-  int i;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-
-  for (i = 0; i < 256; i++) {
-    y_ccir_to_jpeg[i] = Y_CCIR_TO_JPEG (i);
-    y_jpeg_to_ccir[i] = Y_JPEG_TO_CCIR (i);
-    c_ccir_to_jpeg[i] = C_CCIR_TO_JPEG (i);
-    c_jpeg_to_ccir[i] = C_JPEG_TO_CCIR (i);
-  }
-}
-
-/* apply to each pixel the given table */
-static void
-img_apply_table (uint8_t * dst, int dst_wrap,
-    const uint8_t * src, int src_wrap,
-    int width, int height, const uint8_t * table1)
-{
-  int n;
-  const uint8_t *s;
-  uint8_t *d;
-  const uint8_t *table;
-
-  table = table1;
-  for (; height > 0; height--) {
-    s = src;
-    d = dst;
-    n = width;
-    while (n >= 4) {
-      d[0] = table[s[0]];
-      d[1] = table[s[1]];
-      d[2] = table[s[2]];
-      d[3] = table[s[3]];
-      d += 4;
-      s += 4;
-      n -= 4;
-    }
-    while (n > 0) {
-      d[0] = table[s[0]];
-      d++;
-      s++;
-      n--;
-    }
-    dst += dst_wrap;
-    src += src_wrap;
-  }
-}
-
-/* XXX: use generic filter ? */
-/* XXX: in most cases, the sampling position is incorrect */
-
-static void
-img_copy_plane_resize (uint8_t * dst, int dst_wrap, int dst_width,
-    int dst_height, const uint8_t * src, int src_wrap, int src_width,
-    int src_height)
-{
-  img_copy_plane (dst, dst_wrap, src, src_wrap, dst_width, dst_height);
-}
-
-/* 4x1 -> 1x1 */
-static void
-shrink41 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  int w, s_w;
-  const uint8_t *s;
-  uint8_t *d;
-
-  for (; dst_height > 0; dst_height--) {
-    s = src;
-    d = dst;
-    for (s_w = src_width, w = dst_width; w > 0 && s_w > 3; w--, s_w -= 4) {
-      d[0] = (s[0] + s[1] + s[2] + s[3] + 2) >> 2;
-      s += 4;
-      d++;
-    }
-
-    if (w) {
-      if (s_w == 3)
-        d[0] = (s[0] + s[1] + s[2]) / 3;
-      else if (s_w == 2)
-        d[0] = (s[0] + s[1]) / 2;
-      else                      /* s_w == 1 */
-        d[0] = s[0];
-    }
-
-    src += src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 2x1 -> 1x1 */
-static void
-shrink21 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  int w, s_w;
-  const uint8_t *s;
-  uint8_t *d;
-
-  for (; dst_height > 0; dst_height--) {
-    s = src;
-    d = dst;
-    for (s_w = src_width, w = dst_width; w > 0 && s_w > 1; w--, s_w -= 2) {
-      d[0] = (s[0] + s[1]) >> 1;
-      s += 2;
-      d++;
-    }
-
-    if (w)                      /* s_w == 1 */
-      d[0] = s[0];
-
-    src += src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 1x2 -> 1x1 */
-static void
-shrink12 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  int w;
-  uint8_t *d;
-  const uint8_t *s1, *s2;
-
-  for (; dst_height > 0; dst_height--, src_height -= 2) {
-    s1 = src;
-    s2 = s1 + (src_height > 1 ? src_wrap : 0);
-    d = dst;
-    for (w = dst_width; w >= 4; w -= 4) {
-      d[0] = (s1[0] + s2[0]) >> 1;
-      d[1] = (s1[1] + s2[1]) >> 1;
-      d[2] = (s1[2] + s2[2]) >> 1;
-      d[3] = (s1[3] + s2[3]) >> 1;
-      s1 += 4;
-      s2 += 4;
-      d += 4;
-    }
-    for (; w > 0; w--) {
-      d[0] = (s1[0] + s2[0]) >> 1;
-      s1++;
-      s2++;
-      d++;
-    }
-    src += 2 * src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 2x2 -> 1x1 */
-static void
-shrink22 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  int w, s_w;
-  const uint8_t *s1, *s2;
-  uint8_t *d;
-
-  for (; dst_height > 0; dst_height--, src_height -= 2) {
-    s1 = src;
-    s2 = s1 + (src_height > 1 ? src_wrap : 0);
-    d = dst;
-    for (s_w = src_width, w = dst_width; w >= 4; w -= 4, s_w -= 8) {
-      d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
-      d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
-      d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
-      d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
-      s1 += 8;
-      s2 += 8;
-      d += 4;
-    }
-    for (; w > 0 && s_w > 1; w--, s_w -= 2) {
-      d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
-      s1 += 2;
-      s2 += 2;
-      d++;
-    }
-
-    if (w)
-      d[0] = (s1[0] + s2[0] + 1) >> 1;
-
-    src += 2 * src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 4x4 -> 1x1 */
-static void
-shrink44 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  int s_w, w;
-  const uint8_t *s1, *s2, *s3, *s4;
-  uint8_t *d;
-
-  for (; dst_height > 0; dst_height--, src_height -= 4) {
-    s1 = src;
-    s2 = s1 + (src_height > 1 ? src_wrap : 0);
-    s3 = s2 + (src_height > 2 ? src_wrap : 0);
-    s4 = s3 + (src_height > 3 ? src_wrap : 0);
-    d = dst;
-    for (s_w = src_width, w = dst_width; s_w > 3 && w > 0; w--, s_w -= 4) {
-      d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
-          s2[0] + s2[1] + s2[2] + s2[3] +
-          s3[0] + s3[1] + s3[2] + s3[3] +
-          s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
-      s1 += 4;
-      s2 += 4;
-      s3 += 4;
-      s4 += 4;
-      d++;
-    }
-
-    if (w) {
-      if (s_w == 3)
-        d[0] = (s1[0] + s1[1] + s1[2] +
-            s2[0] + s2[1] + s2[2] +
-            s3[0] + s3[1] + s3[2] + s4[0] + s4[1] + s4[2]) / 12;
-      else if (s_w == 2)
-        d[0] = (s1[0] + s1[1] +
-            s2[0] + s2[1] + s3[0] + s3[1] + s4[0] + s4[1]) / 8;
-      else                      /* s_w == 1 */
-        d[0] = (s1[0] + s2[0] + s3[0] + s4[0]) / 4;
-    }
-
-    src += 4 * src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-static void
-grow21_line (uint8_t * dst, const uint8_t * src, int width)
-{
-  int w;
-  const uint8_t *s1;
-  uint8_t *d;
-
-  s1 = src;
-  d = dst;
-  for (w = width; w >= 4; w -= 4) {
-    d[1] = d[0] = s1[0];
-    d[3] = d[2] = s1[1];
-    s1 += 2;
-    d += 4;
-  }
-  for (; w >= 2; w -= 2) {
-    d[1] = d[0] = s1[0];
-    s1++;
-    d += 2;
-  }
-  /* only needed if width is not a multiple of two */
-  if (w) {
-    d[0] = s1[0];
-  }
-}
-
-static void
-grow41_line (uint8_t * dst, const uint8_t * src, int width)
-{
-  int w, v;
-  const uint8_t *s1;
-  uint8_t *d;
-
-  s1 = src;
-  d = dst;
-  for (w = width; w >= 4; w -= 4) {
-    v = s1[0];
-    d[0] = v;
-    d[1] = v;
-    d[2] = v;
-    d[3] = v;
-    s1++;
-    d += 4;
-  }
-  for (; w > 0; w--) {
-    d[0] = s1[0];
-    d++;
-  }
-}
-
-/* 1x1 -> 2x1 */
-static void
-grow21 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  for (; dst_height > 0; dst_height--) {
-    grow21_line (dst, src, dst_width);
-    src += src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 1x1 -> 2x2 */
-static void
-grow22 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  for (; dst_height > 0; dst_height--) {
-    grow21_line (dst, src, dst_width);
-    if (dst_height % 2)
-      src += src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 1x1 -> 4x1 */
-static void
-grow41 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  for (; dst_height > 0; dst_height--) {
-    grow41_line (dst, src, dst_width);
-    src += src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 1x1 -> 4x4 */
-static void
-grow44 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  for (; dst_height > 0; dst_height--) {
-    grow41_line (dst, src, dst_width);
-    if ((dst_height & 3) == 1)
-      src += src_wrap;
-    dst += dst_wrap;
-  }
-}
-
-/* 1x2 -> 2x1 */
-static void
-conv411 (uint8_t * dst, int dst_wrap, int dst_width, int dst_height,
-    const uint8_t * src, int src_wrap, int src_width, int src_height)
-{
-  int w, c;
-  const uint8_t *s1, *s2;
-  uint8_t *d;
-
-  for (; dst_height > 0; dst_height--, src_height -= 2) {
-    s1 = src;
-    s2 = src + (src_height > 1 ? src_wrap : 0);
-    d = dst;
-    for (w = dst_width; w > 1; w -= 2) {
-      c = (s1[0] + s2[0]) >> 1;
-      d[0] = c;
-      d[1] = c;
-      s1++;
-      s2++;
-      d += 2;
-    }
-
-    if (w) {
-      d[0] = (s1[0] + s2[0]) >> 1;
-    }
-
-    src += src_wrap * 2;
-    dst += dst_wrap;
-  }
-}
-
-/* XXX: add jpeg quantize code */
-
-#define TRANSP_INDEX (6*6*6)
-
-/* this is maybe slow, but allows for extensions */
-static inline unsigned char
-gif_clut_index (uint8_t r, uint8_t g, uint8_t b)
-{
-  return ((((r) / 47) % 6) * 6 * 6 + (((g) / 47) % 6) * 6 + (((b) / 47) % 6));
-}
-
-static void
-build_rgb_palette (uint8_t * palette, int has_alpha)
-{
-  uint32_t *pal;
-  static const uint8_t pal_value[6] = { 0x00, 0x33, 0x66, 0x99, 0xcc, 0xff };
-  int i, r, g, b;
-
-  pal = (uint32_t *) palette;
-  i = 0;
-  for (r = 0; r < 6; r++) {
-    for (g = 0; g < 6; g++) {
-      for (b = 0; b < 6; b++) {
-        pal[i++] = (0xffU << 24) | (pal_value[r] << 16) |
-            (pal_value[g] << 8) | pal_value[b];
-      }
-    }
-  }
-  if (has_alpha)
-    pal[i++] = 0;
-  while (i < 256)
-    pal[i++] = 0xff000000;
-}
-
-/* copy bit n to bits 0 ... n - 1 */
-static inline unsigned int
-bitcopy_n (unsigned int a, int n)
-{
-  int mask;
-
-  mask = (1 << n) - 1;
-  return (a & (0xff & ~mask)) | ((-((a >> n) & 1)) & mask);
-}
-
-/* rgb555 handling */
-
-#define RGB_NAME rgb555
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint16_t *)(s))[0];\
-    r = bitcopy_n(v >> (10 - 3), 3);\
-    g = bitcopy_n(v >> (5 - 3), 3);\
-    b = bitcopy_n(v << 3, 3);\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint16_t *)(s))[0];\
-    r = bitcopy_n(v >> (10 - 3), 3);\
-    g = bitcopy_n(v >> (5 - 3), 3);\
-    b = bitcopy_n(v << 3, 3);\
-    a = (-(v >> 15)) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint16_t *)(d))[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3) | \
-                           ((a << 8) & 0x8000);\
-}
-
-#define BPP 2
-
-#include "imgconvert_template.h"
-
-/* rgb565 handling */
-
-#define RGB_NAME rgb565
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint16_t *)(s))[0];\
-    r = bitcopy_n(v >> (11 - 3), 3);\
-    g = bitcopy_n(v >> (5 - 2), 2);\
-    b = bitcopy_n(v << 3, 3);\
-}
-
-#define RGB_OUT(d, r, g, b)\
-{\
-    ((uint16_t *)(d))[0] = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);\
-}
-
-#define BPP 2
-
-#include "imgconvert_template.h"
-
-/* bgr24 handling */
-
-#define RGB_NAME bgr24
-
-#define RGB_IN(r, g, b, s)\
-{\
-    b = (s)[0];\
-    g = (s)[1];\
-    r = (s)[2];\
-}
-
-#define RGB_OUT(d, r, g, b)\
-{\
-    (d)[0] = b;\
-    (d)[1] = g;\
-    (d)[2] = r;\
-}
-
-#define BPP 3
-
-#include "imgconvert_template.h"
-
-#undef RGB_IN
-#undef RGB_OUT
-#undef BPP
-
-/* rgb24 handling */
-
-#define RGB_NAME rgb24
-#define FMT_RGB24
-
-#define RGB_IN(r, g, b, s)\
-{\
-    r = (s)[0];\
-    g = (s)[1];\
-    b = (s)[2];\
-}
-
-#define RGB_OUT(d, r, g, b)\
-{\
-    (d)[0] = r;\
-    (d)[1] = g;\
-    (d)[2] = b;\
-}
-
-#define BPP 3
-
-#include "imgconvert_template.h"
-
-/* rgb32 handling */
-
-#define RGB_NAME rgb32
-#define FMT_RGBA32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 16) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = v & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = 0xff;\
-    r = (v >> 16) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = v & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = (a << 24) | (r << 16) | (g << 8) | b;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* bgr32 handling */
-
-#define RGB_NAME bgr32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 8) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = 0xff;\
-    r = (v >> 8) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = a | (r << 8) | (g << 16) | (b << 24);\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* xrgb32 handling */
-
-#define RGB_NAME xrgb32
-#define FMT_RGBA32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 24) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 8) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = 0xff;\
-    r = (v >> 24) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 8) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = (r << 24) | (g << 16) | (b << 8) | a;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* bgrx32 handling */
-
-#define RGB_NAME bgrx32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = (v >> 16) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = 0xff;\
-    r = (v) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = (v >> 16) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = r | (g << 8) | (b << 16) | (a << 24);\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* rgba32 handling */
-
-#define RGB_NAME rgba32
-#define FMT_RGBA32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 16) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = v & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = (v >> 24) & 0xff;\
-    r = (v >> 16) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = v & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = (a << 24) | (r << 16) | (g << 8) | b;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* bgra32 handling */
-
-#define RGB_NAME bgra32
-#define FMT_BGRA32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 8) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = v & 0xff;\
-    r = (v >> 8) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = a | (r << 8) | (g << 16) | (b << 24 );\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* argb32 handling */
-
-#define RGB_NAME argb32
-#define FMT_ARGB32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 24) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 8) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = (v >> 24) & 0xff;\
-    g = (v >> 16) & 0xff;\
-    b = (v >> 8) & 0xff;\
-    a = v & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = (r << 24) | (g << 16) | (b << 8) | a;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* abgr32 handling */
-
-#define RGB_NAME abgr32
-#define FMT_ABGR32
-
-#define RGB_IN(r, g, b, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = v & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = (v >> 16) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    r = v & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = (v >> 16) & 0xff;\
-    a = (v >> 24) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
-    ((uint32_t *)(d))[0] = r | (g << 8) | (b << 16) | (a << 24 );\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-static void
-gray_to_gray16_l (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      GST_WRITE_UINT16_LE (q, (*p << 8));
-      q += 2;
-      p++;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-gray_to_gray16_b (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      GST_WRITE_UINT16_BE (q, (*p << 8));
-      q += 2;
-      p++;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-gray16_l_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      q[0] = GST_READ_UINT16_LE (p) >> 8;
-      q++;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-gray16_b_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      q[0] = GST_READ_UINT16_BE (p) >> 8;
-      q++;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-gray16_b_to_gray16_l (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      q[0] = p[1];
-      q[1] = p[0];
-      q += 2;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-mono_to_gray (AVPicture * dst, const AVPicture * src,
-    int width, int height, int xor_mask)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int v, dst_wrap, src_wrap;
-  int y, w;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - ((width + 7) >> 3);
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-  for (y = 0; y < height; y++) {
-    w = width;
-    while (w >= 8) {
-      v = *p++ ^ xor_mask;
-      q[0] = -(v >> 7);
-      q[1] = -((v >> 6) & 1);
-      q[2] = -((v >> 5) & 1);
-      q[3] = -((v >> 4) & 1);
-      q[4] = -((v >> 3) & 1);
-      q[5] = -((v >> 2) & 1);
-      q[6] = -((v >> 1) & 1);
-      q[7] = -((v >> 0) & 1);
-      w -= 8;
-      q += 8;
-    }
-    if (w > 0) {
-      v = *p++ ^ xor_mask;
-      do {
-        q[0] = -((v >> 7) & 1);
-        q++;
-        v <<= 1;
-      } while (--w);
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-monowhite_to_gray (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  mono_to_gray (dst, src, width, height, 0xff);
-}
-
-static void
-monoblack_to_gray (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  mono_to_gray (dst, src, width, height, 0x00);
-}
-
-static void
-gray_to_mono (AVPicture * dst, const AVPicture * src,
-    int width, int height, int xor_mask)
-{
-  int n;
-  const uint8_t *s;
-  uint8_t *d;
-  int j, b, v, n1, src_wrap, dst_wrap, y;
-
-  s = src->data[0];
-  src_wrap = src->linesize[0] - width;
-
-  d = dst->data[0];
-  dst_wrap = dst->linesize[0] - ((width + 7) >> 3);
-
-  for (y = 0; y < height; y++) {
-    n = width;
-    while (n >= 8) {
-      v = 0;
-      for (j = 0; j < 8; j++) {
-        b = s[0];
-        s++;
-        v = (v << 1) | (b >> 7);
-      }
-      d[0] = v ^ xor_mask;
-      d++;
-      n -= 8;
-    }
-    if (n > 0) {
-      n1 = n;
-      v = 0;
-      while (n > 0) {
-        b = s[0];
-        s++;
-        v = (v << 1) | (b >> 7);
-        n--;
-      }
-      d[0] = (v << (8 - (n1 & 7))) ^ xor_mask;
-      d++;
-    }
-    s += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-static void
-gray_to_monowhite (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  gray_to_mono (dst, src, width, height, 0xff);
-}
-
-static void
-gray_to_monoblack (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  gray_to_mono (dst, src, width, height, 0x00);
-}
-
-static void
-y800_to_y16 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      GST_WRITE_UINT16_LE (q, (*p << 8));
-      q += 2;
-      p++;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-y16_to_y800 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      q[0] = GST_READ_UINT16_LE (p) >> 8;
-      q++;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void
-yuva420p_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *a1_ptr, *a2_ptr;
-  uint8_t *d, *d1, *d2;
-  int w, width2;
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  cb_ptr = src->data[1];
-  cr_ptr = src->data[2];
-  a1_ptr = src->data[3];
-  width2 = (width + 1) >> 1;
-  for (; height >= 2; height -= 2) {
-    d1 = d;
-    d2 = d + dst->linesize[0];
-    y2_ptr = y1_ptr + src->linesize[0];
-    a2_ptr = a1_ptr + src->linesize[3];
-    for (w = width; w >= 2; w -= 2) {
-      d1[0] = a1_ptr[0];
-      d1[1] = y1_ptr[0];
-      d1[2] = cb_ptr[0];
-      d1[3] = cr_ptr[0];
-
-      d1[4 + 0] = a1_ptr[1];
-      d1[4 + 1] = y1_ptr[1];
-      d1[4 + 2] = cb_ptr[0];
-      d1[4 + 3] = cr_ptr[0];
-
-      d2[0] = a2_ptr[0];
-      d2[1] = y2_ptr[0];
-      d2[2] = cb_ptr[0];
-      d2[3] = cr_ptr[0];
-
-      d2[4 + 0] = a2_ptr[1];
-      d2[4 + 1] = y2_ptr[1];
-      d2[4 + 2] = cb_ptr[0];
-      d2[4 + 3] = cr_ptr[0];
-
-      d1 += 2 * 4;
-      d2 += 2 * 4;
-
-      y1_ptr += 2;
-      y2_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr += 2;
-      a2_ptr += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      d1[0] = a1_ptr[0];
-      d1[1] = y1_ptr[0];
-      d1[2] = cb_ptr[0];
-      d1[3] = cr_ptr[0];
-
-      d2[0] = a2_ptr[0];
-      d2[1] = y2_ptr[0];
-      d2[2] = cb_ptr[0];
-      d2[3] = cr_ptr[0];
-
-      d1 += 4;
-      d2 += 4;
-      y1_ptr++;
-      y2_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr++;
-      a2_ptr++;
-    }
-    d += 2 * dst->linesize[0];
-    y1_ptr += 2 * src->linesize[0] - width;
-    cb_ptr += src->linesize[1] - width2;
-    cr_ptr += src->linesize[2] - width2;
-    a1_ptr += 2 * src->linesize[3] - width;
-  }
-  /* handle odd height */
-  if (height) {
-    d1 = d;
-    for (w = width; w >= 2; w -= 2) {
-      d1[0] = a1_ptr[0];
-      d1[1] = y1_ptr[0];
-      d1[2] = cb_ptr[0];
-      d1[3] = cr_ptr[0];
-
-      d1[4 + 0] = a1_ptr[1];
-      d1[4 + 1] = y1_ptr[1];
-      d1[4 + 2] = cb_ptr[0];
-      d1[4 + 3] = cr_ptr[0];
-
-      d1 += 2 * 4;
-
-      y1_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr += 2;
-    }
-    /* handle width */
-    if (w) {
-      d1[0] = a1_ptr[0];
-      d1[1] = y1_ptr[0];
-      d1[2] = cb_ptr[0];
-      d1[3] = cr_ptr[0];
-      d1 += 4;
-
-      y1_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr++;
-    }
-  }
-}
-
-static void
-ayuv4444_to_yuva420p (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  int wrap, wrap3, width2;
-  int u1, v1, w;
-  uint8_t *lum, *cb, *cr, *a;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  cb = dst->data[1];
-  cr = dst->data[2];
-  a = dst->data[3];
-
-  width2 = (width + 1) >> 1;
-  wrap = dst->linesize[0];
-  wrap3 = src->linesize[0];
-  p = src->data[0];
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      a[0] = p[0];
-      lum[0] = p[1];
-      u1 = p[2];
-      v1 = p[3];
-
-      a[1] = p[4 + 0];
-      lum[1] = p[4 + 1];
-      u1 += p[4 + 2];
-      v1 += p[4 + 3];
-      p += wrap3;
-      lum += wrap;
-      a += wrap;
-
-      a[0] = p[0];
-      lum[0] = p[1];
-      u1 += p[2];
-      v1 += p[3];
-
-      a[1] = p[4 + 0];
-      lum[1] = p[4 + 1];
-      u1 += p[4 + 2];
-      v1 += p[4 + 3];
-
-      cb[0] = u1 >> 2;
-      cr[0] = v1 >> 2;
-
-      cb++;
-      cr++;
-      p += -wrap3 + 2 * 4;
-      lum += -wrap + 2;
-      a += -wrap + 2;
-    }
-    if (w) {
-      a[0] = p[0];
-      lum[0] = p[1];
-      u1 = p[2];
-      v1 = p[3];
-      p += wrap3;
-      lum += wrap;
-      a += wrap;
-
-      a[0] = p[0];
-      lum[0] = p[1];
-      u1 += p[2];
-      v1 += p[3];
-
-      cb[0] = u1 >> 1;
-      cr[0] = v1 >> 1;
-      cb++;
-      cr++;
-      p += -wrap3 + 4;
-      lum += -wrap + 1;
-      a += -wrap + 1;
-    }
-    p += wrap3 + (wrap3 - width * 4);
-    lum += wrap + (wrap - width);
-    a += wrap + (wrap - width);
-    cb += dst->linesize[1] - width2;
-    cr += dst->linesize[2] - width2;
-  }
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      a[0] = p[0];
-      lum[0] = p[1];
-      u1 = p[2];
-      v1 = p[3];
-
-      a[1] = p[4 + 0];
-      lum[1] = p[4 + 1];
-      u1 += p[4 + 2];
-      v1 += p[4 + 3];
-      cb[0] = u1 >> 1;
-      cr[0] = v1 >> 1;
-      cb++;
-      cr++;
-      p += 2 * 4;
-      lum += 2;
-      a += 2;
-    }
-    if (w) {
-      a[0] = p[0];
-      lum[0] = p[1];
-      cb[0] = p[2];
-      cr[0] = p[3];
-    }
-  }
-}
-
-typedef struct ConvertEntry
-{
-  enum PixelFormat src;
-  enum PixelFormat dest;
-  void (*convert) (AVPicture * dst,
-      const AVPicture * src, int width, int height);
-} ConvertEntry;
-
-/* Add each new convertion function in this table. In order to be able
-   to convert from any format to any format, the following constraints
-   must be satisfied:
-
-   - all FF_COLOR_RGB formats must convert to and from PIX_FMT_RGB24 
-
-   - all FF_COLOR_GRAY formats must convert to and from PIX_FMT_GRAY8
-
-   - all FF_COLOR_RGB formats with alpha must convert to and from PIX_FMT_RGBA32
-
-   - PIX_FMT_YUV444P and PIX_FMT_YUVJ444P must convert to and from
-     PIX_FMT_RGB24.
-
-   - PIX_FMT_422 must convert to and from PIX_FMT_422P.
-
-   The other conversion functions are just optimisations for common cases.
-*/
-static ConvertEntry convert_table[] = {
-  {PIX_FMT_YUV420P, PIX_FMT_YUV422, yuv420p_to_yuv422},
-  {PIX_FMT_YUV420P, PIX_FMT_RGB555, yuv420p_to_rgb555},
-  {PIX_FMT_YUV420P, PIX_FMT_RGB565, yuv420p_to_rgb565},
-  {PIX_FMT_YUV420P, PIX_FMT_BGR24, yuv420p_to_bgr24},
-  {PIX_FMT_YUV420P, PIX_FMT_RGB24, yuv420p_to_rgb24},
-  {PIX_FMT_YUV420P, PIX_FMT_RGB32, yuv420p_to_rgb32},
-  {PIX_FMT_YUV420P, PIX_FMT_BGR32, yuv420p_to_bgr32},
-  {PIX_FMT_YUV420P, PIX_FMT_xRGB32, yuv420p_to_xrgb32},
-  {PIX_FMT_YUV420P, PIX_FMT_BGRx32, yuv420p_to_bgrx32},
-  {PIX_FMT_YUV420P, PIX_FMT_RGBA32, yuv420p_to_rgba32},
-  {PIX_FMT_YUV420P, PIX_FMT_BGRA32, yuv420p_to_bgra32},
-  {PIX_FMT_YUV420P, PIX_FMT_ARGB32, yuv420p_to_argb32},
-  {PIX_FMT_YUV420P, PIX_FMT_ABGR32, yuv420p_to_abgr32},
-
-  {PIX_FMT_NV12, PIX_FMT_RGB555, nv12_to_rgb555},
-  {PIX_FMT_NV12, PIX_FMT_RGB565, nv12_to_rgb565},
-  {PIX_FMT_NV12, PIX_FMT_BGR24, nv12_to_bgr24},
-  {PIX_FMT_NV12, PIX_FMT_RGB24, nv12_to_rgb24},
-  {PIX_FMT_NV12, PIX_FMT_RGB32, nv12_to_rgb32},
-  {PIX_FMT_NV12, PIX_FMT_BGR32, nv12_to_bgr32},
-  {PIX_FMT_NV12, PIX_FMT_xRGB32, nv12_to_xrgb32},
-  {PIX_FMT_NV12, PIX_FMT_BGRx32, nv12_to_bgrx32},
-  {PIX_FMT_NV12, PIX_FMT_RGBA32, nv12_to_rgba32},
-  {PIX_FMT_NV12, PIX_FMT_BGRA32, nv12_to_bgra32},
-  {PIX_FMT_NV12, PIX_FMT_ARGB32, nv12_to_argb32},
-  {PIX_FMT_NV12, PIX_FMT_ABGR32, nv12_to_abgr32},
-  {PIX_FMT_NV12, PIX_FMT_NV21, nv12_to_nv21},
-  {PIX_FMT_NV12, PIX_FMT_YUV444P, nv12_to_yuv444p},
-
-  {PIX_FMT_NV21, PIX_FMT_RGB555, nv21_to_rgb555},
-  {PIX_FMT_NV21, PIX_FMT_RGB565, nv21_to_rgb565},
-  {PIX_FMT_NV21, PIX_FMT_BGR24, nv21_to_bgr24},
-  {PIX_FMT_NV21, PIX_FMT_RGB24, nv21_to_rgb24},
-  {PIX_FMT_NV21, PIX_FMT_RGB32, nv21_to_rgb32},
-  {PIX_FMT_NV21, PIX_FMT_BGR32, nv21_to_bgr32},
-  {PIX_FMT_NV21, PIX_FMT_xRGB32, nv21_to_xrgb32},
-  {PIX_FMT_NV21, PIX_FMT_BGRx32, nv21_to_bgrx32},
-  {PIX_FMT_NV21, PIX_FMT_RGBA32, nv21_to_rgba32},
-  {PIX_FMT_NV21, PIX_FMT_BGRA32, nv21_to_bgra32},
-  {PIX_FMT_NV21, PIX_FMT_ARGB32, nv21_to_argb32},
-  {PIX_FMT_NV21, PIX_FMT_ABGR32, nv21_to_abgr32},
-  {PIX_FMT_NV21, PIX_FMT_YUV444P, nv21_to_yuv444p},
-  {PIX_FMT_NV21, PIX_FMT_NV12, nv21_to_nv12},
-
-  {PIX_FMT_YUV422P, PIX_FMT_YUV422, yuv422p_to_yuv422},
-  {PIX_FMT_YUV422P, PIX_FMT_UYVY422, yuv422p_to_uyvy422},
-  {PIX_FMT_YUV422P, PIX_FMT_YVYU422, yuv422p_to_yvyu422},
-
-  {PIX_FMT_YUV444P, PIX_FMT_RGB24, yuv444p_to_rgb24},
-
-  {PIX_FMT_YUVJ420P, PIX_FMT_RGB555, yuvj420p_to_rgb555},
-  {PIX_FMT_YUVJ420P, PIX_FMT_RGB565, yuvj420p_to_rgb565},
-  {PIX_FMT_YUVJ420P, PIX_FMT_BGR24, yuvj420p_to_bgr24},
-  {PIX_FMT_YUVJ420P, PIX_FMT_RGB24, yuvj420p_to_rgb24},
-  {PIX_FMT_YUVJ420P, PIX_FMT_RGB32, yuvj420p_to_rgb32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_BGR32, yuvj420p_to_bgr32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_RGB32, yuvj420p_to_xrgb32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_BGR32, yuvj420p_to_bgrx32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_RGBA32, yuvj420p_to_rgba32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_BGRA32, yuvj420p_to_bgra32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_ARGB32, yuvj420p_to_argb32},
-  {PIX_FMT_YUVJ420P, PIX_FMT_ABGR32, yuvj420p_to_abgr32},
-
-  {PIX_FMT_YUVJ444P, PIX_FMT_RGB24, yuvj444p_to_rgb24},
-
-  {PIX_FMT_YUV422, PIX_FMT_YUV420P, yuv422_to_yuv420p},
-  {PIX_FMT_YUV422, PIX_FMT_YUV422P, yuv422_to_yuv422p},
-  {PIX_FMT_YUV422, PIX_FMT_GRAY8, yvyu422_to_gray},
-  {PIX_FMT_YUV422, PIX_FMT_RGB555, yuv422_to_rgb555},
-  {PIX_FMT_YUV422, PIX_FMT_RGB565, yuv422_to_rgb565},
-  {PIX_FMT_YUV422, PIX_FMT_BGR24, yuv422_to_bgr24},
-  {PIX_FMT_YUV422, PIX_FMT_RGB24, yuv422_to_rgb24},
-  {PIX_FMT_YUV422, PIX_FMT_BGR32, yuv422_to_bgr32},
-  {PIX_FMT_YUV422, PIX_FMT_RGB32, yuv422_to_rgb32},
-  {PIX_FMT_YUV422, PIX_FMT_xRGB32, yuv422_to_xrgb32},
-  {PIX_FMT_YUV422, PIX_FMT_BGRx32, yuv422_to_bgrx32},
-  {PIX_FMT_YUV422, PIX_FMT_BGRA32, yuv422_to_bgra32},
-  {PIX_FMT_YUV422, PIX_FMT_RGBA32, yuv422_to_rgba32},
-  {PIX_FMT_YUV422, PIX_FMT_ABGR32, yuv422_to_abgr32},
-  {PIX_FMT_YUV422, PIX_FMT_ARGB32, yuv422_to_argb32},
-
-  {PIX_FMT_UYVY422, PIX_FMT_YUV420P, uyvy422_to_yuv420p},
-  {PIX_FMT_UYVY422, PIX_FMT_YUV422P, uyvy422_to_yuv422p},
-  {PIX_FMT_UYVY422, PIX_FMT_GRAY8, uyvy422_to_gray},
-  {PIX_FMT_UYVY422, PIX_FMT_RGB555, uyvy422_to_rgb555},
-  {PIX_FMT_UYVY422, PIX_FMT_RGB565, uyvy422_to_rgb565},
-  {PIX_FMT_UYVY422, PIX_FMT_BGR24, uyvy422_to_bgr24},
-  {PIX_FMT_UYVY422, PIX_FMT_RGB24, uyvy422_to_rgb24},
-  {PIX_FMT_UYVY422, PIX_FMT_RGB32, uyvy422_to_rgb32},
-  {PIX_FMT_UYVY422, PIX_FMT_BGR32, uyvy422_to_bgr32},
-  {PIX_FMT_UYVY422, PIX_FMT_xRGB32, uyvy422_to_xrgb32},
-  {PIX_FMT_UYVY422, PIX_FMT_BGRx32, uyvy422_to_bgrx32},
-  {PIX_FMT_UYVY422, PIX_FMT_RGBA32, uyvy422_to_rgba32},
-  {PIX_FMT_UYVY422, PIX_FMT_BGRA32, uyvy422_to_bgra32},
-  {PIX_FMT_UYVY422, PIX_FMT_ARGB32, uyvy422_to_argb32},
-  {PIX_FMT_UYVY422, PIX_FMT_ABGR32, uyvy422_to_abgr32},
-
-  {PIX_FMT_YVYU422, PIX_FMT_YUV420P, yvyu422_to_yuv420p},
-  {PIX_FMT_YVYU422, PIX_FMT_YUV422P, yvyu422_to_yuv422p},
-  {PIX_FMT_YVYU422, PIX_FMT_GRAY8, yvyu422_to_gray},
-  {PIX_FMT_YVYU422, PIX_FMT_RGB555, yvyu422_to_rgb555},
-  {PIX_FMT_YVYU422, PIX_FMT_RGB565, yvyu422_to_rgb565},
-  {PIX_FMT_YVYU422, PIX_FMT_BGR24, yvyu422_to_bgr24},
-  {PIX_FMT_YVYU422, PIX_FMT_RGB24, yvyu422_to_rgb24},
-  {PIX_FMT_YVYU422, PIX_FMT_BGR32, yvyu422_to_bgr32},
-  {PIX_FMT_YVYU422, PIX_FMT_RGB32, yvyu422_to_rgb32},
-  {PIX_FMT_YVYU422, PIX_FMT_xRGB32, yvyu422_to_xrgb32},
-  {PIX_FMT_YVYU422, PIX_FMT_BGRx32, yvyu422_to_bgrx32},
-  {PIX_FMT_YVYU422, PIX_FMT_BGRA32, yvyu422_to_bgra32},
-  {PIX_FMT_YVYU422, PIX_FMT_RGBA32, yvyu422_to_rgba32},
-  {PIX_FMT_YVYU422, PIX_FMT_ABGR32, yvyu422_to_abgr32},
-  {PIX_FMT_YVYU422, PIX_FMT_ARGB32, yvyu422_to_argb32},
-
-  {PIX_FMT_RGB24, PIX_FMT_YUV420P, rgb24_to_yuv420p},
-  {PIX_FMT_RGB24, PIX_FMT_YUVA420P, rgb24_to_yuva420p},
-  {PIX_FMT_RGB24, PIX_FMT_NV12, rgb24_to_nv12},
-  {PIX_FMT_RGB24, PIX_FMT_NV21, rgb24_to_nv21},
-  {PIX_FMT_RGB24, PIX_FMT_RGB565, rgb24_to_rgb565},
-  {PIX_FMT_RGB24, PIX_FMT_RGB555, rgb24_to_rgb555},
-  {PIX_FMT_RGB24, PIX_FMT_RGB32, rgb24_to_rgb32},
-  {PIX_FMT_RGB24, PIX_FMT_BGR32, rgb24_to_bgr32},
-  {PIX_FMT_RGB24, PIX_FMT_xRGB32, rgb24_to_xrgb32},
-  {PIX_FMT_RGB24, PIX_FMT_BGRx32, rgb24_to_bgrx32},
-  {PIX_FMT_RGB24, PIX_FMT_RGBA32, rgb24_to_rgba32},
-  {PIX_FMT_RGB24, PIX_FMT_BGR24, rgb24_to_bgr24},
-  {PIX_FMT_RGB24, PIX_FMT_BGRA32, rgb24_to_bgra32},
-  {PIX_FMT_RGB24, PIX_FMT_ARGB32, rgb24_to_argb32},
-  {PIX_FMT_RGB24, PIX_FMT_ABGR32, rgb24_to_abgr32},
-  {PIX_FMT_RGB24, PIX_FMT_Y800, rgb24_to_y800},
-  {PIX_FMT_RGB24, PIX_FMT_Y16, rgb24_to_y16},
-  {PIX_FMT_RGB24, PIX_FMT_GRAY8, rgb24_to_gray},
-  {PIX_FMT_RGB24, PIX_FMT_GRAY16_L, rgb24_to_gray16_l},
-  {PIX_FMT_RGB24, PIX_FMT_GRAY16_B, rgb24_to_gray16_b},
-  {PIX_FMT_RGB24, PIX_FMT_PAL8, rgb24_to_pal8},
-  {PIX_FMT_RGB24, PIX_FMT_YUV444P, rgb24_to_yuv444p},
-  {PIX_FMT_RGB24, PIX_FMT_YUVJ420P, rgb24_to_yuvj420p},
-  {PIX_FMT_RGB24, PIX_FMT_YUVJ444P, rgb24_to_yuvj444p},
-  {PIX_FMT_RGB24, PIX_FMT_AYUV4444, rgb24_to_ayuv4444},
-  {PIX_FMT_RGB24, PIX_FMT_V308, rgb24_to_v308},
-
-  {PIX_FMT_RGB32, PIX_FMT_RGB24, rgb32_to_rgb24},
-  {PIX_FMT_RGB32, PIX_FMT_RGB555, rgba32_to_rgb555},
-  {PIX_FMT_RGB32, PIX_FMT_PAL8, rgb32_to_pal8},
-  {PIX_FMT_RGB32, PIX_FMT_YUV420P, rgb32_to_yuv420p},
-  {PIX_FMT_RGB32, PIX_FMT_YUVA420P, rgb32_to_yuva420p},
-  {PIX_FMT_RGB32, PIX_FMT_NV12, rgb32_to_nv12},
-  {PIX_FMT_RGB32, PIX_FMT_NV21, rgb32_to_nv21},
-  {PIX_FMT_RGB32, PIX_FMT_Y800, rgb32_to_y800},
-  {PIX_FMT_RGB32, PIX_FMT_Y16, rgb32_to_y16},
-  {PIX_FMT_RGB32, PIX_FMT_GRAY8, rgb32_to_gray},
-  {PIX_FMT_RGB32, PIX_FMT_GRAY16_L, rgb32_to_gray16_l},
-  {PIX_FMT_RGB32, PIX_FMT_GRAY16_B, rgb32_to_gray16_b},
-
-  {PIX_FMT_xRGB32, PIX_FMT_RGB24, xrgb32_to_rgb24},
-  {PIX_FMT_xRGB32, PIX_FMT_PAL8, xrgb32_to_pal8},
-  {PIX_FMT_xRGB32, PIX_FMT_YUV420P, xrgb32_to_yuv420p},
-  {PIX_FMT_xRGB32, PIX_FMT_YUVA420P, xrgb32_to_yuva420p},
-  {PIX_FMT_xRGB32, PIX_FMT_NV12, xrgb32_to_nv12},
-  {PIX_FMT_xRGB32, PIX_FMT_NV21, xrgb32_to_nv21},
-  {PIX_FMT_xRGB32, PIX_FMT_Y800, xrgb32_to_y800},
-  {PIX_FMT_xRGB32, PIX_FMT_Y16, xrgb32_to_y16},
-  {PIX_FMT_xRGB32, PIX_FMT_GRAY8, xrgb32_to_gray},
-  {PIX_FMT_xRGB32, PIX_FMT_GRAY16_L, xrgb32_to_gray16_l},
-  {PIX_FMT_xRGB32, PIX_FMT_GRAY16_B, xrgb32_to_gray16_b},
-
-  {PIX_FMT_RGBA32, PIX_FMT_BGRA32, rgba32_to_bgra32},
-  {PIX_FMT_RGBA32, PIX_FMT_ABGR32, rgba32_to_abgr32},
-  {PIX_FMT_RGBA32, PIX_FMT_ARGB32, rgba32_to_argb32},
-  {PIX_FMT_RGBA32, PIX_FMT_BGR32, rgba32_to_bgr32},
-  {PIX_FMT_RGBA32, PIX_FMT_BGRx32, rgba32_to_bgrx32},
-  {PIX_FMT_RGBA32, PIX_FMT_ABGR32, rgba32_to_abgr32},
-  {PIX_FMT_RGBA32, PIX_FMT_RGB24, rgba32_to_rgb24},
-  {PIX_FMT_RGBA32, PIX_FMT_RGB555, rgba32_to_rgb555},
-  {PIX_FMT_RGBA32, PIX_FMT_PAL8, rgba32_to_pal8},
-  {PIX_FMT_RGBA32, PIX_FMT_YUV420P, rgba32_to_yuv420p},
-  {PIX_FMT_RGBA32, PIX_FMT_YUVA420P, rgba32_to_yuva420p},
-  {PIX_FMT_RGBA32, PIX_FMT_NV12, rgba32_to_nv12},
-  {PIX_FMT_RGBA32, PIX_FMT_NV21, rgba32_to_nv21},
-  {PIX_FMT_RGBA32, PIX_FMT_Y800, rgba32_to_y800},
-  {PIX_FMT_RGBA32, PIX_FMT_Y16, rgba32_to_y16},
-  {PIX_FMT_RGBA32, PIX_FMT_GRAY8, rgba32_to_gray},
-  {PIX_FMT_RGBA32, PIX_FMT_GRAY16_L, rgba32_to_gray16_l},
-  {PIX_FMT_RGBA32, PIX_FMT_GRAY16_B, rgba32_to_gray16_b},
-  {PIX_FMT_RGBA32, PIX_FMT_AYUV4444, rgba32_to_ayuv4444},
-
-  {PIX_FMT_BGR24, PIX_FMT_RGB24, bgr24_to_rgb24},
-  {PIX_FMT_BGR24, PIX_FMT_YUV420P, bgr24_to_yuv420p},
-  {PIX_FMT_BGR24, PIX_FMT_YUVA420P, bgr24_to_yuva420p},
-  {PIX_FMT_BGR24, PIX_FMT_NV12, bgr24_to_nv12},
-  {PIX_FMT_BGR24, PIX_FMT_NV21, bgr24_to_nv21},
-  {PIX_FMT_BGR24, PIX_FMT_Y800, bgr24_to_y800},
-  {PIX_FMT_BGR24, PIX_FMT_Y16, bgr24_to_y16},
-  {PIX_FMT_BGR24, PIX_FMT_GRAY8, bgr24_to_gray},
-  {PIX_FMT_BGR24, PIX_FMT_GRAY16_L, bgr24_to_gray16_l},
-  {PIX_FMT_BGR24, PIX_FMT_GRAY16_B, bgr24_to_gray16_b},
-
-  {PIX_FMT_BGR32, PIX_FMT_RGB24, bgr32_to_rgb24},
-  {PIX_FMT_BGR32, PIX_FMT_RGBA32, bgr32_to_rgba32},
-  {PIX_FMT_BGR32, PIX_FMT_YUV420P, bgr32_to_yuv420p},
-  {PIX_FMT_BGR32, PIX_FMT_YUVA420P, bgr32_to_yuva420p},
-  {PIX_FMT_BGR32, PIX_FMT_NV12, bgr32_to_nv12},
-  {PIX_FMT_BGR32, PIX_FMT_NV21, bgr32_to_nv21},
-  {PIX_FMT_BGR32, PIX_FMT_Y800, bgr32_to_y800},
-  {PIX_FMT_BGR32, PIX_FMT_Y16, bgr32_to_y16},
-  {PIX_FMT_BGR32, PIX_FMT_GRAY8, bgr32_to_gray},
-  {PIX_FMT_BGR32, PIX_FMT_GRAY16_L, bgr32_to_gray16_l},
-  {PIX_FMT_BGR32, PIX_FMT_GRAY16_B, bgr32_to_gray16_b},
-
-  {PIX_FMT_BGRx32, PIX_FMT_RGB24, bgrx32_to_rgb24},
-  {PIX_FMT_BGRx32, PIX_FMT_RGBA32, bgrx32_to_rgba32},
-  {PIX_FMT_BGRx32, PIX_FMT_YUV420P, bgrx32_to_yuv420p},
-  {PIX_FMT_BGRx32, PIX_FMT_YUVA420P, bgrx32_to_yuva420p},
-  {PIX_FMT_BGRx32, PIX_FMT_NV12, bgrx32_to_nv12},
-  {PIX_FMT_BGRx32, PIX_FMT_NV21, bgrx32_to_nv21},
-  {PIX_FMT_BGRx32, PIX_FMT_Y800, bgrx32_to_y800},
-  {PIX_FMT_BGRx32, PIX_FMT_Y16, bgrx32_to_y16},
-  {PIX_FMT_BGRx32, PIX_FMT_GRAY8, bgrx32_to_gray},
-  {PIX_FMT_BGRx32, PIX_FMT_GRAY16_L, bgrx32_to_gray16_l},
-  {PIX_FMT_BGRx32, PIX_FMT_GRAY16_B, bgrx32_to_gray16_b},
-
-  {PIX_FMT_BGRA32, PIX_FMT_RGB24, bgra32_to_rgb24},
-  {PIX_FMT_BGRA32, PIX_FMT_RGBA32, bgra32_to_rgba32},
-  {PIX_FMT_BGRA32, PIX_FMT_YUV420P, bgra32_to_yuv420p},
-  {PIX_FMT_BGRA32, PIX_FMT_YUVA420P, bgra32_to_yuva420p},
-  {PIX_FMT_BGRA32, PIX_FMT_NV12, bgra32_to_nv12},
-  {PIX_FMT_BGRA32, PIX_FMT_NV21, bgra32_to_nv21},
-  {PIX_FMT_BGRA32, PIX_FMT_Y800, bgra32_to_y800},
-  {PIX_FMT_BGRA32, PIX_FMT_Y16, bgra32_to_y16},
-  {PIX_FMT_BGRA32, PIX_FMT_GRAY8, bgra32_to_gray},
-  {PIX_FMT_BGRA32, PIX_FMT_GRAY16_L, bgra32_to_gray16_l},
-  {PIX_FMT_BGRA32, PIX_FMT_GRAY16_B, bgra32_to_gray16_b},
-  {PIX_FMT_BGRA32, PIX_FMT_AYUV4444, bgra32_to_ayuv4444},
-
-  {PIX_FMT_ABGR32, PIX_FMT_RGB24, abgr32_to_rgb24},
-  {PIX_FMT_ABGR32, PIX_FMT_RGBA32, abgr32_to_rgba32},
-  {PIX_FMT_ABGR32, PIX_FMT_YUV420P, abgr32_to_yuv420p},
-  {PIX_FMT_ABGR32, PIX_FMT_YUVA420P, abgr32_to_yuva420p},
-  {PIX_FMT_ABGR32, PIX_FMT_NV12, abgr32_to_nv12},
-  {PIX_FMT_ABGR32, PIX_FMT_NV21, abgr32_to_nv21},
-  {PIX_FMT_ABGR32, PIX_FMT_Y800, abgr32_to_y800},
-  {PIX_FMT_ABGR32, PIX_FMT_Y16, abgr32_to_y16},
-  {PIX_FMT_ABGR32, PIX_FMT_GRAY8, abgr32_to_gray},
-  {PIX_FMT_ABGR32, PIX_FMT_GRAY16_L, abgr32_to_gray16_l},
-  {PIX_FMT_ABGR32, PIX_FMT_GRAY16_B, abgr32_to_gray16_b},
-  {PIX_FMT_ABGR32, PIX_FMT_AYUV4444, abgr32_to_ayuv4444},
-
-  {PIX_FMT_ARGB32, PIX_FMT_RGB24, argb32_to_rgb24},
-  {PIX_FMT_ARGB32, PIX_FMT_RGBA32, argb32_to_rgba32},
-  {PIX_FMT_ARGB32, PIX_FMT_YUV420P, argb32_to_yuv420p},
-  {PIX_FMT_ARGB32, PIX_FMT_YUVA420P, argb32_to_yuva420p},
-  {PIX_FMT_ARGB32, PIX_FMT_NV12, argb32_to_nv12},
-  {PIX_FMT_ARGB32, PIX_FMT_NV21, argb32_to_nv21},
-  {PIX_FMT_ARGB32, PIX_FMT_Y800, argb32_to_y800},
-  {PIX_FMT_ARGB32, PIX_FMT_Y16, argb32_to_y16},
-  {PIX_FMT_ARGB32, PIX_FMT_GRAY8, argb32_to_gray},
-  {PIX_FMT_ARGB32, PIX_FMT_GRAY16_L, argb32_to_gray16_l},
-  {PIX_FMT_ARGB32, PIX_FMT_GRAY16_B, argb32_to_gray16_b},
-  {PIX_FMT_ARGB32, PIX_FMT_AYUV4444, argb32_to_ayuv4444},
-
-  {PIX_FMT_RGB555, PIX_FMT_RGB24, rgb555_to_rgb24},
-  {PIX_FMT_RGB555, PIX_FMT_RGB32, rgb555_to_rgba32},
-  {PIX_FMT_RGB555, PIX_FMT_RGBA32, rgb555_to_rgba32},
-  {PIX_FMT_RGB555, PIX_FMT_YUV420P, rgb555_to_yuv420p},
-  {PIX_FMT_RGB555, PIX_FMT_YUVA420P, rgb555_to_yuva420p},
-  {PIX_FMT_RGB555, PIX_FMT_NV12, rgb555_to_nv12},
-  {PIX_FMT_RGB555, PIX_FMT_NV21, rgb555_to_nv21},
-  {PIX_FMT_RGB555, PIX_FMT_Y800, rgb555_to_y800},
-  {PIX_FMT_RGB555, PIX_FMT_Y16, rgb555_to_y16},
-  {PIX_FMT_RGB555, PIX_FMT_GRAY8, rgb555_to_gray},
-  {PIX_FMT_RGB555, PIX_FMT_GRAY16_L, rgb555_to_gray16_l},
-  {PIX_FMT_RGB555, PIX_FMT_GRAY16_B, rgb555_to_gray16_b},
-
-  {PIX_FMT_RGB565, PIX_FMT_RGB24, rgb565_to_rgb24},
-  {PIX_FMT_RGB565, PIX_FMT_YUV420P, rgb565_to_yuv420p},
-  {PIX_FMT_RGB565, PIX_FMT_YUVA420P, rgb565_to_yuva420p},
-  {PIX_FMT_RGB565, PIX_FMT_NV12, rgb565_to_nv12},
-  {PIX_FMT_RGB565, PIX_FMT_NV21, rgb565_to_nv21},
-  {PIX_FMT_RGB565, PIX_FMT_Y800, rgb565_to_y800},
-  {PIX_FMT_RGB565, PIX_FMT_Y16, rgb565_to_y16},
-  {PIX_FMT_RGB565, PIX_FMT_GRAY8, rgb565_to_gray},
-  {PIX_FMT_RGB565, PIX_FMT_GRAY16_L, rgb565_to_gray16_l},
-  {PIX_FMT_RGB565, PIX_FMT_GRAY16_B, rgb565_to_gray16_b},
-
-  {PIX_FMT_Y800, PIX_FMT_RGB555, y800_to_rgb555},
-  {PIX_FMT_Y800, PIX_FMT_RGB565, y800_to_rgb565},
-  {PIX_FMT_Y800, PIX_FMT_BGR24, y800_to_bgr24},
-  {PIX_FMT_Y800, PIX_FMT_RGB24, y800_to_rgb24},
-  {PIX_FMT_Y800, PIX_FMT_RGB32, y800_to_rgb32},
-  {PIX_FMT_Y800, PIX_FMT_BGR32, y800_to_bgr32},
-  {PIX_FMT_Y800, PIX_FMT_RGB32, y800_to_xrgb32},
-  {PIX_FMT_Y800, PIX_FMT_BGR32, y800_to_bgrx32},
-  {PIX_FMT_Y800, PIX_FMT_RGBA32, y800_to_rgba32},
-  {PIX_FMT_Y800, PIX_FMT_BGRA32, y800_to_bgra32},
-  {PIX_FMT_Y800, PIX_FMT_ARGB32, y800_to_argb32},
-  {PIX_FMT_Y800, PIX_FMT_ABGR32, y800_to_abgr32},
-  {PIX_FMT_Y800, PIX_FMT_Y16, y800_to_y16},
-
-  {PIX_FMT_Y16, PIX_FMT_RGB555, y16_to_rgb555},
-  {PIX_FMT_Y16, PIX_FMT_RGB565, y16_to_rgb565},
-  {PIX_FMT_Y16, PIX_FMT_BGR24, y16_to_bgr24},
-  {PIX_FMT_Y16, PIX_FMT_RGB24, y16_to_rgb24},
-  {PIX_FMT_Y16, PIX_FMT_RGB32, y16_to_rgb32},
-  {PIX_FMT_Y16, PIX_FMT_BGR32, y16_to_bgr32},
-  {PIX_FMT_Y16, PIX_FMT_RGB32, y16_to_xrgb32},
-  {PIX_FMT_Y16, PIX_FMT_BGR32, y16_to_bgrx32},
-  {PIX_FMT_Y16, PIX_FMT_RGBA32, y16_to_rgba32},
-  {PIX_FMT_Y16, PIX_FMT_BGRA32, y16_to_bgra32},
-  {PIX_FMT_Y16, PIX_FMT_ARGB32, y16_to_argb32},
-  {PIX_FMT_Y16, PIX_FMT_ABGR32, y16_to_abgr32},
-  {PIX_FMT_Y16, PIX_FMT_Y800, y16_to_y800},
-
-  {PIX_FMT_GRAY8, PIX_FMT_RGB555, gray_to_rgb555},
-  {PIX_FMT_GRAY8, PIX_FMT_RGB565, gray_to_rgb565},
-  {PIX_FMT_GRAY8, PIX_FMT_RGB24, gray_to_rgb24},
-  {PIX_FMT_GRAY8, PIX_FMT_BGR24, gray_to_bgr24},
-  {PIX_FMT_GRAY8, PIX_FMT_RGB32, gray_to_rgb32},
-  {PIX_FMT_GRAY8, PIX_FMT_BGR32, gray_to_bgr32},
-  {PIX_FMT_GRAY8, PIX_FMT_xRGB32, gray_to_xrgb32},
-  {PIX_FMT_GRAY8, PIX_FMT_BGRx32, gray_to_bgrx32},
-  {PIX_FMT_GRAY8, PIX_FMT_RGBA32, gray_to_rgba32},
-  {PIX_FMT_GRAY8, PIX_FMT_BGRA32, gray_to_bgra32},
-  {PIX_FMT_GRAY8, PIX_FMT_ARGB32, gray_to_argb32},
-  {PIX_FMT_GRAY8, PIX_FMT_ABGR32, gray_to_abgr32},
-  {PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, gray_to_monowhite},
-  {PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, gray_to_monoblack},
-  {PIX_FMT_GRAY8, PIX_FMT_GRAY16_L, gray_to_gray16_l},
-  {PIX_FMT_GRAY8, PIX_FMT_GRAY16_B, gray_to_gray16_b},
-
-  {PIX_FMT_MONOWHITE, PIX_FMT_GRAY8, monowhite_to_gray},
-
-  {PIX_FMT_MONOBLACK, PIX_FMT_GRAY8, monoblack_to_gray},
-
-  {PIX_FMT_GRAY16_L, PIX_FMT_GRAY8, gray16_l_to_gray},
-  {PIX_FMT_GRAY16_L, PIX_FMT_RGB555, gray16_l_to_rgb555},
-  {PIX_FMT_GRAY16_L, PIX_FMT_RGB565, gray16_l_to_rgb565},
-  {PIX_FMT_GRAY16_L, PIX_FMT_BGR24, gray16_l_to_bgr24},
-  {PIX_FMT_GRAY16_L, PIX_FMT_RGB24, gray16_l_to_rgb24},
-  {PIX_FMT_GRAY16_L, PIX_FMT_BGR32, gray16_l_to_bgr32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_RGB32, gray16_l_to_rgb32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_xRGB32, gray16_l_to_xrgb32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_BGRx32, gray16_l_to_bgrx32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_ABGR32, gray16_l_to_abgr32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_ARGB32, gray16_l_to_argb32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_BGRA32, gray16_l_to_bgra32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_RGBA32, gray16_l_to_rgba32},
-  {PIX_FMT_GRAY16_L, PIX_FMT_GRAY16_B, gray16_b_to_gray16_l},
-
-  {PIX_FMT_GRAY16_B, PIX_FMT_GRAY8, gray16_b_to_gray},
-  {PIX_FMT_GRAY16_B, PIX_FMT_RGB555, gray16_b_to_rgb555},
-  {PIX_FMT_GRAY16_B, PIX_FMT_RGB565, gray16_b_to_rgb565},
-  {PIX_FMT_GRAY16_B, PIX_FMT_BGR24, gray16_b_to_bgr24},
-  {PIX_FMT_GRAY16_B, PIX_FMT_RGB24, gray16_b_to_rgb24},
-  {PIX_FMT_GRAY16_B, PIX_FMT_BGR32, gray16_b_to_bgr32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_RGB32, gray16_b_to_rgb32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_xRGB32, gray16_b_to_xrgb32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_BGRx32, gray16_b_to_bgrx32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_ABGR32, gray16_b_to_abgr32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_ARGB32, gray16_b_to_argb32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_BGRA32, gray16_b_to_bgra32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_RGBA32, gray16_b_to_rgba32},
-  {PIX_FMT_GRAY16_B, PIX_FMT_GRAY16_L, gray16_b_to_gray16_l},
-
-  {PIX_FMT_PAL8, PIX_FMT_RGB555, pal8_to_rgb555},
-  {PIX_FMT_PAL8, PIX_FMT_RGB565, pal8_to_rgb565},
-  {PIX_FMT_PAL8, PIX_FMT_BGR24, pal8_to_bgr24},
-  {PIX_FMT_PAL8, PIX_FMT_RGB24, pal8_to_rgb24},
-  {PIX_FMT_PAL8, PIX_FMT_RGB32, pal8_to_rgb32},
-  {PIX_FMT_PAL8, PIX_FMT_BGR32, pal8_to_bgr32},
-  {PIX_FMT_PAL8, PIX_FMT_xRGB32, pal8_to_xrgb32},
-  {PIX_FMT_PAL8, PIX_FMT_BGRx32, pal8_to_bgrx32},
-  {PIX_FMT_PAL8, PIX_FMT_RGBA32, pal8_to_rgba32},
-  {PIX_FMT_PAL8, PIX_FMT_BGRA32, pal8_to_bgra32},
-  {PIX_FMT_PAL8, PIX_FMT_ARGB32, pal8_to_argb32},
-  {PIX_FMT_PAL8, PIX_FMT_ABGR32, pal8_to_abgr32},
-
-  {PIX_FMT_UYVY411, PIX_FMT_YUV411P, uyvy411_to_yuv411p},
-  {PIX_FMT_YUV411P, PIX_FMT_UYVY411, yuv411p_to_uyvy411},
-
-  {PIX_FMT_V308, PIX_FMT_RGB24, v308_to_rgb24},
-
-  {PIX_FMT_AYUV4444, PIX_FMT_RGBA32, ayuv4444_to_rgba32},
-  {PIX_FMT_AYUV4444, PIX_FMT_ARGB32, ayuv4444_to_argb32},
-  {PIX_FMT_AYUV4444, PIX_FMT_BGRA32, ayuv4444_to_bgra32},
-  {PIX_FMT_AYUV4444, PIX_FMT_ABGR32, ayuv4444_to_abgr32},
-  {PIX_FMT_AYUV4444, PIX_FMT_RGB24, ayuv4444_to_rgb24},
-  {PIX_FMT_AYUV4444, PIX_FMT_YUVA420P, ayuv4444_to_yuva420p},
-
-  {PIX_FMT_YUVA420P, PIX_FMT_YUV420P, yuva420p_to_yuv420p},
-  {PIX_FMT_YUVA420P, PIX_FMT_YUV422, yuva420p_to_yuv422},
-  {PIX_FMT_YUVA420P, PIX_FMT_AYUV4444, yuva420p_to_ayuv4444},
-  {PIX_FMT_YUVA420P, PIX_FMT_RGB555, yuva420p_to_rgb555},
-  {PIX_FMT_YUVA420P, PIX_FMT_RGB565, yuva420p_to_rgb565},
-  {PIX_FMT_YUVA420P, PIX_FMT_BGR24, yuva420p_to_bgr24},
-  {PIX_FMT_YUVA420P, PIX_FMT_RGB24, yuva420p_to_rgb24},
-  {PIX_FMT_YUVA420P, PIX_FMT_RGB32, yuva420p_to_rgb32},
-  {PIX_FMT_YUVA420P, PIX_FMT_BGR32, yuva420p_to_bgr32},
-  {PIX_FMT_YUVA420P, PIX_FMT_xRGB32, yuva420p_to_xrgb32},
-  {PIX_FMT_YUVA420P, PIX_FMT_BGRx32, yuva420p_to_bgrx32},
-  {PIX_FMT_YUVA420P, PIX_FMT_RGBA32, yuva420p_to_rgba32},
-  {PIX_FMT_YUVA420P, PIX_FMT_BGRA32, yuva420p_to_bgra32},
-  {PIX_FMT_YUVA420P, PIX_FMT_ARGB32, yuva420p_to_argb32},
-  {PIX_FMT_YUVA420P, PIX_FMT_ABGR32, yuva420p_to_abgr32},
-};
-
-static ConvertEntry *
-get_convert_table_entry (int src_pix_fmt, int dst_pix_fmt)
-{
-  int i;
-
-  for (i = 0; i < sizeof (convert_table) / sizeof (convert_table[0]); i++) {
-    if (convert_table[i].src == src_pix_fmt &&
-        convert_table[i].dest == dst_pix_fmt) {
-      return convert_table + i;
-    }
-  }
-
-  return NULL;
-}
-
-static int
-avpicture_alloc (AVPicture * picture, int pix_fmt, int width, int height,
-    int interlaced)
-{
-  unsigned int size;
-  void *ptr;
-
-  size = avpicture_get_size (pix_fmt, width, height);
-  ptr = av_malloc (size);
-  if (!ptr)
-    goto fail;
-  gst_ffmpegcsp_avpicture_fill (picture, ptr, pix_fmt, width, height,
-      interlaced);
-  return 0;
-fail:
-  memset (picture, 0, sizeof (AVPicture));
-  return -1;
-}
-
-static void
-avpicture_free (AVPicture * picture)
-{
-  av_free (picture->data[0]);
-}
-
-/* return true if yuv planar */
-static inline int
-is_yuv_planar (PixFmtInfo * ps)
-{
-  return (ps->color_type == FF_COLOR_YUV ||
-      ps->color_type == FF_COLOR_YUV_JPEG) && ps->pixel_type == FF_PIXEL_PLANAR;
-}
-
-/* XXX: always use linesize. Return -1 if not supported */
-int
-img_convert (AVPicture * dst, int dst_pix_fmt,
-    const AVPicture * src, int src_pix_fmt, int src_width, int src_height)
-{
-  static int inited;
-  int i, ret, dst_width, dst_height, int_pix_fmt;
-  PixFmtInfo *src_pix, *dst_pix;
-  ConvertEntry *ce;
-  AVPicture tmp1, *tmp = &tmp1;
-
-  if (G_UNLIKELY (src_width <= 0 || src_height <= 0))
-    return 0;
-
-  if (G_UNLIKELY (!inited)) {
-    inited = 1;
-    img_convert_init ();
-  }
-
-  dst_width = src_width;
-  dst_height = src_height;
-
-  dst_pix = get_pix_fmt_info (dst_pix_fmt);
-  src_pix = get_pix_fmt_info (src_pix_fmt);
-  if (G_UNLIKELY (src_pix_fmt == dst_pix_fmt)) {
-    /* no conversion needed: just copy */
-    img_copy (dst, src, dst_pix_fmt, dst_width, dst_height);
-    return 0;
-  }
-
-  ce = get_convert_table_entry (src_pix_fmt, dst_pix_fmt);
-  if (ce && ce->convert) {
-    /* specific conversion routine */
-    ce->convert (dst, src, dst_width, dst_height);
-    return 0;
-  }
-
-  /* gray to YUV */
-  if (is_yuv_planar (dst_pix) && dst_pix_fmt != PIX_FMT_Y16
-      && src_pix_fmt == PIX_FMT_GRAY8) {
-    int w, h, y;
-    uint8_t *d;
-
-    if (dst_pix->color_type == FF_COLOR_YUV_JPEG) {
-      img_copy_plane (dst->data[0], dst->linesize[0],
-          src->data[0], src->linesize[0], dst_width, dst_height);
-    } else {
-      img_apply_table (dst->data[0], dst->linesize[0],
-          src->data[0], src->linesize[0],
-          dst_width, dst_height, y_jpeg_to_ccir);
-    }
-    /* fill U and V with 128 */
-    w = dst_width;
-    h = dst_height;
-    w >>= dst_pix->x_chroma_shift;
-    h >>= dst_pix->y_chroma_shift;
-    for (i = 1; i <= 2; i++) {
-      d = dst->data[i];
-      if (!d)
-        continue;
-      for (y = 0; y < h; y++) {
-        memset (d, 128, w);
-        d += dst->linesize[i];
-      }
-    }
-    return 0;
-  }
-
-  /* YUV to gray */
-  if (is_yuv_planar (src_pix) && src_pix_fmt != PIX_FMT_Y16
-      && dst_pix_fmt == PIX_FMT_GRAY8) {
-    if (src_pix->color_type == FF_COLOR_YUV_JPEG) {
-      img_copy_plane (dst->data[0], dst->linesize[0],
-          src->data[0], src->linesize[0], dst_width, dst_height);
-    } else {
-      img_apply_table (dst->data[0], dst->linesize[0],
-          src->data[0], src->linesize[0],
-          dst_width, dst_height, y_ccir_to_jpeg);
-    }
-    return 0;
-  }
-
-  /* YUV to YUV planar */
-  if (is_yuv_planar (dst_pix) && is_yuv_planar (src_pix) &&
-      dst_pix->depth == src_pix->depth) {
-    int x_shift, y_shift, xy_shift;
-    void (*resize_func) (uint8_t * dst, int dst_wrap, int dst_width,
-        int dst_height, const uint8_t * src, int src_wrap, int src_width,
-        int src_height);
-
-    x_shift = (dst_pix->x_chroma_shift - src_pix->x_chroma_shift);
-    y_shift = (dst_pix->y_chroma_shift - src_pix->y_chroma_shift);
-    xy_shift = ((x_shift & 0xf) << 4) | (y_shift & 0xf);
-
-    /* there must be filters for conversion at least from and to
-       YUV444 format */
-    switch (xy_shift) {
-      case 0x00:
-        resize_func = img_copy_plane_resize;
-        break;
-      case 0x10:
-        resize_func = shrink21;
-        break;
-      case 0x20:
-        resize_func = shrink41;
-        break;
-      case 0x01:
-        resize_func = shrink12;
-        break;
-      case 0x11:
-        resize_func = shrink22;
-        break;
-      case 0x22:
-        resize_func = shrink44;
-        break;
-      case 0xf0:
-        resize_func = grow21;
-        break;
-      case 0xe0:
-        resize_func = grow41;
-        break;
-      case 0xff:
-        resize_func = grow22;
-        break;
-      case 0xee:
-        resize_func = grow44;
-        break;
-      case 0xf1:
-        resize_func = conv411;
-        break;
-      default:
-        /* currently not handled */
-        goto no_chroma_filter;
-    }
-
-    img_copy_plane (dst->data[0], dst->linesize[0],
-        src->data[0], src->linesize[0], dst_width, dst_height);
-
-#define GEN_MASK(x) ((1<<(x))-1)
-#define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
-
-    for (i = 1; i <= 2; i++) {
-      gint w, h;
-      gint s_w, s_h;
-
-      w = DIV_ROUND_UP_X (dst_width, dst_pix->x_chroma_shift);
-      h = DIV_ROUND_UP_X (dst_height, dst_pix->y_chroma_shift);
-
-      s_w = DIV_ROUND_UP_X (src_width, src_pix->x_chroma_shift);
-      s_h = DIV_ROUND_UP_X (src_height, src_pix->y_chroma_shift);
-
-      if (src->data[i] != NULL && dst->data[i] != NULL) {
-        resize_func (dst->data[i], dst->linesize[i], w, h,
-            src->data[i], src->linesize[i], s_w, s_h);
-      } else if (dst->data[i] != NULL) {
-        memset (dst->data[i], 128, dst->linesize[i] * h);
-      }
-    }
-    /* if yuv color space conversion is needed, we do it here on
-       the destination image */
-    if (dst_pix->color_type != src_pix->color_type) {
-      const uint8_t *y_table, *c_table;
-
-      if (dst_pix->color_type == FF_COLOR_YUV) {
-        y_table = y_jpeg_to_ccir;
-        c_table = c_jpeg_to_ccir;
-      } else {
-        y_table = y_ccir_to_jpeg;
-        c_table = c_ccir_to_jpeg;
-      }
-      img_apply_table (dst->data[0], dst->linesize[0],
-          dst->data[0], dst->linesize[0], dst_width, dst_height, y_table);
-
-      for (i = 1; i <= 2; i++)
-        img_apply_table (dst->data[i], dst->linesize[i],
-            dst->data[i], dst->linesize[i],
-            dst_width >> dst_pix->x_chroma_shift,
-            dst_height >> dst_pix->y_chroma_shift, c_table);
-    }
-    return 0;
-  }
-no_chroma_filter:
-  GST_CAT_INFO (ffmpegcolorspace_performance,
-      "no direct path to convert colorspace from %s -> %s", src_pix->name,
-      dst_pix->name);
-
-  /* try to use an intermediate format */
-  if (src_pix_fmt == PIX_FMT_YUV422 || dst_pix_fmt == PIX_FMT_YUV422) {
-    /* specific case: convert to YUV422P first */
-    int_pix_fmt = PIX_FMT_YUV422P;
-  } else if (src_pix_fmt == PIX_FMT_UYVY422 || dst_pix_fmt == PIX_FMT_UYVY422 ||
-      src_pix_fmt == PIX_FMT_YVYU422 || dst_pix_fmt == PIX_FMT_YVYU422) {
-    /* specific case: convert to YUV422P first */
-    int_pix_fmt = PIX_FMT_YUV422P;
-  } else if (src_pix_fmt == PIX_FMT_UYVY411 || dst_pix_fmt == PIX_FMT_UYVY411) {
-    /* specific case: convert to YUV411P first */
-    int_pix_fmt = PIX_FMT_YUV411P;
-  } else if ((src_pix->color_type == FF_COLOR_GRAY &&
-          src_pix_fmt != PIX_FMT_GRAY8) ||
-      (dst_pix->color_type == FF_COLOR_GRAY && dst_pix_fmt != PIX_FMT_GRAY8)) {
-    /* gray8 is the normalized format */
-    int_pix_fmt = PIX_FMT_GRAY8;
-  } else if (src_pix_fmt == PIX_FMT_Y16 || dst_pix_fmt == PIX_FMT_Y16) {
-    /* y800 is the normalized format */
-    int_pix_fmt = PIX_FMT_Y800;
-  } else if ((is_yuv_planar (src_pix) &&
-          src_pix_fmt != PIX_FMT_YUV444P && src_pix_fmt != PIX_FMT_YUVJ444P)) {
-    /* yuv444 is the normalized format */
-    if (src_pix->color_type == FF_COLOR_YUV_JPEG)
-      int_pix_fmt = PIX_FMT_YUVJ444P;
-    else
-      int_pix_fmt = PIX_FMT_YUV444P;
-  } else if ((is_yuv_planar (dst_pix) &&
-          dst_pix_fmt != PIX_FMT_YUV444P && dst_pix_fmt != PIX_FMT_YUVJ444P)) {
-    /* yuv444 is the normalized format */
-    if (dst_pix->color_type == FF_COLOR_YUV_JPEG)
-      int_pix_fmt = PIX_FMT_YUVJ444P;
-    else
-      int_pix_fmt = PIX_FMT_YUV444P;
-  } else {
-    /* the two formats are rgb or gray8 or yuv[j]444p */
-    if (src_pix->is_alpha && dst_pix->is_alpha)
-      int_pix_fmt = PIX_FMT_RGBA32;
-    else
-      int_pix_fmt = PIX_FMT_RGB24;
-  }
-  if (avpicture_alloc (tmp, int_pix_fmt, dst_width, dst_height,
-          dst->interlaced) < 0)
-    return -1;
-  ret = -1;
-  if (img_convert (tmp, int_pix_fmt,
-          src, src_pix_fmt, src_width, src_height) < 0)
-    goto fail1;
-
-  if (img_convert (dst, dst_pix_fmt,
-          tmp, int_pix_fmt, dst_width, dst_height) < 0)
-    goto fail1;
-  ret = 0;
-fail1:
-  avpicture_free (tmp);
-  return ret;
-}
-
-/* NOTE: we scan all the pixels to have an exact information */
-static int
-get_alpha_info_pal8 (const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  int src_wrap, ret, x, y;
-  unsigned int a;
-  uint32_t *palette = (uint32_t *) src->data[1];
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-  ret = 0;
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      a = palette[p[0]] >> 24;
-      if (a == 0x00) {
-        ret |= FF_ALPHA_TRANSP;
-      } else if (a != 0xff) {
-        ret |= FF_ALPHA_SEMI_TRANSP;
-      }
-      p++;
-    }
-    p += src_wrap;
-  }
-  return ret;
-}
-
-/**
- * Tell if an image really has transparent alpha values.
- * @return ored mask of FF_ALPHA_xxx constants
- */
-int
-img_get_alpha_info (const AVPicture * src, int pix_fmt, int width, int height)
-{
-  const PixFmtInfo *pf;
-  int ret;
-
-  pf = get_pix_fmt_info (pix_fmt);
-  /* no alpha can be represented in format */
-  if (!pf->is_alpha)
-    return 0;
-  switch (pix_fmt) {
-    case PIX_FMT_RGB32:
-      ret = get_alpha_info_rgb32 (src, width, height);
-      break;
-    case PIX_FMT_BGR32:
-      ret = get_alpha_info_bgr32 (src, width, height);
-      break;
-    case PIX_FMT_xRGB32:
-      ret = get_alpha_info_xrgb32 (src, width, height);
-      break;
-    case PIX_FMT_BGRx32:
-      ret = get_alpha_info_bgrx32 (src, width, height);
-      break;
-    case PIX_FMT_RGBA32:
-      ret = get_alpha_info_rgba32 (src, width, height);
-      break;
-    case PIX_FMT_BGRA32:
-      ret = get_alpha_info_bgra32 (src, width, height);
-      break;
-    case PIX_FMT_ARGB32:
-      ret = get_alpha_info_argb32 (src, width, height);
-      break;
-    case PIX_FMT_ABGR32:
-      ret = get_alpha_info_abgr32 (src, width, height);
-      break;
-    case PIX_FMT_RGB555:
-      ret = get_alpha_info_rgb555 (src, width, height);
-      break;
-    case PIX_FMT_PAL8:
-      ret = get_alpha_info_pal8 (src, width, height);
-      break;
-    default:
-      /* we do not know, so everything is indicated */
-      ret = FF_ALPHA_TRANSP | FF_ALPHA_SEMI_TRANSP;
-      break;
-  }
-  return ret;
-}
-
-#ifdef HAVE_MMX
-#define DEINT_INPLACE_LINE_LUM \
-                    movd_m2r(lum_m4[0],mm0);\
-                    movd_m2r(lum_m3[0],mm1);\
-                    movd_m2r(lum_m2[0],mm2);\
-                    movd_m2r(lum_m1[0],mm3);\
-                    movd_m2r(lum[0],mm4);\
-                    punpcklbw_r2r(mm7,mm0);\
-                    movd_r2m(mm2,lum_m4[0]);\
-                    punpcklbw_r2r(mm7,mm1);\
-                    punpcklbw_r2r(mm7,mm2);\
-                    punpcklbw_r2r(mm7,mm3);\
-                    punpcklbw_r2r(mm7,mm4);\
-                    paddw_r2r(mm3,mm1);\
-                    psllw_i2r(1,mm2);\
-                    paddw_r2r(mm4,mm0);\
-                    psllw_i2r(2,mm1);\
-                    paddw_r2r(mm6,mm2);\
-                    paddw_r2r(mm2,mm1);\
-                    psubusw_r2r(mm0,mm1);\
-                    psrlw_i2r(3,mm1);\
-                    packuswb_r2r(mm7,mm1);\
-                    movd_r2m(mm1,lum_m2[0]);
-
-#define DEINT_LINE_LUM \
-                    movd_m2r(lum_m4[0],mm0);\
-                    movd_m2r(lum_m3[0],mm1);\
-                    movd_m2r(lum_m2[0],mm2);\
-                    movd_m2r(lum_m1[0],mm3);\
-                    movd_m2r(lum[0],mm4);\
-                    punpcklbw_r2r(mm7,mm0);\
-                    punpcklbw_r2r(mm7,mm1);\
-                    punpcklbw_r2r(mm7,mm2);\
-                    punpcklbw_r2r(mm7,mm3);\
-                    punpcklbw_r2r(mm7,mm4);\
-                    paddw_r2r(mm3,mm1);\
-                    psllw_i2r(1,mm2);\
-                    paddw_r2r(mm4,mm0);\
-                    psllw_i2r(2,mm1);\
-                    paddw_r2r(mm6,mm2);\
-                    paddw_r2r(mm2,mm1);\
-                    psubusw_r2r(mm0,mm1);\
-                    psrlw_i2r(3,mm1);\
-                    packuswb_r2r(mm7,mm1);\
-                    movd_r2m(mm1,dst[0]);
-#endif
-
-/* filter parameters: [-1 4 2 4 -1] // 8 */
-#if 0
-static void
-deinterlace_line (uint8_t * dst,
-    const uint8_t * lum_m4, const uint8_t * lum_m3,
-    const uint8_t * lum_m2, const uint8_t * lum_m1,
-    const uint8_t * lum, int size)
-{
-#ifndef HAVE_MMX
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  int sum;
-
-  for (; size > 0; size--) {
-    sum = -lum_m4[0];
-    sum += lum_m3[0] << 2;
-    sum += lum_m2[0] << 1;
-    sum += lum_m1[0] << 2;
-    sum += -lum[0];
-    dst[0] = cm[(sum + 4) >> 3];
-    lum_m4++;
-    lum_m3++;
-    lum_m2++;
-    lum_m1++;
-    lum++;
-    dst++;
-  }
-#else
-
-  {
-    mmx_t rounder;
-
-    rounder.uw[0] = 4;
-    rounder.uw[1] = 4;
-    rounder.uw[2] = 4;
-    rounder.uw[3] = 4;
-    pxor_r2r (mm7, mm7);
-    movq_m2r (rounder, mm6);
-  }
-  for (; size > 3; size -= 4) {
-    DEINT_LINE_LUM lum_m4 += 4;
-
-    lum_m3 += 4;
-    lum_m2 += 4;
-    lum_m1 += 4;
-    lum += 4;
-    dst += 4;
-  }
-#endif
-}
-
-static void
-deinterlace_line_inplace (uint8_t * lum_m4, uint8_t * lum_m3, uint8_t * lum_m2,
-    uint8_t * lum_m1, uint8_t * lum, int size)
-{
-#ifndef HAVE_MMX
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  int sum;
-
-  for (; size > 0; size--) {
-    sum = -lum_m4[0];
-    sum += lum_m3[0] << 2;
-    sum += lum_m2[0] << 1;
-    lum_m4[0] = lum_m2[0];
-    sum += lum_m1[0] << 2;
-    sum += -lum[0];
-    lum_m2[0] = cm[(sum + 4) >> 3];
-    lum_m4++;
-    lum_m3++;
-    lum_m2++;
-    lum_m1++;
-    lum++;
-  }
-#else
-
-  {
-    mmx_t rounder;
-
-    rounder.uw[0] = 4;
-    rounder.uw[1] = 4;
-    rounder.uw[2] = 4;
-    rounder.uw[3] = 4;
-    pxor_r2r (mm7, mm7);
-    movq_m2r (rounder, mm6);
-  }
-  for (; size > 3; size -= 4) {
-    DEINT_INPLACE_LINE_LUM lum_m4 += 4;
-
-    lum_m3 += 4;
-    lum_m2 += 4;
-    lum_m1 += 4;
-    lum += 4;
-  }
-#endif
-}
-#endif
-
-/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
-   top field is copied as is, but the bottom field is deinterlaced
-   against the top field. */
-#if 0
-static void
-deinterlace_bottom_field (uint8_t * dst, int dst_wrap,
-    const uint8_t * src1, int src_wrap, int width, int height)
-{
-  const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
-  int y;
-
-  src_m2 = src1;
-  src_m1 = src1;
-  src_0 = &src_m1[src_wrap];
-  src_p1 = &src_0[src_wrap];
-  src_p2 = &src_p1[src_wrap];
-  for (y = 0; y < (height - 2); y += 2) {
-    memcpy (dst, src_m1, width);
-    dst += dst_wrap;
-    deinterlace_line (dst, src_m2, src_m1, src_0, src_p1, src_p2, width);
-    src_m2 = src_0;
-    src_m1 = src_p1;
-    src_0 = src_p2;
-    src_p1 += 2 * src_wrap;
-    src_p2 += 2 * src_wrap;
-    dst += dst_wrap;
-  }
-  memcpy (dst, src_m1, width);
-  dst += dst_wrap;
-  /* do last line */
-  deinterlace_line (dst, src_m2, src_m1, src_0, src_0, src_0, width);
-}
-
-static void
-deinterlace_bottom_field_inplace (uint8_t * src1, int src_wrap,
-    int width, int height)
-{
-  uint8_t *src_m1, *src_0, *src_p1, *src_p2;
-  int y;
-  uint8_t *buf;
-
-  buf = (uint8_t *) av_malloc (width);
-
-  src_m1 = src1;
-  memcpy (buf, src_m1, width);
-  src_0 = &src_m1[src_wrap];
-  src_p1 = &src_0[src_wrap];
-  src_p2 = &src_p1[src_wrap];
-  for (y = 0; y < (height - 2); y += 2) {
-    deinterlace_line_inplace (buf, src_m1, src_0, src_p1, src_p2, width);
-    src_m1 = src_p1;
-    src_0 = src_p2;
-    src_p1 += 2 * src_wrap;
-    src_p2 += 2 * src_wrap;
-  }
-  /* do last line */
-  deinterlace_line_inplace (buf, src_m1, src_0, src_0, src_0, width);
-  av_free (buf);
-}
-#endif
-
-/* deinterlace - if not supported return -1 */
-#if 0
-static int
-avpicture_deinterlace (AVPicture * dst, const AVPicture * src,
-    int pix_fmt, int width, int height)
-{
-  int i;
-
-  if (pix_fmt != PIX_FMT_YUV420P &&
-      pix_fmt != PIX_FMT_YUV422P &&
-      pix_fmt != PIX_FMT_YUV444P && pix_fmt != PIX_FMT_YUV411P)
-    return -1;
-  if ((width & 3) != 0 || (height & 3) != 0)
-    return -1;
-
-  for (i = 0; i < 3; i++) {
-    if (i == 1) {
-      switch (pix_fmt) {
-        case PIX_FMT_YUV420P:
-          width >>= 1;
-          height >>= 1;
-          break;
-        case PIX_FMT_YUV422P:
-          width >>= 1;
-          break;
-        case PIX_FMT_YUV411P:
-          width >>= 2;
-          break;
-        default:
-          break;
-      }
-    }
-    if (src == dst) {
-      deinterlace_bottom_field_inplace (dst->data[i], dst->linesize[i],
-          width, height);
-    } else {
-      deinterlace_bottom_field (dst->data[i], dst->linesize[i],
-          src->data[i], src->linesize[i], width, height);
-    }
-  }
-#ifdef HAVE_MMX
-  emms ();
-#endif
-  return 0;
-}
-#endif
-
-#undef FIX
diff --git a/gst/ffmpegcolorspace/imgconvert_template.h b/gst/ffmpegcolorspace/imgconvert_template.h
deleted file mode 100644 (file)
index 3b287e7..0000000
+++ /dev/null
@@ -1,2188 +0,0 @@
-/*
- * Templates for image convertion routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef RGB_OUT
-#define RGB_OUT(d, r, g, b) RGBA_OUT(d, r, g, b, 0xffU)
-#endif
-
-static void glue (uyvy422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
-                                        int width, int height)
-{
-    uint8_t *s, *d, *d1, *s1;
-    int w, y, cb, cr, r_add, g_add, b_add;
-    uint8_t *cm = cropTbl + MAX_NEG_CROP;
-    unsigned int r, g, b;
-
-    d = dst->data[0];
-    s = src->data[0];
-    for(;height > 0; height --) {
-        d1 = d;
-        s1 = s;
-        for(w = width; w >= 2; w -= 2) {
-            YUV_TO_RGB1_CCIR(s1[0], s1[2]);
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[1]);
-            RGB_OUT(d1, r, g, b);
-            d1 += BPP;
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[3]);
-            RGB_OUT(d1, r, g, b);
-            d1 += BPP;
-
-            s1 += 4;
-        }
-
-        if (w) {
-            YUV_TO_RGB1_CCIR(s1[0], s1[2]);
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[1]);
-            RGB_OUT(d1, r, g, b);
-        }
-
-        d += dst->linesize[0];
-        s += src->linesize[0];
-    }
-}
-
-static void glue (yuv422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
-                                        int width, int height)
-{
-    uint8_t *s, *d, *d1, *s1;
-    int w, y, cb, cr, r_add, g_add, b_add;
-    uint8_t *cm = cropTbl + MAX_NEG_CROP;
-    unsigned int r, g, b;
-
-    d = dst->data[0];
-    s = src->data[0];
-    for(;height > 0; height --) {
-        d1 = d;
-        s1 = s;
-        for(w = width; w >= 2; w -= 2) {
-            YUV_TO_RGB1_CCIR(s1[1], s1[3]);
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[0]);
-            RGB_OUT(d1, r, g, b);
-            d1 += BPP;
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[2]);
-            RGB_OUT(d1, r, g, b);
-            d1 += BPP;
-
-            s1 += 4;
-        }
-
-        if (w) {
-            YUV_TO_RGB1_CCIR(s1[1], s1[3]);
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[0]);
-            RGB_OUT(d1, r, g, b);
-        }
-
-        d += dst->linesize[0];
-        s += src->linesize[0];
-    }
-}
-
-static void glue (yvyu422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
-                                        int width, int height)
-{
-    uint8_t *s, *d, *d1, *s1;
-    int w, y, cb, cr, r_add, g_add, b_add;
-    uint8_t *cm = cropTbl + MAX_NEG_CROP;
-    unsigned int r, g, b;
-
-    d = dst->data[0];
-    s = src->data[0];
-    for(;height > 0; height --) {
-        d1 = d;
-        s1 = s;
-        for(w = width; w >= 2; w -= 2) {
-            YUV_TO_RGB1_CCIR(s1[3], s1[1]);
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[0]);
-            RGB_OUT(d1, r, g, b);
-            d1 += BPP;
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[2]);
-            RGB_OUT(d1, r, g, b);
-            d1 += BPP;
-
-            s1 += 4;
-        }
-
-        if (w) {
-            YUV_TO_RGB1_CCIR(s1[3], s1[1]);
-
-            YUV_TO_RGB2_CCIR(r, g, b, s1[0]);
-            RGB_OUT(d1, r, g, b);
-        }
-
-        d += dst->linesize[0];
-        s += src->linesize[0];
-    }
-}
-
-static void glue (yuv420p_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
-                                        int width, int height)
-{
-  const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr;
-  uint8_t *d, *d1, *d2;
-  int w, y, cb, cr, r_add, g_add, b_add, width2;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  cb_ptr = src->data[1];
-  cr_ptr = src->data[2];
-  width2 = (width + 1) >> 1;
-  for (; height >= 2; height -= 2) {
-    d1 = d;
-    d2 = d + dst->linesize[0];
-    y2_ptr = y1_ptr + src->linesize[0];
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      /* output 4 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
-      RGB_OUT (d2 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-      d2 += 2 * BPP;
-
-      y1_ptr += 2;
-      y2_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    /* handle odd width */
-    if (w) {
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-      d1 += BPP;
-      d2 += BPP;
-      y1_ptr++;
-      y2_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    d += 2 * dst->linesize[0];
-    y1_ptr += 2 * src->linesize[0] - width;
-    cb_ptr += src->linesize[1] - width2;
-    cr_ptr += src->linesize[2] - width2;
-  }
-  /* handle odd height */
-  if (height) {
-    d1 = d;
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      /* output 2 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-
-      y1_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    /* handle width */
-    if (w) {
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      /* output 2 pixel */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-
-      y1_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-    }
-  }
-}
-
-#ifndef RGBA_OUT
-#define RGBA_OUT_(d, r, g, b, a) RGB_OUT(d, r, g, b)
-#define YUVA_TO_A(d, a)
-#else
-#define RGBA_OUT_(d, r, g, b, a) RGBA_OUT(d, r, g, b, a)
-#define YUVA_TO_A(d, a) do { d = a; } while (0);
-#endif
-
-static void glue (yuva420p_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
-                                        int width, int height)
-{
-  const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *a1_ptr, *a2_ptr;
-  uint8_t *d, *d1, *d2;
-  int w, y, cb, cr, r_add, g_add, b_add, width2;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-#ifdef RGBA_OUT
-  unsigned int a = 0;
-#endif
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  cb_ptr = src->data[1];
-  cr_ptr = src->data[2];
-  a1_ptr = src->data[3];
-  width2 = (width + 1) >> 1;
-  for (; height >= 2; height -= 2) {
-    d1 = d;
-    d2 = d + dst->linesize[0];
-    y2_ptr = y1_ptr + src->linesize[0];
-    a2_ptr = a1_ptr + src->linesize[3];
-    for (w = width; w >= 2; w -= 2) {
-      YUVA_TO_A (a, a1_ptr[0]);
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      /* output 4 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGBA_OUT_ (d1, r, g, b, a);
-
-      YUVA_TO_A (a, a1_ptr[1]);
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGBA_OUT_ (d1 + BPP, r, g, b, a);
-
-      YUVA_TO_A (a, a2_ptr[0]);
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGBA_OUT_ (d2, r, g, b, a);
-
-      YUVA_TO_A (a, a2_ptr[1]);
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
-      RGBA_OUT_ (d2 + BPP, r, g, b, a);
-
-      d1 += 2 * BPP;
-      d2 += 2 * BPP;
-
-      y1_ptr += 2;
-      y2_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr += 2;
-      a2_ptr += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      YUVA_TO_A (a, a1_ptr[0]);
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGBA_OUT_ (d1, r, g, b, a);
-
-      YUVA_TO_A (a, a2_ptr[0]);
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGBA_OUT_ (d2, r, g, b, a);
-      d1 += BPP;
-      d2 += BPP;
-      y1_ptr++;
-      y2_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr++;
-      a2_ptr++;
-    }
-    d += 2 * dst->linesize[0];
-    y1_ptr += 2 * src->linesize[0] - width;
-    cb_ptr += src->linesize[1] - width2;
-    cr_ptr += src->linesize[2] - width2;
-    a1_ptr += 2 * src->linesize[3] - width;
-  }
-  /* handle odd height */
-  if (height) {
-    d1 = d;
-    for (w = width; w >= 2; w -= 2) {
-      YUVA_TO_A (a, a1_ptr[0]);
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      /* output 2 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGBA_OUT_ (d1, r, g, b, a);
-
-      YUVA_TO_A (a, a1_ptr[1]);
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGBA_OUT_ (d1 + BPP, r, g, b, a);
-
-      d1 += 2 * BPP;
-
-      y1_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr += 2;
-    }
-    /* handle width */
-    if (w) {
-      YUVA_TO_A (a, a1_ptr[0]);
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-      /* output 2 pixel */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGBA_OUT_ (d1, r, g, b, a);
-      d1 += BPP;
-
-      y1_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-      a1_ptr++;
-    }
-  }
-}
-
-static void glue (nv12_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *y1_ptr, *y2_ptr, *c_ptr;
-  uint8_t *d, *d1, *d2;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-  int c_wrap = src->linesize[1] - ((width + 1) & ~0x01);
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  c_ptr = src->data[1];
-  for (; height >= 2; height -= 2) {
-    d1 = d;
-    d2 = d + dst->linesize[0];
-    y2_ptr = y1_ptr + src->linesize[0];
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
-      /* output 4 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
-      RGB_OUT (d2 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-      d2 += 2 * BPP;
-
-      y1_ptr += 2;
-      y2_ptr += 2;
-      c_ptr += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-      d1 += BPP;
-      d2 += BPP;
-      y1_ptr++;
-      y2_ptr++;
-      c_ptr += 2;
-    }
-    d += 2 * dst->linesize[0];
-    y1_ptr += 2 * src->linesize[0] - width;
-    c_ptr += c_wrap;
-  }
-  /* handle odd height */
-  if (height) {
-    d1 = d;
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
-      /* output 2 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-
-      y1_ptr += 2;
-      c_ptr += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
-      /* output 1 pixel */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-
-      y1_ptr++;
-      c_ptr += 2;
-    }
-  }
-}
-
-static void glue (nv21_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *y1_ptr, *y2_ptr, *c_ptr;
-  uint8_t *d, *d1, *d2;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-  int c_wrap = src->linesize[1] - ((width + 1) & ~0x01);
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  c_ptr = src->data[1];
-  for (; height >= 2; height -= 2) {
-    d1 = d;
-    d2 = d + dst->linesize[0];
-    y2_ptr = y1_ptr + src->linesize[0];
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
-      /* output 4 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
-      RGB_OUT (d2 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-      d2 += 2 * BPP;
-
-      y1_ptr += 2;
-      y2_ptr += 2;
-      c_ptr += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-      d1 += BPP;
-      d2 += BPP;
-      y1_ptr++;
-      y2_ptr++;
-      c_ptr += 2;
-    }
-    d += 2 * dst->linesize[0];
-    y1_ptr += 2 * src->linesize[0] - width;
-    c_ptr += c_wrap;
-  }
-  /* handle odd height */
-  if (height) {
-    d1 = d;
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
-      /* output 2 pixels */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-
-      y1_ptr += 2;
-      c_ptr += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
-      /* output 1 pixel */
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-
-      y1_ptr++;
-      c_ptr += 2;
-    }
-  }
-}
-
-static void glue (yuvj420p_to_, RGB_NAME) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr;
-  uint8_t *d, *d1, *d2;
-  int w, y, cb, cr, r_add, g_add, b_add, width2;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  cb_ptr = src->data[1];
-  cr_ptr = src->data[2];
-  width2 = (width + 1) >> 1;
-  for (; height >= 2; height -= 2) {
-    d1 = d;
-    d2 = d + dst->linesize[0];
-    y2_ptr = y1_ptr + src->linesize[0];
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
-      /* output 4 pixels */
-      YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2 (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      YUV_TO_RGB2 (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-
-      YUV_TO_RGB2 (r, g, b, y2_ptr[1]);
-      RGB_OUT (d2 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-      d2 += 2 * BPP;
-
-      y1_ptr += 2;
-      y2_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    /* handle odd width */
-    if (w) {
-      YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
-      YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2 (r, g, b, y2_ptr[0]);
-      RGB_OUT (d2, r, g, b);
-      d1 += BPP;
-      d2 += BPP;
-      y1_ptr++;
-      y2_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    d += 2 * dst->linesize[0];
-    y1_ptr += 2 * src->linesize[0] - width;
-    cb_ptr += src->linesize[1] - width2;
-    cr_ptr += src->linesize[2] - width2;
-  }
-  /* handle odd height */
-  if (height) {
-    d1 = d;
-    for (w = width; w >= 2; w -= 2) {
-      YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
-      /* output 2 pixels */
-      YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-
-      YUV_TO_RGB2 (r, g, b, y1_ptr[1]);
-      RGB_OUT (d1 + BPP, r, g, b);
-
-      d1 += 2 * BPP;
-
-      y1_ptr += 2;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    /* handle width */
-    if (w) {
-      YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
-      /* output 2 pixels */
-      YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-
-      y1_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-    }
-  }
-}
-
-static void glue (y800_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  int r, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - BPP * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      r = Y_CCIR_TO_JPEG (p[0]);
-      RGB_OUT (q, r, r, r);
-      q += BPP;
-      p++;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (y16_to_, RGB_NAME) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  int r, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - BPP * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      r = Y_CCIR_TO_JPEG (GST_READ_UINT16_LE (p) >> 8);
-      RGB_OUT (q, r, r, r);
-      q += BPP;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_yuv420p) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  int wrap, wrap3, width2;
-  int r, g, b, r1, g1, b1, w;
-  uint8_t *lum, *cb, *cr;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  cb = dst->data[1];
-  cr = dst->data[2];
-
-  width2 = (width + 1) >> 1;
-  wrap = dst->linesize[0];
-  wrap3 = src->linesize[0];
-  p = src->data[0];
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      p += wrap3;
-      lum += wrap;
-
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-
-      cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 2);
-      cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-
-      cb++;
-      cr++;
-      p += -wrap3 + 2 * BPP;
-      lum += -wrap + 2;
-    }
-    if (w) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      p += wrap3;
-      lum += wrap;
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      cb++;
-      cr++;
-      p += -wrap3 + BPP;
-      lum += -wrap + 1;
-    }
-    p += wrap3 + (wrap3 - width * BPP);
-    lum += wrap + (wrap - width);
-    cb += dst->linesize[1] - width2;
-    cr += dst->linesize[2] - width2;
-  }
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      cb++;
-      cr++;
-      p += 2 * BPP;
-      lum += 2;
-    }
-    if (w) {
-      RGB_IN (r, g, b, p);
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      cb[0] = RGB_TO_U_CCIR (r, g, b, 0);
-      cr[0] = RGB_TO_V_CCIR (r, g, b, 0);
-    }
-  }
-}
-
-#ifndef RGBA_IN
-#define RGBA_IN_(r, g, b, a, p) RGB_IN(r, g, b, p)
-#else
-#define RGBA_IN_(r, g, b, a, p) RGBA_IN(r, g, b, a, p)
-#endif
-
-static void glue (RGB_NAME, _to_yuva420p) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  int wrap, wrap3, width2;
-  int r, g, b, r1, g1, b1, w, ra = 255;
-  uint8_t *lum, *cb, *cr, *a;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  cb = dst->data[1];
-  cr = dst->data[2];
-  a = dst->data[3];
-
-  width2 = (width + 1) >> 1;
-  wrap = dst->linesize[0];
-  wrap3 = src->linesize[0];
-  p = src->data[0];
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      RGBA_IN_ (r, g, b, ra, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      a[0] = ra;
-
-      RGBA_IN_ (r, g, b, ra, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      a[1] = ra;
-      p += wrap3;
-      lum += wrap;
-      a += wrap;
-
-      RGBA_IN_ (r, g, b, ra, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      a[0] = ra;
-
-      RGBA_IN_ (r, g, b, ra, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      a[1] = ra;
-
-      cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 2);
-      cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-      cb++;
-      cr++;
-      p += -wrap3 + 2 * BPP;
-      lum += -wrap + 2;
-      a += -wrap + 2;
-    }
-    if (w) {
-      RGBA_IN_ (r, g, b, ra, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      a[0] = ra;
-      p += wrap3;
-      lum += wrap;
-      a += wrap;
-      RGBA_IN_ (r, g, b, ra, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      a[0] = ra;
-      cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      cb++;
-      cr++;
-      p += -wrap3 + BPP;
-      lum += -wrap + 1;
-      a += -wrap + 1;
-    }
-    p += wrap3 + (wrap3 - width * BPP);
-    lum += wrap + (wrap - width);
-    a += wrap + (wrap - width);
-    cb += dst->linesize[1] - width2;
-    cr += dst->linesize[2] - width2;
-  }
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      RGBA_IN_ (r, g, b, ra, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      a[0] = ra;
-
-      RGBA_IN_ (r, g, b, ra, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      a[1] = ra;
-      cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      cb++;
-      cr++;
-      p += 2 * BPP;
-      lum += 2;
-      a += 2;
-    }
-    if (w) {
-      RGBA_IN_ (r, g, b, ra, p);
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      a[0] = ra;
-      cb[0] = RGB_TO_U_CCIR (r, g, b, 0);
-      cr[0] = RGB_TO_V_CCIR (r, g, b, 0);
-    }
-  }
-}
-
-static void glue (RGB_NAME, _to_nv12) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int wrap, wrap3;
-  int r, g, b, r1, g1, b1, w;
-  uint8_t *lum, *c;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  c = dst->data[1];
-
-  wrap = dst->linesize[0];
-  wrap3 = src->linesize[0];
-  p = src->data[0];
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      p += wrap3;
-      lum += wrap;
-
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-
-      c[0] = RGB_TO_U_CCIR (r1, g1, b1, 2);
-      c[1] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-
-      c += 2;
-      p += -wrap3 + 2 * BPP;
-      lum += -wrap + 2;
-    }
-    /* handle odd width */
-    if (w) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      p += wrap3;
-      lum += wrap;
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      c[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      c[1] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      p += -wrap3 + BPP;
-      lum += -wrap + 1;
-    }
-    p += wrap3 + (wrap3 - width * BPP);
-    lum += wrap + (wrap - width);
-    c += dst->linesize[1] - (width & ~1);
-  }
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      c[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      c[1] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      c += 2;
-      p += 2 * BPP;
-      lum += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      RGB_IN (r, g, b, p);
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      c[0] = RGB_TO_U_CCIR (r, g, b, 0);
-      c[1] = RGB_TO_V_CCIR (r, g, b, 0);
-    }
-  }
-}
-
-static void glue (RGB_NAME, _to_nv21) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int wrap, wrap3;
-  int r, g, b, r1, g1, b1, w;
-  uint8_t *lum, *c;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  c = dst->data[1];
-
-  wrap = dst->linesize[0];
-  wrap3 = src->linesize[0];
-  p = src->data[0];
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      p += wrap3;
-      lum += wrap;
-
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-
-      c[1] = RGB_TO_U_CCIR (r1, g1, b1, 2);
-      c[0] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-
-      c += 2;
-      p += -wrap3 + 2 * BPP;
-      lum += -wrap + 2;
-    }
-    /* handle odd width */
-    if (w) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      p += wrap3;
-      lum += wrap;
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      c[1] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      c[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      p += -wrap3 + BPP;
-      lum += -wrap + 1;
-    }
-    p += wrap3 + (wrap3 - width * BPP);
-    lum += wrap + (wrap - width);
-    c += dst->linesize[1] - (width & ~1);
-  }
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y_CCIR (r, g, b);
-      c[1] = RGB_TO_U_CCIR (r1, g1, b1, 1);
-      c[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
-      c += 2;
-      p += 2 * BPP;
-      lum += 2;
-    }
-    /* handle odd width */
-    if (w) {
-      RGB_IN (r, g, b, p);
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      c[1] = RGB_TO_U_CCIR (r, g, b, 0);
-      c[0] = RGB_TO_V_CCIR (r, g, b, 0);
-    }
-  }
-}
-
-static void glue (RGB_NAME, _to_gray) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, g, b, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      q[0] = RGB_TO_Y (r, g, b);
-      q++;
-      p += BPP;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_y800) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, g, b, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      q[0] = RGB_TO_Y_CCIR (r, g, b);
-      q++;
-      p += BPP;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_y16) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, g, b, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      GST_WRITE_UINT16_LE (q, RGB_TO_Y_CCIR (r, g, b) << 8);
-      q += 2;
-      p += BPP;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (gray_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - BPP * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      r = p[0];
-      RGB_OUT (q, r, r, r);
-      q += BPP;
-      p++;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_gray16_l) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, g, b, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      GST_WRITE_UINT16_LE (q, RGB_TO_Y (r, g, b) << 8);
-      q += 2;
-      p += BPP;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (gray16_l_to_, RGB_NAME) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - BPP * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      r = GST_READ_UINT16_LE (p) >> 8;
-      RGB_OUT (q, r, r, r);
-      q += BPP;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_gray16_b) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, g, b, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - 2 * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      GST_WRITE_UINT16_BE (q, RGB_TO_Y (r, g, b) << 8);
-      q += 2;
-      p += BPP;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (gray16_b_to_, RGB_NAME) (AVPicture * dst,
-    const AVPicture * src, int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, dst_wrap, src_wrap;
-  int x, y;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - 2 * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - BPP * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      r = GST_READ_UINT16_BE (p) >> 8;
-      RGB_OUT (q, r, r, r);
-      q += BPP;
-      p += 2;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-static void glue (pal8_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int r, g, b, dst_wrap, src_wrap;
-  int x, y;
-  uint32_t v;
-  const uint32_t *palette;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - width;
-  palette = (uint32_t *) src->data[1];
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - BPP * width;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      v = palette[p[0]];
-      r = (v >> 16) & 0xff;
-      g = (v >> 8) & 0xff;
-      b = (v) & 0xff;
-#ifdef RGBA_OUT
-      {
-        int a;
-        a = (v >> 24) & 0xff;
-        RGBA_OUT (q, r, g, b, a);
-      }
-#else
-      RGB_OUT (q, r, g, b);
-#endif
-      q += BPP;
-      p++;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-}
-
-#if !defined(FMT_RGBA32) && defined(RGBA_OUT)
-/* alpha support */
-
-static void glue (rgba32_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *s;
-  uint8_t *d;
-  int src_wrap, dst_wrap, j, y;
-  unsigned int v, r, g, b, a;
-
-  s = src->data[0];
-  src_wrap = src->linesize[0] - width * 4;
-
-  d = dst->data[0];
-  dst_wrap = dst->linesize[0] - width * BPP;
-
-  for (y = 0; y < height; y++) {
-    for (j = 0; j < width; j++) {
-      v = ((const uint32_t *) (s))[0];
-      a = (v >> 24) & 0xff;
-      r = (v >> 16) & 0xff;
-      g = (v >> 8) & 0xff;
-      b = v & 0xff;
-      RGBA_OUT (d, r, g, b, a);
-      s += 4;
-      d += BPP;
-    }
-    s += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_rgba32) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *s;
-  uint8_t *d;
-  int src_wrap, dst_wrap, j, y;
-  unsigned int r, g, b, a;
-
-  s = src->data[0];
-  src_wrap = src->linesize[0] - width * BPP;
-
-  d = dst->data[0];
-  dst_wrap = dst->linesize[0] - width * 4;
-
-  for (y = 0; y < height; y++) {
-    for (j = 0; j < width; j++) {
-      RGBA_IN (r, g, b, a, s);
-      ((uint32_t *) (d))[0] = (a << 24) | (r << 16) | (g << 8) | b;
-      d += 4;
-      s += BPP;
-    }
-    s += src_wrap;
-    d += dst_wrap;
-  }
-}
-#endif /* !defined(FMT_RGBA32) && defined(RGBA_OUT) */
-
-#if defined(FMT_RGBA32)
-
-#if !defined(rgba32_fcts_done)
-#define rgba32_fcts_done
-
-static void
-ayuv4444_to_rgba32 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *s, *d, *d1, *s1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b, a;
-
-  d = dst->data[0];
-  s = src->data[0];
-  for (; height > 0; height--) {
-    d1 = d;
-    s1 = s;
-    for (w = width; w > 0; w--) {
-      a = s1[0];
-      YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
-      RGBA_OUT (d1, r, g, b, a);
-      d1 += BPP;
-      s1 += 4;
-    }
-    d += dst->linesize[0];
-    s += src->linesize[0];
-  }
-}
-
-static void
-rgba32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int src_wrap, dst_wrap, x, y;
-  int r, g, b, a;
-  uint8_t *d;
-  const uint8_t *p;
-
-  src_wrap = src->linesize[0] - width * BPP;
-  dst_wrap = dst->linesize[0] - width * 4;
-  d = dst->data[0];
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGBA_IN (r, g, b, a, p);
-      d[0] = a;
-      d[1] = RGB_TO_Y_CCIR (r, g, b);
-      d[2] = RGB_TO_U_CCIR (r, g, b, 0);
-      d[3] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      d += 4;
-    }
-    p += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-#endif /* !defined(rgba32_fcts_done) */
-
-#endif /* defined(FMT_RGBA32) */
-
-#if defined(FMT_BGRA32)
-#if !defined(bgra32_fcts_done)
-#define bgra32_fcts_done
-
-static void
-bgra32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int src_wrap, dst_wrap, x, y;
-  int r, g, b, a;
-  uint8_t *d;
-  const uint8_t *p;
-
-  src_wrap = src->linesize[0] - width * BPP;
-  dst_wrap = dst->linesize[0] - width * 4;
-  d = dst->data[0];
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGBA_IN (r, g, b, a, p);
-      d[0] = a;
-      d[1] = RGB_TO_Y_CCIR (r, g, b);
-      d[2] = RGB_TO_U_CCIR (r, g, b, 0);
-      d[3] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      d += 4;
-    }
-    p += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-static void
-ayuv4444_to_bgra32 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *s, *d, *d1, *s1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b, a;
-
-  d = dst->data[0];
-  s = src->data[0];
-  for (; height > 0; height--) {
-    d1 = d;
-    s1 = s;
-    for (w = width; w > 0; w--) {
-      a = s1[0];
-      YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
-      RGBA_OUT (d1, r, g, b, a);
-      d1 += BPP;
-      s1 += 4;
-    }
-    d += dst->linesize[0];
-    s += src->linesize[0];
-  }
-}
-
-#endif /* !defined(bgra32_fcts_done) */
-
-#endif /* defined(FMT_BGRA32) */
-
-#if defined(FMT_ARGB32)
-
-#if !defined(argb32_fcts_done)
-#define argb32_fcts_done
-
-static void
-ayuv4444_to_argb32 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *s, *d, *d1, *s1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b, a;
-
-  d = dst->data[0];
-  s = src->data[0];
-  for (; height > 0; height--) {
-    d1 = d;
-    s1 = s;
-    for (w = width; w > 0; w--) {
-      a = s1[0];
-      YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
-      RGBA_OUT (d1, r, g, b, a);
-      d1 += BPP;
-      s1 += 4;
-    }
-    d += dst->linesize[0];
-    s += src->linesize[0];
-  }
-}
-
-static void
-argb32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int src_wrap, dst_wrap, x, y;
-  int r, g, b, a;
-  uint8_t *d;
-  const uint8_t *p;
-
-  src_wrap = src->linesize[0] - width * BPP;
-  dst_wrap = dst->linesize[0] - width * 4;
-  d = dst->data[0];
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGBA_IN (r, g, b, a, p);
-      d[0] = a;
-      d[1] = RGB_TO_Y_CCIR (r, g, b);
-      d[2] = RGB_TO_U_CCIR (r, g, b, 0);
-      d[3] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      d += 4;
-    }
-    p += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-#endif /* !defined(argb32_fcts_done) */
-
-#endif /* defined(FMT_ARGB32) */
-
-#if defined(FMT_ABGR32)
-#if !defined(abgr32_fcts_done)
-#define abgr32_fcts_done
-
-static void
-abgr32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int src_wrap, dst_wrap, x, y;
-  int r, g, b, a;
-  uint8_t *d;
-  const uint8_t *p;
-
-  src_wrap = src->linesize[0] - width * BPP;
-  dst_wrap = dst->linesize[0] - width * 4;
-  d = dst->data[0];
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGBA_IN (r, g, b, a, p);
-      d[0] = a;
-      d[1] = RGB_TO_Y_CCIR (r, g, b);
-      d[2] = RGB_TO_U_CCIR (r, g, b, 0);
-      d[3] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      d += 4;
-    }
-    p += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-static void
-ayuv4444_to_abgr32 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *s, *d, *d1, *s1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b, a;
-
-  d = dst->data[0];
-  s = src->data[0];
-  for (; height > 0; height--) {
-    d1 = d;
-    s1 = s;
-    for (w = width; w > 0; w--) {
-      a = s1[0];
-      YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
-      RGBA_OUT (d1, r, g, b, a);
-      d1 += BPP;
-      s1 += 4;
-    }
-    d += dst->linesize[0];
-    s += src->linesize[0];
-  }
-}
-
-#endif /* !defined(abgr32_fcts_done) */
-
-#endif /* defined(FMT_ABGR32) */
-
-#ifndef FMT_RGB24
-
-static void glue (rgb24_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *s;
-  uint8_t *d;
-  int src_wrap, dst_wrap, j, y;
-  unsigned int r, g, b;
-
-  s = src->data[0];
-  src_wrap = src->linesize[0] - width * 3;
-
-  d = dst->data[0];
-  dst_wrap = dst->linesize[0] - width * BPP;
-
-  for (y = 0; y < height; y++) {
-    for (j = 0; j < width; j++) {
-      r = s[0];
-      g = s[1];
-      b = s[2];
-      RGB_OUT (d, r, g, b);
-      s += 3;
-      d += BPP;
-    }
-    s += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-static void glue (RGB_NAME, _to_rgb24) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *s;
-  uint8_t *d;
-  int src_wrap, dst_wrap, j, y;
-  unsigned int r, g, b;
-
-  s = src->data[0];
-  src_wrap = src->linesize[0] - width * BPP;
-
-  d = dst->data[0];
-  dst_wrap = dst->linesize[0] - width * 3;
-
-  for (y = 0; y < height; y++) {
-    for (j = 0; j < width; j++) {
-      RGB_IN (r, g, b, s)
-          d[0] = r;
-      d[1] = g;
-      d[2] = b;
-      d += 3;
-      s += BPP;
-    }
-    s += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-#endif /* !FMT_RGB24 */
-
-#ifdef FMT_RGB24
-
-static void
-yuv444p_to_rgb24 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  const uint8_t *y1_ptr, *cb_ptr, *cr_ptr;
-  uint8_t *d, *d1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  cb_ptr = src->data[1];
-  cr_ptr = src->data[2];
-  for (; height > 0; height--) {
-    d1 = d;
-    for (w = width; w > 0; w--) {
-      YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-
-      y1_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    d += dst->linesize[0];
-    y1_ptr += src->linesize[0] - width;
-    cb_ptr += src->linesize[1] - width;
-    cr_ptr += src->linesize[2] - width;
-  }
-}
-
-static void
-yuvj444p_to_rgb24 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const uint8_t *y1_ptr, *cb_ptr, *cr_ptr;
-  uint8_t *d, *d1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-
-  d = dst->data[0];
-  y1_ptr = src->data[0];
-  cb_ptr = src->data[1];
-  cr_ptr = src->data[2];
-  for (; height > 0; height--) {
-    d1 = d;
-    for (w = width; w > 0; w--) {
-      YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
-
-      YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-
-      y1_ptr++;
-      cb_ptr++;
-      cr_ptr++;
-    }
-    d += dst->linesize[0];
-    y1_ptr += src->linesize[0] - width;
-    cb_ptr += src->linesize[1] - width;
-    cr_ptr += src->linesize[2] - width;
-  }
-}
-
-static void
-rgb24_to_yuv444p (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  int src_wrap, x, y;
-  int r, g, b;
-  uint8_t *lum, *cb, *cr;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  cb = dst->data[1];
-  cr = dst->data[2];
-
-  src_wrap = src->linesize[0] - width * BPP;
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      lum[0] = RGB_TO_Y_CCIR (r, g, b);
-      cb[0] = RGB_TO_U_CCIR (r, g, b, 0);
-      cr[0] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      cb++;
-      cr++;
-      lum++;
-    }
-    p += src_wrap;
-    lum += dst->linesize[0] - width;
-    cb += dst->linesize[1] - width;
-    cr += dst->linesize[2] - width;
-  }
-}
-
-static void
-rgb24_to_yuvj420p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int wrap, wrap3, width2;
-  int r, g, b, r1, g1, b1, w;
-  uint8_t *lum, *cb, *cr;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  cb = dst->data[1];
-  cr = dst->data[2];
-
-  width2 = (width + 1) >> 1;
-  wrap = dst->linesize[0];
-  wrap3 = src->linesize[0];
-  p = src->data[0];
-  for (; height >= 2; height -= 2) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y (r, g, b);
-      p += wrap3;
-      lum += wrap;
-
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y (r, g, b);
-
-      cb[0] = RGB_TO_U (r1, g1, b1, 2);
-      cr[0] = RGB_TO_V (r1, g1, b1, 2);
-
-      cb++;
-      cr++;
-      p += -wrap3 + 2 * BPP;
-      lum += -wrap + 2;
-    }
-    if (w) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y (r, g, b);
-      p += wrap3;
-      lum += wrap;
-      RGB_IN (r, g, b, p);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[0] = RGB_TO_Y (r, g, b);
-      cb[0] = RGB_TO_U (r1, g1, b1, 1);
-      cr[0] = RGB_TO_V (r1, g1, b1, 1);
-      cb++;
-      cr++;
-      p += -wrap3 + BPP;
-      lum += -wrap + 1;
-    }
-    p += wrap3 + (wrap3 - width * BPP);
-    lum += wrap + (wrap - width);
-    cb += dst->linesize[1] - width2;
-    cr += dst->linesize[2] - width2;
-  }
-  /* handle odd height */
-  if (height) {
-    for (w = width; w >= 2; w -= 2) {
-      RGB_IN (r, g, b, p);
-      r1 = r;
-      g1 = g;
-      b1 = b;
-      lum[0] = RGB_TO_Y (r, g, b);
-
-      RGB_IN (r, g, b, p + BPP);
-      r1 += r;
-      g1 += g;
-      b1 += b;
-      lum[1] = RGB_TO_Y (r, g, b);
-      cb[0] = RGB_TO_U (r1, g1, b1, 1);
-      cr[0] = RGB_TO_V (r1, g1, b1, 1);
-      cb++;
-      cr++;
-      p += 2 * BPP;
-      lum += 2;
-    }
-    if (w) {
-      RGB_IN (r, g, b, p);
-      lum[0] = RGB_TO_Y (r, g, b);
-      cb[0] = RGB_TO_U (r, g, b, 0);
-      cr[0] = RGB_TO_V (r, g, b, 0);
-    }
-  }
-}
-
-static void
-rgb24_to_yuvj444p (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int src_wrap, x, y;
-  int r, g, b;
-  uint8_t *lum, *cb, *cr;
-  const uint8_t *p;
-
-  lum = dst->data[0];
-  cb = dst->data[1];
-  cr = dst->data[2];
-
-  src_wrap = src->linesize[0] - width * BPP;
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      lum[0] = RGB_TO_Y (r, g, b);
-      cb[0] = RGB_TO_U (r, g, b, 0);
-      cr[0] = RGB_TO_V (r, g, b, 0);
-      p += BPP;
-      cb++;
-      cr++;
-      lum++;
-    }
-    p += src_wrap;
-    lum += dst->linesize[0] - width;
-    cb += dst->linesize[1] - width;
-    cr += dst->linesize[2] - width;
-  }
-}
-
-static void
-ayuv4444_to_rgb24 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  uint8_t *s, *d, *d1, *s1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-
-  d = dst->data[0];
-  s = src->data[0];
-  for (; height > 0; height--) {
-    d1 = d;
-    s1 = s;
-    for (w = width; w > 0; w--) {
-      YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-      s1 += 4;
-    }
-    d += dst->linesize[0];
-    s += src->linesize[0];
-  }
-}
-
-static void
-rgb24_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  int src_wrap, dst_wrap, x, y;
-  int r, g, b;
-  uint8_t *d;
-  const uint8_t *p;
-
-  src_wrap = src->linesize[0] - width * BPP;
-  dst_wrap = dst->linesize[0] - width * 4;
-  d = dst->data[0];
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      d[0] = 0xff;
-      d[1] = RGB_TO_Y_CCIR (r, g, b);
-      d[2] = RGB_TO_U_CCIR (r, g, b, 0);
-      d[3] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      d += 4;
-    }
-    p += src_wrap;
-    d += dst_wrap;
-  }
-}
-
-static void
-v308_to_rgb24 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  uint8_t *s, *d, *d1, *s1;
-  int w, y, cb, cr, r_add, g_add, b_add;
-  uint8_t *cm = cropTbl + MAX_NEG_CROP;
-  unsigned int r, g, b;
-
-  d = dst->data[0];
-  s = src->data[0];
-  for (; height > 0; height--) {
-    d1 = d;
-    s1 = s;
-    for (w = width; w > 0; w--) {
-      YUV_TO_RGB1_CCIR (s1[1], s1[2]);
-
-      YUV_TO_RGB2_CCIR (r, g, b, s1[0]);
-      RGB_OUT (d1, r, g, b);
-      d1 += BPP;
-      s1 += 3;
-    }
-    d += dst->linesize[0];
-    s += src->linesize[0];
-  }
-}
-
-static void
-rgb24_to_v308 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
-  int src_wrap, dst_wrap, x, y;
-  int r, g, b;
-  uint8_t *d;
-  const uint8_t *p;
-
-  src_wrap = src->linesize[0] - width * BPP;
-  dst_wrap = dst->linesize[0] - width * 3;
-  d = dst->data[0];
-  p = src->data[0];
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGB_IN (r, g, b, p);
-      d[0] = RGB_TO_Y_CCIR (r, g, b);
-      d[1] = RGB_TO_U_CCIR (r, g, b, 0);
-      d[2] = RGB_TO_V_CCIR (r, g, b, 0);
-      p += BPP;
-      d += 3;
-    }
-    p += src_wrap;
-    d += dst_wrap;
-  }
-}
-#endif /* FMT_RGB24 */
-
-#if defined(FMT_RGB24) || defined(FMT_RGBA32)
-
-static void glue (RGB_NAME, _to_pal8) (AVPicture * dst, const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  unsigned char *q;
-  int dst_wrap, src_wrap;
-  int x, y, has_alpha;
-  unsigned int r, g, b;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-
-  q = dst->data[0];
-  dst_wrap = dst->linesize[0] - width;
-  has_alpha = 0;
-
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-#ifdef RGBA_IN
-      {
-        unsigned int a;
-        RGBA_IN (r, g, b, a, p);
-        /* crude approximation for alpha ! */
-        if (a < 0x80) {
-          has_alpha = 1;
-          q[0] = TRANSP_INDEX;
-        } else {
-          q[0] = gif_clut_index (r, g, b);
-        }
-      }
-#else
-      RGB_IN (r, g, b, p);
-      q[0] = gif_clut_index (r, g, b);
-#endif
-      q++;
-      p += BPP;
-    }
-    p += src_wrap;
-    q += dst_wrap;
-  }
-
-  build_rgb_palette (dst->data[1], has_alpha);
-}
-
-#endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */
-
-#ifdef RGBA_IN
-
-static int glue (get_alpha_info_, RGB_NAME) (const AVPicture * src,
-    int width, int height)
-{
-  const unsigned char *p;
-  int src_wrap, ret, x, y;
-  unsigned int G_GNUC_UNUSED r, G_GNUC_UNUSED g, G_GNUC_UNUSED b, a;
-
-  p = src->data[0];
-  src_wrap = src->linesize[0] - BPP * width;
-  ret = 0;
-  for (y = 0; y < height; y++) {
-    for (x = 0; x < width; x++) {
-      RGBA_IN (r, g, b, a, p);
-      if (a == 0x00) {
-        ret |= FF_ALPHA_TRANSP;
-      } else if (a != 0xff) {
-        ret |= FF_ALPHA_SEMI_TRANSP;
-      }
-      p += BPP;
-    }
-    p += src_wrap;
-  }
-  return ret;
-}
-
-#endif /* RGBA_IN */
-
-#undef RGB_IN
-#undef RGBA_IN
-#undef RGB_OUT
-#undef RGBA_OUT
-#undef BPP
-#undef RGB_NAME
-#undef FMT_RGB24
-#undef FMT_RGBA32
-#undef YUVA_TO_A
-#undef RGBA_OUT_
-#undef RGBA_IN_
diff --git a/gst/ffmpegcolorspace/mem.c b/gst/ffmpegcolorspace/mem.c
deleted file mode 100644 (file)
index 5c3a8a3..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * default memory allocator for libavcodec
- * Copyright (c) 2002 Fabrice Bellard.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/**
- * @file mem.c
- * default memory allocator for libavcodec.
- */
-
-#include "avcodec.h"
-
-/* here we can use OS dependant allocation functions */
-#undef malloc
-#undef free
-#undef realloc
-
-#include <stdlib.h>
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
-/* you can redefine av_malloc and av_free in your project to use your
-   memory allocator. You do not need to suppress this file because the
-   linker will do it automatically */
-
-/** 
- * Memory allocation of size byte with alignment suitable for all
- * memory accesses (including vectors if available on the
- * CPU). av_malloc(0) must return a non NULL pointer.
- */
-void *
-av_malloc (unsigned int size)
-{
-  void *ptr;
-
-#ifdef MEMALIGN_HACK
-  int diff;
-
-  ptr = malloc (size + 16 + 1);
-  diff = ((-(int) ptr - 1) & 15) + 1;
-  ptr += diff;
-  ((char *) ptr)[-1] = diff;
-#elif defined (HAVE_MEMALIGN)
-  ptr = memalign (16, size);
-  /* Why 64? 
-     Indeed, we should align it:
-     on 4 for 386
-     on 16 for 486
-     on 32 for 586, PPro - k6-III
-     on 64 for K7 (maybe for P3 too).
-     Because L1 and L2 caches are aligned on those values.
-     But I don't want to code such logic here!
-   */
-  /* Why 16?
-     because some cpus need alignment, for example SSE2 on P4, & most RISC cpus
-     it will just trigger an exception and the unaligned load will be done in the
-     exception handler or it will just segfault (SSE2 on P4)
-     Why not larger? because i didnt see a difference in benchmarks ...
-   */
-  /* benchmarks with p3
-     memalign(64)+1          3071,3051,3032
-     memalign(64)+2          3051,3032,3041
-     memalign(64)+4          2911,2896,2915
-     memalign(64)+8          2545,2554,2550
-     memalign(64)+16         2543,2572,2563
-     memalign(64)+32         2546,2545,2571
-     memalign(64)+64         2570,2533,2558
-
-     btw, malloc seems to do 8 byte alignment by default here
-   */
-#else
-  ptr = malloc (size);
-#endif
-  return ptr;
-}
-
-/**
- * av_realloc semantics (same as glibc): if ptr is NULL and size > 0,
- * identical to malloc(size). If size is zero, it is identical to
- * free(ptr) and NULL is returned.  
- */
-void *
-av_realloc (void *ptr, unsigned int size)
-{
-#ifdef MEMALIGN_HACK
-  //FIXME this isnt aligned correctly though it probably isnt needed
-  int diff;
-
-  if (!ptr)
-    return av_malloc (size);
-  diff = ((char *) ptr)[-1];
-  return realloc (ptr - diff, size + diff) + diff;
-#else
-  return realloc (ptr, size);
-#endif
-}
-
-/* NOTE: ptr = NULL is explicetly allowed */
-void
-av_free (void *ptr)
-{
-  /* XXX: this test should not be needed on most libcs */
-  if (ptr)
-#ifdef MEMALIGN_HACK
-    free (ptr - ((char *) ptr)[-1]);
-#else
-    free (ptr);
-#endif
-}
diff --git a/gst/ffmpegcolorspace/utils.c b/gst/ffmpegcolorspace/utils.c
deleted file mode 100644 (file)
index 49d86e7..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * utils for libavcodec
- * Copyright (c) 2001 Fabrice Bellard.
- * Copyright (c) 2003 Michel Bardiaux for the av_log API
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/**
- * @file utils.c
- * utils.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <limits.h>
-
-void *
-av_mallocz (unsigned int size)
-{
-  void *ptr;
-
-  ptr = av_malloc (size);
-  if (!ptr)
-    return NULL;
-  memset (ptr, 0, size);
-  return ptr;
-}
-
-char *
-av_strdup (const char *s)
-{
-  char *ptr;
-  int len;
-
-  len = strlen (s) + 1;
-  ptr = av_malloc (len);
-  if (!ptr)
-    return NULL;
-  memcpy (ptr, s, len);
-  return ptr;
-}
-
-/**
- * realloc which does nothing if the block is large enough
- */
-void *
-av_fast_realloc (void *ptr, unsigned int *size, unsigned int min_size)
-{
-  if (min_size < *size)
-    return ptr;
-
-  *size = 17 * min_size / 16 + 32;
-
-  return av_realloc (ptr, *size);
-}
-
-
-static unsigned int last_static = 0;
-static unsigned int allocated_static = 0;
-static void **array_static = NULL;
-
-/**
- * allocation of static arrays - do not use for normal allocation.
- */
-void *
-av_mallocz_static (unsigned int size)
-{
-  void *ptr = av_mallocz (size);
-
-  if (ptr) {
-    array_static =
-        av_fast_realloc (array_static, &allocated_static,
-        sizeof (void *) * (last_static + 1));
-    array_static[last_static++] = ptr;
-  }
-
-  return ptr;
-}
-
-/**
- * free all static arrays and reset pointers to 0.
- */
-void
-av_free_static (void)
-{
-  while (last_static) {
-    av_freep (&array_static[--last_static]);
-  }
-  av_freep (&array_static);
-}
-
-/**
- * Frees memory and sets the pointer to NULL.
- * @param arg pointer to the pointer which should be freed
- */
-void
-av_freep (void *arg)
-{
-  void **ptr = (void **) arg;
-
-  av_free (*ptr);
-  *ptr = NULL;
-}
-
-void
-avcodec_get_context_defaults (AVCodecContext * s)
-{
-  memset (s, 0, sizeof (AVCodecContext));
-
-  s->frame_rate_base = 1;
-  s->frame_rate = 25;
-}
-
-/**
- * allocates a AVCodecContext and set it to defaults.
- * this can be deallocated by simply calling free() 
- */
-AVCodecContext *
-avcodec_alloc_context (void)
-{
-  AVCodecContext *avctx = av_malloc (sizeof (AVCodecContext));
-
-  if (avctx == NULL)
-    return NULL;
-
-  avcodec_get_context_defaults (avctx);
-
-  return avctx;
-}
-
-/* must be called before any other functions */
-void
-avcodec_init (void)
-{
-  static int inited = 0;
-
-  if (inited != 0)
-    return;
-  inited = 1;
-
-  dsputil_static_init ();
-}
index 702e63f..b608977 100644 (file)
@@ -62,11 +62,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
 GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug);
 #define GST_CAT_DEFAULT gst_gdp_depay_debug
 
-#define _do_init(x) \
+#define _do_init \
     GST_DEBUG_CATEGORY_INIT (gst_gdp_depay_debug, "gdpdepay", 0, \
     "GDP depayloader");
-
-GST_BOILERPLATE_FULL (GstGDPDepay, gst_gdp_depay, GstElement,
+#define gst_gdp_depay_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGDPDepay, gst_gdp_depay,
     GST_TYPE_ELEMENT, _do_init);
 
 static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event);
@@ -80,29 +80,23 @@ static GstStateChangeReturn gst_gdp_depay_change_state (GstElement *
 static void gst_gdp_depay_finalize (GObject * object);
 
 static void
-gst_gdp_depay_base_init (gpointer g_class)
+gst_gdp_depay_class_init (GstGDPDepayClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
 
-  gst_element_class_set_details_simple (element_class,
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+
+  gst_element_class_set_details_simple (gstelement_class,
       "GDP Depayloader", "GDP/Depayloader",
       "Depayloads GStreamer Data Protocol buffers",
       "Thomas Vander Stichele <thomas at apestaart dot org>");
 
-  gst_element_class_add_pad_template (element_class,
+  gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&gdp_depay_sink_template));
-  gst_element_class_add_pad_template (element_class,
+  gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&gdp_depay_src_template));
-}
-
-static void
-gst_gdp_depay_class_init (GstGDPDepayClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
 
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_gdp_depay_change_state);
@@ -110,7 +104,7 @@ gst_gdp_depay_class_init (GstGDPDepayClass * klass)
 }
 
 static void
-gst_gdp_depay_init (GstGDPDepay * gdpdepay, GstGDPDepayClass * g_class)
+gst_gdp_depay_init (GstGDPDepay * gdpdepay)
 {
   gdpdepay->sinkpad =
       gst_pad_new_from_static_template (&gdp_depay_sink_template, "sink");
@@ -169,7 +163,7 @@ gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event)
       /* after EOS, we don't expect to output anything anymore */
       res = gst_pad_push_event (this->srcpad, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     case GST_EVENT_TAG:
     case GST_EVENT_BUFFERSIZE:
     default:
@@ -285,17 +279,23 @@ gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer)
           goto wrong_type;
         }
 
-        if (this->payload_length
-            && (!gst_dp_validate_payload (GST_DP_HEADER_LENGTH, this->header,
-                    gst_adapter_peek (this->adapter, this->payload_length)))) {
-          goto payload_validate_error;
+        if (this->payload_length) {
+          const guint8 *data;
+          gboolean res;
+
+          data = gst_adapter_map (this->adapter, this->payload_length);
+          res = gst_dp_validate_payload (GST_DP_HEADER_LENGTH, this->header,
+              data);
+          gst_adapter_unmap (this->adapter, 0);
+
+          if (!res)
+            goto payload_validate_error;
         }
 
         break;
       }
       case GST_GDP_DEPAY_STATE_BUFFER:
       {
-
         /* if we receive a buffer without caps first, we error out */
         if (!this->caps)
           goto no_caps;
@@ -309,22 +309,23 @@ gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer)
         if (this->payload_length > 0) {
           guint8 *payload;
 
-          payload = gst_adapter_take (this->adapter, this->payload_length);
-          memcpy (GST_BUFFER_DATA (buf), payload, this->payload_length);
-          g_free (payload);
+          payload = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
+          gst_adapter_copy (this->adapter, payload, 0, this->payload_length);
+          gst_buffer_unmap (buf, payload, this->payload_length);
+
+          gst_adapter_flush (this->adapter, this->payload_length);
         }
 
         /* set caps and push */
-        gst_buffer_set_caps (buf, this->caps);
         GST_LOG_OBJECT (this, "deserialized buffer %p, pushing, timestamp %"
             GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT
             ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT
-            ", size %d, flags 0x%x",
+            ", size %" G_GSIZE_FORMAT ", flags 0x%x",
             buf,
             GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
             GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
             GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
-            GST_BUFFER_SIZE (buf), GST_BUFFER_FLAGS (buf));
+            gst_buffer_get_size (buf), GST_BUFFER_FLAGS (buf));
         ret = gst_pad_push (this->srcpad, buf);
         if (ret != GST_FLOW_OK)
           goto push_error;
index 6da4967..6c59dfa 100644 (file)
@@ -67,19 +67,16 @@ enum
   PROP_VERSION,
 };
 
-#define _do_init(x) \
+#define _do_init \
     GST_DEBUG_CATEGORY_INIT (gst_gdp_pay_debug, "gdppay", 0, \
     "GDP payloader");
-
-GST_BOILERPLATE_FULL (GstGDPPay, gst_gdp_pay, GstElement,
-    GST_TYPE_ELEMENT, _do_init);
+#define gst_gdp_pay_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGDPPay, gst_gdp_pay, GST_TYPE_ELEMENT, _do_init);
 
 static void gst_gdp_pay_reset (GstGDPPay * this);
 
 static GstFlowReturn gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer);
-
 static gboolean gst_gdp_pay_src_event (GstPad * pad, GstEvent * event);
-
 static gboolean gst_gdp_pay_sink_event (GstPad * pad, GstEvent * event);
 
 static GstStateChangeReturn gst_gdp_pay_change_state (GstElement *
@@ -93,26 +90,9 @@ static void gst_gdp_pay_get_property (GObject * object, guint prop_id,
 static void gst_gdp_pay_finalize (GObject * gobject);
 
 static void
-gst_gdp_pay_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "GDP Payloader", "GDP/Payloader",
-      "Payloads GStreamer Data Protocol buffers",
-      "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gdp_pay_sink_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gdp_pay_src_template));
-}
-
-static void
 gst_gdp_pay_class_init (GstGDPPayClass * klass)
 {
   GObjectClass *gobject_class;
-
   GstElementClass *gstelement_class;
 
   gobject_class = (GObjectClass *) klass;
@@ -136,11 +116,21 @@ gst_gdp_pay_class_init (GstGDPPayClass * klass)
           GST_TYPE_DP_VERSION, DEFAULT_VERSION,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "GDP Payloader", "GDP/Payloader",
+      "Payloads GStreamer Data Protocol buffers",
+      "Thomas Vander Stichele <thomas at apestaart dot org>");
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gdp_pay_sink_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gdp_pay_src_template));
+
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_gdp_pay_change_state);
 }
 
 static void
-gst_gdp_pay_init (GstGDPPay * gdppay, GstGDPPayClass * g_class)
+gst_gdp_pay_init (GstGDPPay * gdppay)
 {
   gdppay->sinkpad =
       gst_pad_new_from_static_template (&gdp_pay_sink_template, "sink");
@@ -216,7 +206,7 @@ static void
 gst_gdp_stamp_buffer (GstGDPPay * this, GstBuffer * buffer)
 {
   GST_BUFFER_OFFSET (buffer) = this->offset;
-  GST_BUFFER_OFFSET_END (buffer) = this->offset + GST_BUFFER_SIZE (buffer);
+  GST_BUFFER_OFFSET_END (buffer) = this->offset + gst_buffer_get_size (buffer);
   this->offset = GST_BUFFER_OFFSET_END (buffer);
 }
 
@@ -224,12 +214,9 @@ static GstBuffer *
 gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
 {
   GstBuffer *headerbuf;
-
   GstBuffer *payloadbuf;
-
   guint8 *header, *payload;
-
-  guint len;
+  guint len, plen;
 
   if (!this->packetizer->packet_from_caps (caps, this->header_flag, &len,
           &header, &payload))
@@ -237,13 +224,13 @@ gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
 
   GST_LOG_OBJECT (this, "creating GDP header and payload buffer from caps");
   headerbuf = gst_buffer_new ();
-  gst_buffer_set_data (headerbuf, header, len);
-  GST_BUFFER_MALLOCDATA (headerbuf) = header;
+  gst_buffer_take_memory (headerbuf, -1,
+      gst_memory_new_wrapped (0, header, g_free, len, 0, len));
 
   payloadbuf = gst_buffer_new ();
-  gst_buffer_set_data (payloadbuf, payload,
-      gst_dp_header_payload_length (header));
-  GST_BUFFER_MALLOCDATA (payloadbuf) = payload;
+  plen = gst_dp_header_payload_length (header);
+  gst_buffer_take_memory (payloadbuf, -1,
+      gst_memory_new_wrapped (0, payload, g_free, plen, 0, plen));
 
   return gst_buffer_join (headerbuf, payloadbuf);
 
@@ -259,9 +246,7 @@ static GstBuffer *
 gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer)
 {
   GstBuffer *headerbuf;
-
   guint8 *header;
-
   guint len;
 
   if (!this->packetizer->header_from_buffer (buffer, this->header_flag, &len,
@@ -270,8 +255,8 @@ gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer)
 
   GST_LOG_OBJECT (this, "creating GDP header and payload buffer from buffer");
   headerbuf = gst_buffer_new ();
-  gst_buffer_set_data (headerbuf, header, len);
-  GST_BUFFER_MALLOCDATA (headerbuf) = header;
+  gst_buffer_take_memory (headerbuf, -1,
+      gst_memory_new_wrapped (0, header, g_free, len, 0, len));
 
   /* we do not want to lose the ref on the incoming buffer */
   gst_buffer_ref (buffer);
@@ -290,13 +275,9 @@ static GstBuffer *
 gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event)
 {
   GstBuffer *headerbuf;
-
   GstBuffer *payloadbuf;
-
   guint8 *header, *payload;
-
-  guint len;
-
+  guint len, plen;
   gboolean ret;
 
   ret =
@@ -307,13 +288,15 @@ gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event)
 
   GST_LOG_OBJECT (this, "creating GDP header and payload buffer from event");
   headerbuf = gst_buffer_new ();
-  gst_buffer_set_data (headerbuf, header, len);
-  GST_BUFFER_MALLOCDATA (headerbuf) = header;
+  gst_buffer_take_memory (headerbuf, -1,
+      gst_memory_new_wrapped (0, header, g_free, len, 0, len));
 
   payloadbuf = gst_buffer_new ();
-  gst_buffer_set_data (payloadbuf, payload,
-      gst_dp_header_payload_length (header));
-  GST_BUFFER_MALLOCDATA (payloadbuf) = payload;
+  plen = gst_dp_header_payload_length (header);
+  if (plen && payload != NULL) {
+    gst_buffer_take_memory (payloadbuf, -1,
+        gst_memory_new_wrapped (0, payload, g_free, plen, 0, plen));
+  }
 
   return gst_buffer_join (headerbuf, payloadbuf);
 
@@ -333,14 +316,10 @@ static GstFlowReturn
 gst_gdp_pay_reset_streamheader (GstGDPPay * this)
 {
   GstCaps *caps;
-
   /* We use copies of these to avoid circular refcounts */
   GstBuffer *new_segment_buf, *caps_buf, *tag_buf;
-
   GstStructure *structure;
-
   GstFlowReturn r = GST_FLOW_OK;
-
   gboolean version_one_zero = TRUE;
 
   GValue array = { 0 };
@@ -373,7 +352,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
     GST_DEBUG_OBJECT (this, "1.0, appending copy of new segment buffer %p",
         this->new_segment_buf);
     new_segment_buf = gst_buffer_copy (this->new_segment_buf);
-    gst_buffer_set_caps (new_segment_buf, NULL);
     g_value_init (&value, GST_TYPE_BUFFER);
     gst_value_set_buffer (&value, new_segment_buf);
     gst_value_array_append_value (&array, &value);
@@ -387,7 +365,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
       tag_buf = this->tag_buf;
       this->tag_buf = NULL;
 
-      gst_buffer_set_caps (tag_buf, NULL);
       g_value_init (&value, GST_TYPE_BUFFER);
       gst_value_set_buffer (&value, tag_buf);
       gst_value_array_append_value (&array, &value);
@@ -399,7 +376,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
   gst_gdp_stamp_buffer (this, this->caps_buf);
   GST_DEBUG_OBJECT (this, "appending copy of caps buffer %p", this->caps_buf);
   caps_buf = gst_buffer_copy (this->caps_buf);
-  gst_buffer_set_caps (caps_buf, NULL);
   g_value_init (&value, GST_TYPE_BUFFER);
   gst_value_set_buffer (&value, caps_buf);
   gst_value_array_append_value (&array, &value);
@@ -474,16 +450,15 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
 
   GST_DEBUG_OBJECT (this, "Setting caps on src pad %" GST_PTR_FORMAT, caps);
   gst_pad_set_caps (this->srcpad, caps);
-  this->caps_buf = gst_buffer_make_metadata_writable (this->caps_buf);
-  gst_buffer_set_caps (this->caps_buf, caps);
-  this->new_segment_buf =
-      gst_buffer_make_metadata_writable (this->new_segment_buf);
-  gst_buffer_set_caps (this->new_segment_buf, caps);
 
   /* if these are our first ever buffers, send out new_segment first */
   if (!this->sent_streamheader) {
-    GstEvent *event =
-        gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
+    GstEvent *event;
+    GstSegment segment;
+
+    gst_segment_init (&segment, GST_FORMAT_BYTES);
+    event = gst_event_new_segment (&segment);
+
     GST_DEBUG_OBJECT (this, "Sending out new_segment event %p", event);
     if (!gst_pad_push_event (this->srcpad, event)) {
       GST_WARNING_OBJECT (this, "pushing new segment failed");
@@ -504,7 +479,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
     goto done;
   }
   if (this->tag_buf) {
-    gst_buffer_set_caps (this->tag_buf, caps);
     GST_DEBUG_OBJECT (this, "Pushing GDP tag buffer %p", this->tag_buf);
     /* we stored these bufs with refcount 1, so make sure we keep a ref */
     r = gst_pad_push (this->srcpad, gst_buffer_ref (this->tag_buf));
@@ -532,7 +506,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
     this->queue = g_list_delete_link (this->queue, this->queue);
 
     /* set caps and push */
-    gst_buffer_set_caps (buffer, caps);
     r = gst_pad_push (this->srcpad, buffer);
     if (r != GST_FLOW_OK) {
       GST_WARNING_OBJECT (this, "pushing queued GDP buffer returned %d", r);
@@ -562,7 +535,6 @@ gst_gdp_queue_buffer (GstGDPPay * this, GstBuffer * buffer)
   if (this->sent_streamheader) {
     GST_LOG_OBJECT (this, "Pushing GDP buffer %p, caps %" GST_PTR_FORMAT,
         buffer, this->caps);
-    gst_buffer_set_caps (buffer, GST_PAD_CAPS (this->srcpad));
     return gst_pad_push (this->srcpad, buffer);
   }
 
@@ -579,11 +551,10 @@ static GstFlowReturn
 gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstGDPPay *this;
-
+#if 0
   GstCaps *caps;
-
+#endif
   GstBuffer *outbuffer;
-
   GstFlowReturn ret;
 
   this = GST_GDP_PAY (gst_pad_get_parent (pad));
@@ -592,10 +563,12 @@ gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
    * fake one in that case */
   if (!this->new_segment_buf) {
     GstEvent *event;
+    GstSegment segment;
 
     GST_WARNING_OBJECT (this,
         "did not receive new-segment before first buffer");
-    event = gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
+    gst_segment_init (&segment, GST_FORMAT_BYTES);
+    event = gst_event_new_segment (&segment);
     outbuffer = gst_gdp_buffer_from_event (this, event);
     gst_event_unref (event);
 
@@ -612,7 +585,7 @@ gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
       this->new_segment_buf = outbuffer;
     }
   }
-
+#if 0
   /* make sure we've received caps before */
   caps = gst_buffer_get_caps (buffer);
   if (!this->caps && !caps)
@@ -638,6 +611,7 @@ gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
 
   if (caps)
     gst_caps_unref (caps);
+#endif
 
   /* create a GDP header packet,
    * then create a GST buffer of the header packet and the buffer contents */
@@ -666,6 +640,7 @@ done:
   return ret;
 
   /* ERRORS */
+#if 0
 no_caps:
   {
     /* when returning a fatal error as a GstFlowReturn we must post an error
@@ -685,6 +660,7 @@ no_caps_buffer:
     ret = GST_FLOW_ERROR;
     goto done;
   }
+#endif
 no_buffer:
   {
     GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
@@ -698,11 +674,9 @@ static gboolean
 gst_gdp_pay_sink_event (GstPad * pad, GstEvent * event)
 {
   GstBuffer *outbuffer;
-
   GstGDPPay *this = GST_GDP_PAY (gst_pad_get_parent (pad));
-
   GstFlowReturn flowret;
-
+  GstCaps *caps;
   gboolean ret = TRUE;
 
   GST_DEBUG_OBJECT (this, "received event %p of type %s (%d)",
@@ -719,7 +693,7 @@ gst_gdp_pay_sink_event (GstPad * pad, GstEvent * event)
   /* if we got a new segment or tag event, we should put it on our streamheader,
    * and not send it on */
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
       GST_DEBUG_OBJECT (this, "Storing in caps buffer %p as new_segment_buf",
           outbuffer);
 
@@ -730,6 +704,24 @@ gst_gdp_pay_sink_event (GstPad * pad, GstEvent * event)
       GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
       gst_gdp_pay_reset_streamheader (this);
       break;
+    case GST_EVENT_CAPS:{
+      gst_event_parse_caps (event, &caps);
+      if (this->caps == NULL || !gst_caps_is_equal (this->caps, caps)) {
+        GST_INFO_OBJECT (pad, "caps changed to %" GST_PTR_FORMAT, caps);
+        gst_caps_replace (&this->caps, caps);
+        outbuffer = gst_gdp_buffer_from_caps (this, caps);
+        if (outbuffer == NULL)
+          goto no_buffer_from_caps;
+
+        GST_BUFFER_DURATION (outbuffer) = 0;
+        GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
+        if (this->caps_buf)
+          gst_buffer_unref (this->caps_buf);
+        this->caps_buf = outbuffer;
+        gst_gdp_pay_reset_streamheader (this);
+      }
+      break;
+    }
     case GST_EVENT_TAG:
       GST_DEBUG_OBJECT (this, "Storing in caps buffer %p as tag_buf",
           outbuffer);
@@ -772,6 +764,13 @@ no_outbuffer:
     ret = FALSE;
     goto done;
   }
+no_buffer_from_caps:
+  {
+    GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
+        ("Could not create GDP buffer from caps %" GST_PTR_FORMAT, caps));
+    ret = FALSE;
+    goto done;
+  }
 push_error:
   {
     GST_WARNING_OBJECT (this, "queueing GDP event buffer returned %d", flowret);
@@ -784,7 +783,6 @@ static gboolean
 gst_gdp_pay_src_event (GstPad * pad, GstEvent * event)
 {
   GstGDPPay *this;
-
   gboolean res = TRUE;
 
   this = GST_GDP_PAY (gst_pad_get_parent (pad));
@@ -865,7 +863,6 @@ static GstStateChangeReturn
 gst_gdp_pay_change_state (GstElement * element, GstStateChange transition)
 {
   GstStateChangeReturn ret;
-
   GstGDPPay *this = GST_GDP_PAY (element);
 
   switch (transition) {
index 2fe90e6..d0138ce 100644 (file)
@@ -6,55 +6,34 @@ glib_gen_basename = gstplay
 built_sources = gstplay-marshal.c
 built_headers = gstplay-marshal.h
 
-plugin_LTLIBRARIES = libgstplaybin.la libgstdecodebin.la libgstdecodebin2.la
+plugin_LTLIBRARIES = libgstplayback.la
 
-libgstplaybin_la_SOURCES = \
+libgstplayback_la_SOURCES = \
+       gstdecodebin2.c \
+       gsturidecodebin.c \
        gstplayback.c \
-       gstplaybin.c \
        gstplaybin2.c \
        gstplaysink.c \
-       gstplaybasebin.c \
        gstplay-enum.c \
-       gststreaminfo.c \
        gststreamselector.c \
        gstsubtitleoverlay.c \
        gstplaysinkvideoconvert.c \
        gstplaysinkaudioconvert.c \
        gststreamsynchronizer.c
 
-nodist_libgstplaybin_la_SOURCES = $(built_sources)
-libgstplaybin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstplaybin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstplaybin_la_LIBADD = \
+nodist_libgstplayback_la_SOURCES = $(built_sources)
+libgstplayback_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
+libgstplayback_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstplayback_la_LIBADD = \
        $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
        $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
        $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
        $(GST_LIBS)
-libgstplaybin_la_LIBTOOLFLAGS = --tag=disable-static
-
-libgstdecodebin_la_SOURCES = gstdecodebin.c
-nodist_libgstdecodebin_la_SOURCES = $(built_sources)
-libgstdecodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstdecodebin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdecodebin_la_LIBADD = \
-       $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
-       $(GST_LIBS)
-libgstdecodebin_la_LIBTOOLFLAGS = --tag=disable-static
-
-libgstdecodebin2_la_SOURCES = gstdecodebin2.c gsturidecodebin.c gstplay-enum.c
-nodist_libgstdecodebin2_la_SOURCES = $(built_sources)
-libgstdecodebin2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstdecodebin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdecodebin2_la_LIBADD = \
-       $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
-       $(GST_LIBS)
-libgstdecodebin2_la_LIBTOOLFLAGS = --tag=disable-static
+libgstplayback_la_LIBTOOLFLAGS = --tag=disable-static
 
 noinst_HEADERS = \
        gstplayback.h \
-       gstplaybasebin.h \
        gstplaysink.h \
-       gststreaminfo.h \
        gstplay-enum.h \
        gststreamselector.h \
        gstrawcaps.h \
@@ -73,38 +52,14 @@ include $(top_srcdir)/common/gst-glib-gen.mak
 
 Android.mk: Makefile.am $(BUILT_SOURCES)
        androgenizer \
-       -:PROJECT libgstdecodebin -:SHARED libgstdecodebin \
-        -:TAGS eng debug \
-         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-        -:SOURCES $(libgstdecodebin_la_SOURCES) \
-                  $(nodist_libgstdecodebin_la_SOURCES) \
-        -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdecodebin_la_CFLAGS) \
-        -:LDFLAGS $(libgstdecodebin_la_LDFLAGS) \
-                  $(libgstdecodebin_la_LIBADD) \
-                  -ldl \
-        -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
-                      LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
-        \
-       -:PROJECT libgstdecodebin2 -:SHARED libgstdecodebin2 \
-        -:TAGS eng debug \
-         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-        -:SOURCES $(libgstdecodebin2_la_SOURCES) \
-                  $(nodist_libgstdecodebin2_la_SOURCES) \
-        -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdecodebin2_la_CFLAGS) \
-        -:LDFLAGS $(libgstdecodebin2_la_LDFLAGS) \
-                  $(libgstdecodebin2_la_LIBADD) \
-                  -ldl \
-        -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
-                      LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
-        \
-       -:PROJECT libgstplaybin -:SHARED libgstplaybin \
+       -:PROJECT libgstplayback -:SHARED libgstplayback \
         -:TAGS eng debug \
          -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-        -:SOURCES $(libgstplaybin_la_SOURCES) \
-                  $(nodist_libgstplaybin_la_SOURCES) \
-        -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstplaybin_la_CFLAGS) \
-        -:LDFLAGS $(libgstplaybin_la_LDFLAGS) \
-                  $(libgstplaybin_la_LIBADD) \
+        -:SOURCES $(libgstplayback_la_SOURCES) \
+                  $(nodist_libgstplayback_la_SOURCES) \
+        -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstplayback_la_CFLAGS) \
+        -:LDFLAGS $(libgstplayback_la_LDFLAGS) \
+                  $(libgstplayback_la_LIBADD) \
                   -ldl \
         -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
                       LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
diff --git a/gst/playback/README b/gst/playback/README
deleted file mode 100644 (file)
index 286e49f..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-decodebin:
-
-  A bin with a sinkpad that decodes the data into raw formats. It works by sending
-  the input data through a typefind element and then recursively autoplugs elements 
-  from the registry until a raw format is obtained. It will then create a new ghostpad
-  on itself to signal the app of the new pad. 
-
-  Decodebin will also remove pads when they are removed from the stream.
-
-  TODO
-   - reuse of decoderbin, cleanup in READY state
-   - threading after demuxing?
-   - new_media events should be handled.
-   - caching of elements.
-   - abstract more elements, pads (typefind, ...);
-
-   The autoplugging happens as follows:
-
-   1) typefind is added internally to the bin.
-   2) the have_type signal is connected to typefind.
-   3) in the have_type callback the close_pad_link function is called
-   4) close_pad_link checks the type on the pad, if it is raw, a ghostpad
-      is created and autoplugging for that pad stops.
-   5) if the type of the pad is not raw, a list of possible elements that
-      can connect to this type is generated in find_compatibles.
-   6) try_to_link_1 with the element list is called. The function will loop
-      over the element list and will try to connect one of the elements to
-      the pad. If the link works, a call is made to close_link.
-   7) close_link loops over all the source pads of the element and 
-      recursively calls 4) for any ALWAYS pad. For elements with
-      a SOMETIMES pad, a structure is set up and is passed to the callback
-      of the new_pad signal.
-   8) in the new_pad callback, 4) is called to try to autoplug the
-      new pad.
-
-
-playbasebin:
-
-  A bin with an uri property. It will find the right source element from the registry
-  and connect a decoderbin to it. When going to the PAUSED state, it will iterate the
-  decoderbin and listen for new pad signals from it. It will connect a queue to each
-  new pad and will iterate the decoderbin until one of the queues is filled. It is
-  assumed that by that time all the streams will be found so that when leaving the
-  PAUSED state, one can query the number of streams in the media file with the given
-  uri.
-
-  Playbasebin internally groups related streams together in a GstPlayBaseGroup. This
-  is particulary important for chained oggs. Initially, a new group is created in 
-  the 'building' state. All new streams will be added to the building group until
-  no-more-pads is signaled or one of the preroll queues overflows. When this happens,
-  the group is commited to a list of groups ready for playback. PlaybaseBin will then
-  attach a padprobe to each stream to figure out when it finished. It will remove
-  the current group and install the next playable group, then.
-
-  Before going to the PLAYING state, it is possible to connect a custom element to
-  each of the streams. To do that, you have to add the element to the bin and then
-  connect the pad(s) from the stream(s). You do not have to add the elements in
-  a thread, the bin will take care of then when it's needed. You are allowed to use
-  threads inside the elements, of course.
-  The bin tries to be smart and doesn't add a queue when there is only one possible 
-  stream.
-
-  
-  TODO
-  - reuse, cleanup in ready state
-  - when the first pad is closed, it's possible that another dynamic element is
-    added somewhere so that we need a queue for the first pad as well.
-
-
-playbin:
-  
-   Extends playbasebin, sets up default audiosink and videosink for first audio/video
-   stream detected. implements seeking and querying on the configured sinks.
-
-   It also waits for new notifications from playbasebin about any new groups that are
-   becomming active. It then disconnects the sinks and reconnects them to the new
-   pads in the group.
-
-   TODO
-   - reuse, refcounting, cleanup in READY state
-   - be smarter about replugging the sinks instead of removing them and readding them.
-   - Do not crap out when the audio device is in use.
-
-
-general
-
-   TODO
-   - playlist support. maybe use a playlist bin that streams the contents of the
-     playlist on a pad, interleaved with new_media events. Also add a tuner 
-     interface while we're at it.
-   
index 7794260..4afac3e 100644 (file)
  */
 
 /**
- * SECTION:element-decodebin2
+ * SECTION:element-decodebin
  *
  * #GstBin that auto-magically constructs a decoding pipeline using available
  * decoders and demuxers via auto-plugging.
  *
- * decodebin2 is considered stable now and replaces the old #decodebin element.
- * #uridecodebin uses decodebin2 internally and is often more convenient to
+ * decodebin is considered stable now and replaces the old #decodebin element.
+ * #uridecodebin uses decodebin internally and is often more convenient to
  * use, as it creates a suitable source element as well.
  */
 
 /* Implementation notes:
  *
- * The following section describes how decodebin2 works internally.
+ * The following section describes how decodebin works internally.
  *
- * The first part of decodebin2 is its typefind element, which tries
+ * The first part of decodebin is its typefind element, which tries
  * to determine the media type of the input stream. If the type is found
  * autoplugging starts.
  *
- * decodebin2 internally organizes the elements it autoplugged into GstDecodeChains
+ * decodebin internally organizes the elements it autoplugged into GstDecodeChains
  * and GstDecodeGroups. A decode chain is a single chain of decoding, this
- * means that if decodebin2 every autoplugs an element with two+ srcpads
+ * means that if decodebin every autoplugs an element with two+ srcpads
  * (e.g. a demuxer) this will end the chain and everything following this
  * demuxer will be put into decode groups below the chain. Otherwise,
  * if an element has a single srcpad that outputs raw data the decode chain
  * chains are complete.
  *
  * If this happens at some point, all endpads of all active groups are exposed.
- * For this decodebin2 adds the endpads, signals no-more-pads and then unblocks
+ * For this decodebin adds the endpads, signals no-more-pads and then unblocks
  * them. Now playback starts.
  *
- * If one of the chains that end on a endpad receives EOS decodebin2 checks
+ * If one of the chains that end on a endpad receives EOS decodebin checks
  * if all chains and groups are drained. In that case everything goes into EOS.
  * If there is a chain where the active group is drained but there exist next
  * groups, the active group is hidden (endpads are removed) and the next group
@@ -116,7 +116,6 @@ typedef struct _GstDecodeGroup GstDecodeGroup;
 typedef struct _GstDecodePad GstDecodePad;
 typedef GstGhostPadClass GstDecodePadClass;
 typedef struct _GstDecodeBin GstDecodeBin;
-typedef struct _GstDecodeBin GstDecodeBin2;
 typedef struct _GstDecodeBinClass GstDecodeBinClass;
 
 #define GST_TYPE_DECODE_BIN             (gst_decode_bin_get_type())
@@ -127,9 +126,9 @@ typedef struct _GstDecodeBinClass GstDecodeBinClass;
 #define GST_IS_DECODE_BIN_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECODE_BIN))
 
 /**
- *  GstDecodeBin2:
+ *  GstDecodeBin:
  *
- *  The opaque #DecodeBin2 data structure
+ *  The opaque #GstDecodeBin data structure
  */
 struct _GstDecodeBin
 {
@@ -178,10 +177,6 @@ struct _GstDecodeBinClass
 {
   GstBinClass parent_class;
 
-  /* signal we fire when a new pad has been decoded into raw audio/video */
-  void (*new_decoded_pad) (GstElement * element, GstPad * pad, gboolean last);
-  /* signal we fire when a pad has been removed */
-  void (*removed_decoded_pad) (GstElement * element, GstPad * pad);
   /* signal fired when we found a pad that we cannot decode */
   void (*unknown_type) (GstElement * element, GstPad * pad, GstCaps * caps);
 
@@ -205,8 +200,6 @@ struct _GstDecodeBinClass
 /* signals */
 enum
 {
-  SIGNAL_NEW_DECODED_PAD,
-  SIGNAL_REMOVED_DECODED_PAD,
   SIGNAL_UNKNOWN_TYPE,
   SIGNAL_AUTOPLUG_CONTINUE,
   SIGNAL_AUTOPLUG_FACTORIES,
@@ -465,6 +458,8 @@ struct _GstDecodePad
   gboolean blocked;             /* the *target* pad is blocked */
   gboolean exposed;             /* the pad is exposed */
   gboolean drained;             /* an EOS has been seen on the pad */
+
+  gulong block_id;
 };
 
 GType gst_decode_pad_get_type (void);
@@ -480,7 +475,8 @@ static void gst_decode_pad_unblock (GstDecodePad * dpad);
 static void gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked);
 
 static void gst_pending_pad_free (GstPendingPad * ppad);
-static gboolean pad_event_cb (GstPad * pad, GstEvent * event, gpointer data);
+static GstProbeReturn pad_event_cb (GstPad * pad, GstProbeType type,
+    gpointer type_data, gpointer data);
 
 /********************************
  * Standard GObject boilerplate *
@@ -511,7 +507,7 @@ gst_decode_bin_get_type (void)
     };
 
     gst_decode_bin_type =
-        g_type_register_static (GST_TYPE_BIN, "GstDecodeBin2",
+        g_type_register_static (GST_TYPE_BIN, "GstDecodeBin",
         &gst_decode_bin_info, 0);
   }
 
@@ -592,42 +588,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
   gobject_klass->get_property = gst_decode_bin_get_property;
 
   /**
-   * GstDecodeBin2::new-decoded-pad:
-   * @bin: The decodebin.
-   * @pad: The newly created pad.
-   * @islast: #TRUE if this is the last pad to be added. Deprecated.
-   *
-   * This signal gets emitted as soon as a new pad of the same type as one of
-   * the valid 'raw' types is added.
-   *
-   * Deprecated: Use GstElement::pad-added instead of this signal.
-   *
-   */
-  gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD] =
-      g_signal_new ("new-decoded-pad", G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_LAST,
-      G_STRUCT_OFFSET (GstDecodeBinClass, new_decoded_pad), NULL, NULL,
-      gst_play_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, GST_TYPE_PAD,
-      G_TYPE_BOOLEAN);
-
-  /**
-   * GstDecodeBin2::removed-decoded-pad:
-   * @bin: The decodebin.
-   * @pad: The pad that was removed.
-   *
-   * This signal is emitted when a 'final' caps pad has been removed.
-   *
-   * Deprecated: Use GstElement::pad-removed instead of this signal.
-   *
-   */
-  gst_decode_bin_signals[SIGNAL_REMOVED_DECODED_PAD] =
-      g_signal_new ("removed-decoded-pad", G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_LAST,
-      G_STRUCT_OFFSET (GstDecodeBinClass, removed_decoded_pad), NULL, NULL,
-      gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
-
-  /**
-   * GstDecodeBin2::unknown-type:
+   * GstDecodeBin::unknown-type:
    * @bin: The decodebin.
    * @pad: The new pad containing caps that cannot be resolved to a 'final'
    *       stream type.
@@ -643,12 +604,12 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
       GST_TYPE_PAD, GST_TYPE_CAPS);
 
   /**
-   * GstDecodeBin2::autoplug-continue:
+   * GstDecodeBin::autoplug-continue:
    * @bin: The decodebin.
    * @pad: The #GstPad.
    * @caps: The #GstCaps found.
    *
-   * This signal is emitted whenever decodebin2 finds a new stream. It is
+   * This signal is emitted whenever decodebin finds a new stream. It is
    * emitted before looking for any elements that can handle that stream.
    *
    * <note>
@@ -657,10 +618,10 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
    *   connected in.
    * </note>
    *
-   * Returns: #TRUE if you wish decodebin2 to look for elements that can
+   * Returns: #TRUE if you wish decodebin to look for elements that can
    * handle the given @caps. If #FALSE, those caps will be considered as
-   * final and the pad will be exposed as such (see 'new-decoded-pad'
-   * signal).
+   * final and the pad will be exposed as such (see 'pad-added' signal of
+   * #GstElement).
    */
   gst_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE] =
       g_signal_new ("autoplug-continue", G_TYPE_FROM_CLASS (klass),
@@ -669,13 +630,13 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
       G_TYPE_BOOLEAN, 2, GST_TYPE_PAD, GST_TYPE_CAPS);
 
   /**
-   * GstDecodeBin2::autoplug-factories:
+   * GstDecodeBin::autoplug-factories:
    * @bin: The decodebin.
    * @pad: The #GstPad.
    * @caps: The #GstCaps found.
    *
    * This function is emited when an array of possible factories for @caps on
-   * @pad is needed. Decodebin2 will by default return an array with all
+   * @pad is needed. Decodebin will by default return an array with all
    * compatible factories, sorted by rank.
    *
    * If this function returns NULL, @pad will be exposed as a final caps.
@@ -701,13 +662,13 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
       GST_TYPE_PAD, GST_TYPE_CAPS);
 
   /**
-   * GstDecodeBin2::autoplug-sort:
+   * GstDecodeBin::autoplug-sort:
    * @bin: The decodebin.
    * @pad: The #GstPad.
    * @caps: The #GstCaps.
    * @factories: A #GValueArray of possible #GstElementFactory to use.
    *
-   * Once decodebin2 has found the possible #GstElementFactory objects to try
+   * Once decodebin has found the possible #GstElementFactory objects to try
    * for @caps on @pad, this signal is emited. The purpose of the signal is for
    * the application to perform additional sorting or filtering on the element
    * factory array.
@@ -733,18 +694,18 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
       GST_TYPE_PAD, GST_TYPE_CAPS, G_TYPE_VALUE_ARRAY);
 
   /**
-   * GstDecodeBin2::autoplug-select:
+   * GstDecodeBin::autoplug-select:
    * @bin: The decodebin.
    * @pad: The #GstPad.
    * @caps: The #GstCaps.
    * @factory: A #GstElementFactory to use.
    *
-   * This signal is emitted once decodebin2 has found all the possible
+   * This signal is emitted once decodebin has found all the possible
    * #GstElementFactory that can be used to handle the given @caps. For each of
    * those factories, this signal is emited.
    *
    * The signal handler should return a #GST_TYPE_AUTOPLUG_SELECT_RESULT enum
-   * value indicating what decodebin2 should do next.
+   * value indicating what decodebin should do next.
    *
    * A value of #GST_AUTOPLUG_SELECT_TRY will try to autoplug an element from
    * @factory.
@@ -774,10 +735,10 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
       GST_TYPE_ELEMENT_FACTORY);
 
   /**
-   * GstDecodeBin2::drained
+   * GstDecodeBin::drained
    * @bin: The decodebin
    *
-   * This signal is emitted once decodebin2 has finished decoding all the data.
+   * This signal is emitted once decodebin has finished decoding all the data.
    *
    * Since: 0.10.16
    */
@@ -804,9 +765,9 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstDecodeBin2::use-buffering
+   * GstDecodeBin::use-buffering
    *
-   * Activate buffering in decodebin2. This will instruct the multiqueues behind
+   * Activate buffering in decodebin. This will instruct the multiqueues behind
    * decoders to emit BUFFERING messages.
 
    * Since: 0.10.26
@@ -817,7 +778,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstDecodebin2:low-percent
+   * GstDecodeBin:low-percent
    *
    * Low threshold percent for buffering to start.
    *
@@ -828,7 +789,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           "Low threshold for buffering to start", 0, 100,
           DEFAULT_LOW_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstDecodebin2:high-percent
+   * GstDecodeBin:high-percent
    *
    * High threshold percent for buffering to finish.
    *
@@ -840,7 +801,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           DEFAULT_HIGH_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstDecodebin2:max-size-bytes
+   * GstDecodeBin:max-size-bytes
    *
    * Max amount amount of bytes in the queue (0=automatic).
    *
@@ -852,7 +813,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstDecodebin2:max-size-buffers
+   * GstDecodeBin:max-size-buffers
    *
    * Max amount amount of buffers in the queue (0=automatic).
    *
@@ -864,7 +825,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           0, G_MAXUINT, DEFAULT_MAX_SIZE_BUFFERS,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstDecodebin2:max-size-time
+   * GstDecodeBin:max-size-time
    *
    * Max amount amount of time in the queue (in ns, 0=automatic).
    *
@@ -877,7 +838,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           DEFAULT_MAX_SIZE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstDecodeBin2::post-stream-topology
+   * GstDecodeBin::post-stream-topology
    *
    * Post stream-topology messages on the bus every time the topology changes.
    *
@@ -890,7 +851,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstDecodeBin2::expose-all-streams
+   * GstDecodeBin::expose-all-streams
    *
    * Expose streams of unknown type.
    *
@@ -1614,7 +1575,7 @@ setup_caps_delay:
     ppad->pad = gst_object_ref (pad);
     ppad->chain = chain;
     ppad->event_probe_id =
-        gst_pad_add_event_probe (pad, (GCallback) pad_event_cb, ppad);
+        gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, pad_event_cb, ppad, NULL);
     chain->pending_pads = g_list_prepend (chain->pending_pads, ppad);
     CHAIN_MUTEX_UNLOCK (chain);
     g_signal_connect (G_OBJECT (pad), "notify::caps",
@@ -1841,7 +1802,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
           }
 
           g_signal_handlers_disconnect_by_func (pp->pad, caps_notify_cb, chain);
-          gst_pad_remove_event_probe (pp->pad, pp->event_probe_id);
+          gst_pad_remove_probe (pp->pad, pp->event_probe_id);
           gst_object_unref (pp->pad);
           g_slice_free (GstPendingPad, pp);
 
@@ -1888,16 +1849,13 @@ get_pad_caps (GstPad * pad)
 
   /* first check the pad caps, if this is set, we are positively sure it is
    * fixed and exactly what the element will produce. */
-  GST_OBJECT_LOCK (pad);
-  if ((caps = GST_PAD_CAPS (pad)))
-    gst_caps_ref (caps);
-  GST_OBJECT_UNLOCK (pad);
+  caps = gst_pad_get_current_caps (pad);
 
   /* then use the getcaps function if we don't have caps. These caps might not
    * be fixed in some cases, in which case analyze_new_pad will set up a
    * notify::caps signal to continue autoplugging. */
   if (caps == NULL)
-    caps = gst_pad_get_caps_reffed (pad);
+    caps = gst_pad_get_caps (pad, NULL);
 
   return caps;
 }
@@ -2074,10 +2032,8 @@ check_upstream_seekable (GstDecodeBin * dbin, GstPad * pad)
 
   /* try harder to query upstream size if we didn't get it the first time */
   if (dbin->upstream_seekable && stop == -1) {
-    GstFormat fmt = GST_FORMAT_BYTES;
-
     GST_DEBUG_OBJECT (dbin, "doing duration query to fix up unset stop");
-    gst_pad_query_peer_duration (pad, &fmt, &stop);
+    gst_pad_query_peer_duration (pad, GST_FORMAT_BYTES, &stop);
   }
 
   /* if upstream doesn't know the size, it's likely that it's not seekable in
@@ -2104,7 +2060,7 @@ type_found (GstElement * typefind, guint probability,
   if (gst_structure_has_name (gst_caps_get_structure (caps, 0), "text/plain")) {
     GST_ELEMENT_ERROR (decode_bin, STREAM, WRONG_TYPE,
         (_("This appears to be a text file")),
-        ("decodebin2 cannot decode plain text files"));
+        ("decodebin cannot decode plain text files"));
     goto exit;
   }
 
@@ -2138,9 +2094,11 @@ exit:
   return;
 }
 
-static gboolean
-pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
+static GstProbeReturn
+pad_event_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer data)
 {
+  GstEvent *event = type_data;
   GstPendingPad *ppad = (GstPendingPad *) data;
   GstDecodeChain *chain = ppad->chain;
   GstDecodeBin *dbin = chain->dbin;
@@ -2162,7 +2120,7 @@ pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
     default:
       break;
   }
-  return TRUE;
+  return GST_PROBE_OK;
 }
 
 static void
@@ -2498,8 +2456,6 @@ gst_decode_chain_free_internal (GstDecodeChain * chain, gboolean hide)
     if (chain->endpad->exposed) {
       gst_element_remove_pad (GST_ELEMENT_CAST (chain->dbin),
           GST_PAD_CAST (chain->endpad));
-      g_signal_emit (G_OBJECT (chain->dbin),
-          gst_decode_bin_signals[SIGNAL_REMOVED_DECODED_PAD], 0, chain->endpad);
     }
 
     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (chain->endpad), NULL);
@@ -2532,7 +2488,7 @@ gst_decode_chain_free_internal (GstDecodeChain * chain, gboolean hide)
 /* gst_decode_chain_free:
  *
  * Completely frees and removes the chain and all
- * child groups from decodebin2.
+ * child groups from decodebin.
  *
  * MT-safe, don't hold the chain lock or any child chain's lock
  * when calling this!
@@ -2672,7 +2628,7 @@ gst_decode_group_free (GstDecodeGroup * group)
 /* gst_decode_group_hide:
  *
  * Hide the decode group only, this means that
- * all child endpads are removed from decodebin2
+ * all child endpads are removed from decodebin
  * and all signals are unconnected.
  *
  * No element is set to NULL state and completely
@@ -2790,6 +2746,7 @@ gst_decode_group_control_demuxer_pad (GstDecodeGroup * group, GstPad * pad)
   GstDecodeBin *dbin;
   GstPad *srcpad, *sinkpad;
   GstIterator *it = NULL;
+  GValue item = { 0, };
 
   dbin = group->dbin;
 
@@ -2812,19 +2769,19 @@ gst_decode_group_control_demuxer_pad (GstDecodeGroup * group, GstPad * pad)
 
   it = gst_pad_iterate_internal_links (sinkpad);
 
-  if (!it || (gst_iterator_next (it, (gpointer) & srcpad)) != GST_ITERATOR_OK
-      || srcpad == NULL) {
+  if (!it || (gst_iterator_next (it, &item)) != GST_ITERATOR_OK
+      || ((srcpad = g_value_dup_object (&item)) == NULL)) {
     GST_ERROR_OBJECT (dbin,
         "Couldn't get srcpad from multiqueue for sinkpad %" GST_PTR_FORMAT,
         sinkpad);
     goto error;
   }
-
   CHAIN_MUTEX_LOCK (group->parent);
   group->reqpads = g_list_prepend (group->reqpads, gst_object_ref (sinkpad));
   CHAIN_MUTEX_UNLOCK (group->parent);
 
 beach:
+  g_value_unset (&item);
   if (it)
     gst_iterator_free (it);
   gst_object_unref (sinkpad);
@@ -3093,7 +3050,7 @@ sort_end_pads (GstDecodePad * da, GstDecodePad * db)
   namea = gst_structure_get_name (sa);
   nameb = gst_structure_get_name (sb);
 
-  if (g_strrstr (namea, "video/x-raw-"))
+  if (g_strrstr (namea, "video/x-raw"))
     va = 0;
   else if (g_strrstr (namea, "video/"))
     va = 1;
@@ -3104,7 +3061,7 @@ sort_end_pads (GstDecodePad * da, GstDecodePad * db)
   else
     va = 4;
 
-  if (g_strrstr (nameb, "video/x-raw-"))
+  if (g_strrstr (nameb, "video/x-raw"))
     vb = 0;
   else if (g_strrstr (nameb, "video/"))
     vb = 1;
@@ -3129,16 +3086,18 @@ _gst_element_get_linked_caps (GstElement * src, GstElement * sink)
   GstPad *pad, *peer;
   gboolean done = FALSE;
   GstCaps *caps = NULL;
+  GValue item = { 0, };
 
   it = gst_element_iterate_src_pads (src);
   while (!done) {
-    switch (gst_iterator_next (it, (gpointer) & pad)) {
+    switch (gst_iterator_next (it, &item)) {
       case GST_ITERATOR_OK:
+        pad = g_value_get_object (&item);
         peer = gst_pad_get_peer (pad);
         if (peer) {
           parent = gst_pad_get_parent_element (peer);
           if (parent == sink) {
-            caps = gst_pad_get_negotiated_caps (pad);
+            caps = gst_pad_get_current_caps (pad);
             done = TRUE;
           }
 
@@ -3146,7 +3105,7 @@ _gst_element_get_linked_caps (GstElement * src, GstElement * sink)
             gst_object_unref (parent);
           gst_object_unref (peer);
         }
-        gst_object_unref (pad);
+        g_value_reset (&item);
         break;
       case GST_ITERATOR_RESYNC:
         gst_iterator_resync (it);
@@ -3157,7 +3116,7 @@ _gst_element_get_linked_caps (GstElement * src, GstElement * sink)
         break;
     }
   }
-
+  g_value_unset (&item);
   gst_iterator_free (it);
 
   return caps;
@@ -3234,7 +3193,7 @@ gst_decode_chain_get_topology (GstDecodeChain * chain)
   }
 
   /* Caps that resulted in this chain */
-  caps = gst_pad_get_negotiated_caps (chain->pad);
+  caps = gst_pad_get_current_caps (chain->pad);
   if (!caps) {
     caps = get_pad_caps (chain->pad);
     if (G_UNLIKELY (!gst_caps_is_fixed (caps))) {
@@ -3350,17 +3309,13 @@ gst_decode_bin_expose (GstDecodeBin * dbin)
     if (!dpad->exposed
         && !gst_element_add_pad (GST_ELEMENT (dbin), GST_PAD_CAST (dpad))) {
       /* not really fatal, we can try to add the other pads */
-      g_warning ("error adding pad to decodebin2");
+      g_warning ("error adding pad to decodebin");
       continue;
     }
     dpad->exposed = TRUE;
 
     /* 3. emit signal */
-    GST_DEBUG_OBJECT (dbin, "emitting new-decoded-pad");
-    g_signal_emit (G_OBJECT (dbin),
-        gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, dpad,
-        (tmp->next == NULL));
-    GST_DEBUG_OBJECT (dbin, "emitted new-decoded-pad");
+    GST_INFO_OBJECT (dpad, "added new decoded pad");
   }
 
   /* 4. Signal no-more-pads. This allows the application to hook stuff to the
@@ -3465,36 +3420,40 @@ gst_decode_pad_init (GstDecodePad * pad)
   pad->blocked = FALSE;
   pad->exposed = FALSE;
   pad->drained = FALSE;
-  gst_object_ref (pad);
-  gst_object_sink (pad);
+  gst_object_ref_sink (pad);
 }
 
-static void
-source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad)
+static GstProbeReturn
+source_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstDecodePad *dpad = user_data;
   GstDecodeChain *chain;
   GstDecodeBin *dbin;
 
   chain = dpad->chain;
   dbin = chain->dbin;
 
-  GST_LOG_OBJECT (dpad, "blocked:%d, dpad->chain:%p", blocked, chain);
+  GST_LOG_OBJECT (dpad, "blocked: dpad->chain:%p", chain);
 
-  dpad->blocked = blocked;
+  dpad->blocked = TRUE;
 
-  if (dpad->blocked) {
-    EXPOSE_LOCK (dbin);
-    if (gst_decode_chain_is_complete (dbin->decode_chain)) {
-      if (!gst_decode_bin_expose (dbin))
-        GST_WARNING_OBJECT (dbin, "Couldn't expose group");
-    }
-    EXPOSE_UNLOCK (dbin);
+  EXPOSE_LOCK (dbin);
+  if (gst_decode_chain_is_complete (dbin->decode_chain)) {
+    if (!gst_decode_bin_expose (dbin))
+      GST_WARNING_OBJECT (dbin, "Couldn't expose group");
   }
+  EXPOSE_UNLOCK (dbin);
+
+  return GST_PROBE_OK;
 }
 
-static gboolean
-source_pad_event_probe (GstPad * pad, GstEvent * event, GstDecodePad * dpad)
+static GstProbeReturn
+source_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstEvent *event = type_data;
+  GstDecodePad *dpad = user_data;
   gboolean res = TRUE;
 
   GST_LOG_OBJECT (pad, "%s dpad:%p", GST_EVENT_TYPE_NAME (event), dpad);
@@ -3511,8 +3470,10 @@ source_pad_event_probe (GstPad * pad, GstEvent * event, GstDecodePad * dpad)
      *   first, which unlinks the peer and so drops the EOS. */
     res = gst_decode_pad_handle_eos (dpad);
   }
-
-  return res;
+  if (res)
+    return GST_PROBE_OK;
+  else
+    return GST_PROBE_DROP;
 }
 
 static void
@@ -3531,10 +3492,20 @@ gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked)
 
   /* do not block if shutting down.
    * we do not consider/expect it blocked further below, but use other trick */
-  if (!blocked || !dbin->shutdown)
-    gst_pad_set_blocked_async_full (opad, blocked,
-        (GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
-        (GDestroyNotify) gst_object_unref);
+  if (!blocked || !dbin->shutdown) {
+    if (blocked) {
+      if (dpad->block_id == 0)
+        dpad->block_id = gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK,
+            source_pad_blocked_cb, gst_object_ref (dpad),
+            (GDestroyNotify) gst_object_unref);
+    } else {
+      if (dpad->block_id != 0) {
+        gst_pad_remove_probe (opad, dpad->block_id);
+        dpad->block_id = 0;
+      }
+      dpad->blocked = FALSE;
+    }
+  }
 
   if (blocked) {
     if (dbin->shutdown) {
@@ -3563,8 +3534,8 @@ out:
 static void
 gst_decode_pad_add_drained_check (GstDecodePad * dpad)
 {
-  gst_pad_add_event_probe (GST_PAD_CAST (dpad),
-      G_CALLBACK (source_pad_event_probe), dpad);
+  gst_pad_add_probe (GST_PAD_CAST (dpad), GST_PROBE_TYPE_EVENT,
+      source_pad_event_probe, dpad, NULL);
 }
 
 static void
@@ -3615,7 +3586,7 @@ gst_pending_pad_free (GstPendingPad * ppad)
   g_assert (ppad->pad);
 
   if (ppad->event_probe_id != 0)
-    gst_pad_remove_event_probe (ppad->pad, ppad->event_probe_id);
+    gst_pad_remove_probe (ppad->pad, ppad->event_probe_id);
   gst_object_unref (ppad->pad);
   g_slice_free (GstPendingPad, ppad);
 }
@@ -3631,7 +3602,7 @@ do_async_start (GstDecodeBin * dbin)
 
   dbin->async_pending = TRUE;
 
-  message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE);
+  message = gst_message_new_async_start (GST_OBJECT_CAST (dbin));
   parent_class->handle_message (GST_BIN_CAST (dbin), message);
 }
 
@@ -3641,7 +3612,7 @@ do_async_done (GstDecodeBin * dbin)
   GstMessage *message;
 
   if (dbin->async_pending) {
-    message = gst_message_new_async_done (GST_OBJECT_CAST (dbin));
+    message = gst_message_new_async_done (GST_OBJECT_CAST (dbin), FALSE);
     parent_class->handle_message (GST_BIN_CAST (dbin), message);
 
     dbin->async_pending = FALSE;
@@ -3663,13 +3634,13 @@ find_sink_pad (GstElement * element)
 {
   GstIterator *it;
   GstPad *pad = NULL;
-  gpointer point;
+  GValue item = { 0, };
 
   it = gst_element_iterate_sink_pads (element);
 
-  if ((gst_iterator_next (it, &point)) == GST_ITERATOR_OK)
-    pad = (GstPad *) point;
-
+  if ((gst_iterator_next (it, &item)) == GST_ITERATOR_OK)
+    pad = g_value_dup_object (&item);
+  g_value_unset (&item);
   gst_iterator_free (it);
 
   return pad;
@@ -3692,9 +3663,11 @@ unblock_pads (GstDecodeBin * dbin)
       continue;
 
     GST_DEBUG_OBJECT (dpad, "unblocking");
-    gst_pad_set_blocked_async_full (opad, FALSE,
-        (GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
-        (GDestroyNotify) gst_object_unref);
+    if (dpad->block_id != 0) {
+      gst_pad_remove_probe (opad, dpad->block_id);
+      dpad->block_id = 0;
+    }
+    dpad->blocked = FALSE;
     /* make flushing, prevent NOT_LINKED */
     GST_PAD_SET_FLUSHING (GST_PAD_CAST (dpad));
     gst_object_unref (dpad);
@@ -3787,15 +3760,7 @@ activate_failed:
 gboolean
 gst_decode_bin_plugin_init (GstPlugin * plugin)
 {
-  GST_DEBUG_CATEGORY_INIT (gst_decode_bin_debug, "decodebin2", 0,
-      "decoder bin");
-
-#ifdef ENABLE_NLS
-  GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
-      LOCALEDIR);
-  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
+  GST_DEBUG_CATEGORY_INIT (gst_decode_bin_debug, "decodebin", 0, "decoder bin");
 
   /* Register some quarks here for the stream topology message */
   topology_structure_name = g_quark_from_static_string ("stream-topology");
@@ -3803,6 +3768,6 @@ gst_decode_bin_plugin_init (GstPlugin * plugin)
   topology_next = g_quark_from_static_string ("next");
   topology_pad = g_quark_from_static_string ("pad");
 
-  return gst_element_register (plugin, "decodebin2", GST_RANK_NONE,
+  return gst_element_register (plugin, "decodebin", GST_RANK_NONE,
       GST_TYPE_DECODE_BIN);
 }
index 1e33f06..b0709ab 100644 (file)
@@ -52,7 +52,7 @@ GType gst_autoplug_select_result_get_type (void);
  * @GST_PLAY_FLAG_NATIVE_AUDIO: only allow native audio formats, this omits
  *   configuration of audioconvert and audioresample.
  * @GST_PLAY_FLAG_NATIVE_VIDEO: only allow native video formats, this omits
- *   configuration of ffmpegcolorspace and videoscale.
+ *   configuration of videoconvert and videoscale.
  * @GST_PLAY_FLAG_DOWNLOAD: enable progressice download buffering for selected
  *   formats.
  * @GST_PLAY_FLAG_BUFFERING: enable buffering of the demuxed or parsed data.
index d7eddf4..ace5d91 100644 (file)
@@ -1,7 +1,6 @@
 BOOLEAN:OBJECT,BOXED
 BOOLEAN:OBJECT,OBJECT,OBJECT
 BOXED:OBJECT,BOXED
-VOID:OBJECT,BOOLEAN
 ENUM:OBJECT,OBJECT,BOXED
 ENUM:OBJECT,BOXED,OBJECT
 BOXED:OBJECT,BOXED,BOXED
index a83fee1..75eddd7 100644 (file)
@@ -30,7 +30,6 @@
 #include "gstplayback.h"
 #include "gstplaysink.h"
 #include "gststreamselector.h"
-#include "gststreaminfo.h"
 #include "gstsubtitleoverlay.h"
 
 static gboolean
@@ -49,14 +48,15 @@ plugin_init (GstPlugin * plugin)
 
   /* ref class from a thread-safe context to work around missing bit of
    * thread-safety in GObject */
-  g_type_class_ref (GST_TYPE_STREAM_INFO);
   g_type_class_ref (GST_TYPE_STREAM_SELECTOR);
 
-  res = gst_play_bin_plugin_init (plugin);
-  res &= gst_play_bin2_plugin_init (plugin);
+  res = gst_play_bin2_plugin_init (plugin);
   res &= gst_play_sink_plugin_init (plugin);
   res &= gst_subtitle_overlay_plugin_init (plugin);
 
+  res &= gst_decode_bin_plugin_init (plugin);
+  res &= gst_uri_decode_bin_plugin_init (plugin);
+
   return res;
 }
 
index 4be121c..910b1a3 100644 (file)
@@ -24,6 +24,8 @@
 #include <gst/gst.h>
 
 gboolean gst_decode_bin_plugin_init (GstPlugin * plugin);
+gboolean gst_uri_decode_bin_plugin_init (GstPlugin * plugin);
+
 gboolean gst_play_bin_plugin_init (GstPlugin * plugin);
 gboolean gst_play_bin2_plugin_init (GstPlugin * plugin);
 
diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c
deleted file mode 100644 (file)
index 847e12f..0000000
+++ /dev/null
@@ -1,2811 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <string.h>
-#include "gstplaybasebin.h"
-#include "gststreamselector.h"
-#include "gstplay-marshal.h"
-
-#include <gst/pbutils/pbutils.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug);
-#define GST_CAT_DEFAULT gst_play_base_bin_debug
-
-#define DEFAULT_QUEUE_SIZE          (3 * GST_SECOND)
-#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
-#define DEFAULT_QUEUE_THRESHOLD     ((DEFAULT_QUEUE_SIZE * 95) / 100)
-#define DEFAULT_CONNECTION_SPEED    0
-
-#define GROUP_LOCK(pbb) g_mutex_lock (pbb->group_lock)
-#define GROUP_UNLOCK(pbb) g_mutex_unlock (pbb->group_lock)
-#define GROUP_WAIT(pbb) g_cond_wait (pbb->group_cond, pbb->group_lock)
-#define GROUP_SIGNAL(pbb) g_cond_signal (pbb->group_cond)
-
-/* props */
-enum
-{
-  ARG_0,
-  ARG_URI,
-  ARG_SUBURI,
-  ARG_QUEUE_SIZE,
-  ARG_QUEUE_THRESHOLD,
-  ARG_QUEUE_MIN_THRESHOLD,
-  ARG_NSTREAMS,
-  ARG_STREAMINFO,
-  ARG_STREAMINFO_VALUES,
-  ARG_SOURCE,
-  ARG_VIDEO,
-  ARG_AUDIO,
-  ARG_TEXT,
-  ARG_SUBTITLE_ENCODING,
-  ARG_CONNECTION_SPEED
-};
-
-static void gst_play_base_bin_class_init (GstPlayBaseBinClass * klass);
-static void gst_play_base_bin_init (GstPlayBaseBin * play_base_bin);
-static void gst_play_base_bin_dispose (GObject * object);
-static void gst_play_base_bin_finalize (GObject * object);
-
-static void gst_play_base_bin_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * spec);
-static void gst_play_base_bin_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * spec);
-static void gst_play_base_bin_handle_message_func (GstBin * bin,
-    GstMessage * msg);
-
-static GstStateChangeReturn gst_play_base_bin_change_state (GstElement *
-    element, GstStateChange transition);
-
-static const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * bin);
-static GValueArray *gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin
-    * play_base_bin);
-static void preroll_remove_overrun (GstElement * element,
-    GstPlayBaseBin * play_base_bin);
-static void queue_remove_probe (GstElement * queue, GstPlayBaseBin
-    * play_base_bin);
-
-static GstElement *make_decoder (GstPlayBaseBin * play_base_bin);
-static gboolean has_all_raw_caps (GstPad * pad, gboolean * all_raw);
-
-static gboolean prepare_output (GstPlayBaseBin * play_base_bin);
-static void set_active_source (GstPlayBaseBin * play_base_bin,
-    GstStreamType type, gint source_num);
-static gboolean probe_triggered (GstPad * pad, GstEvent * event,
-    gpointer user_data);
-static void setup_substreams (GstPlayBaseBin * play_base_bin);
-
-static GstPipelineClass *parent_class;
-
-/*
- * GObject playbasebin wrappers.
- */
-
-GType
-gst_play_base_bin_get_type (void)
-{
-  static GType gst_play_base_bin_type = 0;
-
-  if (!gst_play_base_bin_type) {
-    static const GTypeInfo gst_play_base_bin_info = {
-      sizeof (GstPlayBaseBinClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_play_base_bin_class_init,
-      NULL,
-      NULL,
-      sizeof (GstPlayBaseBin),
-      0,
-      (GInstanceInitFunc) gst_play_base_bin_init,
-      NULL
-    };
-
-    gst_play_base_bin_type = g_type_register_static (GST_TYPE_PIPELINE,
-        "GstPlayBaseBin", &gst_play_base_bin_info, 0);
-  }
-
-  return gst_play_base_bin_type;
-}
-
-static void
-gst_play_base_bin_class_init (GstPlayBaseBinClass * klass)
-{
-  GObjectClass *gobject_klass;
-  GstElementClass *gstelement_klass;
-  GstBinClass *gstbin_klass;
-
-  gobject_klass = (GObjectClass *) klass;
-  gstelement_klass = (GstElementClass *) klass;
-  gstbin_klass = (GstBinClass *) klass;
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_klass->set_property = gst_play_base_bin_set_property;
-  gobject_klass->get_property = gst_play_base_bin_get_property;
-
-  g_object_class_install_property (gobject_klass, ARG_URI,
-      g_param_spec_string ("uri", "URI", "URI of the media to play",
-          NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_SUBURI,
-      g_param_spec_string ("suburi", ".sub-URI", "Optional URI of a subtitle",
-          NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_klass, ARG_QUEUE_SIZE,
-      g_param_spec_uint64 ("queue-size", "Queue size",
-          "Size of internal queues in nanoseconds", 0, G_MAXINT64,
-          DEFAULT_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_QUEUE_THRESHOLD,
-      g_param_spec_uint64 ("queue-threshold", "Queue threshold",
-          "Buffering threshold of internal queues in nanoseconds", 0,
-          G_MAXINT64, DEFAULT_QUEUE_THRESHOLD,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_QUEUE_MIN_THRESHOLD,
-      g_param_spec_uint64 ("queue-min-threshold", "Queue min threshold",
-          "Buffering low threshold of internal queues in nanoseconds", 0,
-          G_MAXINT64, DEFAULT_QUEUE_MIN_THRESHOLD,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_klass, ARG_NSTREAMS,
-      g_param_spec_int ("nstreams", "NStreams", "number of streams",
-          0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_STREAMINFO,
-      g_param_spec_pointer ("stream-info", "Stream info", "List of streaminfo",
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_STREAMINFO_VALUES,
-      g_param_spec_value_array ("stream-info-value-array",
-          "StreamInfo GValueArray", "value array of streaminfo",
-          g_param_spec_object ("streaminfo", "StreamInfo", "Streaminfo object",
-              GST_TYPE_STREAM_INFO, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_SOURCE,
-      g_param_spec_object ("source", "Source", "Source element",
-          GST_TYPE_ELEMENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_klass, ARG_VIDEO,
-      g_param_spec_int ("current-video", "Current video",
-          "Currently playing video stream (-1 = none)",
-          -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_AUDIO,
-      g_param_spec_int ("current-audio", "Current audio",
-          "Currently playing audio stream (-1 = none)",
-          -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_TEXT,
-      g_param_spec_int ("current-text", "Current text",
-          "Currently playing text stream (-1 = none)",
-          -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_SUBTITLE_ENCODING,
-      g_param_spec_string ("subtitle-encoding", "subtitle encoding",
-          "Encoding to assume if input subtitles are not in UTF-8 encoding. "
-          "If not set, the GST_SUBTITLE_ENCODING environment variable will "
-          "be checked for an encoding to use. If that is not set either, "
-          "ISO-8859-15 will be assumed.", NULL,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstPlayBaseBin:connection-speed
-   *
-   * Network connection speed in kbps (0 = unknown)
-   * <note><simpara>
-   * Since version 0.10.10 in #GstPlayBin, at 0.10.15 moved to #GstPlayBaseBin
-   * </simpara></note>
-   *
-   * Since: 0.10.10
-   */
-  g_object_class_install_property (gobject_klass, ARG_CONNECTION_SPEED,
-      g_param_spec_uint ("connection-speed", "Connection Speed",
-          "Network connection speed in kbps (0 = unknown)",
-          0, G_MAXUINT, DEFAULT_CONNECTION_SPEED,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  GST_DEBUG_CATEGORY_INIT (gst_play_base_bin_debug, "playbasebin", 0,
-      "playbasebin");
-
-  gobject_klass->dispose = gst_play_base_bin_dispose;
-  gobject_klass->finalize = gst_play_base_bin_finalize;
-
-  gstbin_klass->handle_message =
-      GST_DEBUG_FUNCPTR (gst_play_base_bin_handle_message_func);
-
-  gstelement_klass->change_state =
-      GST_DEBUG_FUNCPTR (gst_play_base_bin_change_state);
-}
-
-static void
-gst_play_base_bin_init (GstPlayBaseBin * play_base_bin)
-{
-  play_base_bin->uri = NULL;
-  play_base_bin->suburi = NULL;
-  play_base_bin->need_rebuild = TRUE;
-  play_base_bin->is_stream = FALSE;
-  play_base_bin->source = NULL;
-  play_base_bin->decoders = NULL;
-  play_base_bin->subtitle = NULL;
-  play_base_bin->subencoding = NULL;
-  play_base_bin->subtitle_elements = NULL;
-  play_base_bin->sub_lock = g_mutex_new ();
-
-  play_base_bin->group_lock = g_mutex_new ();
-  play_base_bin->group_cond = g_cond_new ();
-
-  play_base_bin->building_group = NULL;
-  play_base_bin->queued_groups = NULL;
-
-  play_base_bin->queue_size = DEFAULT_QUEUE_SIZE;
-  play_base_bin->queue_threshold = DEFAULT_QUEUE_THRESHOLD;
-  play_base_bin->queue_min_threshold = DEFAULT_QUEUE_MIN_THRESHOLD;
-  play_base_bin->connection_speed = DEFAULT_CONNECTION_SPEED;
-}
-
-static void
-gst_play_base_bin_dispose (GObject * object)
-{
-  GstPlayBaseBin *play_base_bin;
-
-  play_base_bin = GST_PLAY_BASE_BIN (object);
-  g_free (play_base_bin->uri);
-  play_base_bin->uri = NULL;
-  g_free (play_base_bin->suburi);
-  play_base_bin->suburi = NULL;
-  g_free (play_base_bin->subencoding);
-  play_base_bin->subencoding = NULL;
-  if (play_base_bin->subtitle_elements) {
-    g_slist_free (play_base_bin->subtitle_elements);
-    play_base_bin->subtitle_elements = NULL;
-  }
-  G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_play_base_bin_finalize (GObject * object)
-{
-  GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (object);
-
-  g_mutex_free (play_base_bin->group_lock);
-  g_cond_free (play_base_bin->group_cond);
-
-  g_mutex_free (play_base_bin->sub_lock);
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/*
- * playbasebingroup stuff.
- */
-
-static GstPlayBaseGroup *
-group_create (GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group;
-
-  group = g_new0 (GstPlayBaseGroup, 1);
-  group->bin = play_base_bin;
-  group->streaminfo_value_array = g_value_array_new (0);
-
-  GST_DEBUG_OBJECT (play_base_bin, "created new group %p", group);
-
-  return group;
-}
-
-/*
- * Gets the currently playing group.
- *
- * Callers must have group-lock held when calling this.
- */
-
-static GstPlayBaseGroup *
-get_active_group (GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group = NULL;
-
-  if (play_base_bin->queued_groups)
-    group = play_base_bin->queued_groups->data;
-
-  return group;
-}
-
-/*
- * get the group used for discovering the different streams.
- * This function creates a group is there is none.
- *
- * Callers must have group-lock held when calling this.
- */
-static GstPlayBaseGroup *
-get_building_group (GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group;
-
-  group = play_base_bin->building_group;
-  if (group == NULL) {
-    group = group_create (play_base_bin);
-    play_base_bin->building_group = group;
-  }
-
-  return group;
-}
-
-/*
- * Callers must have lock held when calling this!
- */
-
-static void
-group_destroy (GstPlayBaseGroup * group)
-{
-  GstPlayBaseBin *play_base_bin = group->bin;
-  gint n;
-
-  GST_LOG ("removing group %p", group);
-
-  /* remove the preroll queues */
-  for (n = 0; n < NUM_TYPES; n++) {
-    GstElement *element = group->type[n].preroll;
-    GstElement *fakesrc;
-    GstElement *sel;
-    const GList *item;
-
-    if (!element)
-      continue;
-
-    sel = group->type[n].selector;
-
-    /* remove any fakesrc elements for this preroll element */
-    for (item = sel->pads; item != NULL; item = item->next) {
-      GstPad *pad = GST_PAD (item->data);
-      guint sig_id;
-
-      if (GST_PAD_DIRECTION (pad) != GST_PAD_SINK)
-        continue;
-
-      sig_id =
-          GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), "unlinked_id"));
-
-      if (sig_id != 0) {
-        GST_LOG ("removing unlink signal %s:%s", GST_DEBUG_PAD_NAME (pad));
-        g_signal_handler_disconnect (G_OBJECT (pad), sig_id);
-        g_object_set_data (G_OBJECT (pad), "unlinked_id", GINT_TO_POINTER (0));
-      }
-
-      fakesrc = (GstElement *) g_object_get_data (G_OBJECT (pad), "fakesrc");
-      if (fakesrc != NULL) {
-        GST_LOG ("removing fakesrc from %s:%s",
-            GST_PAD_NAME (pad), GST_ELEMENT_NAME (GST_PAD_PARENT (pad)));
-        gst_element_set_state (fakesrc, GST_STATE_NULL);
-        gst_bin_remove (GST_BIN_CAST (play_base_bin), fakesrc);
-      }
-    }
-
-    /* if the group is currently being played, we have to remove the element
-     * from the thread */
-    gst_element_set_state (element, GST_STATE_NULL);
-    gst_element_set_state (group->type[n].selector, GST_STATE_NULL);
-
-    GST_LOG ("removing preroll element %s", GST_ELEMENT_NAME (element));
-
-    gst_bin_remove (group->type[n].bin, element);
-    gst_bin_remove (group->type[n].bin, group->type[n].selector);
-
-    group->type[n].preroll = NULL;
-    group->type[n].selector = NULL;
-    group->type[n].bin = NULL;
-  }
-
-  /* free the streaminfo too */
-  g_list_foreach (group->streaminfo, (GFunc) g_object_unref, NULL);
-  g_list_free (group->streaminfo);
-  g_value_array_free (group->streaminfo_value_array);
-  g_free (group);
-}
-
-/*
- * is called when the current building group is completely finished
- * and ready for playback
- *
- * This function grabs lock, so take care when calling.
- */
-static void
-group_commit (GstPlayBaseBin * play_base_bin, gboolean fatal, gboolean subtitle)
-{
-  GstPlayBaseGroup *group;
-  gboolean had_active_group;
-
-  GROUP_LOCK (play_base_bin);
-  group = play_base_bin->building_group;
-  had_active_group = (get_active_group (play_base_bin) != NULL);
-
-  GST_DEBUG_OBJECT (play_base_bin, "commit group %p, had active %d",
-      group, had_active_group);
-
-  /* if an element signalled a no-more-pads after we stopped due
-   * to preroll, the group is NULL. This is not an error */
-  if (group == NULL) {
-    if (!fatal) {
-      GROUP_UNLOCK (play_base_bin);
-      return;
-    } else {
-      GST_DEBUG_OBJECT (play_base_bin, "Group loading failed, bailing out");
-    }
-  } else {
-    if (!subtitle) {
-      gint n;
-
-      GST_DEBUG_OBJECT (play_base_bin, "group %p done", group);
-
-      play_base_bin->queued_groups =
-          g_list_append (play_base_bin->queued_groups, group);
-
-      play_base_bin->building_group = NULL;
-
-      /* remove signals. We don't want anymore signals from the preroll
-       * elements at this stage. */
-      for (n = 0; n < NUM_TYPES; n++) {
-        GstElement *element = group->type[n].preroll;
-
-        if (!element)
-          continue;
-
-        preroll_remove_overrun (element, play_base_bin);
-        /* if overrun is removed, probe alse has to be removed */
-        queue_remove_probe (element, play_base_bin);
-      }
-    } else {
-      /* this is a special subtitle bin, we don't commit the group but
-       * mark the subtitles as detected before we signal. */
-      GST_DEBUG_OBJECT (play_base_bin, "marking subtitle bin as complete");
-      play_base_bin->subtitle_done = TRUE;
-    }
-  }
-
-  GST_DEBUG_OBJECT (play_base_bin, "signal group done");
-  GROUP_SIGNAL (play_base_bin);
-  GST_DEBUG_OBJECT (play_base_bin, "signaled group done");
-
-  if (!subtitle && !had_active_group) {
-    if (!prepare_output (play_base_bin)) {
-      GROUP_UNLOCK (play_base_bin);
-      return;
-    }
-
-    setup_substreams (play_base_bin);
-    GST_DEBUG_OBJECT (play_base_bin, "Emitting signal");
-    GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads
-        (play_base_bin, group);
-    GST_DEBUG_OBJECT (play_base_bin, "done");
-
-    GROUP_UNLOCK (play_base_bin);
-
-    g_object_notify (G_OBJECT (play_base_bin), "stream-info");
-  } else {
-    GROUP_UNLOCK (play_base_bin);
-  }
-}
-
-/*
- * check if there are streams in the group that are not muted
- *
- * Callers must have group-lock held when calling this.
- */
-static gboolean
-group_is_muted (GstPlayBaseGroup * group)
-{
-  gint n;
-
-  for (n = 0; n < NUM_TYPES; n++) {
-    if (group->type[n].preroll && !group->type[n].done)
-      return FALSE;
-  }
-
-  return TRUE;
-}
-
-/*
- * Buffer/cache checking.
- */
-
-static inline void
-fill_buffer (GstPlayBaseBin * play_base_bin, gint percent)
-{
-  GST_DEBUG_OBJECT (play_base_bin, "buffering %d", percent);
-  gst_element_post_message (GST_ELEMENT_CAST (play_base_bin),
-      gst_message_new_buffering (GST_OBJECT_CAST (play_base_bin), percent));
-}
-
-static gboolean
-check_queue_event (GstPad * pad, GstEvent * event, gpointer user_data)
-{
-  GstElement *queue = GST_ELEMENT_CAST (user_data);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      GST_DEBUG ("EOS event, mark EOS");
-      g_object_set_data (G_OBJECT (queue), "eos", GINT_TO_POINTER (1));
-      break;
-    case GST_EVENT_FLUSH_STOP:
-      GST_DEBUG ("FLUSH_STOP event, remove EOS");
-      g_object_set_data (G_OBJECT (queue), "eos", NULL);
-      break;
-    default:
-      GST_DEBUG ("uninteresting event %s", GST_EVENT_TYPE_NAME (event));
-      break;
-  }
-  return TRUE;
-}
-
-static gboolean
-check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
-{
-  GstElement *queue = GST_ELEMENT_CAST (user_data);
-  GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb");
-  guint64 level = 0;
-
-  GST_DEBUG_OBJECT (queue, "check queue triggered");
-
-  g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL);
-  GST_DEBUG_OBJECT (play_base_bin, "Queue size: %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (level));
-
-  if (play_base_bin->queue_threshold > 0) {
-    level = level * 99 / play_base_bin->queue_threshold;
-    if (level > 99)
-      level = 99;
-  } else
-    level = 99;
-
-  fill_buffer (play_base_bin, level);
-
-  /* continue! */
-  return TRUE;
-}
-
-/* If a queue overruns and we are buffer in streaming mode (we have a min-time)
- * we can potentially create a deadlock when:
- *
- *  1) the max-bytes is hit and
- *  2) the min-time is not hit.
- *
- * We recover from this situation in this callback by
- * setting the max-bytes to unlimited if we see that there is
- * a current-time-level (which means some sort of timestamping is
- * done).
- */
-static void
-queue_deadlock_check (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
-  guint64 time, min_time;
-  guint bytes;
-
-  GST_DEBUG_OBJECT (play_base_bin, "overrun signal received from queue %s",
-      GST_ELEMENT_NAME (queue));
-
-  /* figure out where we are */
-  g_object_get (G_OBJECT (queue), "current-level-time", &time,
-      "current-level-bytes", &bytes, "min-threshold-time", &min_time, NULL);
-
-  GST_DEBUG_OBJECT (play_base_bin, "streaming mode, queue %s current %"
-      GST_TIME_FORMAT ", min %" GST_TIME_FORMAT
-      ", bytes %d", GST_ELEMENT_NAME (queue),
-      GST_TIME_ARGS (time), GST_TIME_ARGS (min_time), bytes);
-
-  /* if the bytes in the queue represent time, we disable bytes
-   * overrun checking to not cause deadlocks.
-   */
-  if (bytes && time != 0 && time < min_time) {
-    GST_DEBUG_OBJECT (play_base_bin,
-        "possible deadlock found, removing byte limit");
-
-    /* queue knows about time but is filled with bytes that do
-     * not represent min-threshold time, disable bytes checking so
-     * the queue can grow some more. */
-    g_object_set (G_OBJECT (queue), "max-size-bytes", 0, NULL);
-
-    /* bytes limit is removed, we cannot deadlock anymore */
-    g_signal_handlers_disconnect_by_func (queue,
-        (gpointer) queue_deadlock_check, play_base_bin);
-  } else {
-    GST_DEBUG_OBJECT (play_base_bin, "no deadlock");
-  }
-}
-
-static void
-queue_remove_probe (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
-  gpointer data;
-  GstPad *sinkpad;
-
-  data = g_object_get_data (G_OBJECT (queue), "probe");
-  sinkpad = gst_element_get_static_pad (queue, "sink");
-
-  if (data) {
-    GST_DEBUG_OBJECT (play_base_bin,
-        "Removing buffer probe from pad %s:%s (%p)",
-        GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
-
-    g_object_set_data (G_OBJECT (queue), "probe", NULL);
-    gst_pad_remove_buffer_probe (sinkpad, GPOINTER_TO_INT (data));
-  } else {
-    GST_DEBUG_OBJECT (play_base_bin,
-        "No buffer probe to remove from %s:%s (%p)",
-        GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
-  }
-  gst_object_unref (sinkpad);
-}
-
-/* Used for time-based buffering in streaming mode and is called when a queue
- * emits the running signal. This means that the high watermark threshold is
- * reached and the buffering is completed. */
-static void
-queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group;
-  gint n;
-
-  GST_DEBUG_OBJECT (play_base_bin, "running signal received from queue %s",
-      GST_ELEMENT_NAME (queue));
-
-  /* we disconnect the signal so that we don't get called for every buffer. */
-  g_signal_handlers_disconnect_by_func (queue,
-      (gpointer) queue_threshold_reached, play_base_bin);
-
-  if (g_object_get_data (G_OBJECT (queue), "eos")) {
-    GST_DEBUG_OBJECT (play_base_bin, "disable min threshold time, we are EOS");
-    g_object_set (queue, "min-threshold-time", (guint64) 0, NULL);
-  } else {
-    /* now place the limits at the low threshold. When we hit this limit, the
-     * underrun signal will be called. The underrun signal is always connected. */
-    GST_DEBUG_OBJECT (play_base_bin,
-        "setting min threshold time to %" G_GUINT64_FORMAT,
-        play_base_bin->queue_min_threshold);
-    g_object_set (queue, "min-threshold-time",
-        play_base_bin->queue_min_threshold, NULL);
-  }
-
-  GROUP_LOCK (play_base_bin);
-  group = get_active_group (play_base_bin);
-  if (!group) {
-    GROUP_UNLOCK (play_base_bin);
-    return;
-  }
-
-  /* we remove the probe now because we don't need it anymore to give progress
-   * about the buffering. */
-  for (n = 0; n < NUM_TYPES; n++) {
-    GstElement *element = group->type[n].preroll;
-
-    if (!element)
-      continue;
-
-    queue_remove_probe (element, play_base_bin);
-  }
-
-  GROUP_UNLOCK (play_base_bin);
-
-  /* we post a 100% buffering message to notify the app that buffering is
-   * completed and playback can start/continue */
-  if (play_base_bin->is_stream)
-    fill_buffer (play_base_bin, 100);
-}
-
-/* this signal will be fired when one of the queues with raw
- * data is filled. This means that the group building stage is over
- * and playback of the new queued group should start. This is a rather unusual
- * situation because normally the group is commited when the "no_more_pads"
- * signal is fired.
- */
-static void
-queue_overrun (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
-  GST_DEBUG_OBJECT (play_base_bin, "queue %s overrun",
-      GST_ELEMENT_NAME (queue));
-
-  preroll_remove_overrun (queue, play_base_bin);
-
-  group_commit (play_base_bin, FALSE,
-      GST_OBJECT_PARENT (GST_OBJECT_CAST (queue)) ==
-      GST_OBJECT_CAST (play_base_bin->subtitle));
-
-  /* notify end of buffering */
-  queue_threshold_reached (queue, play_base_bin);
-}
-
-/* this signal is only added when in streaming mode to catch underruns
- */
-static void
-queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
-  GST_DEBUG_OBJECT (play_base_bin, "underrun signal received from queue %s",
-      GST_ELEMENT_NAME (queue));
-
-  /* On underrun, we want to temoprarily pause playback, set a "min-size"
-   * threshold and wait for the running signal and then play again.
-   *
-   * This signal could never be called because the queue max-size limits are set
-   * too low. We take care of this possible deadlock in the the overrun signal
-   * handler. */
-  g_signal_connect (G_OBJECT (queue), "pushing",
-      G_CALLBACK (queue_threshold_reached), play_base_bin);
-  GST_DEBUG_OBJECT (play_base_bin,
-      "setting min threshold time to %" G_GUINT64_FORMAT,
-      (guint64) play_base_bin->queue_threshold);
-  g_object_set (queue, "min-threshold-time",
-      (guint64) play_base_bin->queue_threshold, NULL);
-
-  /* re-connect probe, this will fire feedback about the percentage that we
-   * buffered and is posted in the BUFFERING message. */
-  if (!g_object_get_data (G_OBJECT (queue), "probe")) {
-    GstPad *sinkpad;
-    guint id;
-
-    sinkpad = gst_element_get_static_pad (queue, "sink");
-    id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
-    g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id));
-    GST_DEBUG_OBJECT (play_base_bin,
-        "Re-attaching buffering probe to pad %s:%s %p",
-        GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
-    gst_object_unref (sinkpad);
-
-    fill_buffer (play_base_bin, 0);
-  }
-}
-
-/*
- * generate a preroll element which is simply a queue. While there
- * are still dynamic elements in the pipeline, we wait for one
- * of the queues to fill. The assumption is that all the dynamic
- * streams will be detected by that time.
- *
- * Callers must have the group-lock held when calling this.
- */
-static void
-gen_preroll_element (GstPlayBaseBin * play_base_bin,
-    GstPlayBaseGroup * group, GstStreamType type, GstPad * pad,
-    GstStreamInfo * info)
-{
-  GstElement *selector, *preroll;
-  gchar *name, *padname;
-  const gchar *prename;
-  guint overrun_sig;
-  GstPad *preroll_pad;
-  GstBin *target;
-  GstState state;
-
-  if (type == GST_STREAM_TYPE_VIDEO)
-    prename = "video";
-  else if (type == GST_STREAM_TYPE_TEXT)
-    prename = "text";
-  else if (type == GST_STREAM_TYPE_AUDIO)
-    prename = "audio";
-  else if (type == GST_STREAM_TYPE_SUBPICTURE)
-    prename = "subpicture";
-  else
-    g_return_if_reached ();
-
-  /* create stream selector */
-  selector = g_object_new (GST_TYPE_STREAM_SELECTOR, NULL);
-  padname = gst_pad_get_name (pad);
-  name = g_strdup_printf ("selector_%s_%s", prename, padname);
-  gst_object_set_name (GST_OBJECT_CAST (selector), name);
-  g_free (name);
-
-  /* create preroll queue */
-  name = g_strdup_printf ("preroll_%s_%s", prename, padname);
-  preroll = gst_element_factory_make ("queue", name);
-  g_free (name);
-  g_free (padname);
-
-  /* for buffering of raw data we ideally want to buffer a
-   * very small amount of buffers since the memory used by
-   * this raw data can be enormously huge.
-   *
-   * We use an upper limit of typically a few seconds here but
-   * cap in case no timestamps are set on the raw data (bad!).
-   *
-   * FIXME: we abuse this buffer to do network buffering since
-   * we can then easily do time-based buffering. The better
-   * solution would be to add a specific network queue right
-   * after the source that measures the datarate and scales this
-   * queue of encoded data instead.
-   */
-  if (play_base_bin->raw_decoding_mode) {
-    if (type == GST_STREAM_TYPE_VIDEO) {
-      g_object_set (G_OBJECT (preroll),
-          "max-size-buffers", 2, "max-size-bytes", 0,
-          "max-size-time", (guint64) 0, NULL);
-    } else {
-      g_object_set (G_OBJECT (preroll),
-          "max-size-buffers", 0, "max-size-bytes",
-          2 * 1024 * 1024, "max-size-time", play_base_bin->queue_size, NULL);
-    }
-  } else {
-    g_object_set (G_OBJECT (preroll),
-        "max-size-buffers", 0, "max-size-bytes",
-        ((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024,
-        "max-size-time", play_base_bin->queue_size, NULL);
-  }
-
-  /* the overrun signal is always attached and serves two purposes:
-   *
-   *  1) when we are building a group and the overrun is called, we commit the
-   *     group. The reason being that if we fill the entire queue without a
-   *     normal group commit (with _no_more_pads()) we can assume the
-   *     audio/video is completely wacked or the element just does not know when
-   *     it is ready with all the pads (mpeg).
-   *  2) When we are doing network buffering, we keep track of low/high
-   *     watermarks in the queue. It is possible that we set the high watermark
-   *     higher than the max-size limits to trigger an overrun. In this case we
-   *     will never get a running signal but we can use the overrun signal to
-   *     detect this deadlock and correct it.
-   */
-  overrun_sig = g_signal_connect (G_OBJECT (preroll), "overrun",
-      G_CALLBACK (queue_overrun), play_base_bin);
-
-  /* keep a ref to the signal id so that we can disconnect the signal callback
-   * when we are done with the preroll */
-  g_object_set_data (G_OBJECT (preroll), "overrun_signal_id",
-      GINT_TO_POINTER (overrun_sig));
-
-  if (play_base_bin->is_stream &&
-      ((type == GST_STREAM_TYPE_VIDEO &&
-              group->type[GST_STREAM_TYPE_AUDIO - 1].npads == 0) ||
-          (type == GST_STREAM_TYPE_AUDIO &&
-              group->type[GST_STREAM_TYPE_VIDEO - 1].npads == 0))) {
-    GstPad *sinkpad;
-    guint id;
-
-    /* catch deadlocks when we are network buffering in time but the max-limit
-     * in bytes is hit. */
-    g_signal_connect (G_OBJECT (preroll), "overrun",
-        G_CALLBACK (queue_deadlock_check), play_base_bin);
-
-    /* attach pointer to playbasebin */
-    g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin);
-
-    /* give updates on queue size */
-    sinkpad = gst_element_get_static_pad (preroll, "sink");
-    id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
-    GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
-        GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
-    g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
-
-    /* catch eos and flush events so that we can ignore underruns */
-    id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event),
-        preroll);
-    g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id));
-
-    gst_object_unref (sinkpad);
-
-    /* When we connect this queue, it will start running and immediatly
-     * fire an underrun. */
-    g_signal_connect (G_OBJECT (preroll), "underrun",
-        G_CALLBACK (queue_out_of_data), play_base_bin);
-    /* configure threshold and callbacks */
-    queue_out_of_data (preroll, play_base_bin);
-  }
-
-  /* listen for EOS so we can switch groups when one ended. */
-  preroll_pad = gst_element_get_static_pad (preroll, "src");
-  gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info);
-  gst_object_unref (preroll_pad);
-
-  /* add to group list */
-  group->type[type - 1].selector = selector;
-  group->type[type - 1].preroll = preroll;
-
-  /* figure out where the preroll element should go */
-  if (type == GST_STREAM_TYPE_TEXT && play_base_bin->subtitle)
-    target = GST_BIN_CAST (play_base_bin->subtitle);
-  else
-    target = GST_BIN_CAST (play_base_bin);
-
-  group->type[type - 1].bin = target;
-  gst_bin_add (target, selector);
-  gst_bin_add (target, preroll);
-
-  gst_element_link (selector, preroll);
-
-  /* figure out target state and set */
-  state = (GST_STATE (play_base_bin) == GST_STATE_PLAYING ?
-      GST_STATE_PLAYING : GST_STATE_PAUSED);
-
-  gst_element_set_state (selector, state);
-  gst_element_set_state (preroll, state);
-}
-
-static void
-preroll_remove_overrun (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
-  guint overrun_sig;
-  GObject *obj = G_OBJECT (element);
-
-  overrun_sig = GPOINTER_TO_INT (g_object_get_data (obj, "overrun_signal_id"));
-  if (overrun_sig) {
-    GST_LOG_OBJECT (play_base_bin, "removing preroll signal %s",
-        GST_ELEMENT_NAME (element));
-    g_signal_handler_disconnect (obj, overrun_sig);
-    /* We have disconnected this signal, remove the signal_id from the object
-     * data */
-    g_object_set_data (obj, "overrun_signal_id", NULL);
-  }
-}
-
-static void
-remove_groups (GstPlayBaseBin * play_base_bin)
-{
-  GROUP_LOCK (play_base_bin);
-
-  /* first destroy the group we were building if any */
-  if (play_base_bin->building_group) {
-    group_destroy (play_base_bin->building_group);
-    play_base_bin->building_group = NULL;
-  }
-
-  /* remove the queued groups */
-  g_list_foreach (play_base_bin->queued_groups, (GFunc) group_destroy, NULL);
-  g_list_free (play_base_bin->queued_groups);
-  play_base_bin->queued_groups = NULL;
-
-  /* clear subs */
-  if (play_base_bin->subtitle) {
-    gst_element_set_state (play_base_bin->subtitle, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (play_base_bin), play_base_bin->subtitle);
-    play_base_bin->subtitle = NULL;
-  }
-
-  GROUP_UNLOCK (play_base_bin);
-}
-
-/*
- * Add/remove a single stream to current building group.
- *
- * Must be called with group-lock held.
- */
-static void
-add_stream (GstPlayBaseGroup * group, GstStreamInfo * info)
-{
-  GValue v = { 0, };
-  GST_DEBUG ("add stream to group %p", group);
-
-  /* keep ref to the group */
-  g_object_set_data (G_OBJECT (info), "group", group);
-
-  g_value_init (&v, G_TYPE_OBJECT);
-  g_value_set_object (&v, info);
-  g_value_array_append (group->streaminfo_value_array, &v);
-  g_value_unset (&v);
-  group->streaminfo = g_list_append (group->streaminfo, info);
-  if (info->type > 0 && info->type <= NUM_TYPES) {
-    group->type[info->type - 1].npads++;
-  }
-}
-
-static gboolean
-string_arr_has_str (const gchar * values[], const gchar * value)
-{
-  if (values && value) {
-    while (*values != NULL) {
-      if (strcmp (value, *values) == 0)
-        return TRUE;
-      ++values;
-    }
-  }
-  return FALSE;
-}
-
-/* mime types we are not handling on purpose right now, don't post a
- * missing-plugin message for these */
-static const gchar *blacklisted_mimes[] = {
-  "video/x-dvd-subpicture", NULL
-};
-
-#define IS_BLACKLISTED_MIME(type) (string_arr_has_str(blacklisted_mimes,type))
-
-static void
-gst_play_base_bin_handle_message_func (GstBin * bin, GstMessage * msg)
-{
-  if (gst_is_missing_plugin_message (msg)) {
-    gchar *detail;
-    guint i;
-
-    detail = gst_missing_plugin_message_get_installer_detail (msg);
-    for (i = 0; detail != NULL && blacklisted_mimes[i] != NULL; ++i) {
-      if (strstr (detail, "|decoder-") && strstr (detail, blacklisted_mimes[i])) {
-        GST_LOG_OBJECT (bin, "suppressing message %" GST_PTR_FORMAT, msg);
-        gst_message_unref (msg);
-        g_free (detail);
-        return;
-      }
-    }
-    g_free (detail);
-  }
-  GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-/*
- * signal fired when an unknown stream is found. We create a new
- * UNKNOWN streaminfo object.
- */
-static void
-unknown_type (GstElement * element, GstPad * pad, GstCaps * caps,
-    GstPlayBaseBin * play_base_bin)
-{
-  const gchar *type_name;
-  GstStreamInfo *info;
-  GstPlayBaseGroup *group;
-
-  type_name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
-  if (type_name && !IS_BLACKLISTED_MIME (type_name)) {
-    gchar *capsstr;
-
-    capsstr = gst_caps_to_string (caps);
-    GST_DEBUG_OBJECT (play_base_bin, "don't know how to handle %s", capsstr);
-    /* FIXME, g_message() ? */
-    g_message ("don't know how to handle %s", capsstr);
-    g_free (capsstr);
-  } else {
-    /* don't spew stuff to the terminal or send message if it's blacklisted */
-    GST_DEBUG_OBJECT (play_base_bin, "media type %s not handled on purpose, "
-        "not posting a missing-plugin message on the bus", type_name);
-  }
-
-  GROUP_LOCK (play_base_bin);
-
-  group = get_building_group (play_base_bin);
-
-  /* add the stream to the list */
-  info = gst_stream_info_new (GST_OBJECT_CAST (pad), GST_STREAM_TYPE_UNKNOWN,
-      NULL, caps);
-  info->origin = GST_OBJECT_CAST (pad);
-  add_stream (group, info);
-
-  GROUP_UNLOCK (play_base_bin);
-}
-
-/* add a streaminfo that indicates that the stream is handled by the
- * given element. This usually means that a stream without actual data is
- * produced but one that is sunken by an element. Examples of this are:
- * cdaudio, a hardware decoder/sink, dvd meta bins etc...
- */
-static void
-add_element_stream (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
-  GstStreamInfo *info;
-  GstPlayBaseGroup *group;
-
-  GROUP_LOCK (play_base_bin);
-
-  group = get_building_group (play_base_bin);
-
-  /* add the stream to the list */
-  info =
-      gst_stream_info_new (GST_OBJECT_CAST (element), GST_STREAM_TYPE_ELEMENT,
-      NULL, NULL);
-  info->origin = GST_OBJECT_CAST (element);
-  add_stream (group, info);
-
-  GROUP_UNLOCK (play_base_bin);
-}
-
-/* when the decoder element signals that no more pads will be generated, we
- * can commit the current group.
- */
-static void
-no_more_pads_full (GstElement * element, gboolean subs,
-    GstPlayBaseBin * play_base_bin)
-{
-  /* setup phase */
-  GST_DEBUG_OBJECT (element, "no more pads, %d pending",
-      play_base_bin->pending);
-
-  /* nothing pending, we can exit */
-  if (play_base_bin->pending == 0)
-    return;
-
-  /* the object has no pending no_more_pads */
-  if (!g_object_get_data (G_OBJECT (element), "pending"))
-    return;
-
-  g_object_set_data (G_OBJECT (element), "pending", NULL);
-
-  play_base_bin->pending--;
-
-  GST_DEBUG_OBJECT (element, "remove pending, now %d pending",
-      play_base_bin->pending);
-
-  if (play_base_bin->pending == 0) {
-    /* we can commit this group for playback now */
-    group_commit (play_base_bin, play_base_bin->is_stream, subs);
-  }
-}
-
-static void
-no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
-  no_more_pads_full (element, FALSE, play_base_bin);
-}
-
-static void
-sub_no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
-  no_more_pads_full (element, TRUE, play_base_bin);
-}
-
-static void
-source_no_more_pads (GstElement * element, GstPlayBaseBin * bin)
-{
-  GST_DEBUG_OBJECT (bin, "No more pads in source element %s.",
-      GST_ELEMENT_NAME (element));
-
-  g_signal_handler_disconnect (G_OBJECT (element), bin->src_np_sig_id);
-  bin->src_np_sig_id = 0;
-  g_signal_handler_disconnect (G_OBJECT (element), bin->src_nmp_sig_id);
-  bin->src_nmp_sig_id = 0;
-
-  no_more_pads_full (element, FALSE, bin);
-}
-
-static gboolean
-probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
-{
-  GstPlayBaseGroup *group;
-  GstPlayBaseBin *play_base_bin;
-  GstStreamInfo *info;
-  GstEventType type;
-
-  type = GST_EVENT_TYPE (event);
-
-  GST_LOG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type));
-
-  /* we only care about EOS */
-  if (type != GST_EVENT_EOS)
-    return TRUE;
-
-  info = GST_STREAM_INFO (user_data);
-  group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group");
-  play_base_bin = group->bin;
-
-  if (type == GST_EVENT_EOS) {
-    gint num_groups = 0;
-    gboolean have_left;
-
-    GST_DEBUG_OBJECT (play_base_bin, "probe got EOS in group %p", group);
-
-    GROUP_LOCK (play_base_bin);
-
-    /* mute this stream */
-    g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
-    if (info->type > 0 && info->type <= NUM_TYPES)
-      group->type[info->type - 1].done = TRUE;
-
-    /* see if we have some more groups left to play */
-    num_groups = g_list_length (play_base_bin->queued_groups);
-    if (play_base_bin->building_group)
-      num_groups++;
-    have_left = (num_groups > 1);
-
-    /* see if the complete group is muted */
-    if (!group_is_muted (group)) {
-      /* group is not completely muted, we remove the EOS event
-       * and continue, eventually the other streams will be EOSed and
-       * we can switch out this group. */
-      GST_DEBUG ("group %p not completely muted", group);
-
-      GROUP_UNLOCK (play_base_bin);
-
-      /* remove the EOS if we have something left */
-      return !have_left;
-    }
-
-    if (have_left) {
-      /* ok, get rid of the current group then */
-      //group_destroy (group);
-      /* removing the current group brings the next group
-       * active */
-      play_base_bin->queued_groups =
-          g_list_remove (play_base_bin->queued_groups, group);
-      /* and wait for the next one to be ready */
-      while (!play_base_bin->queued_groups) {
-        GROUP_WAIT (play_base_bin);
-      }
-      group = play_base_bin->queued_groups->data;
-
-      /* now activate the next one */
-      setup_substreams (play_base_bin);
-      GST_DEBUG ("switching to next group %p - emitting signal", group);
-      /* and signal the new group */
-      GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads
-          (play_base_bin, group);
-
-      GROUP_UNLOCK (play_base_bin);
-
-      g_object_notify (G_OBJECT (play_base_bin), "stream-info");
-
-      /* get rid of the EOS event */
-      return FALSE;
-    } else {
-      GROUP_UNLOCK (play_base_bin);
-      GST_LOG ("Last group done, EOS");
-    }
-  }
-
-  return TRUE;
-}
-
-/* This function will be called when the sinkpad of the preroll element
- * is unlinked, we have to connect something to the sinkpad or else the
- * state change will fail..
- */
-static void
-preroll_unlinked (GstPad * pad, GstPad * peerpad,
-    GstPlayBaseBin * play_base_bin)
-{
-  GstElement *fakesrc;
-  guint sig_id;
-  GstPad *srcpad;
-
-  /* make a fakesrc that will just emit one EOS */
-  fakesrc = gst_element_factory_make ("fakesrc", NULL);
-  g_object_set (G_OBJECT (fakesrc), "num-buffers", 0, NULL);
-
-  GST_DEBUG ("patching unlinked pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
-  srcpad = gst_element_get_static_pad (fakesrc, "src");
-  gst_bin_add (GST_BIN_CAST (play_base_bin), fakesrc);
-  gst_pad_link (srcpad, pad);
-  gst_object_unref (srcpad);
-
-  /* keep track of these patch elements */
-  g_object_set_data (G_OBJECT (pad), "fakesrc", fakesrc);
-
-  /* now unlink the unlinked signal so that it is not called again when
-   * we destroy the queue */
-  sig_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), "unlinked_id"));
-  if (sig_id != 0) {
-    g_signal_handler_disconnect (G_OBJECT (pad), sig_id);
-    g_object_set_data (G_OBJECT (pad), "unlinked_id", GINT_TO_POINTER (0));
-  }
-}
-
-/* Mute stream on first data - for header-is-in-stream-stuff
- * (vorbis, ogmtext). */
-static gboolean
-mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
-{
-  GstStreamInfo *info = GST_STREAM_INFO (data);
-  guint id;
-
-  GST_DEBUG ("mute stream triggered");
-
-  g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
-  id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
-  g_object_set_data (G_OBJECT (info), "mute_probe", NULL);
-  if (id > 0)
-    gst_pad_remove_buffer_probe (GST_PAD_CAST (info->object), id);
-
-  /* no data */
-  return FALSE;
-}
-
-/* Eat data. */
-static gboolean
-silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data)
-{
-  GST_DEBUG ("silence stream triggered");
-
-  /* no data */
-  return FALSE;
-}
-
-/* Called by the signal handlers when a decodebin (main or subtitle) has
- * found a new raw pad.  We create a preroll element if needed and the
- * appropriate streaminfo. Commits the group if there will be no more pads
- * from decodebin */
-static void
-new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last,
-    GstPlayBaseBin * play_base_bin, gboolean is_subs)
-{
-  GstStructure *structure;
-  const gchar *mimetype;
-  GstCaps *caps;
-  GstStreamInfo *info;
-  GstStreamType type = GST_STREAM_TYPE_UNKNOWN;
-  GstPad *sinkpad;
-  GstPlayBaseGroup *group;
-  guint sig;
-  GstObject *parent;
-  gboolean first_pad;
-
-  GST_DEBUG ("play base: new decoded pad. Last: %d", last);
-
-  /* first see if this pad has interesting caps */
-  caps = gst_pad_get_caps (pad);
-  if (caps == NULL || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
-    goto no_type;
-
-  /* get the mime type */
-  structure = gst_caps_get_structure (caps, 0);
-  mimetype = gst_structure_get_name (structure);
-
-  GROUP_LOCK (play_base_bin);
-
-  group = get_building_group (play_base_bin);
-
-  group->nstreams++;
-
-  parent = gst_object_get_parent (GST_OBJECT_CAST (element));
-  if (g_str_has_prefix (mimetype, "audio/") &&
-      parent != GST_OBJECT_CAST (play_base_bin->subtitle)) {
-    type = GST_STREAM_TYPE_AUDIO;
-  } else if (g_str_has_prefix (mimetype, "video/x-dvd-subpicture") &&
-      parent != GST_OBJECT_CAST (play_base_bin->subtitle)) {
-    type = GST_STREAM_TYPE_SUBPICTURE;
-  } else if (g_str_has_prefix (mimetype, "video/") &&
-      parent != GST_OBJECT_CAST (play_base_bin->subtitle)) {
-    type = GST_STREAM_TYPE_VIDEO;
-  } else if (g_str_has_prefix (mimetype, "text/")) {
-    type = GST_STREAM_TYPE_TEXT;
-  }
-  gst_object_unref (parent);
-
-  info = gst_stream_info_new (GST_OBJECT_CAST (pad), type, NULL, caps);
-  gst_caps_unref (caps);
-
-  if (type == GST_STREAM_TYPE_UNKNOWN) {
-    /* Unknown streams get added to the group, but the data
-     * just gets ignored */
-    add_stream (group, info);
-
-    GROUP_UNLOCK (play_base_bin);
-
-    /* signal the no more pads after adding the stream */
-    if (last)
-      no_more_pads_full (element, is_subs, play_base_bin);
-
-    return;
-  }
-
-  /* first pad of each type gets a selector + preroll queue */
-  first_pad = (group->type[type - 1].npads == 0);
-
-  if (first_pad) {
-    GST_DEBUG ("play base: pad needs new preroll");
-    gen_preroll_element (play_base_bin, group, type, pad, info);
-  }
-
-  /* add to stream selector */
-  sinkpad =
-      gst_element_get_request_pad (group->type[type - 1].selector, "sink%d");
-
-  /* make sure we catch unlink signals */
-  sig = g_signal_connect (G_OBJECT (sinkpad), "unlinked",
-      G_CALLBACK (preroll_unlinked), play_base_bin);
-  /* keep a ref to the signal id so that we can disconnect the signal callback */
-  g_object_set_data (G_OBJECT (sinkpad), "unlinked_id", GINT_TO_POINTER (sig));
-  /* Store a pointer to the stream selector pad for this stream */
-  g_object_set_data (G_OBJECT (pad), "pb_sel_pad", sinkpad);
-
-  gst_pad_link (pad, sinkpad);
-  gst_object_unref (sinkpad);
-
-  /* select 1st for now - we'll select a preferred one after preroll */
-  if (!first_pad) {
-    guint id;
-
-    GST_DEBUG ("Adding silence_stream data probe on type %d (npads %d)", type,
-        group->type[type - 1].npads);
-
-    id = gst_pad_add_data_probe (GST_PAD_CAST (pad),
-        G_CALLBACK (silence_stream), info);
-    g_object_set_data (G_OBJECT (pad), "eat_probe", GINT_TO_POINTER (id));
-  }
-
-  /* add the stream to the list */
-  add_stream (group, info);
-
-  GROUP_UNLOCK (play_base_bin);
-
-  /* signal the no more pads after adding the stream */
-  if (last)
-    no_more_pads_full (element, is_subs, play_base_bin);
-
-  return;
-
-  /* ERRORS */
-no_type:
-  {
-    g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-    if (caps)
-      gst_caps_unref (caps);
-    return;
-  }
-}
-
-static void
-new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
-    GstPlayBaseBin * play_base_bin)
-{
-  new_decoded_pad_full (element, pad, last, play_base_bin, FALSE);
-}
-
-static void
-subs_new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
-    GstPlayBaseBin * play_base_bin)
-{
-  new_decoded_pad_full (element, pad, last, play_base_bin, TRUE);
-}
-
-static void
-set_encoding_element (GstElement * element, gchar * encoding)
-{
-  GST_DEBUG_OBJECT (element, "setting encoding to %s", GST_STR_NULL (encoding));
-  g_object_set (G_OBJECT (element), "subtitle-encoding", encoding, NULL);
-}
-
-
-static void
-decodebin_element_added_cb (GstBin * decodebin, GstElement * element,
-    gpointer data)
-{
-  GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (data);
-  gchar *encoding;
-
-  if (!g_object_class_find_property (G_OBJECT_GET_CLASS (element),
-          "subtitle-encoding")) {
-    return;
-  }
-
-  g_mutex_lock (play_base_bin->sub_lock);
-  play_base_bin->subtitle_elements =
-      g_slist_append (play_base_bin->subtitle_elements, element);
-  encoding = g_strdup (play_base_bin->subencoding);
-  g_mutex_unlock (play_base_bin->sub_lock);
-
-  set_encoding_element (element, encoding);
-  g_free (encoding);
-}
-
-static void
-decodebin_element_removed_cb (GstBin * decodebin, GstElement * element,
-    gpointer data)
-{
-  GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (data);
-
-  g_mutex_lock (play_base_bin->sub_lock);
-  play_base_bin->subtitle_elements =
-      g_slist_remove (play_base_bin->subtitle_elements, element);
-  g_mutex_unlock (play_base_bin->sub_lock);
-}
-
-
-/*
- * Generate source ! subparse bins.
- */
-
-static GstElement *
-setup_subtitle (GstPlayBaseBin * play_base_bin, gchar * sub_uri)
-{
-  GstElement *source, *subdecodebin, *subbin;
-
-  if (!gst_uri_is_valid (sub_uri))
-    goto invalid_uri;
-
-  source = gst_element_make_from_uri (GST_URI_SRC, sub_uri, NULL);
-  if (!source)
-    goto unknown_uri;
-
-  if (g_getenv ("USE_DECODEBIN2"))
-    subdecodebin = gst_element_factory_make ("decodebin2", "subtitle-decoder");
-  else
-    subdecodebin = gst_element_factory_make ("decodebin", "subtitle-decoder");
-  g_signal_connect (subdecodebin, "element-added",
-      G_CALLBACK (decodebin_element_added_cb), play_base_bin);
-  g_signal_connect (subdecodebin, "element-removed",
-      G_CALLBACK (decodebin_element_removed_cb), play_base_bin);
-  subbin = gst_bin_new ("subtitle-bin");
-  gst_bin_add_many (GST_BIN_CAST (subbin), source, subdecodebin, NULL);
-
-  gst_element_link (source, subdecodebin);
-
-  /* return the subtitle GstElement object */
-  return subbin;
-
-  /* WARNINGS */
-invalid_uri:
-  {
-    GST_ELEMENT_WARNING (play_base_bin, RESOURCE, NOT_FOUND,
-        (_("Invalid subtitle URI \"%s\", subtitles disabled."), sub_uri),
-        (NULL));
-    return NULL;
-  }
-unknown_uri:
-  {
-    gchar *prot = gst_uri_get_protocol (sub_uri);
-
-    if (prot) {
-      gchar *desc;
-
-      gst_element_post_message (GST_ELEMENT (play_base_bin),
-          gst_missing_uri_source_message_new (GST_ELEMENT (play_base_bin),
-              prot));
-
-      desc = gst_pb_utils_get_source_description (prot);
-      GST_ELEMENT_ERROR (play_base_bin, CORE, MISSING_PLUGIN,
-          (_("A %s plugin is required to play this stream, but not installed."),
-              desc), ("No URI handler to handle sub_uri: %s", sub_uri));
-      g_free (desc);
-      g_free (prot);
-    } else
-      goto invalid_uri;
-
-    return NULL;
-  }
-}
-
-/* helper function to lookup stuff in lists */
-static gboolean
-array_has_value (const gchar * values[], const gchar * value)
-{
-  gint i;
-
-  for (i = 0; values[i]; i++) {
-    if (g_str_has_prefix (value, values[i]))
-      return TRUE;
-  }
-  return FALSE;
-}
-
-/* list of URIs that we consider to be streams and that need buffering.
- * We have no mechanism yet to figure this out with a query. */
-static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://",
-  "mmsu://", "mmst://", "myth://", NULL
-};
-
-/* blacklisted URIs, we know they will always fail. */
-static const gchar *blacklisted_uris[] = { NULL };
-
-/* mime types that we don't consider to be media types */
-static const gchar *no_media_mimes[] = {
-  "application/x-executable", "application/x-bzip", "application/x-gzip",
-  "application/zip", "application/x-compress", NULL
-};
-
-/* mime types we consider raw media */
-static const gchar *raw_mimes[] = {
-  "audio/x-raw", "video/x-raw", "video/x-dvd-subpicture", NULL
-};
-
-#define IS_STREAM_URI(uri)          (array_has_value (stream_uris, uri))
-#define IS_BLACKLISTED_URI(uri)     (array_has_value (blacklisted_uris, uri))
-#define IS_NO_MEDIA_MIME(mime)      (array_has_value (no_media_mimes, mime))
-#define IS_RAW_MIME(mime)           (array_has_value (raw_mimes, mime))
-
-/*
- * Generate and configure a source element.
- */
-static GstElement *
-gen_source_element (GstPlayBaseBin * play_base_bin, GstElement ** subbin)
-{
-  GstElement *source;
-
-  if (!play_base_bin->uri)
-    goto no_uri;
-
-  if (!gst_uri_is_valid (play_base_bin->uri))
-    goto invalid_uri;
-
-  if (IS_BLACKLISTED_URI (play_base_bin->uri))
-    goto uri_blacklisted;
-
-  if (play_base_bin->suburi) {
-    GST_LOG_OBJECT (play_base_bin, "Creating decoder for subtitles URI %s",
-        play_base_bin->suburi);
-    /* subtitle specified */
-    *subbin = setup_subtitle (play_base_bin, play_base_bin->suburi);
-  } else {
-    /* no subtitle specified */
-    *subbin = NULL;
-  }
-
-  source = gst_element_make_from_uri (GST_URI_SRC, play_base_bin->uri,
-      "source");
-  if (!source)
-    goto no_source;
-
-  play_base_bin->is_stream = IS_STREAM_URI (play_base_bin->uri);
-
-  /* make HTTP sources send extra headers so we get icecast
-   * metadata in case the stream is an icecast stream */
-  if (!strncmp (play_base_bin->uri, "http://", 7) &&
-      g_object_class_find_property (G_OBJECT_GET_CLASS (source),
-          "iradio-mode")) {
-    g_object_set (source, "iradio-mode", TRUE, NULL);
-  }
-
-  if (g_object_class_find_property (G_OBJECT_GET_CLASS (source),
-          "connection-speed")) {
-    GST_DEBUG_OBJECT (play_base_bin,
-        "setting connection-speed=%d to source element",
-        play_base_bin->connection_speed / 1000);
-    g_object_set (source, "connection-speed",
-        play_base_bin->connection_speed / 1000, NULL);
-  }
-
-  return source;
-
-  /* ERRORS */
-no_uri:
-  {
-    GST_ELEMENT_ERROR (play_base_bin, RESOURCE, NOT_FOUND,
-        (_("No URI specified to play from.")), (NULL));
-    return NULL;
-  }
-invalid_uri:
-  {
-    GST_ELEMENT_ERROR (play_base_bin, RESOURCE, NOT_FOUND,
-        (_("Invalid URI \"%s\"."), play_base_bin->uri), (NULL));
-    return NULL;
-  }
-uri_blacklisted:
-  {
-    GST_ELEMENT_ERROR (play_base_bin, RESOURCE, FAILED,
-        (_("RTSP streams cannot be played yet.")), (NULL));
-    return NULL;
-  }
-no_source:
-  {
-    gchar *prot = gst_uri_get_protocol (play_base_bin->uri);
-
-    /* whoops, could not create the source element, dig a little deeper to
-     * figure out what might be wrong. */
-    if (prot) {
-      gchar *desc;
-
-      gst_element_post_message (GST_ELEMENT (play_base_bin),
-          gst_missing_uri_source_message_new (GST_ELEMENT (play_base_bin),
-              prot));
-
-      desc = gst_pb_utils_get_source_description (prot);
-      GST_ELEMENT_ERROR (play_base_bin, CORE, MISSING_PLUGIN,
-          (_("A %s plugin is required to play this stream, but not installed."),
-              desc), ("No URI handler for %s", prot));
-      g_free (desc);
-      g_free (prot);
-    } else
-      goto invalid_uri;
-
-    return NULL;
-  }
-}
-
-/* is called when a dynamic source element created a new pad. */
-static void
-source_new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin)
-{
-  GstElement *decoder;
-  gboolean is_raw;
-
-  GST_DEBUG_OBJECT (bin, "Found new pad %s.%s in source element %s",
-      GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element));
-
-  /* if this is a pad with all raw caps, we can expose it */
-  if (has_all_raw_caps (pad, &is_raw) && is_raw) {
-    bin->raw_decoding_mode = TRUE;
-    /* it's all raw, create output pads. */
-    new_decoded_pad_full (element, pad, FALSE, bin, FALSE);
-    return;
-  }
-
-  /* not raw, create decoder */
-  decoder = make_decoder (bin);
-  if (!decoder)
-    goto no_decodebin;
-
-  /* and link to decoder */
-  if (!gst_element_link (bin->source, decoder))
-    goto could_not_link;
-
-  gst_element_set_state (decoder, GST_STATE_PAUSED);
-
-  return;
-
-  /* ERRORS */
-no_decodebin:
-  {
-    /* error was posted */
-    return;
-  }
-could_not_link:
-  {
-    GST_ELEMENT_ERROR (bin, CORE, NEGOTIATION,
-        (NULL), ("Can't link source to decoder element"));
-    return;
-  }
-}
-
-/*
- * Setup the substreams (is called right after group_commit () when
- * loading a new group, or after switching groups).
- *
- * Should be called with group-lock held.
- */
-static void
-setup_substreams (GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group;
-  gint n;
-  const GList *item;
-
-  GST_DEBUG_OBJECT (play_base_bin, "setting up substreams");
-
-  /* Remove the eat probes */
-  group = get_active_group (play_base_bin);
-  for (item = group->streaminfo; item; item = item->next) {
-    GstStreamInfo *info = item->data;
-    gpointer data;
-
-    data = g_object_get_data (G_OBJECT (info->object), "eat_probe");
-    if (data) {
-      gst_pad_remove_data_probe (GST_PAD_CAST (info->object),
-          GPOINTER_TO_INT (data));
-      g_object_set_data (G_OBJECT (info->object), "eat_probe", NULL);
-    }
-
-    /* now remove unknown pads */
-    if (info->type == GST_STREAM_TYPE_UNKNOWN) {
-      guint id;
-
-      id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
-      if (id == 0) {
-        id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
-            G_CALLBACK (mute_stream), info);
-        g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
-      }
-    }
-  }
-
-  /* now check if the requested current streams exist. If
-   * current >= num_streams, decrease current so at least
-   * we have output. Always keep it enabled. */
-  for (n = 0; n < NUM_TYPES; n++) {
-    if (play_base_bin->current[n] >= group->type[n].npads) {
-      GST_DEBUG_OBJECT (play_base_bin, "reset type %d to current 0", n);
-      play_base_bin->current[n] = 0;
-    }
-  }
-
-  /* now activate the right sources. Don't forget that during preroll,
-   * we set the first source to forwarding and ignored the rest. */
-  for (n = 0; n < NUM_TYPES; n++) {
-    GST_DEBUG_OBJECT (play_base_bin, "setting type %d to current %d", n,
-        play_base_bin->current[n]);
-    set_active_source (play_base_bin, n + 1, play_base_bin->current[n]);
-  }
-}
-
-/**
- * has_all_raw_caps:
- * @pad: a #GstPad
- * @all_raw: pointer to hold the result
- *
- * check if the caps of the pad are all raw. The caps are all raw if
- * all of its structures contain audio/x-raw or video/x-raw.
- *
- * Returns: %FALSE @pad has no caps. Else TRUE and @all_raw set t the result.
- */
-static gboolean
-has_all_raw_caps (GstPad * pad, gboolean * all_raw)
-{
-  GstCaps *caps;
-  gint capssize;
-  guint i, num_raw = 0;
-  gboolean res = FALSE;
-
-  caps = gst_pad_get_caps (pad);
-  if (caps == NULL)
-    return FALSE;
-
-  capssize = gst_caps_get_size (caps);
-  /* no caps, skip and move to the next pad */
-  if (capssize == 0 || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
-    goto done;
-
-  /* count the number of raw formats in the caps */
-  for (i = 0; i < capssize; ++i) {
-    GstStructure *s;
-    const gchar *mime_type;
-
-    s = gst_caps_get_structure (caps, i);
-    mime_type = gst_structure_get_name (s);
-
-    if (IS_RAW_MIME (mime_type))
-      ++num_raw;
-  }
-
-  *all_raw = (num_raw == capssize);
-  res = TRUE;
-
-done:
-  gst_caps_unref (caps);
-  return res;
-}
-
-/**
- * analyse_source:
- * @play_base_bin: a #GstPlayBaseBin
- * @is_raw: are all pads raw data
- * @have_out: does the source have output
- * @is_dynamic: is this a dynamic source
- *
- * Check the source of @play_base_bin and collect information about it.
- *
- * @is_raw will be set to TRUE if the source only produces raw pads. When this
- * function returns, all of the raw pad of the source will be added
- * to @play_base_bin.
- *
- * @have_out: will be set to TRUE if the source has output pads.
- *
- * @is_dynamic: TRUE if the element will create (more) pads dynamically later
- * on.
- *
- * Returns: FALSE if a fatal error occured while scanning.
- */
-static gboolean
-analyse_source (GstPlayBaseBin * play_base_bin, gboolean * is_raw,
-    gboolean * have_out, gboolean * is_dynamic)
-{
-  GstIterator *pads_iter;
-  gboolean done = FALSE;
-  gboolean res = TRUE;
-
-  *have_out = FALSE;
-  *is_raw = FALSE;
-  *is_dynamic = FALSE;
-
-  pads_iter = gst_element_iterate_src_pads (play_base_bin->source);
-  while (!done) {
-    GstPad *pad = NULL;
-
-    switch (gst_iterator_next (pads_iter, (gpointer) & pad)) {
-      case GST_ITERATOR_ERROR:
-        res = FALSE;
-        /* FALLTROUGH */
-      case GST_ITERATOR_DONE:
-        done = TRUE;
-        break;
-      case GST_ITERATOR_RESYNC:
-        /* reset results and resync */
-        *have_out = FALSE;
-        *is_raw = FALSE;
-        *is_dynamic = FALSE;
-        gst_iterator_resync (pads_iter);
-        break;
-      case GST_ITERATOR_OK:
-        /* we now officially have an ouput pad */
-        *have_out = TRUE;
-
-        /* if FALSE, this pad has no caps and we continue with the next pad. */
-        if (!has_all_raw_caps (pad, is_raw)) {
-          gst_object_unref (pad);
-          break;
-        }
-
-        /* caps on source pad are all raw, we can add the pad */
-        if (*is_raw) {
-          new_decoded_pad_full (play_base_bin->source, pad, FALSE,
-              play_base_bin, FALSE);
-        }
-
-        gst_object_unref (pad);
-        break;
-    }
-  }
-  gst_iterator_free (pads_iter);
-
-  if (!*have_out) {
-    GstElementClass *elemclass;
-    GList *walk;
-
-    /* element has no output pads, check for padtemplates that list SOMETIMES
-     * pads. */
-    elemclass = GST_ELEMENT_GET_CLASS (play_base_bin->source);
-
-    walk = gst_element_class_get_pad_template_list (elemclass);
-    while (walk != NULL) {
-      GstPadTemplate *templ;
-
-      templ = (GstPadTemplate *) walk->data;
-      if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) {
-        if (GST_PAD_TEMPLATE_PRESENCE (templ) == GST_PAD_SOMETIMES) {
-          *is_dynamic = TRUE;
-          break;                /* only break out if we found a sometimes src pad
-                                   continue walking through if say a request src pad is found
-                                   elements such as mpegtsparse and dvbbasebin have request
-                                   and sometimes src pads */
-        }
-      }
-      walk = g_list_next (walk);
-    }
-  }
-
-  return res;
-}
-
-static void
-remove_decoders (GstPlayBaseBin * bin)
-{
-  GSList *walk;
-
-  for (walk = bin->decoders; walk; walk = g_slist_next (walk)) {
-    GstElement *decoder = GST_ELEMENT_CAST (walk->data);
-
-    GST_DEBUG_OBJECT (bin, "removing old decoder element");
-    /* Disconnect all the signal handlers we attached to the decodebin before
-     * we dispose of it */
-    g_signal_handlers_disconnect_by_func (decoder,
-        (gpointer) (decodebin_element_added_cb), bin);
-    g_signal_handlers_disconnect_by_func (decoder,
-        (gpointer) (decodebin_element_removed_cb), bin);
-    g_signal_handlers_disconnect_by_func (decoder,
-        (gpointer) (new_decoded_pad), bin);
-    g_signal_handlers_disconnect_by_func (decoder,
-        (gpointer) (no_more_pads), bin);
-    g_signal_handlers_disconnect_by_func (decoder,
-        (gpointer) (unknown_type), bin);
-
-    gst_element_set_state (decoder, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (bin), decoder);
-  }
-  g_slist_free (bin->decoders);
-  bin->decoders = NULL;
-}
-
-static GstElement *
-make_decoder (GstPlayBaseBin * play_base_bin)
-{
-  GstElement *decoder;
-
-  /* now create the decoder element */
-  if (g_getenv ("USE_DECODEBIN2"))
-    decoder = gst_element_factory_make ("decodebin2", NULL);
-  else
-    decoder = gst_element_factory_make ("decodebin", NULL);
-  if (!decoder)
-    goto no_decodebin;
-
-  g_signal_connect (decoder, "element-added",
-      G_CALLBACK (decodebin_element_added_cb), play_base_bin);
-  g_signal_connect (decoder, "element-removed",
-      G_CALLBACK (decodebin_element_removed_cb), play_base_bin);
-
-  gst_bin_add (GST_BIN_CAST (play_base_bin), decoder);
-
-  /* set up callbacks to create the links between decoded data
-   * and video/audio/subtitle rendering/output. */
-  g_signal_connect (G_OBJECT (decoder),
-      "new-decoded-pad", G_CALLBACK (new_decoded_pad), play_base_bin);
-  g_signal_connect (G_OBJECT (decoder), "no-more-pads",
-      G_CALLBACK (no_more_pads), play_base_bin);
-  g_signal_connect (G_OBJECT (decoder),
-      "unknown-type", G_CALLBACK (unknown_type), play_base_bin);
-  g_object_set_data (G_OBJECT (decoder), "pending", GINT_TO_POINTER (1));
-  play_base_bin->pending++;
-
-  GST_DEBUG_OBJECT (play_base_bin, "created decodebin, %d pending",
-      play_base_bin->pending);
-
-  play_base_bin->decoders = g_slist_prepend (play_base_bin->decoders, decoder);
-
-  return decoder;
-
-  /* ERRORS */
-no_decodebin:
-  {
-    GST_ELEMENT_ERROR (play_base_bin, CORE, MISSING_PLUGIN,
-        (_("Could not create \"decodebin\" element.")), (NULL));
-    return NULL;
-  }
-}
-
-static void
-remove_source (GstPlayBaseBin * bin)
-{
-  GstElement *source = bin->source;
-
-  if (source) {
-    GST_DEBUG_OBJECT (bin, "removing old src element");
-    gst_element_set_state (source, GST_STATE_NULL);
-
-    if (bin->src_np_sig_id) {
-      g_signal_handler_disconnect (G_OBJECT (source), bin->src_np_sig_id);
-      bin->src_np_sig_id = 0;
-    }
-    if (bin->src_nmp_sig_id) {
-      g_signal_handler_disconnect (G_OBJECT (source), bin->src_nmp_sig_id);
-      bin->src_nmp_sig_id = 0;
-    }
-    gst_bin_remove (GST_BIN_CAST (bin), source);
-    bin->source = NULL;
-  }
-}
-
-static GstBusSyncReply
-subbin_startup_sync_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
-{
-  if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
-    GstPlayBaseBin *play_base_bin;
-
-    play_base_bin = GST_PLAY_BASE_BIN (user_data);
-    if (!play_base_bin->subtitle_done) {
-      GST_WARNING_OBJECT (play_base_bin, "error starting up subtitle bin: %"
-          GST_PTR_FORMAT, msg);
-      play_base_bin->subtitle_done = TRUE;
-      GST_DEBUG_OBJECT (play_base_bin, "signal group done");
-      GROUP_SIGNAL (play_base_bin);
-      GST_DEBUG_OBJECT (play_base_bin, "signaled group done");
-    }
-  }
-  return GST_BUS_PASS;
-}
-
-/* construct and run the source and decoder elements until we found
- * all the streams or until a preroll queue has been filled.
-*/
-static gboolean
-setup_source (GstPlayBaseBin * play_base_bin)
-{
-  GstElement *subbin = NULL;
-  gboolean is_raw, have_out, is_dynamic;
-
-  if (!play_base_bin->need_rebuild)
-    return TRUE;
-  play_base_bin->raw_decoding_mode = FALSE;
-
-  GST_DEBUG_OBJECT (play_base_bin, "setup source");
-
-  /* delete old src */
-  remove_source (play_base_bin);
-
-  /* create and configure an element that can handle the uri */
-  if (!(play_base_bin->source = gen_source_element (play_base_bin, &subbin)))
-    goto no_source;
-
-  /* state will be merged later - if file is not found, error will be
-   * handled by the application right after. */
-  gst_bin_add (GST_BIN_CAST (play_base_bin), play_base_bin->source);
-  g_object_notify (G_OBJECT (play_base_bin), "source");
-
-  /* remove the old decoders now, if any */
-  remove_decoders (play_base_bin);
-
-  /* remove our previous preroll queues */
-  remove_groups (play_base_bin);
-
-  /* clear pending dynamic elements */
-  play_base_bin->pending = 0;
-
-  /* do subs */
-  if (subbin) {
-    GstElement *db;
-    GstBus *bus;
-
-    play_base_bin->subtitle = subbin;
-    db = gst_bin_get_by_name (GST_BIN_CAST (subbin), "subtitle-decoder");
-
-    /* do type detection, without adding (so no preroll) */
-    g_signal_connect (G_OBJECT (db), "new-decoded-pad",
-        G_CALLBACK (subs_new_decoded_pad), play_base_bin);
-    g_signal_connect (G_OBJECT (db), "no-more-pads",
-        G_CALLBACK (sub_no_more_pads), play_base_bin);
-    g_signal_connect (G_OBJECT (db), "unknown-type",
-        G_CALLBACK (unknown_type), play_base_bin);
-    g_object_set_data (G_OBJECT (db), "pending", GINT_TO_POINTER (1));
-    play_base_bin->pending++;
-
-    GST_DEBUG_OBJECT (play_base_bin, "we have subtitles, %d pending",
-        play_base_bin->pending);
-
-    if (!play_base_bin->is_stream) {
-      GstStateChangeReturn sret;
-
-      /* either when the queues are filled or when the decoder element
-       * has no more dynamic streams, the cond is unlocked. We can remove
-       * the signal handlers then
-       */
-      GST_DEBUG_OBJECT (play_base_bin, "starting subtitle bin");
-
-      /* for subtitles in a separate bin we will not commit the
-       * current building group since we need to add the other
-       * audio/video streams to the group. We check if we managed
-       * to commit the subtitle group using an extra flag. */
-      play_base_bin->subtitle_done = FALSE;
-
-      /* since subbin is still a stand-alone bin, we need to add a custom bus
-       * to intercept error messages, so we can stop waiting and continue */
-      bus = gst_bus_new ();
-      gst_element_set_bus (subbin, bus);
-      gst_bus_set_sync_handler (bus, subbin_startup_sync_msg, play_base_bin);
-
-      sret = gst_element_set_state (subbin, GST_STATE_PAUSED);
-      if (sret != GST_STATE_CHANGE_FAILURE) {
-        GROUP_LOCK (play_base_bin);
-        GST_DEBUG ("waiting for subtitle to complete...");
-        while (!play_base_bin->subtitle_done)
-          GROUP_WAIT (play_base_bin);
-        GST_DEBUG ("group done !");
-        GROUP_UNLOCK (play_base_bin);
-
-        if (!play_base_bin->building_group ||
-            play_base_bin->building_group->type[GST_STREAM_TYPE_TEXT -
-                1].npads == 0) {
-
-          GST_DEBUG ("No subtitle found - ignoring");
-          gst_element_set_state (subbin, GST_STATE_NULL);
-          gst_object_unref (play_base_bin->subtitle);
-          play_base_bin->subtitle = NULL;
-        } else {
-          GST_DEBUG_OBJECT (play_base_bin, "Subtitle set-up successful");
-        }
-      } else {
-        GST_WARNING_OBJECT (play_base_bin, "Failed to start subtitle bin");
-        gst_element_set_state (subbin, GST_STATE_NULL);
-        gst_object_unref (play_base_bin->subtitle);
-        play_base_bin->subtitle = NULL;
-      }
-
-      gst_bus_set_sync_handler (bus, NULL, NULL);
-      gst_element_set_bus (subbin, NULL);
-      gst_object_unref (bus);
-    }
-    gst_object_unref (db);
-  }
-  /* see if the source element emits raw audio/video all by itself,
-   * if so, we can create streams for the pads and be done with it.
-   * Also check that is has source pads, if not, we assume it will
-   * do everything itself.  */
-  if (!analyse_source (play_base_bin, &is_raw, &have_out, &is_dynamic))
-    goto invalid_source;
-
-  if (is_raw) {
-    GST_DEBUG_OBJECT (play_base_bin, "Source provides all raw data");
-    /* source provides raw data, we added the pads and we can now signal a
-     * no_more pads because we are done. */
-    group_commit (play_base_bin, play_base_bin->is_stream, FALSE);
-    return TRUE;
-  }
-  if (!have_out && !is_dynamic) {
-    GST_DEBUG_OBJECT (play_base_bin, "Source has no output pads");
-    /* create a stream to indicate that this uri is handled by a self
-     * contained element. We are now done. */
-    add_element_stream (play_base_bin->source, play_base_bin);
-    group_commit (play_base_bin, play_base_bin->is_stream, FALSE);
-    return TRUE;
-  }
-  if (is_dynamic) {
-    /* connect a handler for the new-pad signal */
-    play_base_bin->src_np_sig_id =
-        g_signal_connect (G_OBJECT (play_base_bin->source), "pad-added",
-        G_CALLBACK (source_new_pad), play_base_bin);
-    play_base_bin->src_nmp_sig_id =
-        g_signal_connect (G_OBJECT (play_base_bin->source), "no-more-pads",
-        G_CALLBACK (source_no_more_pads), play_base_bin);
-    g_object_set_data (G_OBJECT (play_base_bin->source), "pending",
-        GINT_TO_POINTER (1));
-    play_base_bin->pending++;
-    GST_DEBUG_OBJECT (play_base_bin,
-        "Source has dynamic output pads, %d pending", play_base_bin->pending);
-  } else {
-    GstElement *decoder;
-
-    /* no dynamic source, we can link now */
-    decoder = make_decoder (play_base_bin);
-    if (!decoder)
-      goto no_decodebin;
-
-    if (!gst_element_link (play_base_bin->source, decoder))
-      goto could_not_link;
-  }
-
-  if (play_base_bin->subtitle)
-    gst_bin_add (GST_BIN_CAST (play_base_bin), play_base_bin->subtitle);
-
-  play_base_bin->need_rebuild = FALSE;
-
-  return TRUE;
-
-  /* ERRORS */
-no_source:
-  {
-    /* error message was already posted */
-    return FALSE;
-  }
-invalid_source:
-  {
-    GST_ELEMENT_ERROR (play_base_bin, CORE, FAILED,
-        (_("Source element is invalid.")), (NULL));
-    return FALSE;
-  }
-no_decodebin:
-  {
-    /* message was posted */
-    return FALSE;
-  }
-could_not_link:
-  {
-    GST_ELEMENT_ERROR (play_base_bin, CORE, NEGOTIATION,
-        (NULL), ("Can't link source to decoder element"));
-    return FALSE;
-  }
-}
-
-static void
-finish_source (GstPlayBaseBin * play_base_bin)
-{
-  /* FIXME: no need to grab the group lock here? (tpm) */
-  if (get_active_group (play_base_bin) != NULL) {
-    if (play_base_bin->subtitle) {
-      /* make subs iterate from now on */
-      gst_bin_add (GST_BIN_CAST (play_base_bin), play_base_bin->subtitle);
-    }
-  }
-}
-
-/*
- * Caller must have group-lock held.
- *
- * We iterate over all detected streams in the streaminfo and try to find
- * impossible cases, like subtitles without video.
- */
-static gboolean
-prepare_output (GstPlayBaseBin * play_base_bin)
-{
-  const GList *item;
-  gboolean stream_found = FALSE, no_media = FALSE;
-  gboolean got_video = FALSE, got_subtitle = FALSE;
-  GstPlayBaseGroup *group;
-
-  group = get_active_group (play_base_bin);
-
-  /* check if we found any supported stream... if not, then
-   * we detected stream type (or the above would've failed),
-   * but linking/decoding failed - plugin probably missing. */
-  for (item = group ? group->streaminfo : NULL; item != NULL; item = item->next) {
-    GstStreamInfo *info = GST_STREAM_INFO (item->data);
-
-    if (info->type == GST_STREAM_TYPE_VIDEO) {
-      stream_found = TRUE;
-      got_video = TRUE;
-      break;
-    } else if (info->type == GST_STREAM_TYPE_ELEMENT) {
-      stream_found = TRUE;
-    } else if (info->type == GST_STREAM_TYPE_AUDIO) {
-      stream_found = TRUE;
-    } else if (info->type == GST_STREAM_TYPE_TEXT ||
-        info->type == GST_STREAM_TYPE_SUBPICTURE) {
-      got_subtitle = TRUE;
-    } else if (!item->prev && !item->next) {
-      /* We're no audio/video and the only stream... We could
-       * be something not-media that's detected because then our
-       * typefind doesn't mess up with mp3 (bz2, gz, elf, ...) */
-      if (info->caps && !gst_caps_is_empty (info->caps)) {
-        const gchar *mime =
-            gst_structure_get_name (gst_caps_get_structure (info->caps, 0));
-
-        no_media = IS_NO_MEDIA_MIME (mime);
-      }
-    }
-  }
-
-  if (!stream_found) {
-    if (got_subtitle) {
-      GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE,
-          (_("Only a subtitle stream was detected. "
-                  "Either you are loading a subtitle file or some other type of "
-                  "text file, or the media file was not recognized.")), (NULL));
-    } else if (!no_media) {
-      GST_ELEMENT_ERROR (play_base_bin, STREAM, CODEC_NOT_FOUND,
-          (_("You do not have a decoder installed to handle this file. "
-                  "You might need to install the necessary plugins.")), (NULL));
-    } else {
-      GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE,
-          (_("This is not a media file")), (NULL));
-    }
-    return FALSE;
-  } else if (got_subtitle && !got_video) {
-    GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE,
-        (_("A subtitle stream was detected, but no video stream.")), (NULL));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-/*
- * Multi-stream management. -1 = none.
- *
- * Caller has group-lock held.
- */
-static gint
-get_active_source (GstPlayBaseBin * play_base_bin, GstStreamType type)
-{
-  GstPlayBaseGroup *group;
-  GList *s;
-  gint num = 0;
-
-  group = get_active_group (play_base_bin);
-  if (!group)
-    return -1;
-
-  for (s = group->streaminfo; s; s = s->next) {
-    GstStreamInfo *info = s->data;
-
-    if (info->type == type) {
-      if (!info->mute && !g_object_get_data (G_OBJECT (info), "mute_probe")) {
-        return num;
-      } else {
-        num++;
-      }
-    }
-  }
-
-  return -1;
-}
-
-/* Kill pad reactivation on state change. */
-
-#if 0
-static void muted_group_change_state (GstElement * element,
-    gint old_state, gint new_state, gpointer data);
-#endif
-
-static void
-mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute)
-{
-  gboolean active = !mute;
-  GstPad *pad;
-
-  pad = gst_element_get_static_pad (group->type[type - 1].preroll, "src");
-  gst_pad_set_active (pad, active);
-  gst_object_unref (pad);
-  pad = gst_element_get_static_pad (group->type[type - 1].preroll, "sink");
-  gst_pad_set_active (pad, active);
-  gst_object_unref (pad);
-  pad = gst_element_get_static_pad (group->type[type - 1].selector, "src");
-  gst_pad_set_active (pad, active);
-  gst_object_unref (pad);
-
-#if 0
-  if (mute) {
-    g_signal_connect (group->type[type - 1].preroll, "state-changed",
-        G_CALLBACK (muted_group_change_state), group);
-  } else {
-    g_signal_handlers_disconnect_by_func (group->type[type - 1].preroll,
-        G_CALLBACK (muted_group_change_state), group);
-  }
-#endif
-}
-
-#if 0
-static void
-muted_group_change_state (GstElement * element,
-    gint old_state, gint new_state, gpointer data)
-{
-  GstPlayBaseGroup *group = data;
-
-  GROUP_LOCK (group->bin);
-
-  if (new_state == GST_STATE_PLAYING) {
-    gint n;
-
-    for (n = 0; n < NUM_TYPES; n++) {
-      if (group->type[n].selector == element) {
-        mute_group_type (group, n + 1, TRUE);
-      }
-    }
-  }
-
-  GROUP_UNLOCK (group->bin);
-}
-#endif
-
-static void
-set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
-{
-  GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin);
-
-  /* we use a vfunc for this since we don't have a reference to the
-   * textoverlay element, but playbin does */
-  if (klass != NULL && klass->set_subtitles_visible != NULL)
-    klass->set_subtitles_visible (play_base_bin, visible);
-}
-
-static void
-set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute)
-{
-  GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin);
-
-  /* we use a vfunc for this since we don't have a reference to the
-   * textoverlay element, but playbin does */
-  if (klass != NULL && klass->set_audio_mute != NULL)
-    klass->set_audio_mute (play_base_bin, mute);
-}
-
-/*
- * Caller has group-lock held.
- */
-
-static void
-set_active_source (GstPlayBaseBin * play_base_bin,
-    GstStreamType type, gint source_num)
-{
-  GstPlayBaseGroup *group;
-  GList *s;
-  gint num = 0;
-  gboolean have_active = FALSE;
-  GstElement *sel;
-
-  GST_LOG ("Changing active source of type %d to %d", type, source_num);
-  play_base_bin->current[type - 1] = source_num;
-
-  group = get_active_group (play_base_bin);
-  if (!group || !group->type[type - 1].preroll) {
-    GST_LOG ("No active group, or group for type %d has no preroll", type);
-    return;
-  }
-
-  /* HACK: instead of unlinking the subtitle input (= lots of hassle,
-   * especially if subtitles come from an external source), just tell
-   * textoverlay not to render them */
-  if (type == GST_STREAM_TYPE_TEXT) {
-    gboolean visible = (source_num != -1);
-
-    set_subtitles_visible (play_base_bin, visible);
-    if (!visible)
-      return;
-  } else if (type == GST_STREAM_TYPE_AUDIO) {
-    gboolean mute = (source_num == -1);
-
-    set_audio_mute (play_base_bin, mute);
-
-    if (mute)
-      return;
-  }
-
-  sel = group->type[type - 1].selector;
-
-  for (s = group->streaminfo; s; s = s->next) {
-    GstStreamInfo *info = s->data;
-
-    if (info->type == type) {
-      if (num == source_num) {
-        GstPad *sel_pad;
-
-        GST_LOG ("Unmuting (if already muted) source %d of type %d", source_num,
-            type);
-        g_object_set (info, "mute", FALSE, NULL);
-
-        /* Tell the stream selector which pad to accept */
-        sel_pad = GST_PAD_CAST (g_object_get_data (G_OBJECT (info->object),
-                "pb_sel_pad"));
-
-        if (sel && sel_pad != NULL) {
-          g_object_set (G_OBJECT (sel), "active-pad", sel_pad, NULL);
-        }
-
-        have_active = TRUE;
-      } else {
-        guint id;
-
-        GST_LOG_OBJECT (info->object, "Muting source %d of type %d", num, type);
-
-        id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
-            G_CALLBACK (mute_stream), info);
-        g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
-      }
-      num++;
-    }
-  }
-
-  if (!have_active) {
-    GST_LOG ("Muting group type: %d", type);
-    g_object_set (sel, "active-pad", NULL, NULL);
-  } else {
-    GST_LOG ("Unmuting group type: %d", type);
-  }
-  mute_group_type (group, type, !have_active);
-}
-
-static void
-gst_play_base_bin_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstPlayBaseBin *play_base_bin;
-
-  g_return_if_fail (GST_IS_PLAY_BASE_BIN (object));
-
-  play_base_bin = GST_PLAY_BASE_BIN (object);
-
-  switch (prop_id) {
-    case ARG_URI:
-    {
-      const gchar *uri = g_value_get_string (value);
-
-      if (uri == NULL) {
-        g_warning ("cannot set NULL uri");
-        return;
-      }
-      /* if we have no previous uri, or the new uri is different from the
-       * old one, replug */
-      if (play_base_bin->uri == NULL || strcmp (play_base_bin->uri, uri) != 0) {
-        g_free (play_base_bin->uri);
-        play_base_bin->uri = g_strdup (uri);
-
-        GST_DEBUG ("setting new uri to %s", uri);
-
-        play_base_bin->need_rebuild = TRUE;
-      }
-      break;
-    }
-    case ARG_SUBURI:{
-      const gchar *suburi = g_value_get_string (value);
-
-      if ((!suburi && !play_base_bin->suburi) ||
-          (suburi && play_base_bin->suburi &&
-              !strcmp (play_base_bin->suburi, suburi)))
-        return;
-      g_free (play_base_bin->suburi);
-      play_base_bin->suburi = g_strdup (suburi);
-      GST_DEBUG ("setting new .sub uri to %s", suburi);
-      play_base_bin->need_rebuild = TRUE;
-      break;
-    }
-    case ARG_QUEUE_SIZE:
-      play_base_bin->queue_size = g_value_get_uint64 (value);
-      break;
-    case ARG_QUEUE_THRESHOLD:
-      play_base_bin->queue_threshold = g_value_get_uint64 (value);
-      break;
-    case ARG_QUEUE_MIN_THRESHOLD:
-      play_base_bin->queue_min_threshold = g_value_get_uint64 (value);
-      break;
-    case ARG_CONNECTION_SPEED:
-      play_base_bin->connection_speed = g_value_get_uint (value) * 1000;
-      break;
-    case ARG_VIDEO:
-      GROUP_LOCK (play_base_bin);
-      set_active_source (play_base_bin,
-          GST_STREAM_TYPE_VIDEO, g_value_get_int (value));
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    case ARG_AUDIO:
-      GROUP_LOCK (play_base_bin);
-      set_active_source (play_base_bin,
-          GST_STREAM_TYPE_AUDIO, g_value_get_int (value));
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    case ARG_TEXT:
-      GROUP_LOCK (play_base_bin);
-      set_active_source (play_base_bin,
-          GST_STREAM_TYPE_TEXT, g_value_get_int (value));
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    case ARG_SUBTITLE_ENCODING:
-    {
-      const gchar *encoding;
-      GSList *list;
-
-      encoding = g_value_get_string (value);
-      if (encoding && play_base_bin->subencoding &&
-          !strcmp (play_base_bin->subencoding, encoding)) {
-        return;
-      }
-      if (encoding == NULL && play_base_bin->subencoding == NULL)
-        return;
-
-      g_mutex_lock (play_base_bin->sub_lock);
-      g_free (play_base_bin->subencoding);
-      play_base_bin->subencoding = g_strdup (encoding);
-      list = g_slist_copy (play_base_bin->subtitle_elements);
-      g_slist_foreach (list, (GFunc) gst_object_ref, NULL);
-      g_mutex_unlock (play_base_bin->sub_lock);
-
-      /* we can't hold a lock when calling g_object_set() on a child, since
-       * the notify event will trigger GstObject to send a deep-notify event
-       * which will try to take the lock ... */
-      g_slist_foreach (list, (GFunc) set_encoding_element, (gpointer) encoding);
-      g_slist_foreach (list, (GFunc) gst_object_unref, NULL);
-      g_slist_free (list);
-      break;
-    }
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_play_base_bin_get_property (GObject * object, guint prop_id, GValue * value,
-    GParamSpec * pspec)
-{
-  GstPlayBaseBin *play_base_bin;
-
-  g_return_if_fail (GST_IS_PLAY_BASE_BIN (object));
-
-  play_base_bin = GST_PLAY_BASE_BIN (object);
-
-  switch (prop_id) {
-    case ARG_URI:
-      g_value_set_string (value, play_base_bin->uri);
-      break;
-    case ARG_SUBURI:
-      g_value_set_string (value, play_base_bin->suburi);
-      break;
-    case ARG_NSTREAMS:
-    {
-      GstPlayBaseGroup *group;
-
-      GROUP_LOCK (play_base_bin);
-      group = get_active_group (play_base_bin);
-      if (group) {
-        g_value_set_int (value, group->nstreams);
-      } else {
-        g_value_set_int (value, 0);
-      }
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    }
-    case ARG_QUEUE_SIZE:
-      g_value_set_uint64 (value, play_base_bin->queue_size);
-      break;
-    case ARG_QUEUE_THRESHOLD:
-      g_value_set_uint64 (value, play_base_bin->queue_threshold);
-      break;
-    case ARG_QUEUE_MIN_THRESHOLD:
-      g_value_set_uint64 (value, play_base_bin->queue_min_threshold);
-      break;
-    case ARG_CONNECTION_SPEED:
-      g_value_set_uint (value, play_base_bin->connection_speed / 1000);
-      break;
-    case ARG_STREAMINFO:
-      /* FIXME: hold some kind of lock here, use iterator */
-      g_value_set_pointer (value,
-          (gpointer) gst_play_base_bin_get_streaminfo (play_base_bin));
-      break;
-    case ARG_STREAMINFO_VALUES:{
-      GValueArray *copy;
-
-      copy = gst_play_base_bin_get_streaminfo_value_array (play_base_bin);
-      g_value_take_boxed (value, copy);
-      break;
-    }
-    case ARG_SOURCE:
-      g_value_set_object (value, play_base_bin->source);
-      break;
-    case ARG_VIDEO:
-      GROUP_LOCK (play_base_bin);
-      g_value_set_int (value, get_active_source (play_base_bin,
-              GST_STREAM_TYPE_VIDEO));
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    case ARG_AUDIO:
-      GROUP_LOCK (play_base_bin);
-      g_value_set_int (value, get_active_source (play_base_bin,
-              GST_STREAM_TYPE_AUDIO));
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    case ARG_TEXT:
-      GROUP_LOCK (play_base_bin);
-      g_value_set_int (value, get_active_source (play_base_bin,
-              GST_STREAM_TYPE_TEXT));
-      GROUP_UNLOCK (play_base_bin);
-      break;
-    case ARG_SUBTITLE_ENCODING:
-      GST_OBJECT_LOCK (play_base_bin);
-      g_value_set_string (value, play_base_bin->subencoding);
-      GST_OBJECT_UNLOCK (play_base_bin);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static GstStateChangeReturn
-gst_play_base_bin_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret;
-  GstPlayBaseBin *play_base_bin;
-
-  play_base_bin = GST_PLAY_BASE_BIN (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      if (!setup_source (play_base_bin))
-        goto source_failed;
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      if (ret == GST_STATE_CHANGE_FAILURE)
-        goto cleanup_groups;
-
-      finish_source (play_base_bin);
-      break;
-      /* clean-up in both cases, READY=>NULL clean-up is if there was an error */
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      play_base_bin->need_rebuild = TRUE;
-      remove_decoders (play_base_bin);
-      remove_groups (play_base_bin);
-      remove_source (play_base_bin);
-      break;
-    default:
-      break;
-  }
-  return ret;
-
-  /* ERRORS */
-source_failed:
-  {
-    play_base_bin->need_rebuild = TRUE;
-
-    return GST_STATE_CHANGE_FAILURE;
-  }
-cleanup_groups:
-  {
-    /* clean up leftover groups */
-    remove_groups (play_base_bin);
-    play_base_bin->need_rebuild = TRUE;
-
-    return GST_STATE_CHANGE_FAILURE;
-  }
-}
-
-static const GList *
-gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group = get_active_group (play_base_bin);
-  GList *info = NULL;
-
-  if (group) {
-    info = group->streaminfo;
-  }
-  return info;
-}
-
-static GValueArray *
-gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin)
-{
-  GstPlayBaseGroup *group;
-  GValueArray *array = NULL;
-
-  GROUP_LOCK (play_base_bin);
-  group = get_active_group (play_base_bin);
-  if (group) {
-    array = g_value_array_copy (group->streaminfo_value_array);
-  } else {
-    array = g_value_array_new (0);
-  }
-  GROUP_UNLOCK (play_base_bin);
-
-  return array;
-}
diff --git a/gst/playback/gstplaybasebin.h b/gst/playback/gstplaybasebin.h
deleted file mode 100644 (file)
index c8c8649..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *               <2007> Wim Taymans <wim.taymans@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PLAYBASEBIN_H__
-#define __GST_PLAYBASEBIN_H__
-
-#include <gst/gst.h>
-#include "gststreaminfo.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_PLAY_BASE_BIN            (gst_play_base_bin_get_type())
-#define GST_PLAY_BASE_BIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_BASE_BIN,GstPlayBaseBin))
-#define GST_PLAY_BASE_BIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_BASE_BIN,GstPlayBaseBinClass))
-#define GST_IS_PLAY_BASE_BIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_BASE_BIN))
-#define GST_IS_PLAY_BASE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BASE_BIN))
-#define GST_PLAY_BASE_BIN_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY_BASE_BIN, \
-                              GstPlayBaseBinClass))
-
-typedef struct _GstPlayBaseBin GstPlayBaseBin;
-typedef struct _GstPlayBaseBinClass GstPlayBaseBinClass;
-
-/* a GstPlayBaseGroup is a group of pads and streaminfo that together 
- * make up a playable stream. A new group is created from the current 
- * set of pads that are alive when the preroll elements are filled or 
- * when the no-more-pads signal is fired.
- *
- * We have to queue the groups as they can be created while the preroll
- * queues are still playing the old group. We monitor the EOS signals
- * on the preroll queues and when all the streams in the current group
- * have EOSed, we switch to the next queued group.
- */
-typedef struct
-{
-  GstPlayBaseBin *bin;  /* ref to the owner */
-
-  gint           nstreams;
-  GList         *streaminfo;
-  GValueArray   *streaminfo_value_array;
-
-  /* contained decoded elementary streams */
-  struct {
-    gint         npads;
-    GstBin      *bin;
-    GstElement  *preroll;
-    GstElement  *selector;
-    gboolean     done;
-#define NUM_TYPES 4
-  } type[NUM_TYPES]; /* AUDIO, VIDEO, TEXT, SUBPIC */
-} GstPlayBaseGroup;
-
-struct _GstPlayBaseBin {
-  GstPipeline    pipeline;
-        
-  /* properties */
-  guint64        queue_size;
-  guint64        queue_threshold;
-  guint64        queue_min_threshold;
-  /* connection speed in bits/sec (0 = unknown) */
-  guint          connection_speed;
-  
-
-  /* currently loaded media */
-  gint           current[NUM_TYPES];
-  gchar         *uri, *suburi;
-  gboolean       is_stream;
-  GstElement    *source;
-  GSList        *decoders;
-  GstElement    *subtitle;              /* additional filesrc ! subparse bin */
-  gboolean       subtitle_done;
-  gboolean       need_rebuild;
-  gboolean       raw_decoding_mode;     /* Use smaller queues when source outputs raw data */
-
-  GSList        *subtitle_elements;     /* subtitle elements that have 'subtitle-encoding' property */
-  gchar         *subencoding;           /* encoding to propagate to the above subtitle elements     */
-  GMutex        *sub_lock;              /* protecting subtitle_elements and subencoding members     */
-
-  /* group management - using own lock */
-  GMutex        *group_lock;            /* lock and mutex to signal availability of new group */
-  GCond         *group_cond;
-  GstPlayBaseGroup *building_group;     /* the group that we are constructing */
-  GList         *queued_groups;         /* the constructed groups, head is the active one */
-
-  /* for dynamic sources */
-  guint          src_np_sig_id;                /* new-pad signal id */
-  guint          src_nmp_sig_id;        /* no-more-pads signal id */
-  gint           pending;
-};
-
-struct _GstPlayBaseBinClass {
-  GstPipelineClass parent_class;
-
-  /* virtual fuctions */
-  gboolean (*setup_output_pads) (GstPlayBaseBin *play_base_bin,
-                                 GstPlayBaseGroup *group);
-
-  void     (*set_subtitles_visible) (GstPlayBaseBin *play_base_bin,
-                                     gboolean visible);
-  void     (*set_audio_mute)        (GstPlayBaseBin *play_base_bin,
-                                     gboolean mute);
-};
-
-GType gst_play_base_bin_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_PLAYBASEBIN_H__ */
-
diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c
deleted file mode 100644 (file)
index 57b5dbe..0000000
+++ /dev/null
@@ -1,1990 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-playbin
- *
- * Playbin provides a stand-alone everything-in-one abstraction for an
- * audio and/or video player.
- *
- * <note>
- * This element is deprecated and no longer supported. You should use
- * the #playbin2 element instead.
- * </note>
- *
- * It can handle both audio and video files and features
- * <itemizedlist>
- * <listitem>
- * automatic file type recognition and based on that automatic
- * selection and usage of the right audio/video/subtitle demuxers/decoders
- * </listitem>
- * <listitem>
- * visualisations for audio files
- * </listitem>
- * <listitem>
- * subtitle support for video files
- * </listitem>
- * <listitem>
- * stream selection between different audio/subtitles streams
- * </listitem>
- * <listitem>
- * meta info (tag) extraction
- * </listitem>
- * <listitem>
- * easy access to the last video frame
- * </listitem>
- * <listitem>
- * buffering when playing streams over a network
- * </listitem>
- * <listitem>
- * volume control
- * </listitem>
- * </itemizedlist>
- *
- * <refsect2>
- * <title>Usage</title>
- * <para>
- * A playbin element can be created just like any other element using
- * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin:uri
- * property. This must be an absolute URI, relative file paths are not allowed.
- * Example URIs are file:///home/joe/movie.avi or http://www.joedoe.com/foo.ogg
- *
- * Playbin is a #GstPipeline. It will notify the application of everything
- * that's happening (errors, end of stream, tags found, state changes, etc.)
- * by posting messages on its #GstBus. The application needs to watch the
- * bus.
- *
- * Playback can be initiated by setting the element to PLAYING state using
- * gst_element_set_state(). Note that the state change will take place in
- * the background in a separate thread, when the function returns playback
- * is probably not happening yet and any errors might not have occured yet.
- * Applications using playbin should ideally be written to deal with things
- * completely asynchroneous.
- *
- * When playback has finished (an EOS message has been received on the bus)
- * or an error has occured (an ERROR message has been received on the bus) or
- * the user wants to play a different track, playbin should be set back to
- * READY or NULL state, then the #GstPlayBin:uri property should be set to the
- * new location and then playbin be set to PLAYING state again.
- *
- * Seeking can be done using gst_element_seek_simple() or gst_element_seek()
- * on the playbin element. Again, the seek will not be executed
- * instantaneously, but will be done in a background thread. When the seek
- * call returns the seek will most likely still be in process. An application
- * may wait for the seek to finish (or fail) using gst_element_get_state() with
- * -1 as the timeout, but this will block the user interface and is not
- * recommended at all.
- *
- * Applications may query the current position and duration of the stream
- * via gst_element_query_position() and gst_element_query_duration() and
- * setting the format passed to GST_FORMAT_TIME. If the query was successful,
- * the duration or position will have been returned in units of nanoseconds.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Advanced Usage: specifying the audio and video sink</title>
- * <para>
- * By default, if no audio sink or video sink has been specified via the
- * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property, playbin will use
- * the autoaudiosink and autovideosink elements to find the first-best
- * available output method.
- * This should work in most cases, but is not always desirable. Often either
- * the user or application might want to specify more explicitly what to use
- * for audio and video output.
- *
- * If the application wants more control over how audio or video should be
- * output, it may create the audio/video sink elements itself (for example
- * using gst_element_factory_make()) and provide them to playbin using the
- * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property.
- *
- * GNOME-based applications, for example, will usually want to create
- * gconfaudiosink and gconfvideosink elements and make playbin use those,
- * so that output happens to whatever the user has configured in the GNOME
- * Multimedia System Selector confinguration dialog.
- *
- * The sink elements do not necessarily need to be ready-made sinks. It is
- * possible to create container elements that look like a sink to playbin,
- * but in reality contain a number of custom elements linked together. This
- * can be achieved by creating a #GstBin and putting elements in there and
- * linking them, and then creating a sink #GstGhostPad for the bin and pointing
- * it to the sink pad of the first element within the bin. This can be used
- * for a number of purposes, for example to force output to a particular
- * format or to modify or observe the data before it is output.
- *
- * It is also possible to 'suppress' audio and/or video output by using
- * 'fakesink' elements (or capture it from there using the fakesink element's
- * "handoff" signal, which, nota bene, is fired from the streaming thread!).
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Retrieving Tags and Other Meta Data</title>
- * <para>
- * Most of the common meta data (artist, title, etc.) can be retrieved by
- * watching for TAG messages on the pipeline's bus (see above).
- *
- * Other more specific meta information like width/height/framerate of video
- * streams or samplerate/number of channels of audio streams can be obtained
- * using the  #GstPlayBaseBin:stream-info property, which will return a GList of
- * stream info objects, one for each stream. These are opaque objects that can
- * only be accessed via the standard GObject property interface, ie. g_object_get().
- * Each stream info object has the following properties:
- * <itemizedlist>
- * <listitem>"object" (GstObject) (the decoder source pad usually)</listitem>
- * <listitem>"type" (enum) (if this is an audio/video/subtitle stream)</listitem>
- * <listitem>"decoder" (string) (name of decoder used to decode this stream)</listitem>
- * <listitem>"mute" (boolean) (to mute or unmute this stream)</listitem>
- * <listitem>"caps" (GstCaps) (caps of the decoded stream)</listitem>
- * <listitem>"language-code" (string) (ISO-639 language code for this stream, mostly used for audio/subtitle streams)</listitem>
- * <listitem>"codec" (string) (format this stream was encoded in)</listitem>
- * </itemizedlist>
- * Stream information from the #GstPlayBaseBin:stream-info property is best queried once
- * playbin has changed into PAUSED or PLAYING state (which can be detected
- * via a state-changed message on the #GstBus where old_state=READY and
- * new_state=PAUSED), since before that the list might not be complete yet or
- * not contain all available information (like language-codes).
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Buffering</title>
- * Playbin handles buffering automatically for the most part, but applications
- * need to handle parts of the buffering process as well. Whenever playbin is
- * buffering, it will post BUFFERING messages on the bus with a percentage
- * value that shows the progress of the buffering process. Applications need
- * to set playbin to PLAYING or PAUSED state in response to these messages.
- * They may also want to convey the buffering progress to the user in some
- * way. Here is how to extract the percentage information from the message
- * (requires GStreamer >= 0.10.11):
- * |[
- * switch (GST_MESSAGE_TYPE (msg)) {
- *   case GST_MESSAGE_BUFFERING: {
- *     gint percent = 0;
- *     gst_message_parse_buffering (msg, &amp;percent);
- *     g_print ("Buffering (%%u percent done)", percent);
- *     break;
- *   }
- *   ...
- * }
- * ]|
- * Note that applications should keep/set the pipeline in the PAUSED state when
- * a BUFFERING message is received with a buffer percent value < 100 and set
- * the pipeline back to PLAYING state when a BUFFERING message with a value
- * of 100 percent is received (if PLAYING is the desired state, that is).
- * </refsect2>
- * <refsect2>
- * <title>Embedding the video window in your application</title>
- * By default, playbin (or rather the video sinks used) will create their own
- * window. Applications will usually want to force output to a window of their
- * own, however. This can be done using the #GstXOverlay interface, which most
- * video sinks implement. See the documentation there for more details.
- * </refsect2>
- * <refsect2>
- * <title>Specifying which CD/DVD device to use</title>
- * The device to use for CDs/DVDs needs to be set on the source element
- * playbin creates before it is opened. The only way to do this at the moment
- * is to connect to playbin's "notify::source" signal, which will be emitted
- * by playbin when it has created the source element for a particular URI.
- * In the signal callback you can check if the source element has a "device"
- * property and set it appropriately. In future ways might be added to specify
- * the device as part of the URI, but at the time of writing this is not
- * possible yet.
- * </refsect2>
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v playbin uri=file:///path/to/somefile.avi
- * ]| This will play back the given AVI video file, given that the video and
- * audio decoders required to decode the content are installed. Since no
- * special audio sink or video sink is supplied (not possible via gst-launch),
- * playbin will try to find a suitable audio and video sink automatically
- * using the autoaudiosink and autovideosink elements.
- * |[
- * gst-launch -v playbin uri=cdda://4
- * ]| This will play back track 4 on an audio CD in your disc drive (assuming
- * the drive is detected automatically by the plugin).
- * |[
- * gst-launch -v playbin uri=dvd://1
- * ]| This will play back title 1 of a DVD in your disc drive (assuming
- * the drive is detected automatically by the plugin).
- * </refsect2>
- *
- * Deprecated: use playbin2 instead
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/pbutils/pbutils.h>
-
-#include "gstplaybasebin.h"
-#include "gstplayback.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
-#define GST_CAT_DEFAULT gst_play_bin_debug
-
-#define GST_TYPE_PLAY_BIN               (gst_play_bin_get_type())
-#define GST_PLAY_BIN(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_BIN,GstPlayBin))
-#define GST_PLAY_BIN_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_BIN,GstPlayBinClass))
-#define GST_IS_PLAY_BIN(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_BIN))
-#define GST_IS_PLAY_BIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BIN))
-
-#define VOLUME_MAX_DOUBLE 10.0
-
-typedef struct _GstPlayBin GstPlayBin;
-typedef struct _GstPlayBinClass GstPlayBinClass;
-
-/**
- * GstPlayBin:
- *
- * High-level player element
- */
-struct _GstPlayBin
-{
-  GstPlayBaseBin parent;
-
-  /* the configurable elements */
-  GstElement *fakesink;
-  GstElement *audio_sink;
-  GstElement *video_sink;
-  GstElement *visualisation;
-  GstElement *pending_visualisation;
-  GstElement *volume_element;
-  GstElement *textoverlay_element;
-  GstElement *spu_element;
-  gfloat volume;
-
-  /* these are the currently active sinks */
-  GList *sinks;
-
-  /* the last captured frame for snapshots */
-  GstBuffer *frame;
-
-  /* our cache for the sinks */
-  GHashTable *cache;
-
-  /* font description */
-  gchar *font_desc;
-
-  /* indication if the pipeline is live */
-  gboolean is_live;
-};
-
-struct _GstPlayBinClass
-{
-  GstPlayBaseBinClass parent_class;
-};
-
-/* props */
-enum
-{
-  ARG_0,
-  ARG_AUDIO_SINK,
-  ARG_VIDEO_SINK,
-  ARG_VIS_PLUGIN,
-  ARG_VOLUME,
-  ARG_FRAME,
-  ARG_FONT_DESC
-};
-
-/* signals */
-enum
-{
-  LAST_SIGNAL
-};
-
-static void gst_play_bin_class_init (GstPlayBinClass * klass);
-static void gst_play_bin_init (GstPlayBin * play_bin);
-static void gst_play_bin_dispose (GObject * object);
-
-static gboolean setup_sinks (GstPlayBaseBin * play_base_bin,
-    GstPlayBaseGroup * group);
-static void remove_sinks (GstPlayBin * play_bin);
-static void playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin,
-    gboolean visible);
-static void playbin_set_audio_mute (GstPlayBaseBin * play_base_bin,
-    gboolean mute);
-
-static void gst_play_bin_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * spec);
-static void gst_play_bin_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * spec);
-
-static gboolean gst_play_bin_send_event (GstElement * element,
-    GstEvent * event);
-static GstStateChangeReturn gst_play_bin_change_state (GstElement * element,
-    GstStateChange transition);
-
-static void gst_play_bin_handle_message (GstBin * bin, GstMessage * message);
-
-static GstElementClass *parent_class;
-
-//static guint gst_play_bin_signals[LAST_SIGNAL] = { 0 };
-
-static GType
-gst_play_bin_get_type (void)
-{
-  static GType gst_play_bin_type = 0;
-
-  if (!gst_play_bin_type) {
-    static const GTypeInfo gst_play_bin_info = {
-      sizeof (GstPlayBinClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_play_bin_class_init,
-      NULL,
-      NULL,
-      sizeof (GstPlayBin),
-      0,
-      (GInstanceInitFunc) gst_play_bin_init,
-      NULL
-    };
-
-    gst_play_bin_type = g_type_register_static (GST_TYPE_PLAY_BASE_BIN,
-        "GstPlayBin", &gst_play_bin_info, 0);
-  }
-
-  return gst_play_bin_type;
-}
-
-static void
-gst_play_bin_class_init (GstPlayBinClass * klass)
-{
-  GObjectClass *gobject_klass;
-  GstElementClass *gstelement_klass;
-  GstBinClass *gstbin_klass;
-  GstPlayBaseBinClass *playbasebin_klass;
-
-  gobject_klass = (GObjectClass *) klass;
-  gstelement_klass = (GstElementClass *) klass;
-  gstbin_klass = (GstBinClass *) klass;
-  playbasebin_klass = (GstPlayBaseBinClass *) klass;
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_klass->set_property = gst_play_bin_set_property;
-  gobject_klass->get_property = gst_play_bin_get_property;
-
-  g_object_class_install_property (gobject_klass, ARG_VIDEO_SINK,
-      g_param_spec_object ("video-sink", "Video Sink",
-          "the video output element to use (NULL = default sink)",
-          GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_AUDIO_SINK,
-      g_param_spec_object ("audio-sink", "Audio Sink",
-          "the audio output element to use (NULL = default sink)",
-          GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_VIS_PLUGIN,
-      g_param_spec_object ("vis-plugin", "Vis plugin",
-          "the visualization element to use (NULL = none)",
-          GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  /**
-   * GstPlayBin:volume:
-   *
-   * Get or set the current audio stream volume. 1.0 means 100%,
-   * 0.0 means mute. This uses a linear volume scale.
-   *
-   */
-  g_object_class_install_property (gobject_klass, ARG_VOLUME,
-      g_param_spec_double ("volume", "volume", "volume",
-          0.0, VOLUME_MAX_DOUBLE, 1.0,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_FRAME,
-      gst_param_spec_mini_object ("frame", "Frame",
-          "The last frame (NULL = no video available)", GST_TYPE_BUFFER,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_FONT_DESC,
-      g_param_spec_string ("subtitle-font-desc", "Subtitle font description",
-          "Pango font description of font " "to be used for subtitle rendering",
-          NULL, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-
-  gobject_klass->dispose = gst_play_bin_dispose;
-
-  gst_element_class_set_details_simple (gstelement_klass,
-      "Player Bin", "Generic/Bin/Player",
-      "Autoplug and play media from an uri",
-      "Wim Taymans <wim.taymans@gmail.com>");
-
-  gstelement_klass->change_state =
-      GST_DEBUG_FUNCPTR (gst_play_bin_change_state);
-  gstelement_klass->send_event = GST_DEBUG_FUNCPTR (gst_play_bin_send_event);
-
-  gstbin_klass->handle_message =
-      GST_DEBUG_FUNCPTR (gst_play_bin_handle_message);
-
-  playbasebin_klass->setup_output_pads = setup_sinks;
-  playbasebin_klass->set_subtitles_visible = playbin_set_subtitles_visible;
-  playbasebin_klass->set_audio_mute = playbin_set_audio_mute;
-}
-
-static void
-gst_play_bin_init (GstPlayBin * play_bin)
-{
-  play_bin->video_sink = NULL;
-  play_bin->audio_sink = NULL;
-  play_bin->visualisation = NULL;
-  play_bin->pending_visualisation = NULL;
-  play_bin->volume_element = NULL;
-  play_bin->textoverlay_element = NULL;
-  play_bin->spu_element = NULL;
-  play_bin->volume = 1.0;
-  play_bin->sinks = NULL;
-  play_bin->frame = NULL;
-  play_bin->font_desc = NULL;
-  play_bin->cache = g_hash_table_new_full (g_str_hash, g_str_equal,
-      NULL, (GDestroyNotify) gst_object_unref);
-}
-
-static void
-gst_play_bin_dispose (GObject * object)
-{
-  GstPlayBin *play_bin;
-
-  play_bin = GST_PLAY_BIN (object);
-
-  if (play_bin->cache != NULL) {
-    remove_sinks (play_bin);
-    g_hash_table_destroy (play_bin->cache);
-    play_bin->cache = NULL;
-  }
-
-  if (play_bin->audio_sink != NULL) {
-    gst_element_set_state (play_bin->audio_sink, GST_STATE_NULL);
-    gst_object_unref (play_bin->audio_sink);
-    play_bin->audio_sink = NULL;
-  }
-  if (play_bin->video_sink != NULL) {
-    gst_element_set_state (play_bin->video_sink, GST_STATE_NULL);
-    gst_object_unref (play_bin->video_sink);
-    play_bin->video_sink = NULL;
-  }
-  if (play_bin->visualisation != NULL) {
-    gst_element_set_state (play_bin->visualisation, GST_STATE_NULL);
-    gst_object_unref (play_bin->visualisation);
-    play_bin->visualisation = NULL;
-  }
-  if (play_bin->pending_visualisation != NULL) {
-    gst_element_set_state (play_bin->pending_visualisation, GST_STATE_NULL);
-    gst_object_unref (play_bin->pending_visualisation);
-    play_bin->pending_visualisation = NULL;
-  }
-  if (play_bin->textoverlay_element != NULL) {
-    gst_object_unref (play_bin->textoverlay_element);
-    play_bin->textoverlay_element = NULL;
-  }
-  if (play_bin->volume_element) {
-    gst_object_unref (play_bin->volume_element);
-    play_bin->volume_element = NULL;
-  }
-  if (play_bin->spu_element != NULL) {
-    gst_object_unref (play_bin->spu_element);
-    play_bin->spu_element = NULL;
-  }
-  g_free (play_bin->font_desc);
-  play_bin->font_desc = NULL;
-
-  G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_play_bin_vis_unblocked (GstPad * tee_pad, gboolean blocked,
-    gpointer user_data)
-{
-  GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
-
-  if (play_bin->pending_visualisation)
-    gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_bin_vis_unblocked,
-        play_bin);
-}
-
-static void
-gst_play_bin_vis_blocked (GstPad * tee_pad, gboolean blocked,
-    gpointer user_data)
-{
-  GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
-  GstBin *vis_bin = NULL;
-  GstPad *vis_sink_pad = NULL, *vis_src_pad = NULL, *vqueue_pad = NULL;
-  GstState bin_state;
-  GstElement *pending_visualisation;
-
-  GST_OBJECT_LOCK (play_bin);
-  pending_visualisation = play_bin->pending_visualisation;
-  play_bin->pending_visualisation = NULL;
-  GST_OBJECT_UNLOCK (play_bin);
-
-  /* We want to disable visualisation */
-  if (!GST_IS_ELEMENT (pending_visualisation)) {
-    /* Set visualisation element to READY */
-    gst_element_set_state (play_bin->visualisation, GST_STATE_READY);
-    goto beach;
-  }
-
-  vis_bin =
-      GST_BIN_CAST (gst_object_get_parent (GST_OBJECT_CAST
-          (play_bin->visualisation)));
-
-  if (!GST_IS_BIN (vis_bin) || !GST_IS_PAD (tee_pad)) {
-    goto beach;
-  }
-
-  vis_src_pad = gst_element_get_static_pad (play_bin->visualisation, "src");
-  vis_sink_pad = gst_pad_get_peer (tee_pad);
-
-  /* Can be fakesink */
-  if (GST_IS_PAD (vis_src_pad)) {
-    vqueue_pad = gst_pad_get_peer (vis_src_pad);
-  }
-
-  if (!GST_IS_PAD (vis_sink_pad)) {
-    goto beach;
-  }
-
-  /* Check the bin's state */
-  GST_OBJECT_LOCK (vis_bin);
-  bin_state = GST_STATE (vis_bin);
-  GST_OBJECT_UNLOCK (vis_bin);
-
-  /* Unlink */
-  gst_pad_unlink (tee_pad, vis_sink_pad);
-  gst_object_unref (vis_sink_pad);
-  vis_sink_pad = NULL;
-
-  if (GST_IS_PAD (vqueue_pad)) {
-    gst_pad_unlink (vis_src_pad, vqueue_pad);
-    gst_object_unref (vis_src_pad);
-    vis_src_pad = NULL;
-  }
-
-  /* Remove from vis_bin */
-  gst_bin_remove (vis_bin, play_bin->visualisation);
-  /* Set state to NULL */
-  gst_element_set_state (play_bin->visualisation, GST_STATE_NULL);
-  /* And loose our ref */
-  gst_object_unref (play_bin->visualisation);
-
-  if (pending_visualisation) {
-    /* Ref this new visualisation element before adding to the bin */
-    gst_object_ref (pending_visualisation);
-    /* Add the new one */
-    gst_bin_add (vis_bin, pending_visualisation);
-    /* Synchronizing state */
-    gst_element_set_state (pending_visualisation, bin_state);
-
-    vis_sink_pad = gst_element_get_static_pad (pending_visualisation, "sink");
-    vis_src_pad = gst_element_get_static_pad (pending_visualisation, "src");
-
-    if (!GST_IS_PAD (vis_sink_pad) || !GST_IS_PAD (vis_src_pad)) {
-      goto beach;
-    }
-
-    /* Link */
-    gst_pad_link (tee_pad, vis_sink_pad);
-    gst_pad_link (vis_src_pad, vqueue_pad);
-  }
-
-  /* We are done */
-  gst_object_unref (play_bin->visualisation);
-  play_bin->visualisation = pending_visualisation;
-
-beach:
-  if (vis_sink_pad) {
-    gst_object_unref (vis_sink_pad);
-  }
-  if (vis_src_pad) {
-    gst_object_unref (vis_src_pad);
-  }
-  if (vqueue_pad) {
-    gst_object_unref (vqueue_pad);
-  }
-  if (vis_bin) {
-    gst_object_unref (vis_bin);
-  }
-
-  /* Unblock the pad */
-  gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_bin_vis_unblocked,
-      play_bin);
-}
-
-static void
-gst_play_bin_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstPlayBin *play_bin;
-
-  play_bin = GST_PLAY_BIN (object);
-
-  switch (prop_id) {
-    case ARG_VIDEO_SINK:
-      if (play_bin->video_sink != NULL) {
-        gst_object_unref (play_bin->video_sink);
-      }
-      play_bin->video_sink = g_value_get_object (value);
-      if (play_bin->video_sink != NULL) {
-        gst_object_ref (play_bin->video_sink);
-        gst_object_sink (GST_OBJECT_CAST (play_bin->video_sink));
-      }
-      /* when changing the videosink, we just remove the
-       * video pipeline from the cache so that it will be
-       * regenerated with the new sink element */
-      g_hash_table_remove (play_bin->cache, "vbin");
-      break;
-    case ARG_AUDIO_SINK:
-      if (play_bin->audio_sink != NULL) {
-        gst_object_unref (play_bin->audio_sink);
-      }
-      if (play_bin->volume_element != NULL) {
-        gst_object_unref (play_bin->volume_element);
-        play_bin->volume_element = NULL;
-      }
-      play_bin->audio_sink = g_value_get_object (value);
-      if (play_bin->audio_sink != NULL) {
-        gst_object_ref (play_bin->audio_sink);
-        gst_object_sink (GST_OBJECT_CAST (play_bin->audio_sink));
-      }
-      g_hash_table_remove (play_bin->cache, "abin");
-      break;
-    case ARG_VIS_PLUGIN:
-    {
-      GstElement *pending_visualisation =
-          GST_ELEMENT_CAST (g_value_get_object (value));
-
-      /* Take ownership */
-      if (pending_visualisation) {
-        gst_object_ref (pending_visualisation);
-        gst_object_sink (pending_visualisation);
-      }
-
-      /* Do we already have a visualisation change pending ? */
-      GST_OBJECT_LOCK (play_bin);
-      if (play_bin->pending_visualisation) {
-        gst_object_unref (play_bin->pending_visualisation);
-        play_bin->pending_visualisation = pending_visualisation;
-        GST_OBJECT_UNLOCK (play_bin);
-      } else {
-        GST_OBJECT_UNLOCK (play_bin);
-        /* Was there a visualisation already set ? */
-        if (play_bin->visualisation != NULL) {
-          GstBin *vis_bin = NULL;
-
-          vis_bin =
-              GST_BIN_CAST (gst_object_get_parent (GST_OBJECT_CAST
-                  (play_bin->visualisation)));
-
-          /* Check if the visualisation is already in a bin */
-          if (GST_IS_BIN (vis_bin)) {
-            GstPad *vis_sink_pad = NULL, *tee_pad = NULL;
-
-            /* Now get tee pad and block it async */
-            vis_sink_pad = gst_element_get_static_pad (play_bin->visualisation,
-                "sink");
-            if (!GST_IS_PAD (vis_sink_pad)) {
-              goto beach;
-            }
-            tee_pad = gst_pad_get_peer (vis_sink_pad);
-            if (!GST_IS_PAD (tee_pad)) {
-              goto beach;
-            }
-
-            play_bin->pending_visualisation = pending_visualisation;
-            /* Block with callback */
-            gst_pad_set_blocked_async (tee_pad, TRUE, gst_play_bin_vis_blocked,
-                play_bin);
-          beach:
-            if (vis_sink_pad) {
-              gst_object_unref (vis_sink_pad);
-            }
-            if (tee_pad) {
-              gst_object_unref (tee_pad);
-            }
-            gst_object_unref (vis_bin);
-          } else {
-            play_bin->visualisation = pending_visualisation;
-          }
-        } else {
-          play_bin->visualisation = pending_visualisation;
-        }
-      }
-      break;
-    }
-    case ARG_VOLUME:
-      play_bin->volume = g_value_get_double (value);
-      if (play_bin->volume_element) {
-        g_object_set (G_OBJECT (play_bin->volume_element), "volume",
-            play_bin->volume, NULL);
-      }
-      break;
-    case ARG_FONT_DESC:
-      g_free (play_bin->font_desc);
-      play_bin->font_desc = g_strdup (g_value_get_string (value));
-      if (play_bin->textoverlay_element) {
-        g_object_set (G_OBJECT (play_bin->textoverlay_element),
-            "font-desc", g_value_get_string (value), NULL);
-      }
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
-    GParamSpec * pspec)
-{
-  GstPlayBin *play_bin;
-
-  play_bin = GST_PLAY_BIN (object);
-
-  switch (prop_id) {
-    case ARG_VIDEO_SINK:
-      g_value_set_object (value, play_bin->video_sink);
-      break;
-    case ARG_AUDIO_SINK:
-      g_value_set_object (value, play_bin->audio_sink);
-      break;
-    case ARG_VIS_PLUGIN:
-      g_value_set_object (value, play_bin->visualisation);
-      break;
-    case ARG_VOLUME:
-      g_value_set_double (value, play_bin->volume);
-      break;
-    case ARG_FRAME:{
-      GstBuffer *cur_frame = NULL;
-
-      gst_buffer_replace (&cur_frame, play_bin->frame);
-      gst_value_take_buffer (value, cur_frame);
-      break;
-    }
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-/* signal fired when the identity has received a new buffer. This is used for
- * making screenshots.
- */
-static void
-handoff (GstElement * identity, GstBuffer * frame, gpointer data)
-{
-  GstPlayBin *play_bin = GST_PLAY_BIN (data);
-
-  /* applications need to know the buffer caps,
-   * make sure they are always set on the frame */
-  if (GST_BUFFER_CAPS (frame) == NULL) {
-    GstPad *pad;
-
-    if ((pad = gst_element_get_static_pad (identity, "sink"))) {
-      gst_buffer_set_caps (frame, GST_PAD_CAPS (pad));
-      gst_object_unref (pad);
-    }
-  }
-
-  gst_buffer_replace (&play_bin->frame, frame);
-}
-
-static void
-post_missing_element_message (GstPlayBin * playbin, const gchar * name)
-{
-  GstMessage *msg;
-
-  msg = gst_missing_element_message_new (GST_ELEMENT_CAST (playbin), name);
-  gst_element_post_message (GST_ELEMENT_CAST (playbin), msg);
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * video display. We connect a handoff signal to identity so that we
- * can grab snapshots. Identity's sinkpad is ghosted to vbin.
- *
- *  +-------------------------------------------------------------+
- *  | vbin                                                        |
- *  |      +--------+   +----------+   +----------+   +---------+ |
- *  |      |identity|   |colorspace|   |videoscale|   |videosink| |
- *  |   +-sink     src-sink       src-sink       src-sink       | |
- *  |   |  +---+----+   +----------+   +----------+   +---------+ |
- * sink-+      |                                                  |
- *  +----------|--------------------------------------------------+
- *           handoff
- */
-static GstElement *
-gen_video_element (GstPlayBin * play_bin)
-{
-  GstElement *element;
-  GstElement *conv;
-
-  GstElement *scale;
-  GstElement *sink;
-  GstElement *identity;
-  GstPad *pad;
-
-  /* first see if we have it in the cache */
-  element = g_hash_table_lookup (play_bin->cache, "vbin");
-  if (element != NULL) {
-    return element;
-  }
-
-  if (play_bin->video_sink) {
-    sink = play_bin->video_sink;
-  } else {
-    sink = gst_element_factory_make ("autovideosink", "videosink");
-    if (sink == NULL) {
-      sink = gst_element_factory_make ("xvimagesink", "videosink");
-    }
-    if (sink == NULL)
-      goto no_sinks;
-  }
-  gst_object_ref (sink);
-  g_hash_table_insert (play_bin->cache, (gpointer) "video_sink", sink);
-
-  /* create a bin to hold objects, as we create them we add them to this bin so
-   * that when something goes wrong we only need to unref the bin */
-  element = gst_bin_new ("vbin");
-  gst_bin_add (GST_BIN_CAST (element), sink);
-
-  conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");
-  if (conv == NULL)
-    goto no_colorspace;
-  gst_bin_add (GST_BIN_CAST (element), conv);
-
-  scale = gst_element_factory_make ("videoscale", "vscale");
-  if (scale == NULL)
-    goto no_videoscale;
-  gst_bin_add (GST_BIN_CAST (element), scale);
-
-  identity = gst_element_factory_make ("identity", "id");
-  g_object_set (identity, "silent", TRUE, NULL);
-  g_signal_connect (identity, "handoff", G_CALLBACK (handoff), play_bin);
-  gst_bin_add (GST_BIN_CAST (element), identity);
-
-  gst_element_link_pads (identity, "src", conv, "sink");
-  gst_element_link_pads (conv, "src", scale, "sink");
-  /* be more careful with the pad from the custom sink element, it might not
-   * be named 'sink' */
-  if (!gst_element_link_pads (scale, "src", sink, NULL))
-    goto link_failed;
-
-  pad = gst_element_get_static_pad (identity, "sink");
-  gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  gst_element_set_state (element, GST_STATE_READY);
-
-  /* since we're gonna add it to a bin but don't want to lose it,
-   * we keep a reference. */
-  gst_object_ref (element);
-  g_hash_table_insert (play_bin->cache, (gpointer) "vbin", element);
-
-  return element;
-
-  /* ERRORS */
-no_sinks:
-  {
-    post_missing_element_message (play_bin, "autovideosink");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Both autovideosink and xvimagesink elements are missing.")),
-        (NULL));
-    return NULL;
-  }
-no_colorspace:
-  {
-    post_missing_element_message (play_bin, "ffmpegcolorspace");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "ffmpegcolorspace"), (NULL));
-    gst_object_unref (element);
-    return NULL;
-  }
-
-no_videoscale:
-  {
-    post_missing_element_message (play_bin, "videoscale");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "videoscale"), ("possibly a liboil version mismatch?"));
-    gst_object_unref (element);
-    return NULL;
-  }
-link_failed:
-  {
-    GST_ELEMENT_ERROR (play_bin, CORE, PAD,
-        (NULL), ("Failed to configure the video sink."));
-    gst_object_unref (element);
-    return NULL;
-  }
-}
-
-/* make an element for playback of video with subtitles embedded.
- *
- *  +--------------------------------------------------+
- *  | tbin                  +-------------+            |
- *  |          +-----+      | textoverlay |   +------+ |
- *  |          | csp | +--video_sink      |   | vbin | |
- * video_sink-sink  src+ +-text_sink    src---sink   | |
- *  |          +-----+   |  +-------------+   +------+ |
- * text_sink-------------+                             |
- *  +--------------------------------------------------+
- *
- *  If there is no subtitle renderer this function will simply return the
- *  videosink without the text_sink pad.
- */
-static GstElement *
-add_text_element (GstPlayBin * play_bin, GstElement * vbin)
-{
-  GstElement *element, *csp, *overlay;
-  GstPad *pad;
-
-  /* Text overlay */
-  overlay = gst_element_factory_make ("textoverlay", "overlay");
-
-  /* If no overlay return the video bin without subtitle support. */
-  if (!overlay)
-    goto no_overlay;
-
-  /* Create our bin */
-  element = gst_bin_new ("textbin");
-
-  /* Set some parameters */
-  g_object_set (G_OBJECT (overlay),
-      "halign", "center", "valign", "bottom", NULL);
-  if (play_bin->font_desc) {
-    g_object_set (G_OBJECT (overlay), "font-desc", play_bin->font_desc, NULL);
-  }
-
-  /* Take a ref */
-  play_bin->textoverlay_element = GST_ELEMENT_CAST (gst_object_ref (overlay));
-
-  /* we know this will succeed, as the video bin already created one before */
-  csp = gst_element_factory_make ("ffmpegcolorspace", "subtitlecsp");
-
-  /* Add our elements */
-  gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL);
-
-  /* Link */
-  gst_element_link_pads (csp, "src", overlay, "video_sink");
-  gst_element_link_pads (overlay, "src", vbin, "sink");
-
-  /* Add ghost pads on the subtitle bin */
-  pad = gst_element_get_static_pad (overlay, "text_sink");
-  gst_element_add_pad (element, gst_ghost_pad_new ("text_sink", pad));
-  gst_object_unref (pad);
-
-  pad = gst_element_get_static_pad (csp, "sink");
-  gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  /* If the vbin provides a subpicture sink pad, ghost it too */
-  pad = gst_element_get_static_pad (vbin, "subpicture_sink");
-  if (pad) {
-    gst_element_add_pad (element, gst_ghost_pad_new ("subpicture_sink", pad));
-    gst_object_unref (pad);
-  }
-
-  /* Set state to READY */
-  gst_element_set_state (element, GST_STATE_READY);
-
-  return element;
-
-  /* ERRORS */
-no_overlay:
-  {
-    post_missing_element_message (play_bin, "textoverlay");
-    GST_WARNING_OBJECT (play_bin,
-        "No overlay (pango) element, subtitles disabled");
-    return vbin;
-  }
-}
-
-/* make an element for rendering DVD subpictures onto output video
- *
- *  +---------------------------------------------+
- *  | tbin                   +--------+           |
- *  |          +-----+       |        |  +------+ |
- *  |          | csp | src-videosink  |  | vbin | |
- * video_sink-sink  src+     |       src-sink   | |
- *  |          +-----+   +subpicture  |  +------+ |
- * subpicture_pad--------+   +--------+           |
- *  +---------- ----------------------------------+
- *
- */
-static GstElement *
-add_spu_element (GstPlayBin * play_bin, GstElement * vbin)
-{
-  GstElement *element, *csp, *overlay;
-  GstPad *pad;
-
-  /* DVD spu overlay */
-  GST_DEBUG_OBJECT (play_bin, "Attempting to insert DVD SPU element");
-
-  overlay = gst_element_factory_make ("dvdspu", "overlay");
-
-  /* If no overlay return the video bin without subpicture support. */
-  if (!overlay)
-    goto no_overlay;
-
-  /* Create our bin */
-  element = gst_bin_new ("spubin");
-
-  /* Take a ref */
-  play_bin->spu_element = GST_ELEMENT_CAST (gst_object_ref (overlay));
-
-  /* we know this will succeed, as the video bin already created one before */
-  csp = gst_element_factory_make ("ffmpegcolorspace", "spucsp");
-
-  /* Add our elements */
-  gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL);
-
-  /* Link */
-  gst_element_link_pads (csp, "src", overlay, "video");
-  gst_element_link_pads (overlay, "src", vbin, "sink");
-
-  /* Add ghost pad on the subpicture bin so it looks like vbin */
-  pad = gst_element_get_static_pad (csp, "sink");
-  gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  pad = gst_element_get_static_pad (overlay, "subpicture");
-  gst_element_add_pad (element, gst_ghost_pad_new ("subpicture_sink", pad));
-  gst_object_unref (pad);
-
-  /* Set state to READY */
-  gst_element_set_state (element, GST_STATE_READY);
-
-  return element;
-
-  /* ERRORS */
-no_overlay:
-  {
-    post_missing_element_message (play_bin, "dvdspu");
-    GST_WARNING_OBJECT (play_bin,
-        "No DVD overlay (dvdspu) element. "
-        "menu highlight/subtitles unavailable");
-    return vbin;
-  }
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * audio playback.
- *
- *  +-------------------------------------------------------------+
- *  | abin                                                        |
- *  |      +---------+   +----------+   +---------+   +---------+ |
- *  |      |audioconv|   |audioscale|   | volume  |   |audiosink| |
- *  |   +-sink      src-sink       src-sink      src-sink       | |
- *  |   |  +---------+   +----------+   +---------+   +---------+ |
- * sink-+                                                         |
- *  +-------------------------------------------------------------+
- */
-static GstElement *
-gen_audio_element (GstPlayBin * play_bin)
-{
-  gboolean res;
-  GstElement *element;
-  GstElement *conv;
-  GstElement *scale;
-  GstElement *sink;
-  GstElement *volume;
-  GstPad *pad;
-
-  element = g_hash_table_lookup (play_bin->cache, "abin");
-  if (element != NULL)
-    return element;
-
-  if (play_bin->audio_sink) {
-    sink = play_bin->audio_sink;
-  } else {
-    sink = gst_element_factory_make ("autoaudiosink", "audiosink");
-    if (sink == NULL) {
-      sink = gst_element_factory_make ("alsasink", "audiosink");
-    }
-    if (sink == NULL)
-      goto no_sinks;
-
-    play_bin->audio_sink = GST_ELEMENT_CAST (gst_object_ref (sink));
-  }
-
-  gst_object_ref (sink);
-  g_hash_table_insert (play_bin->cache, (gpointer) "audio_sink", sink);
-
-  element = gst_bin_new ("abin");
-  gst_bin_add (GST_BIN_CAST (element), sink);
-
-  conv = gst_element_factory_make ("audioconvert", "aconv");
-  if (conv == NULL)
-    goto no_audioconvert;
-  gst_bin_add (GST_BIN_CAST (element), conv);
-
-  scale = gst_element_factory_make ("audioresample", "aresample");
-  if (scale == NULL)
-    goto no_audioresample;
-  gst_bin_add (GST_BIN_CAST (element), scale);
-
-  volume = gst_element_factory_make ("volume", "volume");
-  if (volume == NULL)
-    goto no_volume;
-  g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL);
-  play_bin->volume_element = GST_ELEMENT_CAST (gst_object_ref (volume));
-  gst_bin_add (GST_BIN_CAST (element), volume);
-
-  res = gst_element_link_pads (conv, "src", scale, "sink");
-  res &= gst_element_link_pads (scale, "src", volume, "sink");
-  res &= gst_element_link_pads (volume, "src", sink, NULL);
-  if (!res)
-    goto link_failed;
-
-  pad = gst_element_get_static_pad (conv, "sink");
-  gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  gst_element_set_state (element, GST_STATE_READY);
-
-  /* since we're gonna add it to a bin but don't want to lose it,
-   * we keep a reference. */
-  gst_object_ref (element);
-  g_hash_table_insert (play_bin->cache, (gpointer) "abin", element);
-
-  return element;
-
-  /* ERRORS */
-no_sinks:
-  {
-    post_missing_element_message (play_bin, "autoaudiosink");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Both autoaudiosink and alsasink elements are missing.")), (NULL));
-    return NULL;
-  }
-no_audioconvert:
-  {
-    post_missing_element_message (play_bin, "audioconvert");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "audioconvert"), ("possibly a liboil version mismatch?"));
-    gst_object_unref (element);
-    return NULL;
-  }
-no_audioresample:
-  {
-    post_missing_element_message (play_bin, "audioresample");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "audioresample"), ("possibly a liboil version mismatch?"));
-    gst_object_unref (element);
-    return NULL;
-  }
-no_volume:
-  {
-    post_missing_element_message (play_bin, "volume");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "volume"), ("possibly a liboil version mismatch?"));
-    gst_object_unref (element);
-    return NULL;
-  }
-link_failed:
-  {
-    GST_ELEMENT_ERROR (play_bin, CORE, PAD,
-        (NULL), ("Failed to configure the audio sink."));
-    gst_object_unref (element);
-    return NULL;
-  }
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * visualisation ouput.  The idea is to split the audio using tee, then
- * sending the output to the regular audio bin and the other output to
- * the vis plugin that transforms it into a video that is rendered with the
- * normal video bin. The video and audio bins are run in threads to make sure
- * they don't block eachother.
- *
- *  +-----------------------------------------------------------------------+
- *  | visbin                                                                |
- *  |      +------+   +--------+   +----------------+                       |
- *  |      | tee  |   | aqueue |   |   abin ...     |                       |
- *  |   +-sink   src-sink     src-sink              |                       |
- *  |   |  |      |   +--------+   +----------------+                       |
- *  |   |  |      |                                                         |
- *  |   |  |      |   +------+   +------------+   +------+   +-----------+  |
- *  |   |  |      |   |vqueue|   | audioconv  |   | vis  |   | vbin ...  |  |
- *  |   |  |     src-sink   src-sink + samp  src-sink   src-sink         |  |
- *  |   |  |      |   +------+   +------------+   +------+   +-----------+  |
- *  |   |  |      |                                                         |
- *  |   |  +------+                                                         |
- * sink-+                                                                   |
- *  +-----------------------------------------------------------------------+
- */
-static GstElement *
-gen_vis_element (GstPlayBin * play_bin)
-{
-  gboolean res;
-  GstElement *element;
-  GstElement *tee;
-  GstElement *asink;
-  GstElement *vsink;
-  GstElement *conv;
-  GstElement *resamp;
-  GstElement *conv2;
-  GstElement *vis;
-  GstElement *vqueue, *aqueue;
-  GstPad *pad, *rpad;
-
-  /* errors are already posted when these fail. */
-  asink = gen_audio_element (play_bin);
-  if (!asink)
-    return NULL;
-  vsink = gen_video_element (play_bin);
-  if (!vsink) {
-    gst_object_unref (asink);
-    return NULL;
-  }
-
-  element = gst_bin_new ("visbin");
-  tee = gst_element_factory_make ("tee", "tee");
-
-  vqueue = gst_element_factory_make ("queue", "vqueue");
-  aqueue = gst_element_factory_make ("queue", "aqueue");
-
-  gst_bin_add (GST_BIN_CAST (element), asink);
-  gst_bin_add (GST_BIN_CAST (element), vqueue);
-  gst_bin_add (GST_BIN_CAST (element), aqueue);
-  gst_bin_add (GST_BIN_CAST (element), vsink);
-  gst_bin_add (GST_BIN_CAST (element), tee);
-
-  conv = gst_element_factory_make ("audioconvert", "aconv");
-  if (conv == NULL)
-    goto no_audioconvert;
-  gst_bin_add (GST_BIN_CAST (element), conv);
-
-  resamp = gst_element_factory_make ("audioresample", "aresamp");
-  if (resamp == NULL)
-    goto no_audioresample;
-  gst_bin_add (GST_BIN_CAST (element), resamp);
-
-  conv2 = gst_element_factory_make ("audioconvert", "aconv2");
-  if (conv2 == NULL)
-    goto no_audioconvert;
-  gst_bin_add (GST_BIN_CAST (element), conv2);
-
-  if (play_bin->visualisation) {
-    gst_object_ref (play_bin->visualisation);
-    vis = play_bin->visualisation;
-  } else {
-    vis = gst_element_factory_make ("goom", "vis");
-    if (!vis)
-      goto no_goom;
-  }
-  gst_bin_add (GST_BIN_CAST (element), vis);
-
-  res = gst_element_link_pads (vqueue, "src", conv, "sink");
-  res &= gst_element_link_pads (conv, "src", resamp, "sink");
-  res &= gst_element_link_pads (resamp, "src", conv2, "sink");
-  res &= gst_element_link_pads (conv2, "src", vis, "sink");
-  res &= gst_element_link_pads (vis, "src", vsink, "sink");
-  if (!res)
-    goto link_failed;
-
-  pad = gst_element_get_static_pad (aqueue, "sink");
-  rpad = gst_element_get_request_pad (tee, "src%d");
-  gst_pad_link (rpad, pad);
-  gst_object_unref (rpad);
-  gst_object_unref (pad);
-  gst_element_link_pads (aqueue, "src", asink, "sink");
-
-  pad = gst_element_get_static_pad (vqueue, "sink");
-  rpad = gst_element_get_request_pad (tee, "src%d");
-  gst_pad_link (rpad, pad);
-  gst_object_unref (rpad);
-  gst_object_unref (pad);
-
-  pad = gst_element_get_static_pad (tee, "sink");
-  gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  return element;
-
-  /* ERRORS */
-no_audioconvert:
-  {
-    post_missing_element_message (play_bin, "audioconvert");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "audioconvert"), ("possibly a liboil version mismatch?"));
-    gst_object_unref (element);
-    return NULL;
-  }
-no_audioresample:
-  {
-    post_missing_element_message (play_bin, "audioresample");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "audioresample"), (NULL));
-    gst_object_unref (element);
-    return NULL;
-  }
-no_goom:
-  {
-    post_missing_element_message (play_bin, "goom");
-    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
-        (_("Missing element '%s' - check your GStreamer installation."),
-            "goom"), (NULL));
-    gst_object_unref (element);
-    return NULL;
-  }
-link_failed:
-  {
-    GST_ELEMENT_ERROR (play_bin, CORE, PAD,
-        (NULL), ("Failed to configure the visualisation element."));
-    gst_object_unref (element);
-    return NULL;
-  }
-}
-
-/* get rid of all installed sinks */
-static void
-remove_sinks (GstPlayBin * play_bin)
-{
-  GList *sinks;
-  GstObject *parent;
-  GstElement *element;
-  GstPad *pad, *peer;
-
-  if (play_bin->cache == NULL)
-    return;
-
-  GST_DEBUG ("removesinks");
-  element = g_hash_table_lookup (play_bin->cache, "abin");
-  if (element != NULL) {
-    parent = gst_element_get_parent (element);
-    if (parent != NULL) {
-      /* we remove the element from the parent so that
-       * there is no unwanted state change when the parent
-       * is disposed */
-      play_bin->sinks = g_list_remove (play_bin->sinks, element);
-      gst_element_set_state (element, GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (parent), element);
-      gst_object_unref (parent);
-    }
-    pad = gst_element_get_static_pad (element, "sink");
-    if (pad != NULL) {
-      peer = gst_pad_get_peer (pad);
-      if (peer != NULL) {
-        gst_pad_unlink (peer, pad);
-        gst_object_unref (peer);
-      }
-      gst_object_unref (pad);
-    }
-  }
-  element = g_hash_table_lookup (play_bin->cache, "vbin");
-  if (element != NULL) {
-    parent = gst_element_get_parent (element);
-    if (parent != NULL) {
-      play_bin->sinks = g_list_remove (play_bin->sinks, element);
-      gst_element_set_state (element, GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (parent), element);
-      gst_object_unref (parent);
-    }
-    pad = gst_element_get_static_pad (element, "sink");
-    if (pad != NULL) {
-      peer = gst_pad_get_peer (pad);
-      if (peer != NULL) {
-        gst_pad_unlink (peer, pad);
-        gst_object_unref (peer);
-      }
-      gst_object_unref (pad);
-    }
-  }
-
-  for (sinks = play_bin->sinks; sinks; sinks = g_list_next (sinks)) {
-    GstElement *element = GST_ELEMENT_CAST (sinks->data);
-    GstPad *pad;
-    GstPad *peer;
-
-    pad = gst_element_get_static_pad (element, "sink");
-
-    GST_LOG ("removing sink %p", element);
-
-    peer = gst_pad_get_peer (pad);
-    if (peer) {
-      gst_pad_unlink (peer, pad);
-      gst_object_unref (peer);
-    }
-    gst_object_unref (pad);
-
-    gst_element_set_state (element, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (play_bin), element);
-  }
-  g_list_free (play_bin->sinks);
-  play_bin->sinks = NULL;
-
-  if (play_bin->visualisation) {
-    GstElement *vis_bin;
-
-    vis_bin =
-        GST_ELEMENT_CAST (gst_element_get_parent (play_bin->visualisation));
-
-    gst_element_set_state (play_bin->visualisation, GST_STATE_NULL);
-
-    if (vis_bin) {
-      gst_bin_remove (GST_BIN_CAST (vis_bin), play_bin->visualisation);
-      gst_object_unref (vis_bin);
-    }
-  }
-
-  if (play_bin->frame) {
-    gst_buffer_unref (play_bin->frame);
-    play_bin->frame = NULL;
-  }
-
-  if (play_bin->textoverlay_element) {
-    gst_object_unref (play_bin->textoverlay_element);
-    play_bin->textoverlay_element = NULL;
-  }
-}
-
-/* loop over the streams and set up the pipeline to play this
- * media file. First we count the number of audio and video streams.
- * If there is no video stream but there exists an audio stream,
- * we install a visualisation pipeline.
- *
- * Also make sure to only connect the first audio and video pad. FIXME
- * this should eventually be handled with a tuner interface so that
- * one can switch the streams.
- *
- * This function takes ownership of @sink.*
- */
-static gboolean
-add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad,
-    GstPad * subtitle_pad)
-{
-  GstPad *sinkpad;
-  GstPadLinkReturn linkres;
-  GstElement *parent;
-  GstStateChangeReturn stateret;
-  GstState state;
-
-  g_return_val_if_fail (sink != NULL, FALSE);
-
-  state = GST_STATE_PAUSED;
-
-  /* this is only for debugging */
-  parent = gst_pad_get_parent_element (srcpad);
-  if (parent) {
-    GST_DEBUG ("Adding sink %" GST_PTR_FORMAT
-        " with state %d (parent: %d, peer: %d)", sink,
-        GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent));
-    gst_object_unref (parent);
-  }
-  gst_bin_add (GST_BIN_CAST (play_bin), sink);
-
-  /* bring it to the required state so we can link to the peer without
-   * breaking the flow */
-  stateret = gst_element_set_state (sink, state);
-  if (stateret == GST_STATE_CHANGE_FAILURE)
-    goto state_failed;
-
-  /* we found a sink for this stream, now try to install it */
-  sinkpad = gst_element_get_static_pad (sink, "sink");
-  linkres = gst_pad_link (srcpad, sinkpad);
-  gst_object_unref (sinkpad);
-
-  /* try to link the pad of the sink to the stream */
-  if (GST_PAD_LINK_FAILED (linkres))
-    goto link_failed;
-
-  if (GST_IS_PAD (subtitle_pad)) {
-    sinkpad = gst_element_get_static_pad (sink, "text_sink");
-    linkres = gst_pad_link (subtitle_pad, sinkpad);
-    gst_object_unref (sinkpad);
-  }
-
-  /* try to link the subtitle pad of the sink to the stream, this is not
-   * fatal. */
-  if (GST_PAD_LINK_FAILED (linkres))
-    goto subtitle_failed;
-
-done:
-  /* we got the sink succesfully linked, now keep the sink
-   * in our internal list */
-  play_bin->sinks = g_list_prepend (play_bin->sinks, sink);
-
-  return TRUE;
-
-  /* ERRORS */
-state_failed:
-  {
-    gst_element_set_state (sink, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (play_bin), sink);
-    GST_DEBUG_OBJECT (play_bin, "state change failure when adding sink");
-    return FALSE;
-  }
-link_failed:
-  {
-    gchar *capsstr;
-    GstCaps *caps;
-
-    /* could not link this stream */
-    caps = gst_pad_get_caps (srcpad);
-    capsstr = gst_caps_to_string (caps);
-    g_warning ("could not link %s: %d", capsstr, linkres);
-    GST_DEBUG_OBJECT (play_bin,
-        "link failed when adding sink, caps %s, reason %d", capsstr, linkres);
-    g_free (capsstr);
-    gst_caps_unref (caps);
-
-    gst_element_set_state (sink, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (play_bin), sink);
-    return FALSE;
-  }
-subtitle_failed:
-  {
-    GstCaps *caps;
-
-    /* could not link this stream */
-    caps = gst_pad_get_caps (subtitle_pad);
-    GST_WARNING_OBJECT (play_bin, "subtitle link failed when adding sink, "
-        "caps = %" GST_PTR_FORMAT ", reason %d", caps, linkres);
-    gst_caps_unref (caps);
-
-    /* not fatal */
-    goto done;
-  }
-}
-
-static void
-dummy_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
-{
-}
-
-static gboolean
-setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
-{
-  GstPlayBin *play_bin = GST_PLAY_BIN (play_base_bin);
-  gboolean have_video = FALSE;
-  gboolean need_vis = FALSE;
-  gboolean need_text = FALSE;
-  gboolean need_spu = FALSE;
-  GstPad *textsrcpad = NULL, *pad = NULL, *origtextsrcpad = NULL;
-  GstElement *sink;
-  gboolean res = TRUE;
-
-  /* get rid of existing sinks */
-  if (play_bin->sinks) {
-    remove_sinks (play_bin);
-  }
-  GST_DEBUG_OBJECT (play_base_bin, "setupsinks");
-
-  /* find out what to do */
-  have_video = (group->type[GST_STREAM_TYPE_VIDEO - 1].npads > 0);
-  need_spu = (group->type[GST_STREAM_TYPE_SUBPICTURE - 1].npads != 0);
-
-  if (have_video && group->type[GST_STREAM_TYPE_TEXT - 1].npads > 0) {
-    need_text = TRUE;
-  } else if (!have_video &&
-      group->type[GST_STREAM_TYPE_AUDIO - 1].npads > 0 &&
-      play_bin->visualisation != NULL) {
-    need_vis = TRUE;
-  }
-
-  /* now actually connect everything */
-
-  /* link audio */
-  if (group->type[GST_STREAM_TYPE_AUDIO - 1].npads > 0) {
-    if (need_vis) {
-      sink = gen_vis_element (play_bin);
-    } else {
-      sink = gen_audio_element (play_bin);
-    }
-    if (!sink)
-      return FALSE;
-
-    pad =
-        gst_element_get_static_pad (group->type[GST_STREAM_TYPE_AUDIO -
-            1].preroll, "src");
-    res = add_sink (play_bin, sink, pad, NULL);
-    gst_object_unref (pad);
-  }
-
-  /* link video */
-  if (have_video) {
-    /* Create the video rendering bin, error is posted when this fails. */
-    sink = gen_video_element (play_bin);
-    if (!sink)
-      return FALSE;
-    if (need_spu) {
-      sink = add_spu_element (play_bin, sink);
-    }
-
-    if (need_text) {
-      GstObject *parent = NULL, *grandparent = NULL;
-      GstPad *ghost = NULL;
-
-      /* Add the subtitle overlay element into the video sink */
-      sink = add_text_element (play_bin, sink);
-
-      /* Link the incoming subtitle stream into the output bin */
-      textsrcpad =
-          gst_element_get_static_pad (group->type[GST_STREAM_TYPE_TEXT -
-              1].preroll, "src");
-
-      /* This pad is from subtitle-bin, we need to create a ghost pad to have
-         common grandparents */
-      parent = gst_object_get_parent (GST_OBJECT_CAST (textsrcpad));
-      if (!parent) {
-        GST_WARNING_OBJECT (textsrcpad, "subtitle pad has no parent !");
-        gst_object_unref (textsrcpad);
-        textsrcpad = NULL;
-        goto beach;
-      }
-
-      grandparent = gst_object_get_parent (parent);
-      if (!grandparent) {
-        GST_WARNING_OBJECT (textsrcpad, "subtitle pad has no grandparent !");
-        gst_object_unref (parent);
-        gst_object_unref (textsrcpad);
-        textsrcpad = NULL;
-        goto beach;
-      }
-
-      /* We ghost the pad on subtitle_bin only, if the text pad is from the
-         media demuxer we keep it as it is */
-      if (!GST_IS_PLAY_BIN (grandparent)) {
-        GST_DEBUG_OBJECT (textsrcpad, "this subtitle pad is from a subtitle "
-            "file, ghosting to a suitable hierarchy");
-        /* Block the pad first, because as soon as we add a ghostpad, the queue
-         * will try and start pushing */
-        gst_pad_set_blocked_async (textsrcpad, TRUE, dummy_blocked_cb, NULL);
-        origtextsrcpad = gst_object_ref (textsrcpad);
-
-        ghost = gst_ghost_pad_new ("text_src", textsrcpad);
-        if (!GST_IS_PAD (ghost)) {
-          GST_WARNING_OBJECT (textsrcpad, "failed creating ghost pad for "
-              "subtitle-bin");
-          gst_object_unref (parent);
-          gst_object_unref (grandparent);
-          gst_object_unref (textsrcpad);
-          textsrcpad = NULL;
-          goto beach;
-        }
-
-        gst_pad_set_active (ghost, TRUE);
-        if (gst_element_add_pad (GST_ELEMENT_CAST (grandparent), ghost)) {
-          gst_object_unref (textsrcpad);
-          textsrcpad = gst_object_ref (ghost);
-        } else {
-          GST_WARNING_OBJECT (ghost, "failed adding ghost pad on subtitle-bin");
-          gst_pad_set_active (ghost, FALSE);
-          gst_object_unref (ghost);
-          gst_object_unref (textsrcpad);
-          textsrcpad = NULL;
-        }
-      } else {
-        GST_DEBUG_OBJECT (textsrcpad, "this subtitle pad is from the demuxer "
-            "no changes to hierarchy needed");
-      }
-
-      gst_object_unref (parent);
-      gst_object_unref (grandparent);
-    }
-  beach:
-    if (!sink)
-      return FALSE;
-    pad =
-        gst_element_get_static_pad (group->type[GST_STREAM_TYPE_VIDEO -
-            1].preroll, "src");
-    res = add_sink (play_bin, sink, pad, textsrcpad);
-    gst_object_unref (pad);
-    if (textsrcpad)
-      gst_object_unref (textsrcpad);
-    if (origtextsrcpad) {
-      gst_pad_set_blocked_async (origtextsrcpad, FALSE, dummy_blocked_cb, NULL);
-      gst_object_unref (origtextsrcpad);
-    }
-
-    /* If we have a DVD subpicture stream, link it to the SPU now */
-    if (need_spu) {
-      GstPad *subpic_pad;
-      GstPad *spu_sink_pad;
-
-      subpic_pad =
-          gst_element_get_static_pad (group->type[GST_STREAM_TYPE_SUBPICTURE
-              - 1].preroll, "src");
-      spu_sink_pad = gst_element_get_static_pad (sink, "subpicture_sink");
-      if (subpic_pad && spu_sink_pad) {
-        GST_LOG_OBJECT (play_bin, "Linking DVD subpicture stream onto SPU");
-        gst_pad_set_blocked_async (subpic_pad, TRUE, dummy_blocked_cb, NULL);
-        if (gst_pad_link (subpic_pad, spu_sink_pad) != GST_PAD_LINK_OK) {
-          GST_WARNING_OBJECT (play_bin,
-              "Failed to link DVD subpicture stream onto SPU");
-        }
-        gst_pad_set_blocked_async (subpic_pad, FALSE, dummy_blocked_cb, NULL);
-      }
-      if (subpic_pad)
-        gst_object_unref (subpic_pad);
-      if (spu_sink_pad)
-        gst_object_unref (spu_sink_pad);
-    }
-  }
-
-  /* remove the sinks now, pipeline get_state will now wait for the
-   * sinks to preroll */
-  if (play_bin->fakesink) {
-    gst_element_set_state (play_bin->fakesink, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (play_bin), play_bin->fakesink);
-    play_bin->fakesink = NULL;
-  }
-
-  return res;
-}
-
-static void
-playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
-{
-  GstPlayBin *playbin = GST_PLAY_BIN (play_base_bin);
-
-  /* we're ignoring the case of someone setting the 'current-text' property
-   * before textoverlay is set up (which is probably okay, since playbasebin
-   * will just select the first subtitle stream as active stream regardless) */
-  if (playbin->textoverlay_element != NULL) {
-    GST_LOG_OBJECT (playbin, "setting subtitle visibility to %d", visible);
-    g_object_set (playbin->textoverlay_element, "silent", !visible, NULL);
-  }
-}
-
-static void
-playbin_set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute)
-{
-  GstPlayBin *playbin = GST_PLAY_BIN (play_base_bin);
-
-  if (playbin->volume_element) {
-    g_object_set (G_OBJECT (playbin->volume_element), "mute", mute, NULL);
-  }
-}
-
-/* Send an event to our sinks until one of them works; don't then send to the
- * remaining sinks (unlike GstBin)
- */
-static gboolean
-gst_play_bin_send_event_to_sink (GstPlayBin * play_bin, GstEvent * event)
-{
-  GList *sinks = play_bin->sinks;
-  gboolean res = TRUE;
-
-  while (sinks) {
-    GstElement *sink = GST_ELEMENT_CAST (sinks->data);
-
-    gst_event_ref (event);
-    if ((res = gst_element_send_event (sink, event))) {
-      GST_DEBUG_OBJECT (play_bin,
-          "Sent event succesfully to sink %" GST_PTR_FORMAT, sink);
-      break;
-    }
-    GST_DEBUG_OBJECT (play_bin,
-        "Event failed when sent to sink %" GST_PTR_FORMAT, sink);
-
-    sinks = g_list_next (sinks);
-  }
-
-  gst_event_unref (event);
-
-  return res;
-}
-
-/* We only want to send the event to a single sink (overriding GstBin's
- * behaviour), but we want to keep GstPipeline's behaviour - wrapping seek
- * events appropriately. So, this is a messy duplication of code. */
-static gboolean
-gst_play_bin_send_event (GstElement * element, GstEvent * event)
-{
-  gboolean res = FALSE;
-  GstEventType event_type = GST_EVENT_TYPE (event);
-
-  switch (event_type) {
-    case GST_EVENT_SEEK:
-      GST_DEBUG_OBJECT (element, "Sending seek event to a sink");
-      res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event);
-      break;
-    default:
-      res = parent_class->send_event (element, event);
-      break;
-  }
-
-  return res;
-}
-
-static void
-value_list_append_structure_list (GValue * list_val, GstStructure ** first,
-    GList * structure_list)
-{
-  GList *l;
-
-  for (l = structure_list; l != NULL; l = l->next) {
-    GValue val = { 0, };
-
-    if (*first == NULL)
-      *first = gst_structure_copy ((GstStructure *) l->data);
-
-    g_value_init (&val, GST_TYPE_STRUCTURE);
-    g_value_take_boxed (&val, gst_structure_copy ((GstStructure *) l->data));
-    gst_value_list_append_value (list_val, &val);
-    g_value_unset (&val);
-  }
-}
-
-/* if it's a redirect message with multiple redirect locations we might
- * want to pick a different 'best' location depending on the required
- * bitrates and the connection speed */
-static GstMessage *
-gst_play_bin_handle_redirect_message (GstPlayBin * playbin, GstMessage * msg)
-{
-  const GValue *locations_list, *location_val;
-  GstMessage *new_msg;
-  GstStructure *new_structure = NULL;
-  GList *l_good = NULL, *l_neutral = NULL, *l_bad = NULL;
-  GValue new_list = { 0, };
-  guint size, i;
-  GstPlayBaseBin *playbasebin = GST_PLAY_BASE_BIN (playbin);
-  guint connection_speed = playbasebin->connection_speed;
-
-  GST_DEBUG_OBJECT (playbin, "redirect message: %" GST_PTR_FORMAT, msg);
-  GST_DEBUG_OBJECT (playbin, "connection speed: %u", connection_speed);
-
-  if (connection_speed == 0 || msg->structure == NULL)
-    return msg;
-
-  locations_list = gst_structure_get_value (msg->structure, "locations");
-  if (locations_list == NULL)
-    return msg;
-
-  size = gst_value_list_get_size (locations_list);
-  if (size < 2)
-    return msg;
-
-  /* maintain existing order as much as possible, just sort references
-   * with too high a bitrate to the end (the assumption being that if
-   * bitrates are given they are given for all interesting streams and
-   * that the you-need-at-least-version-xyz redirect has the same bitrate
-   * as the lowest referenced redirect alternative) */
-  for (i = 0; i < size; ++i) {
-    const GstStructure *s;
-    gint bitrate = 0;
-
-    location_val = gst_value_list_get_value (locations_list, i);
-    s = (const GstStructure *) g_value_get_boxed (location_val);
-    if (!gst_structure_get_int (s, "minimum-bitrate", &bitrate) || bitrate <= 0) {
-      GST_DEBUG_OBJECT (playbin, "no bitrate: %" GST_PTR_FORMAT, s);
-      l_neutral = g_list_append (l_neutral, (gpointer) s);
-    } else if (bitrate > connection_speed) {
-      GST_DEBUG_OBJECT (playbin, "bitrate too high: %" GST_PTR_FORMAT, s);
-      l_bad = g_list_append (l_bad, (gpointer) s);
-    } else if (bitrate <= connection_speed) {
-      GST_DEBUG_OBJECT (playbin, "bitrate OK: %" GST_PTR_FORMAT, s);
-      l_good = g_list_append (l_good, (gpointer) s);
-    }
-  }
-
-  g_value_init (&new_list, GST_TYPE_LIST);
-  value_list_append_structure_list (&new_list, &new_structure, l_good);
-  value_list_append_structure_list (&new_list, &new_structure, l_neutral);
-  value_list_append_structure_list (&new_list, &new_structure, l_bad);
-  gst_structure_set_value (new_structure, "locations", &new_list);
-  g_value_unset (&new_list);
-
-  g_list_free (l_good);
-  g_list_free (l_neutral);
-  g_list_free (l_bad);
-
-  new_msg = gst_message_new_element (msg->src, new_structure);
-  gst_message_unref (msg);
-
-  GST_DEBUG_OBJECT (playbin, "new redirect message: %" GST_PTR_FORMAT, new_msg);
-  return new_msg;
-}
-
-static void
-gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
-{
-  if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT && msg->structure != NULL
-      && gst_structure_has_name (msg->structure, "redirect")) {
-    msg = gst_play_bin_handle_redirect_message (GST_PLAY_BIN (bin), msg);
-  }
-
-  GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-static GstStateChangeReturn
-gst_play_bin_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret;
-  GstPlayBin *play_bin;
-
-  play_bin = GST_PLAY_BIN (element);
-
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      /* this really is the easiest way to make the state change return
-       * ASYNC until we added the sinks */
-      if (!play_bin->fakesink) {
-        play_bin->fakesink = gst_element_factory_make ("fakesink", "test");
-        gst_bin_add (GST_BIN_CAST (play_bin), play_bin->fakesink);
-      }
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-  if (ret == GST_STATE_CHANGE_FAILURE)
-    return ret;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      /* remember us being a live pipeline */
-      play_bin->is_live = (ret == GST_STATE_CHANGE_NO_PREROLL);
-      GST_DEBUG_OBJECT (play_bin, "is live: %d", play_bin->is_live);
-      break;
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      /* FIXME Release audio device when we implement that */
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      /* remove sinks we added */
-      remove_sinks (play_bin);
-      /* and there might be a fakesink we need to clean up now */
-      if (play_bin->fakesink) {
-        gst_element_set_state (play_bin->fakesink, GST_STATE_NULL);
-        gst_bin_remove (GST_BIN_CAST (play_bin), play_bin->fakesink);
-        play_bin->fakesink = NULL;
-      }
-      break;
-    default:
-      break;
-  }
-
-  return ret;
-}
-
-gboolean
-gst_play_bin_plugin_init (GstPlugin * plugin)
-{
-  GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin", 0, "play bin");
-
-  return gst_element_register (plugin, "playbin", GST_RANK_NONE,
-      GST_TYPE_PLAY_BIN);
-}
index d788ebe..3185f6b 100644 (file)
  */
 
 /**
- * SECTION:element-playbin2
+ * SECTION:element-playbin
  *
- * Playbin2 provides a stand-alone everything-in-one abstraction for an
+ * Playbin provides a stand-alone everything-in-one abstraction for an
  * audio and/or video player.
  *
- * playbin2 is considered stable now. It is the prefered playback API now,
- * and replaces the old #playbin element, which is no longer supported.
- *
- * It can handle both audio and video files and features
+ * Playbin can handle both audio and video files and features
  * <itemizedlist>
  * <listitem>
  * automatic file type recognition and based on that automatic
@@ -60,8 +57,8 @@
  * <refsect2>
  * <title>Usage</title>
  * <para>
- * A playbin2 element can be created just like any other element using
- * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin2:uri
+ * A playbin element can be created just like any other element using
+ * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin:uri
  * property. This must be an absolute URI, relative file paths are not allowed.
  * Example URIs are file:///home/joe/movie.avi or http://www.joedoe.com/foo.ogg
  *
@@ -80,7 +77,7 @@
  * When playback has finished (an EOS message has been received on the bus)
  * or an error has occured (an ERROR message has been received on the bus) or
  * the user wants to play a different track, playbin should be set back to
- * READY or NULL state, then the #GstPlayBin2:uri property should be set to the
+ * READY or NULL state, then the #GstPlayBin:uri property should be set to the
  * new location and then playbin be set to PLAYING state again.
  *
  * Seeking can be done using gst_element_seek_simple() or gst_element_seek()
  * <title>Advanced Usage: specifying the audio and video sink</title>
  * <para>
  * By default, if no audio sink or video sink has been specified via the
- * #GstPlayBin2:audio-sink or #GstPlayBin2:video-sink property, playbin will use the autoaudiosink
+ * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property, playbin will use the autoaudiosink
  * and autovideosink elements to find the first-best available output method.
  * This should work in most cases, but is not always desirable. Often either
  * the user or application might want to specify more explicitly what to use
  * If the application wants more control over how audio or video should be
  * output, it may create the audio/video sink elements itself (for example
  * using gst_element_factory_make()) and provide them to playbin using the
- * #GstPlayBin2:audio-sink or #GstPlayBin2:video-sink property.
+ * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property.
  *
  * GNOME-based applications, for example, will usually want to create
  * gconfaudiosink and gconfvideosink elements and make playbin use those,
@@ -266,6 +263,7 @@ struct _GstSourceSelect
                                  */
   GstEvent *sinkpad_delayed_event;
   gulong sinkpad_data_probe;
+  gulong block_id;
 };
 
 #define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
@@ -324,6 +322,8 @@ struct _GstSourceGroup
   gulong sub_no_more_pads_id;
   gulong sub_autoplug_continue_id;
 
+  gulong block_id;
+
   GMutex *stream_changed_pending_lock;
   GList *stream_changed_pending;
 
@@ -356,7 +356,7 @@ G_STMT_START {                                          \
   GST_PLAY_BIN_DYN_UNLOCK (bin);                  \
 
 /**
- * GstPlayBin2:
+ * GstPlayBin:
  *
  * playbin element structure
  */
@@ -557,8 +557,8 @@ static void no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group);
 static void pad_removed_cb (GstElement * decodebin, GstPad * pad,
     GstSourceGroup * group);
 
-static void gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
-    gboolean block);
+static void gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
+    GstElement * suburidecodebin, gboolean block);
 static void gst_play_bin_suburidecodebin_seek_to_start (GstElement *
     suburidecodebin);
 
@@ -595,7 +595,7 @@ gst_play_bin_get_type (void)
     };
 
     gst_play_bin_type = g_type_register_static (GST_TYPE_PIPELINE,
-        "GstPlayBin2", &gst_play_bin_info, 0);
+        "GstPlayBin", &gst_play_bin_info, 0);
 
     g_type_add_interface_static (gst_play_bin_type, GST_TYPE_STREAM_VOLUME,
         &svol_info);
@@ -623,7 +623,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
   gobject_klass->finalize = gst_play_bin_finalize;
 
   /**
-   * GstPlayBin2:uri
+   * GstPlayBin:uri
    *
    * Set the next URI that playbin will play. This property can be set from the
    * about-to-finish signal to queue the next media file.
@@ -633,7 +633,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:suburi
+   * GstPlayBin:suburi
    *
    * Set the next subtitle URI that playbin will play. This property can be
    * set from the about-to-finish signal to queue the next subtitle media file.
@@ -647,7 +647,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           GST_TYPE_ELEMENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:flags
+   * GstPlayBin:flags
    *
    * Control the behaviour of playbin.
    */
@@ -657,7 +657,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:n-video
+   * GstPlayBin:n-video
    *
    * Get the total number of available video streams.
    */
@@ -666,7 +666,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Total number of video streams", 0, G_MAXINT, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:current-video
+   * GstPlayBin:current-video
    *
    * Get or set the currently playing video stream. By default the first video
    * stream with data is played.
@@ -676,7 +676,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Currently playing video stream (-1 = auto)",
           -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:n-audio
+   * GstPlayBin:n-audio
    *
    * Get the total number of available audio streams.
    */
@@ -685,7 +685,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Total number of audio streams", 0, G_MAXINT, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:current-audio
+   * GstPlayBin:current-audio
    *
    * Get or set the currently playing audio stream. By default the first audio
    * stream with data is played.
@@ -695,7 +695,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Currently playing audio stream (-1 = auto)",
           -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:n-text
+   * GstPlayBin:n-text
    *
    * Get the total number of available subtitle streams.
    */
@@ -704,7 +704,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Total number of text streams", 0, G_MAXINT, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:current-text:
+   * GstPlayBin:current-text:
    *
    * Get or set the currently playing subtitle stream. By default the first
    * subtitle stream with data is played.
@@ -740,7 +740,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:volume:
+   * GstPlayBin:volume:
    *
    * Get or set the current audio stream volume. 1.0 means 100%,
    * 0.0 means mute. This uses a linear volume scale.
@@ -756,14 +756,14 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:frame:
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin:frame:
+   * @playbin: a #GstPlayBin
    *
    * Get the currently rendered or prerolled frame in the video sink.
    * The #GstCaps on the buffer will describe the format of the buffer.
    */
   g_object_class_install_property (gobject_klass, PROP_FRAME,
-      gst_param_spec_mini_object ("frame", "Frame",
+      g_param_spec_boxed ("frame", "Frame",
           "The last frame (NULL = no video available)",
           GST_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_klass, PROP_FONT_DESC,
@@ -790,7 +790,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           -1, G_MAXINT64, DEFAULT_BUFFER_DURATION,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:av-offset:
+   * GstPlayBin:av-offset:
    *
    * Control the synchronisation offset between the audio and video streams.
    * Positive values make the audio ahead of the video and negative values make
@@ -820,8 +820,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2::about-to-finish
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::about-to-finish
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted when the current uri is about to finish. You can
    * set the uri and suburi to make sure that playback continues.
@@ -833,8 +833,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
 
   /**
-   * GstPlayBin2::video-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::video-changed
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted whenever the number or order of the video
    * streams has changed. The application will most likely want to select
@@ -846,8 +846,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, video_changed), NULL, NULL,
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
   /**
-   * GstPlayBin2::audio-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::audio-changed
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted whenever the number or order of the audio
    * streams has changed. The application will most likely want to select
@@ -859,8 +859,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, audio_changed), NULL, NULL,
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
   /**
-   * GstPlayBin2::text-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::text-changed
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted whenever the number or order of the text
    * streams has changed. The application will most likely want to select
@@ -873,8 +873,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
 
   /**
-   * GstPlayBin2::video-tags-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::video-tags-changed
+   * @playbin: a #GstPlayBin
    * @stream: stream index with changed tags
    *
    * This signal is emitted whenever the tags of a video stream have changed.
@@ -889,8 +889,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
 
   /**
-   * GstPlayBin2::audio-tags-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::audio-tags-changed
+   * @playbin: a #GstPlayBin
    * @stream: stream index with changed tags
    *
    * This signal is emitted whenever the tags of an audio stream have changed.
@@ -905,8 +905,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
 
   /**
-   * GstPlayBin2::text-tags-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::text-tags-changed
+   * @playbin: a #GstPlayBin
    * @stream: stream index with changed tags
    *
    * This signal is emitted whenever the tags of a text stream have changed.
@@ -921,8 +921,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
 
   /**
-   * GstPlayBin2::source-setup:
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::source-setup:
+   * @playbin: a #GstPlayBin
    * @source: source element
    *
    * This signal is emitted after the source element has been created, so
@@ -939,8 +939,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
 
   /**
-   * GstPlayBin2::get-video-tags
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-video-tags
+   * @playbin: a #GstPlayBin
    * @stream: a video stream number
    *
    * Action signal to retrieve the tags of a specific video stream number.
@@ -955,8 +955,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_video_tags), NULL, NULL,
       gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-audio-tags
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-audio-tags
+   * @playbin: a #GstPlayBin
    * @stream: an audio stream number
    *
    * Action signal to retrieve the tags of a specific audio stream number.
@@ -971,8 +971,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_audio_tags), NULL, NULL,
       gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-text-tags
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-text-tags
+   * @playbin: a #GstPlayBin
    * @stream: a text stream number
    *
    * Action signal to retrieve the tags of a specific text stream number.
@@ -987,8 +987,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_text_tags), NULL, NULL,
       gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::convert-frame
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::convert-frame
+   * @playbin: a #GstPlayBin
    * @caps: the target format of the frame
    *
    * Action signal to retrieve the currently playing video frame in the format
@@ -1008,8 +1008,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_play_marshal_BUFFER__BOXED, GST_TYPE_BUFFER, 1, GST_TYPE_CAPS);
 
   /**
-   * GstPlayBin2::get-video-pad
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-video-pad
+   * @playbin: a #GstPlayBin
    * @stream: a video stream number
    *
    * Action signal to retrieve the stream-selector sinkpad for a specific
@@ -1025,8 +1025,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_video_pad), NULL, NULL,
       gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-audio-pad
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-audio-pad
+   * @playbin: a #GstPlayBin
    * @stream: an audio stream number
    *
    * Action signal to retrieve the stream-selector sinkpad for a specific
@@ -1042,8 +1042,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_audio_pad), NULL, NULL,
       gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-text-pad
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-text-pad
+   * @playbin: a #GstPlayBin
    * @stream: a text stream number
    *
    * Action signal to retrieve the stream-selector sinkpad for a specific
@@ -1131,7 +1131,7 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
   for (n = 0; n < PLAYBIN_STREAM_LAST; n++) {
     GstSourceSelect *select = &group->selector[n];
     if (select->sinkpad && select->sinkpad_data_probe)
-      gst_pad_remove_data_probe (select->sinkpad, select->sinkpad_data_probe);
+      gst_pad_remove_probe (select->sinkpad, select->sinkpad_data_probe);
     if (select->sinkpad_delayed_event)
       gst_event_unref (select->sinkpad_delayed_event);
   }
@@ -1584,19 +1584,14 @@ no_channels:
 }
 
 static void
-_suburidecodebin_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
-{
-  GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
-}
-
-static void
 gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
 {
   GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
   GstPad *sinkpad;
+  GValue item = { 0, };
 
-  if (it && gst_iterator_next (it, (gpointer) & sinkpad) == GST_ITERATOR_OK
-      && sinkpad) {
+  if (it && gst_iterator_next (it, &item) == GST_ITERATOR_OK
+      && ((sinkpad = g_value_get_object (&item)) != NULL)) {
     GstEvent *event;
 
     event =
@@ -1610,7 +1605,7 @@ gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
         GST_DEBUG_OBJECT (suburidecodebin, "Seeking to the beginning failed!");
     }
 
-    gst_object_unref (sinkpad);
+    g_value_unset (&item);
   }
 
   if (it)
@@ -1618,11 +1613,12 @@ gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
 }
 
 static void
-gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
-    gboolean block)
+gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
+    GstElement * suburidecodebin, gboolean block)
 {
   GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
   gboolean done = FALSE;
+  GValue item = { 0, };
 
   GST_DEBUG_OBJECT (suburidecodebin, "Blocking suburidecodebin: %d", block);
 
@@ -1631,11 +1627,18 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
   while (!done) {
     GstPad *sinkpad;
 
-    switch (gst_iterator_next (it, (gpointer) & sinkpad)) {
+    switch (gst_iterator_next (it, &item)) {
       case GST_ITERATOR_OK:
-        gst_pad_set_blocked_async (sinkpad, block, _suburidecodebin_blocked_cb,
-            NULL);
-        gst_object_unref (sinkpad);
+        sinkpad = g_value_get_object (&item);
+        if (block) {
+          group->block_id =
+              gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
+              NULL);
+        } else if (group->block_id) {
+          gst_pad_remove_probe (sinkpad, group->block_id);
+          group->block_id = 0;
+        }
+        g_value_reset (&item);
         break;
       case GST_ITERATOR_DONE:
         done = TRUE;
@@ -1648,6 +1651,7 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
         break;
     }
   }
+  g_value_unset (&item);
   gst_iterator_free (it);
 }
 
@@ -1722,7 +1726,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
 
         /* Block all suburidecodebin sinkpads */
         if (need_block)
-          gst_play_bin_suburidecodebin_block (group->suburidecodebin, TRUE);
+          gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
+              TRUE);
 
         /* activate the selected pad */
         g_object_set (selector, "active-pad", sinkpad, NULL);
@@ -1745,7 +1750,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
 
         /* Unblock pads if necessary */
         if (need_unblock)
-          gst_play_bin_suburidecodebin_block (group->suburidecodebin, FALSE);
+          gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
+              FALSE);
 
         /* seek to the beginning */
         if (need_seek)
@@ -2199,7 +2205,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
     const GstStructure *s = gst_message_get_structure (msg);
 
     /* Drop all stream-changed messages except the last one */
-    if (strcmp ("playbin2-stream-changed", gst_structure_get_name (s)) == 0) {
+    if (strcmp ("playbin-stream-changed", gst_structure_get_name (s)) == 0) {
       guint32 seqnum = gst_message_get_seqnum (msg);
       GList *l, *l_prev;
 
@@ -2253,6 +2259,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
         GstMessage *new_msg;
         GstIterator *it;
         gboolean done = FALSE;
+        GValue item = { 0, };
 
         gst_message_parse_error (msg, &err, &debug);
         new_msg = gst_message_new_warning (msg->src, err, debug);
@@ -2272,15 +2279,16 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
           GstPad *p = NULL;
           GstIteratorResult res;
 
-          res = gst_iterator_next (it, (gpointer) & p);
+          res = gst_iterator_next (it, &item);
 
           switch (res) {
             case GST_ITERATOR_DONE:
               done = TRUE;
               break;
             case GST_ITERATOR_OK:
+              p = g_value_get_object (&item);
               pad_removed_cb (NULL, p, group);
-              gst_object_unref (p);
+              g_value_reset (&item);
               break;
 
             case GST_ITERATOR_RESYNC:
@@ -2291,6 +2299,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
               break;
           }
         }
+        g_value_unset (&item);
         if (it)
           gst_iterator_free (it);
 
@@ -2361,22 +2370,16 @@ selector_active_pad_changed (GObject * selector, GParamSpec * pspec,
     g_object_notify (G_OBJECT (playbin), property);
 }
 
-static void
-selector_blocked (GstPad * pad, gboolean blocked, gpointer user_data)
-{
-  /* no nothing */
-  GST_DEBUG_OBJECT (pad, "blocked callback, blocked: %d", blocked);
-}
-
 /* this callback sends a delayed event once the pad becomes unblocked */
-static gboolean
-stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
+static GstProbeReturn
+stream_changed_data_probe (GstPad * pad, GstProbeType type,
+    GstMiniObject * object, gpointer data)
 {
   GstSourceSelect *select = (GstSourceSelect *) data;
   GstEvent *e;
 
   /* we need do this just once, so cleanup first */
-  gst_pad_remove_data_probe (pad, select->sinkpad_data_probe);
+  gst_pad_remove_probe (pad, select->sinkpad_data_probe);
   select->sinkpad_data_probe = 0;
   e = select->sinkpad_delayed_event;
   select->sinkpad_delayed_event = NULL;
@@ -2384,20 +2387,20 @@ stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
   /* really, this should not happen */
   if (!e) {
     GST_WARNING ("Data probed called, but no delayed event");
-    return TRUE;
+    return GST_PROBE_OK;
   }
 
   if (GST_IS_EVENT (object)
-      && GST_EVENT_TYPE (GST_EVENT_CAST (object)) == GST_EVENT_NEWSEGMENT) {
+      && GST_EVENT_TYPE (GST_EVENT_CAST (object)) == GST_EVENT_SEGMENT) {
     /* push the event first, then send the delayed one */
     gst_event_ref (GST_EVENT_CAST (object));
     gst_pad_send_event (pad, GST_EVENT_CAST (object));
     gst_pad_send_event (pad, e);
-    return FALSE;
+    return GST_PROBE_DROP;
   } else {
     /* send delayed event, then allow the caller to go on */
     gst_pad_send_event (pad, e);
-    return TRUE;
+    return GST_PROBE_OK;
   }
 }
 
@@ -2471,7 +2474,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
 
   playbin = group->playbin;
 
-  caps = gst_pad_get_caps_reffed (pad);
+  caps = gst_pad_get_caps (pad, NULL);
   s = gst_caps_get_structure (caps, 0);
   name = gst_structure_get_name (s);
 
@@ -2540,7 +2543,9 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
      * streams and connect the sinks, resulting in not-linked errors. After we
      * configured the sinks we will unblock them all. */
     GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad);
-    gst_pad_set_blocked_async (select->srcpad, TRUE, selector_blocked, NULL);
+    select->block_id =
+        gst_pad_add_probe (select->srcpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
+        NULL);
   }
 
   /* get sinkpad for the new stream */
@@ -2553,7 +2558,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
           GST_DEBUG_PAD_NAME (sinkpad));
 
       /* store the selector for the pad */
-      g_object_set_data (G_OBJECT (sinkpad), "playbin2.select", select);
+      g_object_set_data (G_OBJECT (sinkpad), "playbin.select", select);
 
       /* connect to the notify::tags signal for our
        * own *-tags-changed signals
@@ -2567,7 +2572,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
           g_signal_connect_data (G_OBJECT (sinkpad), "notify::tags",
           G_CALLBACK (notify_tags_cb), ntdata, (GClosureNotify) g_free,
           (GConnectFlags) 0);
-      g_object_set_data (G_OBJECT (sinkpad), "playbin2.notify_tags_handler",
+      g_object_set_data (G_OBJECT (sinkpad), "playbin.notify_tags_handler",
           (gpointer) notify_tags_handler);
 
       /* store the pad in the array */
@@ -2579,7 +2584,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
         goto link_failed;
 
       /* store selector pad so we can release it */
-      g_object_set_data (G_OBJECT (pad), "playbin2.sinkpad", sinkpad);
+      g_object_set_data (G_OBJECT (pad), "playbin.sinkpad", sinkpad);
 
       changed = TRUE;
       GST_DEBUG_OBJECT (playbin, "linked pad %s:%s to selector %p",
@@ -2602,7 +2607,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
       case GST_PLAY_SINK_TYPE_VIDEO_RAW:
         /* we want to return NOT_LINKED for unselected pads but only for pads
          * from the normal uridecodebin. This makes sure that subtitle streams
-         * are not raced past audio/video from decodebin2's multiqueue.
+         * are not raced past audio/video from decodebin's multiqueue.
          * For pads from suburidecodebin OK should always be returned, otherwise
          * it will most likely stop. */
         g_object_set (sinkpad, "always-ok", always_ok, NULL);
@@ -2663,18 +2668,18 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
 
   GST_SOURCE_GROUP_LOCK (group);
   /* get the selector sinkpad */
-  if (!(peer = g_object_get_data (G_OBJECT (pad), "playbin2.sinkpad")))
+  if (!(peer = g_object_get_data (G_OBJECT (pad), "playbin.sinkpad")))
     goto not_linked;
 
-  if ((select = g_object_get_data (G_OBJECT (peer), "playbin2.select"))) {
+  if ((select = g_object_get_data (G_OBJECT (peer), "playbin.select"))) {
     gulong notify_tags_handler;
 
     notify_tags_handler =
         (gulong) g_object_get_data (G_OBJECT (peer),
-        "playbin2.notify_tags_handler");
+        "playbin.notify_tags_handler");
     if (notify_tags_handler != 0)
       g_signal_handler_disconnect (G_OBJECT (peer), notify_tags_handler);
-    g_object_set_data (G_OBJECT (peer), "playbin2.notify_tags_handler", NULL);
+    g_object_set_data (G_OBJECT (peer), "playbin.notify_tags_handler", NULL);
 
     /* remove the pad from the array */
     g_ptr_array_remove (select->channels, peer);
@@ -2824,7 +2829,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
         GstEvent *event;
         guint32 seqnum;
 
-        s = gst_structure_new ("playbin2-stream-changed", "uri", G_TYPE_STRING,
+        s = gst_structure_new ("playbin-stream-changed", "uri", G_TYPE_STRING,
             group->uri, NULL);
         if (group->suburi)
           gst_structure_set (s, "suburi", G_TYPE_STRING, group->suburi, NULL);
@@ -2841,17 +2846,17 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
           gst_event_unref (select->sinkpad_delayed_event);
         select->sinkpad_delayed_event = event;
         if (select->sinkpad_data_probe)
-          gst_pad_remove_data_probe (select->sinkpad,
-              select->sinkpad_data_probe);
+          gst_pad_remove_probe (select->sinkpad, select->sinkpad_data_probe);
 
         /* we go to the trouble of setting a probe on the pad to send
-           the playbin2-stream-changed event as sending it here might
+           the playbin-stream-changed event as sending it here might
            find that the pad is blocked, so we'd block here, and the
            pad might not be linked yet. Additionally, sending it here
            apparently would be on the wrong thread */
         select->sinkpad_data_probe =
-            gst_pad_add_data_probe (select->sinkpad,
-            (GCallback) stream_changed_data_probe, (gpointer) select);
+            gst_pad_add_probe (select->sinkpad, GST_PROBE_TYPE_DATA,
+            (GstPadProbeCallback) stream_changed_data_probe, (gpointer) select,
+            NULL);
 
         g_mutex_unlock (group->stream_changed_pending_lock);
         gst_message_unref (msg);
@@ -2860,8 +2865,10 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
       if (select->srcpad) {
         GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
             select->srcpad);
-        gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
-            NULL);
+        if (select->block_id) {
+          gst_pad_remove_probe (select->srcpad, select->block_id);
+          select->block_id = 0;
+        }
       }
     }
     GST_SOURCE_GROUP_UNLOCK (group);
@@ -2893,8 +2900,10 @@ shutdown:
         }
         GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
             select->srcpad);
-        gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
-            NULL);
+        if (select->block_id) {
+          gst_pad_remove_probe (select->srcpad, select->block_id);
+          select->block_id = 0;
+        }
       }
     }
     GST_SOURCE_GROUP_UNLOCK (group);
@@ -2993,7 +3002,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
     if (GST_STATE (sink) < GST_STATE_READY)
       gst_element_set_state (sink, GST_STATE_READY);
 
-    sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+    sinkcaps = gst_pad_get_caps (sinkpad, NULL);
     if (!gst_caps_is_any (sinkcaps))
       ret = !gst_pad_accept_caps (sinkpad, caps);
     gst_caps_unref (sinkcaps);
@@ -3025,7 +3034,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
       if (GST_STATE (sink) < GST_STATE_READY)
         gst_element_set_state (sink, GST_STATE_READY);
 
-      sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+      sinkcaps = gst_pad_get_caps (sinkpad, NULL);
       if (!gst_caps_is_any (sinkcaps))
         ret = !gst_pad_accept_caps (sinkpad, caps);
       gst_caps_unref (sinkcaps);
@@ -3046,7 +3055,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
       if (GST_STATE (sink) < GST_STATE_READY)
         gst_element_set_state (sink, GST_STATE_READY);
 
-      sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+      sinkcaps = gst_pad_get_caps (sinkpad, NULL);
       if (!gst_caps_is_any (sinkcaps))
         ret = !gst_pad_accept_caps (sinkpad, caps);
       gst_caps_unref (sinkcaps);
@@ -3111,8 +3120,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
   GST_DEBUG_OBJECT (playbin, "select group %p for %s:%s, %" GST_PTR_FORMAT,
       group, GST_DEBUG_PAD_NAME (pad), caps);
 
-  GST_DEBUG_OBJECT (playbin, "checking factory %s",
-      GST_PLUGIN_FEATURE_NAME (factory));
+  GST_DEBUG_OBJECT (playbin, "checking factory %s", GST_OBJECT_NAME (factory));
 
   /* if it's not a sink, we just make decodebin try it */
   if (!gst_element_factory_list_is_type (factory,
@@ -3402,7 +3410,7 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
     goto uridecodebin_failure;
 
   GST_SOURCE_GROUP_LOCK (group);
-  /* alow state changes of the playbin2 affect the group elements now */
+  /* alow state changes of the playbin affect the group elements now */
   group_set_locked_state_unlocked (playbin, group, FALSE);
   group->active = TRUE;
   GST_SOURCE_GROUP_UNLOCK (group);
@@ -3799,8 +3807,8 @@ failure:
 gboolean
 gst_play_bin2_plugin_init (GstPlugin * plugin)
 {
-  GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin2", 0, "play bin");
+  GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin", 0, "play bin");
 
-  return gst_element_register (plugin, "playbin2", GST_RANK_NONE,
+  return gst_element_register (plugin, "playbin", GST_RANK_NONE,
       GST_TYPE_PLAY_BIN);
 }
index 019dcc3..e0a540b 100644 (file)
@@ -166,6 +166,7 @@ struct _GstPlaySink
   gboolean audio_pad_blocked;
   GstPad *audio_srcpad_stream_synchronizer;
   GstPad *audio_sinkpad_stream_synchronizer;
+  gulong audio_block_id;
   /* audio tee */
   GstElement *audio_tee;
   GstPad *audio_tee_sink;
@@ -177,11 +178,13 @@ struct _GstPlaySink
   gboolean video_pad_blocked;
   GstPad *video_srcpad_stream_synchronizer;
   GstPad *video_sinkpad_stream_synchronizer;
+  gulong video_block_id;
   /* text */
   GstPad *text_pad;
   gboolean text_pad_blocked;
   GstPad *text_srcpad_stream_synchronizer;
   GstPad *text_sinkpad_stream_synchronizer;
+  gulong text_block_id;
 
   guint32 pending_blocked_pads;
 
@@ -268,7 +271,7 @@ static void gst_play_sink_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * spec);
 
 static GstPad *gst_play_sink_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name);
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
 static void gst_play_sink_release_request_pad (GstElement * element,
     GstPad * pad);
 static gboolean gst_play_sink_send_event (GstElement * element,
@@ -388,7 +391,7 @@ gst_play_sink_class_init (GstPlaySinkClass * klass)
    * Since: 0.10.30
    */
   g_object_class_install_property (gobject_klass, PROP_FRAME,
-      gst_param_spec_mini_object ("frame", "Frame",
+      g_param_spec_boxed ("frame", "Frame",
           "The last frame (NULL = no video available)",
           GST_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
@@ -676,21 +679,9 @@ gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type)
   return result;
 }
 
-static void
-gst_play_sink_vis_unblocked (GstPad * tee_pad, gboolean blocked,
-    gpointer user_data)
-{
-  GstPlaySink *playsink;
-
-  playsink = GST_PLAY_SINK (user_data);
-  /* nothing to do here, we need a dummy callback here to make the async call
-   * non-blocking. */
-  GST_DEBUG_OBJECT (playsink, "vis pad unblocked");
-}
-
-static void
-gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
-    gpointer user_data)
+static GstProbeReturn
+gst_play_sink_vis_blocked (GstPad * tee_pad, GstProbeType type,
+    gpointer type_data, gpointer user_data)
 {
   GstPlaySink *playsink;
   GstPlayVisChain *chain;
@@ -727,10 +718,10 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
       chain->vissrcpad);
 
 done:
-  /* Unblock the pad */
-  gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_sink_vis_unblocked,
-      playsink);
   GST_PLAY_SINK_UNLOCK (playsink);
+
+  /* remove the probe and unblock the pad */
+  return GST_PROBE_REMOVE;
 }
 
 void
@@ -767,8 +758,8 @@ gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis)
    * function returns FALSE but the previous pad block will do the right thing
    * anyway. */
   GST_DEBUG_OBJECT (playsink, "blocking vis pad");
-  gst_pad_set_blocked_async (chain->blockpad, TRUE, gst_play_sink_vis_blocked,
-      playsink);
+  gst_pad_add_probe (chain->blockpad, GST_PROBE_TYPE_BLOCK,
+      gst_play_sink_vis_blocked, playsink, NULL);
 done:
   GST_PLAY_SINK_UNLOCK (playsink);
 
@@ -977,15 +968,14 @@ typedef struct
 } FindPropertyHelper;
 
 static gint
-find_property (GstElement * element, FindPropertyHelper * helper)
+find_property (const GValue * item, FindPropertyHelper * helper)
 {
+  GstElement *element = g_value_get_object (item);
   if (helper->need_sink && !element_is_sink (element)) {
-    gst_object_unref (element);
     return 1;
   }
 
   if (!element_has_property (element, helper->prop_name, helper->prop_type)) {
-    gst_object_unref (element);
     return 1;
   }
 
@@ -1008,15 +998,19 @@ gst_play_sink_find_property_sinks (GstPlaySink * playsink, GstElement * obj,
   if (element_has_property (obj, name, expected_type)) {
     result = obj;
   } else if (GST_IS_BIN (obj)) {
+    gboolean found;
+    GValue item = { 0, };
     FindPropertyHelper helper = { name, expected_type, TRUE };
 
     it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
-    result = gst_iterator_find_custom (it,
-        (GCompareFunc) find_property, &helper);
+    found = gst_iterator_find_custom (it,
+        (GCompareFunc) find_property, &item, &helper);
     gst_iterator_free (it);
-    /* we don't need the extra ref */
-    if (result)
-      gst_object_unref (result);
+    if (found) {
+      result = g_value_get_object (&item);
+      /* we don't need the extra ref */
+      g_value_unset (&item);
+    }
   }
   return result;
 }
@@ -1030,12 +1024,17 @@ gst_play_sink_find_property (GstPlaySink * playsink, GstElement * obj,
   GstIterator *it;
 
   if (GST_IS_BIN (obj)) {
+    gboolean found;
+    GValue item = { 0, };
     FindPropertyHelper helper = { name, expected_type, FALSE };
 
     it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
-    result = gst_iterator_find_custom (it,
-        (GCompareFunc) find_property, &helper);
+    found = gst_iterator_find_custom (it,
+        (GCompareFunc) find_property, &item, &helper);
     gst_iterator_free (it);
+    if (found)
+      result = g_value_dup_object (&item);
+    g_value_unset (&item);
   } else {
     if (element_has_property (obj, name, expected_type)) {
       result = obj;
@@ -1058,7 +1057,7 @@ do_async_start (GstPlaySink * playsink)
   playsink->async_pending = TRUE;
 
   GST_INFO_OBJECT (playsink, "Sending async_start message");
-  message = gst_message_new_async_start (GST_OBJECT_CAST (playsink), FALSE);
+  message = gst_message_new_async_start (GST_OBJECT_CAST (playsink));
   GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
       (playsink), message);
 }
@@ -1070,7 +1069,7 @@ do_async_done (GstPlaySink * playsink)
 
   if (playsink->async_pending) {
     GST_INFO_OBJECT (playsink, "Sending async_done message");
-    message = gst_message_new_async_done (GST_OBJECT_CAST (playsink));
+    message = gst_message_new_async_done (GST_OBJECT_CAST (playsink), FALSE);
     GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
         (playsink), message);
 
@@ -1133,13 +1132,13 @@ gen_video_deinterlace_chain (GstPlaySink * playsink)
   bin = GST_BIN_CAST (chain->chain.bin);
   gst_object_ref_sink (bin);
 
-  GST_DEBUG_OBJECT (playsink, "creating ffmpegcolorspace");
-  chain->conv = gst_element_factory_make ("ffmpegcolorspace", "vdconv");
+  GST_DEBUG_OBJECT (playsink, "creating videoconvert");
+  chain->conv = gst_element_factory_make ("videoconvert", "vdconv");
   if (chain->conv == NULL) {
-    post_missing_element_message (playsink, "ffmpegcolorspace");
+    post_missing_element_message (playsink, "videoconvert");
     GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
         (_("Missing element '%s' - check your GStreamer installation."),
-            "ffmpegcolorspace"), ("video rendering might fail"));
+            "videoconvert"), ("video rendering might fail"));
   } else {
     gst_bin_add (bin, chain->conv);
     head = chain->conv;
@@ -2212,6 +2211,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
       goto no_chain;
 
     if (!playsink->video_sinkpad_stream_synchronizer) {
+      GValue item = { 0, };
       GstIterator *it;
 
       playsink->video_sinkpad_stream_synchronizer =
@@ -2220,8 +2220,9 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
       it = gst_pad_iterate_internal_links
           (playsink->video_sinkpad_stream_synchronizer);
       g_assert (it);
-      gst_iterator_next (it,
-          (gpointer *) & playsink->video_srcpad_stream_synchronizer);
+      gst_iterator_next (it, &item);
+      playsink->video_srcpad_stream_synchronizer = g_value_dup_object (&item);
+      g_value_unset (&item);
       g_assert (playsink->video_srcpad_stream_synchronizer);
       gst_iterator_free (it);
     }
@@ -2368,6 +2369,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
     }
 
     if (!playsink->audio_sinkpad_stream_synchronizer) {
+      GValue item = { 0, };
       GstIterator *it;
 
       playsink->audio_sinkpad_stream_synchronizer =
@@ -2376,8 +2378,9 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
       it = gst_pad_iterate_internal_links
           (playsink->audio_sinkpad_stream_synchronizer);
       g_assert (it);
-      gst_iterator_next (it,
-          (gpointer *) & playsink->audio_srcpad_stream_synchronizer);
+      gst_iterator_next (it, &item);
+      playsink->audio_srcpad_stream_synchronizer = g_value_dup_object (&item);
+      g_value_unset (&item);
       g_assert (playsink->audio_srcpad_stream_synchronizer);
       gst_iterator_free (it);
     }
@@ -2487,14 +2490,17 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
       add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
 
       if (!playsink->text_sinkpad_stream_synchronizer) {
+        GValue item = { 0, };
+
         playsink->text_sinkpad_stream_synchronizer =
             gst_element_get_request_pad (GST_ELEMENT_CAST
             (playsink->stream_synchronizer), "sink_%d");
         it = gst_pad_iterate_internal_links
             (playsink->text_sinkpad_stream_synchronizer);
         g_assert (it);
-        gst_iterator_next (it,
-            (gpointer *) & playsink->text_srcpad_stream_synchronizer);
+        gst_iterator_next (it, &item);
+        playsink->text_srcpad_stream_synchronizer = g_value_dup_object (&item);
+        g_value_unset (&item);
         g_assert (playsink->text_srcpad_stream_synchronizer);
         gst_iterator_free (it);
 
@@ -2807,7 +2813,8 @@ gst_play_sink_convert_frame (GstPlaySink * playsink, GstCaps * caps)
     GstBuffer *temp;
     GError *err = NULL;
 
-    temp = gst_video_convert_frame (result, caps, 25 * GST_SECOND, &err);
+    /* FIXME, need to get the input buffer caps */
+    temp = gst_video_convert_frame (result, NULL, caps, 25 * GST_SECOND, &err);
     gst_buffer_unref (result);
     if (temp == NULL && err) {
       /* I'm really uncertain whether we should make playsink post an error
@@ -2827,8 +2834,8 @@ is_raw_structure (GstStructure * s)
 
   name = gst_structure_get_name (s);
 
-  if (g_str_has_prefix (name, "video/x-raw-") ||
-      g_str_has_prefix (name, "audio/x-raw-"))
+  if (g_str_has_prefix (name, "video/x-raw") ||
+      g_str_has_prefix (name, "audio/x-raw"))
     return TRUE;
   return FALSE;
 }
@@ -2843,11 +2850,11 @@ is_raw_pad (GstPad * pad)
   if (!peer)
     return raw;
 
-  caps = gst_pad_get_negotiated_caps (peer);
+  caps = gst_pad_get_current_caps (peer);
   if (!caps) {
     guint i, n;
 
-    caps = gst_pad_get_caps_reffed (peer);
+    caps = gst_pad_get_caps (peer, NULL);
 
     n = gst_caps_get_size (caps);
     for (i = 0; i < n; i++) {
@@ -2871,8 +2878,78 @@ is_raw_pad (GstPad * pad)
   return raw;
 }
 
+static GstProbeReturn
+sinkpad_blocked_cb (GstPad * blockedpad, GstProbeType type, gpointer type_data,
+    gpointer user_data);
+
 static void
-sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
+video_set_blocked (GstPlaySink * playsink, gboolean blocked)
+{
+  if (playsink->video_pad) {
+    GstPad *opad =
+        GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
+            (playsink->video_pad)));
+    if (blocked && playsink->video_block_id == 0) {
+      playsink->video_block_id =
+          gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
+          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
+    } else if (!blocked && playsink->video_block_id) {
+      gst_pad_remove_probe (opad, playsink->video_block_id);
+      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO_RAW);
+      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO);
+      playsink->video_block_id = 0;
+      playsink->video_pad_blocked = FALSE;
+    }
+    gst_object_unref (opad);
+  }
+}
+
+static void
+audio_set_blocked (GstPlaySink * playsink, gboolean blocked)
+{
+  if (playsink->audio_pad) {
+    GstPad *opad =
+        GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
+            (playsink->audio_pad)));
+    if (blocked && playsink->audio_block_id == 0) {
+      playsink->audio_block_id =
+          gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
+          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
+    } else if (!blocked && playsink->audio_block_id) {
+      gst_pad_remove_probe (opad, playsink->audio_block_id);
+      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO_RAW);
+      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO);
+      playsink->audio_block_id = 0;
+      playsink->audio_pad_blocked = FALSE;
+    }
+    gst_object_unref (opad);
+  }
+}
+
+static void
+text_set_blocked (GstPlaySink * playsink, gboolean blocked)
+{
+  if (playsink->text_pad) {
+    GstPad *opad =
+        GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
+            (playsink->text_pad)));
+    if (blocked && playsink->text_block_id == 0) {
+      playsink->text_block_id =
+          gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
+          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
+    } else if (!blocked && playsink->text_block_id) {
+      gst_pad_remove_probe (opad, playsink->text_block_id);
+      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_TEXT);
+      playsink->text_block_id = 0;
+      playsink->text_pad_blocked = FALSE;
+    }
+    gst_object_unref (opad);
+  }
+}
+
+static GstProbeReturn
+sinkpad_blocked_cb (GstPad * blockedpad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
   GstPlaySink *playsink = (GstPlaySink *) user_data;
   GstPad *pad;
@@ -2881,30 +2958,14 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
 
   pad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (blockedpad)));
   if (pad == playsink->video_pad) {
-    playsink->video_pad_blocked = blocked;
-    GST_DEBUG_OBJECT (pad, "Video pad blocked: %d", blocked);
-    if (!blocked) {
-      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO_RAW);
-      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO);
-    }
+    playsink->video_pad_blocked = TRUE;
+    GST_DEBUG_OBJECT (pad, "Video pad blocked");
   } else if (pad == playsink->audio_pad) {
-    playsink->audio_pad_blocked = blocked;
-    GST_DEBUG_OBJECT (pad, "Audio pad blocked: %d", blocked);
-    if (!blocked) {
-      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO_RAW);
-      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO);
-    }
+    playsink->audio_pad_blocked = TRUE;
+    GST_DEBUG_OBJECT (pad, "Audio pad blocked");
   } else if (pad == playsink->text_pad) {
-    playsink->text_pad_blocked = blocked;
-    GST_DEBUG_OBJECT (pad, "Text pad blocked: %d", blocked);
-    if (!blocked)
-      PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_TEXT);
-  }
-
-  if (!blocked) {
-    gst_object_unref (pad);
-    GST_PLAY_SINK_UNLOCK (playsink);
-    return;
+    playsink->text_pad_blocked = TRUE;
+    GST_DEBUG_OBJECT (pad, "Text pad blocked");
   }
 
   /* We reconfigure when for ALL streams:
@@ -2934,37 +2995,16 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
 
     gst_play_sink_reconfigure (playsink);
 
-    if (playsink->video_pad) {
-      GstPad *opad =
-          GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-              (playsink->video_pad)));
-      gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
-          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-      gst_object_unref (opad);
-    }
-
-    if (playsink->audio_pad) {
-      GstPad *opad =
-          GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-              (playsink->audio_pad)));
-      gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
-          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-      gst_object_unref (opad);
-    }
-
-    if (playsink->text_pad) {
-      GstPad *opad =
-          GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-              (playsink->text_pad)));
-      gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
-          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-      gst_object_unref (opad);
-    }
+    video_set_blocked (playsink, FALSE);
+    audio_set_blocked (playsink, FALSE);
+    text_set_blocked (playsink, FALSE);
   }
 
   gst_object_unref (pad);
 
   GST_PLAY_SINK_UNLOCK (playsink);
+
+  return GST_PROBE_OK;
 }
 
 static void
@@ -2998,32 +3038,9 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
 
   if (reconfigure) {
     GST_PLAY_SINK_LOCK (playsink);
-    if (playsink->video_pad) {
-      GstPad *opad =
-          GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-              (playsink->video_pad)));
-      gst_pad_set_blocked_async_full (opad, TRUE, sinkpad_blocked_cb,
-          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-      gst_object_unref (opad);
-    }
-
-    if (playsink->audio_pad) {
-      GstPad *opad =
-          GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-              (playsink->audio_pad)));
-      gst_pad_set_blocked_async_full (opad, TRUE, sinkpad_blocked_cb,
-          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-      gst_object_unref (opad);
-    }
-
-    if (playsink->text_pad) {
-      GstPad *opad =
-          GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-              (playsink->text_pad)));
-      gst_pad_set_blocked_async_full (opad, TRUE, sinkpad_blocked_cb,
-          gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-      gst_object_unref (opad);
-    }
+    video_set_blocked (playsink, TRUE);
+    audio_set_blocked (playsink, TRUE);
+    text_set_blocked (playsink, TRUE);
     GST_PLAY_SINK_UNLOCK (playsink);
   }
 }
@@ -3044,6 +3061,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
   gboolean created = FALSE;
   gboolean activate = TRUE;
   const gchar *pad_name = NULL;
+  gulong *block_id = NULL;
 
   GST_DEBUG_OBJECT (playsink, "request pad type %d", type);
 
@@ -3083,6 +3101,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
       }
       playsink->audio_pad_raw = FALSE;
       res = playsink->audio_pad;
+      block_id = &playsink->audio_block_id;
       break;
     case GST_PLAY_SINK_TYPE_VIDEO_RAW:
     case GST_PLAY_SINK_TYPE_VIDEO:
@@ -3097,6 +3116,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
       }
       playsink->video_pad_raw = FALSE;
       res = playsink->video_pad;
+      block_id = &playsink->video_block_id;
       break;
     case GST_PLAY_SINK_TYPE_TEXT:
       GST_LOG_OBJECT (playsink, "ghosting text");
@@ -3106,6 +3126,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
         created = TRUE;
       }
       res = playsink->text_pad;
+      block_id = &playsink->text_block_id;
       break;
     case GST_PLAY_SINK_TYPE_FLUSHING:
     {
@@ -3131,11 +3152,12 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
      * element is 'running' */
     gst_pad_set_active (res, TRUE);
     gst_element_add_pad (GST_ELEMENT_CAST (playsink), res);
-    if (type != GST_PLAY_SINK_TYPE_FLUSHING) {
+    if (block_id && *block_id == 0) {
       GstPad *blockpad =
           GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res)));
 
-      gst_pad_set_blocked_async_full (blockpad, TRUE, sinkpad_blocked_cb,
+      *block_id =
+          gst_pad_add_probe (blockpad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
           gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
       PENDING_FLAG_SET (playsink, type);
       gst_object_unref (blockpad);
@@ -3149,7 +3171,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
 
 static GstPad *
 gst_play_sink_request_new_pad (GstElement * element, GstPadTemplate * templ,
-    const gchar * name)
+    const gchar * name, const GstCaps * caps)
 {
   GstPlaySink *psink;
   GstPad *pad;
@@ -3384,42 +3406,9 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       /* unblock all pads here */
       GST_PLAY_SINK_LOCK (playsink);
-      if (playsink->video_pad) {
-        GstPad *opad =
-            GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-                (playsink->video_pad)));
-        if (gst_pad_is_blocked (opad)) {
-          gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
-              gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-        }
-        gst_object_unref (opad);
-        playsink->video_pad_blocked = FALSE;
-      }
-
-      if (playsink->audio_pad) {
-        GstPad *opad =
-            GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-                (playsink->audio_pad)));
-
-        if (gst_pad_is_blocked (opad)) {
-          gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
-              gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-        }
-        gst_object_unref (opad);
-        playsink->audio_pad_blocked = FALSE;
-      }
-
-      if (playsink->text_pad) {
-        GstPad *opad =
-            GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
-                (playsink->text_pad)));
-        if (gst_pad_is_blocked (opad)) {
-          gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
-              gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
-        }
-        gst_object_unref (opad);
-        playsink->text_pad_blocked = FALSE;
-      }
+      video_set_blocked (playsink, FALSE);
+      audio_set_blocked (playsink, FALSE);
+      text_set_blocked (playsink, FALSE);
       GST_PLAY_SINK_UNLOCK (playsink);
       /* fall through */
     case GST_STATE_CHANGE_READY_TO_NULL:
index a10ab96..08f356e 100644 (file)
@@ -72,46 +72,23 @@ post_missing_element_message (GstPlaySinkAudioConvert * self,
   gst_element_post_message (GST_ELEMENT_CAST (self), msg);
 }
 
-static void
-distribute_running_time (GstElement * element, const GstSegment * segment)
-{
-  GstEvent *event;
-  GstPad *pad;
-
-  pad = gst_element_get_static_pad (element, "sink");
-
-  if (segment->accum) {
-    event = gst_event_new_new_segment_full (FALSE, segment->rate,
-        segment->applied_rate, segment->format, 0, segment->accum, 0);
-    gst_pad_push_event (pad, event);
-  }
-
-  event = gst_event_new_new_segment_full (FALSE, segment->rate,
-      segment->applied_rate, segment->format,
-      segment->start, segment->stop, segment->time);
-  gst_pad_push_event (pad, event);
-
-  gst_object_unref (pad);
-}
-
-static void
-pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
+static GstProbeReturn
+pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstPlaySinkAudioConvert *self = user_data;
   GstPad *peer;
   GstCaps *caps;
   gboolean raw;
 
   GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
-  self->sink_proxypad_blocked = blocked;
-  GST_DEBUG_OBJECT (self, "Pad blocked: %d", blocked);
-  if (!blocked)
-    goto done;
+  GST_DEBUG_OBJECT (self, "Pad blocked");
 
   /* There must be a peer at this point */
   peer = gst_pad_get_peer (self->sinkpad);
-  caps = gst_pad_get_negotiated_caps (peer);
+  caps = gst_pad_get_current_caps (peer);
   if (!caps)
-    caps = gst_pad_get_caps_reffed (peer);
+    caps = gst_pad_get_caps (peer, NULL);
   gst_object_unref (peer);
 
   raw = is_raw_caps (caps);
@@ -142,7 +119,6 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
       } else {
         gst_bin_add (bin, self->conv);
         gst_element_sync_state_with_parent (self->conv);
-        distribute_running_time (self->conv, &self->segment);
         prev = head = self->conv;
       }
 
@@ -155,7 +131,6 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
       } else {
         gst_bin_add (bin, self->resample);
         gst_element_sync_state_with_parent (self->resample);
-        distribute_running_time (self->resample, &self->segment);
         if (prev) {
           if (!gst_element_link_pads_full (prev, "src", self->resample, "sink",
                   GST_PAD_LINK_CHECK_TEMPLATE_CAPS))
@@ -170,7 +145,6 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
     if (self->use_volume && self->volume) {
       gst_bin_add (bin, gst_object_ref (self->volume));
       gst_element_sync_state_with_parent (self->volume);
-      distribute_running_time (self->volume, &self->segment);
       if (prev) {
         if (!gst_element_link_pads_full (prev, "src", self->volume, "sink",
                 GST_PAD_LINK_CHECK_TEMPLATE_CAPS))
@@ -231,13 +205,10 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
   }
 
 unblock:
-  gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
-      (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-      (GDestroyNotify) gst_object_unref);
-
-done:
+  self->sink_proxypad_block_id = 0;
   GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
-  return;
+
+  return GST_PROBE_REMOVE;
 
 link_failed:
   {
@@ -245,60 +216,37 @@ link_failed:
         (NULL), ("Failed to configure the audio converter."));
     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
         self->sink_proxypad);
-    gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
-        (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
-
+    self->sink_proxypad_block_id = 0;
     GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
-    return;
+
+    return GST_PROBE_REMOVE;
   }
 }
 
-static gboolean
-gst_play_sink_audio_convert_sink_event (GstPad * pad, GstEvent * event)
+static void
+block_proxypad (GstPlaySinkAudioConvert * self)
 {
-  GstPlaySinkAudioConvert *self =
-      GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
-  gboolean ret;
-
-  ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
-
-  if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
-    gboolean update;
-    gdouble rate, applied_rate;
-    GstFormat format;
-    gint64 start, stop, position;
-
-    GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
-    gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-        &format, &start, &stop, &position);
-
-    GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
-        &self->segment);
-    gst_segment_set_newsegment_full (&self->segment, update, rate, applied_rate,
-        format, start, stop, position);
-    GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
-        &self->segment);
-    GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
-  } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
-    GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
-    GST_DEBUG_OBJECT (self, "Resetting segment");
-    gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
-    GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
+  if (self->sink_proxypad_block_id == 0) {
+    self->sink_proxypad_block_id =
+        gst_pad_add_probe (self->sink_proxypad, GST_PROBE_TYPE_BLOCK,
+        pad_blocked_cb, gst_object_ref (self),
+        (GDestroyNotify) gst_object_unref);
   }
+}
 
-  gst_event_unref (event);
-  gst_object_unref (self);
-
-  return ret;
+static void
+unblock_proxypad (GstPlaySinkAudioConvert * self)
+{
+  if (self->sink_proxypad_block_id != 0) {
+    gst_pad_remove_probe (self->sink_proxypad, self->sink_proxypad_block_id);
+    self->sink_proxypad_block_id = 0;
+  }
 }
 
 static gboolean
-gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_play_sink_audio_convert_sink_setcaps (GstPlaySinkAudioConvert * self,
+    GstCaps * caps)
 {
-  GstPlaySinkAudioConvert *self =
-      GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
-  gboolean ret;
   GstStructure *s;
   const gchar *name;
   gboolean reconfigure = FALSE;
@@ -307,21 +255,17 @@ gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
   s = gst_caps_get_structure (caps, 0);
   name = gst_structure_get_name (s);
 
-  if (g_str_has_prefix (name, "audio/x-raw-")) {
+  if (g_str_has_prefix (name, "audio/x-raw")) {
     if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
       GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
       reconfigure = TRUE;
-      gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
-          (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_proxypad (self);
     }
   } else {
     if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
       GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
       reconfigure = TRUE;
-      gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
-          (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_proxypad (self);
     }
   }
 
@@ -332,18 +276,62 @@ gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
   }
 
   GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
-  ret = gst_ghost_pad_setcaps_default (pad, caps);
 
-  GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT ": %d", caps,
-      ret);
+  GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT, caps);
+
+  return TRUE;
+}
+
+static gboolean
+gst_play_sink_audio_convert_sink_event (GstPad * pad, GstEvent * event)
+{
+  GstPlaySinkAudioConvert *self =
+      GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
+  gboolean ret;
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_play_sink_audio_convert_sink_setcaps (self, caps);
+      break;
+    }
+    default:
+      break;
+  }
+
+  ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
 
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_SEGMENT:
+      GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
+      GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
+          &self->segment);
+      gst_event_copy_segment (event, &self->segment);
+      GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
+          &self->segment);
+      GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
+      break;
+    case GST_EVENT_FLUSH_STOP:
+      GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
+      GST_DEBUG_OBJECT (self, "Resetting segment");
+      gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+      GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
+      break;
+    default:
+      break;
+  }
+
+  gst_event_unref (event);
   gst_object_unref (self);
 
   return ret;
 }
 
 static GstCaps *
-gst_play_sink_audio_convert_getcaps (GstPad * pad)
+gst_play_sink_audio_convert_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstPlaySinkAudioConvert *self =
       GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
@@ -359,10 +347,10 @@ gst_play_sink_audio_convert_getcaps (GstPad * pad)
 
   peer = gst_pad_get_peer (otherpad);
   if (peer) {
-    ret = gst_pad_get_caps_reffed (peer);
+    ret = gst_pad_get_caps (peer, filter);
     gst_object_unref (peer);
   } else {
-    ret = gst_caps_new_any ();
+    ret = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
   }
 
   gst_object_unref (otherpad);
@@ -395,10 +383,7 @@ gst_play_sink_audio_convert_change_state (GstElement * element,
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
-      if (gst_pad_is_blocked (self->sink_proxypad))
-        gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
-            (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
+      unblock_proxypad (self);
       GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
       break;
     default:
@@ -436,10 +421,7 @@ gst_play_sink_audio_convert_change_state (GstElement * element,
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
-      if (!gst_pad_is_blocked (self->sink_proxypad))
-        gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
-            (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
+      unblock_proxypad (self);
       GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
     default:
       break;
@@ -487,8 +469,6 @@ gst_play_sink_audio_convert_init (GstPlaySinkAudioConvert * self)
   self->sinkpad = gst_ghost_pad_new_no_target_from_template ("sink", templ);
   gst_pad_set_event_function (self->sinkpad,
       GST_DEBUG_FUNCPTR (gst_play_sink_audio_convert_sink_event));
-  gst_pad_set_setcaps_function (self->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_play_sink_audio_convert_sink_setcaps));
   gst_pad_set_getcaps_function (self->sinkpad,
       GST_DEBUG_FUNCPTR (gst_play_sink_audio_convert_getcaps));
 
index e7d48bc..f9a0791 100644 (file)
@@ -64,7 +64,7 @@ struct _GstPlaySinkAudioConvert
   GMutex *lock;
 
   GstPad *sinkpad, *sink_proxypad;
-  gboolean sink_proxypad_blocked;
+  gulong sink_proxypad_block_id;
   GstSegment segment;
 
   GstPad *srcpad;
index dc87e5f..494d44a 100644 (file)
@@ -72,46 +72,23 @@ post_missing_element_message (GstPlaySinkVideoConvert * self,
   gst_element_post_message (GST_ELEMENT_CAST (self), msg);
 }
 
-static void
-distribute_running_time (GstElement * element, const GstSegment * segment)
-{
-  GstEvent *event;
-  GstPad *pad;
-
-  pad = gst_element_get_static_pad (element, "sink");
-
-  if (segment->accum) {
-    event = gst_event_new_new_segment_full (FALSE, segment->rate,
-        segment->applied_rate, segment->format, 0, segment->accum, 0);
-    gst_pad_push_event (pad, event);
-  }
-
-  event = gst_event_new_new_segment_full (FALSE, segment->rate,
-      segment->applied_rate, segment->format,
-      segment->start, segment->stop, segment->time);
-  gst_pad_push_event (pad, event);
-
-  gst_object_unref (pad);
-}
-
-static void
-pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self)
+static GstProbeReturn
+pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstPlaySinkVideoConvert *self = user_data;
   GstPad *peer;
   GstCaps *caps;
   gboolean raw;
 
   GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
-  self->sink_proxypad_blocked = blocked;
-  GST_DEBUG_OBJECT (self, "Pad blocked: %d", blocked);
-  if (!blocked)
-    goto done;
+  GST_DEBUG_OBJECT (self, "Pad blocked");
 
   /* There must be a peer at this point */
   peer = gst_pad_get_peer (self->sinkpad);
-  caps = gst_pad_get_negotiated_caps (peer);
+  caps = gst_pad_get_current_caps (peer);
   if (!caps)
-    caps = gst_pad_get_caps_reffed (peer);
+    caps = gst_pad_get_caps (peer, NULL);
   gst_object_unref (peer);
 
   raw = is_raw_caps (caps);
@@ -132,16 +109,15 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self)
     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->sinkpad), NULL);
     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL);
 
-    self->conv = gst_element_factory_make ("ffmpegcolorspace", "conv");
+    self->conv = gst_element_factory_make ("videoconvert", "conv");
     if (self->conv == NULL) {
-      post_missing_element_message (self, "ffmpegcolorspace");
+      post_missing_element_message (self, "videoconvert");
       GST_ELEMENT_WARNING (self, CORE, MISSING_PLUGIN,
           (_("Missing element '%s' - check your GStreamer installation."),
-              "ffmpegcolorspace"), ("video rendering might fail"));
+              "videoconvert"), ("video rendering might fail"));
     } else {
       gst_bin_add (bin, self->conv);
       gst_element_sync_state_with_parent (self->conv);
-      distribute_running_time (self->conv, &self->segment);
       prev = head = self->conv;
     }
 
@@ -156,7 +132,6 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self)
       g_object_set (self->scale, "add-borders", TRUE, NULL);
       gst_bin_add (bin, self->scale);
       gst_element_sync_state_with_parent (self->scale);
-      distribute_running_time (self->scale, &self->segment);
       if (prev) {
         if (!gst_element_link_pads_full (prev, "src", self->scale, "sink",
                 GST_PAD_LINK_CHECK_TEMPLATE_CAPS))
@@ -211,13 +186,10 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self)
   }
 
 unblock:
-  gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
-      (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-      (GDestroyNotify) gst_object_unref);
-
-done:
+  self->sink_proxypad_block_id = 0;
   GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
-  return;
+
+  return GST_PROBE_REMOVE;
 
 link_failed:
   {
@@ -225,60 +197,37 @@ link_failed:
         (NULL), ("Failed to configure the video converter."));
     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
         self->sink_proxypad);
-    gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
-        (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
-
+    self->sink_proxypad_block_id = 0;
     GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
-    return;
+
+    return GST_PROBE_REMOVE;
   }
 }
 
-static gboolean
-gst_play_sink_video_convert_sink_event (GstPad * pad, GstEvent * event)
+static void
+block_proxypad (GstPlaySinkVideoConvert * self)
 {
-  GstPlaySinkVideoConvert *self =
-      GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
-  gboolean ret;
-
-  ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
-
-  if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
-    gboolean update;
-    gdouble rate, applied_rate;
-    GstFormat format;
-    gint64 start, stop, position;
-
-    GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
-    gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-        &format, &start, &stop, &position);
-
-    GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
-        &self->segment);
-    gst_segment_set_newsegment_full (&self->segment, update, rate, applied_rate,
-        format, start, stop, position);
-    GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
-        &self->segment);
-    GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
-  } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
-    GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
-    GST_DEBUG_OBJECT (self, "Resetting segment");
-    gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
-    GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
+  if (self->sink_proxypad_block_id == 0) {
+    self->sink_proxypad_block_id =
+        gst_pad_add_probe (self->sink_proxypad, GST_PROBE_TYPE_BLOCK,
+        pad_blocked_cb, gst_object_ref (self),
+        (GDestroyNotify) gst_object_unref);
   }
+}
 
-  gst_event_unref (event);
-  gst_object_unref (self);
-
-  return ret;
+static void
+unblock_proxypad (GstPlaySinkVideoConvert * self)
+{
+  if (self->sink_proxypad_block_id != 0) {
+    gst_pad_remove_probe (self->sink_proxypad, self->sink_proxypad_block_id);
+    self->sink_proxypad_block_id = 0;
+  }
 }
 
 static gboolean
-gst_play_sink_video_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_play_sink_video_convert_sink_setcaps (GstPlaySinkVideoConvert * self,
+    GstCaps * caps)
 {
-  GstPlaySinkVideoConvert *self =
-      GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
-  gboolean ret;
   GstStructure *s;
   const gchar *name;
   gboolean reconfigure = FALSE;
@@ -287,21 +236,17 @@ gst_play_sink_video_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
   s = gst_caps_get_structure (caps, 0);
   name = gst_structure_get_name (s);
 
-  if (g_str_has_prefix (name, "video/x-raw-")) {
+  if (g_str_has_prefix (name, "video/x-raw")) {
     if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
       GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
       reconfigure = TRUE;
-      gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
-          (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_proxypad (self);
     }
   } else {
     if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
       GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
       reconfigure = TRUE;
-      gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
-          (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_proxypad (self);
     }
   }
 
@@ -312,18 +257,61 @@ gst_play_sink_video_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
   }
   GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
 
-  ret = gst_ghost_pad_setcaps_default (pad, caps);
+  GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT, caps);
+
+  return TRUE;
+}
+
+static gboolean
+gst_play_sink_video_convert_sink_event (GstPad * pad, GstEvent * event)
+{
+  GstPlaySinkVideoConvert *self =
+      GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
+  gboolean ret;
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_play_sink_video_convert_sink_setcaps (self, caps);
+      break;
+    }
+    default:
+      break;
+  }
+
+  ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
 
-  GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT ": %d", caps,
-      ret);
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_SEGMENT:
+      GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
+      GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
+          &self->segment);
+      gst_event_copy_segment (event, &self->segment);
+      GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
+          &self->segment);
+      GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
+      break;
+    case GST_EVENT_FLUSH_STOP:
+      GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
+      GST_DEBUG_OBJECT (self, "Resetting segment");
+      gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+      GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
+      break;
+    default:
+      break;
+  }
 
+  gst_event_unref (event);
   gst_object_unref (self);
 
   return ret;
 }
 
 static GstCaps *
-gst_play_sink_video_convert_getcaps (GstPad * pad)
+gst_play_sink_video_convert_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstPlaySinkVideoConvert *self =
       GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
@@ -339,10 +327,10 @@ gst_play_sink_video_convert_getcaps (GstPad * pad)
 
   peer = gst_pad_get_peer (otherpad);
   if (peer) {
-    ret = gst_pad_get_caps_reffed (peer);
+    ret = gst_pad_get_caps (peer, filter);
     gst_object_unref (peer);
   } else {
-    ret = gst_caps_new_any ();
+    ret = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
   }
 
   gst_object_unref (otherpad);
@@ -372,10 +360,7 @@ gst_play_sink_video_convert_change_state (GstElement * element,
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
-      if (gst_pad_is_blocked (self->sink_proxypad))
-        gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
-            (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
+      unblock_proxypad (self);
       GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
       break;
     default:
@@ -408,9 +393,7 @@ gst_play_sink_video_convert_change_state (GstElement * element,
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
       if (!gst_pad_is_blocked (self->sink_proxypad))
-        gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
-            (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
+        block_proxypad (self);
       GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
     default:
       break;
@@ -458,8 +441,6 @@ gst_play_sink_video_convert_init (GstPlaySinkVideoConvert * self)
   self->sinkpad = gst_ghost_pad_new_no_target_from_template ("sink", templ);
   gst_pad_set_event_function (self->sinkpad,
       GST_DEBUG_FUNCPTR (gst_play_sink_video_convert_sink_event));
-  gst_pad_set_setcaps_function (self->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_play_sink_video_convert_sink_setcaps));
   gst_pad_set_getcaps_function (self->sinkpad,
       GST_DEBUG_FUNCPTR (gst_play_sink_video_convert_getcaps));
 
index 83b3b1e..9c32976 100644 (file)
@@ -64,7 +64,7 @@ struct _GstPlaySinkVideoConvert
   GMutex *lock;
 
   GstPad *sinkpad, *sink_proxypad;
-  gboolean sink_proxypad_blocked;
+  gulong sink_proxypad_block_id;
   GstSegment segment;
 
   GstPad *srcpad;
index 0297e33..7f9ef35 100644 (file)
 G_BEGIN_DECLS
 
 #define DEFAULT_RAW_CAPS \
-    "video/x-raw-yuv; " \
-    "video/x-raw-rgb; " \
-    "video/x-raw-gray; " \
-    "audio/x-raw-int; " \
-    "audio/x-raw-float; " \
+    "video/x-raw; " \
+    "audio/x-raw; " \
     "text/plain; " \
     "text/x-pango-markup; " \
     "video/x-dvd-subpicture; " \
diff --git a/gst/playback/gststreaminfo.c b/gst/playback/gststreaminfo.c
deleted file mode 100644 (file)
index 86ec58a..0000000
+++ /dev/null
@@ -1,402 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-#include "gststreaminfo.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_streaminfo_debug);
-#define GST_CAT_DEFAULT gst_streaminfo_debug
-
-/* props */
-enum
-{
-  ARG_0,
-  ARG_PAD,
-  ARG_TYPE,
-  ARG_DECODER,
-  ARG_MUTE,
-  ARG_CAPS,
-  ARG_LANG_CODE,
-  ARG_CODEC
-};
-
-/* signals */
-enum
-{
-  SIGNAL_MUTED,
-  LAST_SIGNAL
-};
-
-static guint gst_stream_info_signals[LAST_SIGNAL] = { 0 };
-
-#define GST_TYPE_STREAM_TYPE (gst_stream_type_get_type())
-static GType
-gst_stream_type_get_type (void)
-{
-  static GType stream_type_type = 0;
-  static const GEnumValue stream_type[] = {
-    {GST_STREAM_TYPE_UNKNOWN, "Unknown stream", "unknown"},
-    {GST_STREAM_TYPE_AUDIO, "Audio stream", "audio"},
-    {GST_STREAM_TYPE_VIDEO, "Video stream", "video"},
-    {GST_STREAM_TYPE_TEXT, "Text stream", "text"},
-    {GST_STREAM_TYPE_SUBPICTURE, "Subpicture stream", "subpicture"},
-    {GST_STREAM_TYPE_ELEMENT,
-        "Stream handled by element", "element"},
-    {0, NULL, NULL},
-  };
-
-  if (!stream_type_type) {
-    stream_type_type = g_enum_register_static ("GstStreamType", stream_type);
-  }
-  return stream_type_type;
-}
-
-static void gst_stream_info_class_init (GstStreamInfoClass * klass);
-static void gst_stream_info_init (GstStreamInfo * stream_info);
-static void gst_stream_info_dispose (GObject * object);
-
-static void stream_info_change_state (GstElement * element,
-    gint old_state, gint new_state, gpointer data);
-
-static void gst_stream_info_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * spec);
-static void gst_stream_info_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * spec);
-
-static GObjectClass *parent_class;
-
-//static guint gst_stream_info_signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_stream_info_get_type (void)
-{
-  static GType gst_stream_info_type = 0;
-
-  if (!gst_stream_info_type) {
-    static const GTypeInfo gst_stream_info_info = {
-      sizeof (GstStreamInfoClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_stream_info_class_init,
-      NULL,
-      NULL,
-      sizeof (GstStreamInfo),
-      0,
-      (GInstanceInitFunc) gst_stream_info_init,
-      NULL
-    };
-    gst_stream_info_type = g_type_register_static (G_TYPE_OBJECT,
-        "GstStreamInfo", &gst_stream_info_info, 0);
-  }
-
-  return gst_stream_info_type;
-}
-
-static void
-gst_stream_info_class_init (GstStreamInfoClass * klass)
-{
-  GObjectClass *gobject_klass;
-
-  gobject_klass = (GObjectClass *) klass;
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_klass->set_property = gst_stream_info_set_property;
-  gobject_klass->get_property = gst_stream_info_get_property;
-
-  g_object_class_install_property (gobject_klass, ARG_PAD,
-      g_param_spec_object ("object", "object",
-          "Source Pad or object of the stream", GST_TYPE_OBJECT,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_TYPE,
-      g_param_spec_enum ("type", "Type", "Type of the stream",
-          GST_TYPE_STREAM_TYPE, GST_STREAM_TYPE_UNKNOWN,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_DECODER,
-      g_param_spec_string ("decoder", "Decoder",
-          "The decoder used to decode the stream", NULL,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_MUTE,
-      g_param_spec_boolean ("mute", "Mute", "Mute or unmute this stream", FALSE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_CAPS,
-      g_param_spec_boxed ("caps", "Capabilities",
-          "Capabilities (or type) of this stream", GST_TYPE_CAPS,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_LANG_CODE,
-      g_param_spec_string ("language-code", "Language code",
-          "Language code for this stream, conforming to ISO-639-1", NULL,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_klass, ARG_CODEC,
-      g_param_spec_string ("codec", "Codec", "Codec used to encode the stream",
-          NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  gst_stream_info_signals[SIGNAL_MUTED] =
-      g_signal_new ("muted", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
-      G_STRUCT_OFFSET (GstStreamInfoClass, muted), NULL, NULL,
-      gst_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
-  gobject_klass->dispose = gst_stream_info_dispose;
-
-  GST_DEBUG_CATEGORY_INIT (gst_streaminfo_debug, "streaminfo", 0,
-      "Playbin Stream Info");
-}
-
-
-static void
-gst_stream_info_init (GstStreamInfo * stream_info)
-{
-  stream_info->object = NULL;
-  stream_info->origin = NULL;
-  stream_info->type = GST_STREAM_TYPE_UNKNOWN;
-  stream_info->decoder = NULL;
-  stream_info->mute = FALSE;
-  stream_info->caps = NULL;
-}
-
-static gboolean
-cb_probe (GstPad * pad, GstEvent * e, gpointer user_data)
-{
-  GstStreamInfo *info = user_data;
-
-  if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
-    gchar *codec, *lang;
-    GstTagList *list;
-
-    gst_event_parse_tag (e, &list);
-
-    if (info->type != GST_STREAM_TYPE_AUDIO &&
-        gst_tag_list_get_string (list, GST_TAG_VIDEO_CODEC, &codec)) {
-      g_free (info->codec);
-      info->codec = codec;
-      GST_LOG_OBJECT (pad, "codec = %s (video)", codec);
-      g_object_notify (G_OBJECT (info), "codec");
-    } else if (info->type != GST_STREAM_TYPE_VIDEO &&
-        gst_tag_list_get_string (list, GST_TAG_AUDIO_CODEC, &codec)) {
-      g_free (info->codec);
-      info->codec = codec;
-      GST_LOG_OBJECT (pad, "codec = %s (audio)", codec);
-      g_object_notify (G_OBJECT (info), "codec");
-    } else if (gst_tag_list_get_string (list, GST_TAG_CODEC, &codec)) {
-      g_free (info->codec);
-      info->codec = codec;
-      GST_LOG_OBJECT (pad, "codec = %s (generic)", codec);
-      g_object_notify (G_OBJECT (info), "codec");
-    }
-    if (gst_tag_list_get_string (list, GST_TAG_LANGUAGE_CODE, &lang)) {
-      g_free (info->langcode);
-      info->langcode = lang;
-      GST_LOG_OBJECT (pad, "language-code = %s", lang);
-      g_object_notify (G_OBJECT (info), "language-code");
-    }
-  }
-
-  return TRUE;
-}
-
-GstStreamInfo *
-gst_stream_info_new (GstObject * object,
-    GstStreamType type, const gchar * decoder, const GstCaps * caps)
-{
-  GstStreamInfo *info;
-
-  info = g_object_new (GST_TYPE_STREAM_INFO, NULL);
-
-  gst_object_ref (object);
-  if (GST_IS_PAD (object)) {
-    gst_pad_add_event_probe (GST_PAD_CAST (object),
-        G_CALLBACK (cb_probe), info);
-  }
-  info->object = object;
-  info->type = type;
-  info->decoder = g_strdup (decoder);
-  info->origin = object;
-  if (caps) {
-    info->caps = gst_caps_copy (caps);
-  }
-
-  return info;
-}
-
-static void
-gst_stream_info_dispose (GObject * object)
-{
-  GstStreamInfo *stream_info;
-
-  stream_info = GST_STREAM_INFO (object);
-
-  if (stream_info->object) {
-    GstElement *parent;
-
-    parent = gst_pad_get_parent_element ((GstPad *)
-        GST_PAD_CAST (stream_info->object));
-    if (parent != NULL) {
-      g_signal_handlers_disconnect_by_func (parent,
-          (gpointer) stream_info_change_state, stream_info);
-      gst_object_unref (parent);
-    }
-
-    gst_object_unref (stream_info->object);
-    stream_info->object = NULL;
-  }
-  stream_info->origin = NULL;
-  stream_info->type = GST_STREAM_TYPE_UNKNOWN;
-  g_free (stream_info->decoder);
-  stream_info->decoder = NULL;
-  g_free (stream_info->langcode);
-  stream_info->langcode = NULL;
-  g_free (stream_info->codec);
-  stream_info->codec = NULL;
-  if (stream_info->caps) {
-    gst_caps_unref (stream_info->caps);
-    stream_info->caps = NULL;
-  }
-
-  if (G_OBJECT_CLASS (parent_class)->dispose) {
-    G_OBJECT_CLASS (parent_class)->dispose (object);
-  }
-}
-
-static void
-stream_info_change_state (GstElement * element,
-    gint old_state, gint new_state, gpointer data)
-{
-  GstStreamInfo *stream_info = data;
-
-  if (new_state == GST_STATE_PLAYING) {
-    /* state change will annoy us */
-    g_return_if_fail (stream_info->mute == TRUE);
-    GST_DEBUG_OBJECT (stream_info, "Re-muting pads after state-change");
-    //gst_pad_set_active_recursive (GST_PAD (stream_info->object), FALSE);
-    g_warning ("FIXME");
-  }
-}
-
-gboolean
-gst_stream_info_set_mute (GstStreamInfo * stream_info, gboolean mute)
-{
-  g_return_val_if_fail (GST_IS_STREAM_INFO (stream_info), FALSE);
-
-  if (stream_info->type == GST_STREAM_TYPE_ELEMENT) {
-    g_warning ("cannot mute element stream");
-    return FALSE;
-  }
-
-  if (mute != stream_info->mute) {
-    /* nothing really happens here. it looks like gstplaybasebin installs a
-     * buffer probe hat drops buffers when muting. but the this removes it self
-     * after first call.
-     */
-
-    stream_info->mute = mute;
-#if 0
-    gst_pad_set_active ((GstPad *) GST_PAD_CAST (stream_info->object), !mute);
-#endif
-#if 0
-    {
-      GstElement *element;
-
-      element = gst_pad_get_parent_element ((GstPad *)
-          GST_PAD_CAST (stream_info->object));
-      if (element) {
-        if (mute) {
-          g_signal_connect (element, "state-changed",
-              G_CALLBACK (stream_info_change_state), stream_info);
-        } else {
-          g_signal_handlers_disconnect_by_func (element,
-              G_CALLBACK (stream_info_change_state), stream_info);
-        }
-        gst_object_unref (element);
-      }
-    }
-#endif
-  }
-  return TRUE;
-}
-
-gboolean
-gst_stream_info_is_mute (GstStreamInfo * stream_info)
-{
-  g_return_val_if_fail (GST_IS_STREAM_INFO (stream_info), TRUE);
-
-  return stream_info->mute;
-}
-
-static void
-gst_stream_info_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstStreamInfo *stream_info;
-
-  g_return_if_fail (GST_IS_STREAM_INFO (object));
-
-  stream_info = GST_STREAM_INFO (object);
-
-  switch (prop_id) {
-    case ARG_MUTE:
-      gst_stream_info_set_mute (stream_info, g_value_get_boolean (value));
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_stream_info_get_property (GObject * object, guint prop_id, GValue * value,
-    GParamSpec * pspec)
-{
-  GstStreamInfo *stream_info;
-
-  g_return_if_fail (GST_IS_STREAM_INFO (object));
-
-  stream_info = GST_STREAM_INFO (object);
-
-  switch (prop_id) {
-    case ARG_PAD:
-      g_value_set_object (value, stream_info->object);
-      break;
-    case ARG_TYPE:
-      g_value_set_enum (value, stream_info->type);
-      break;
-    case ARG_DECODER:
-      g_value_set_string (value, stream_info->decoder);
-      break;
-    case ARG_MUTE:
-      g_value_set_boolean (value, stream_info->mute);
-      break;
-    case ARG_CAPS:
-      g_value_set_boxed (value, stream_info->caps);
-      break;
-    case ARG_LANG_CODE:
-      g_value_set_string (value, stream_info->langcode);
-      break;
-    case ARG_CODEC:
-      g_value_set_string (value, stream_info->codec);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
diff --git a/gst/playback/gststreaminfo.h b/gst/playback/gststreaminfo.h
deleted file mode 100644 (file)
index b4157ea..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *               <2007> Wim Taymans <wim.taymans@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_STREAMINFO_H__
-#define __GST_STREAMINFO_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_STREAM_INFO            (gst_stream_info_get_type())
-#define GST_STREAM_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STREAM_INFO,GstStreamInfo))
-#define GST_STREAM_INFO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STREAM_INFO,GstStreamInfoClass))
-#define GST_IS_STREAM_INFO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STREAM_INFO))
-#define GST_IS_STREAM_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STREAM_INFO))
-
-typedef struct _GstStreamInfo GstStreamInfo;
-typedef struct _GstStreamInfoClass GstStreamInfoClass;
-
-typedef enum {
-  GST_STREAM_TYPE_UNKNOWN = 0,
-  GST_STREAM_TYPE_AUDIO   = 1,    /* an audio stream */
-  GST_STREAM_TYPE_VIDEO   = 2,    /* a video stream */
-  GST_STREAM_TYPE_TEXT    = 3,    /* a subtitle/text stream */
-  GST_STREAM_TYPE_SUBPICTURE = 4, /* a subtitle in picture-form */
-  GST_STREAM_TYPE_ELEMENT = 5    /* stream handled by an element */
-} GstStreamType;
-
-struct _GstStreamInfo {
-  GObject        parent;
-
-  GstObject     *object;        /* pad/element providing/handling this stream */
-  GstStreamType  type;          /* the type of the provided stream */
-  gchar         *decoder;       /* string describing the decoder */
-  gboolean       mute;          /* is the stream muted or not */
-  GstObject     *origin;        /* the real object providing this stream, this can
-                                   be different from the object as the object can be
-                                   a queue pad, inserted for preroll. */
-  GstCaps       *caps;          /* the caps of the stream */
-
-  /* this is tream information cached here because the streaminfo may be
-   * created before the app can know about it. */
-  gchar         *langcode,
-                *codec;
-};
-
-struct _GstStreamInfoClass {
-  GObjectClass   parent_class;
-
-  /* signals */
-  void (*muted) (GstStreamInfo *info, gboolean mute);
-};
-
-GType gst_stream_info_get_type (void);
-
-GstStreamInfo*  gst_stream_info_new             (GstObject     *object,
-                                                 GstStreamType  type,
-                                                 const gchar   *decoder,
-                                                 const GstCaps *caps);
-
-gboolean        gst_stream_info_set_mute        (GstStreamInfo *stream_info, 
-                                                 gboolean mute);
-gboolean        gst_stream_info_is_mute         (GstStreamInfo *stream_info);
-
-
-G_END_DECLS
-
-#endif /* __GST_STREAMINFO_H__ */
index 294eac4..24f0031 100644 (file)
@@ -101,10 +101,8 @@ static GstPadClass *selector_pad_parent_class = NULL;
 
 static void gst_selector_pad_reset (GstSelectorPad * pad);
 static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
-static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
+static GstCaps *gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter);
 static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
 
 enum
 {
@@ -239,24 +237,12 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_FLUSH_STOP:
       gst_selector_pad_reset (selpad);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      gboolean update;
-      GstFormat format;
-      gdouble rate, arate;
-      gint64 start, stop, time;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
-
-      GST_DEBUG_OBJECT (selpad,
-          "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
-          "format %d, "
-          "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
-          G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
-
-      gst_segment_set_newsegment_full (&selpad->segment, update,
-          rate, arate, format, start, stop, time);
+      gst_event_copy_segment (event, &selpad->segment);
+
+      GST_DEBUG_OBJECT (selpad, "configured SEGMENT %" GST_SEGMENT_FORMAT,
+          &selpad->segment);
       /* if we are not going to forward the segment, mark the segment as
        * pending */
       if (!forward)
@@ -295,7 +281,7 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
 }
 
 static GstCaps *
-gst_selector_pad_getcaps (GstPad * pad)
+gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstStreamSelector *sel;
   GstCaps *caps;
@@ -303,9 +289,9 @@ gst_selector_pad_getcaps (GstPad * pad)
   sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
 
   GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer");
-  caps = gst_pad_peer_get_caps (sel->srcpad);
+  caps = gst_pad_peer_get_caps (sel->srcpad, filter);
   if (caps == NULL)
-    caps = gst_caps_new_any ();
+    caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
 
   gst_object_unref (sel);
 
@@ -313,48 +299,6 @@ gst_selector_pad_getcaps (GstPad * pad)
 }
 
 static GstFlowReturn
-gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf)
-{
-  GstStreamSelector *sel;
-  GstFlowReturn result;
-  GstPad *active_sinkpad;
-
-  sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
-
-  active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
-
-  /* Fallback allocation for buffers from pads except the selected one */
-  if (pad != active_sinkpad) {
-    GST_DEBUG_OBJECT (sel,
-        "Pad %s:%s is not selected. Performing fallback allocation",
-        GST_DEBUG_PAD_NAME (pad));
-
-    *buf = NULL;
-    result = GST_FLOW_OK;
-  } else {
-    result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
-
-    /* FIXME: HACK. If buffer alloc returns not-linked, perform a fallback
-     * allocation.  This should NOT be necessary, because playbin should
-     * properly block the source pad from running until it's finished hooking 
-     * everything up, but playbin needs refactoring first. */
-    if (result == GST_FLOW_NOT_LINKED) {
-      GST_DEBUG_OBJECT (sel,
-          "No peer pad yet - performing fallback allocation for pad %s:%s",
-          GST_DEBUG_PAD_NAME (pad));
-
-      *buf = NULL;
-      result = GST_FLOW_OK;
-    }
-  }
-
-  gst_object_unref (sel);
-
-  return result;
-}
-
-static GstFlowReturn
 gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
 {
   GstStreamSelector *sel;
@@ -374,7 +318,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
   if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
     GST_DEBUG_OBJECT (sel, "received timestamp %" GST_TIME_FORMAT,
         GST_TIME_ARGS (timestamp));
-    gst_segment_set_last_stop (seg, seg->format, timestamp);
+    seg->position = timestamp;
   }
 
   /* Ignore buffers from pads except the selected one */
@@ -383,10 +327,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
 
   /* if we have a pending segment, push it out now */
   if (selpad->segment_pending) {
-    gst_pad_push_event (sel->srcpad, gst_event_new_new_segment_full (FALSE,
-            seg->rate, seg->applied_rate, seg->format, seg->start, seg->stop,
-            seg->time));
-
+    gst_pad_push_event (sel->srcpad, gst_event_new_segment (seg));
     selpad->segment_pending = FALSE;
   }
 
@@ -420,11 +361,11 @@ static void gst_stream_selector_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
 static GstPad *gst_stream_selector_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * unused);
+    GstPadTemplate * templ, const gchar * unused, const GstCaps * caps);
 static void gst_stream_selector_release_pad (GstElement * element,
     GstPad * pad);
 static GstIterator *gst_stream_selector_pad_iterate_linked_pads (GstPad * pad);
-static GstCaps *gst_stream_selector_getcaps (GstPad * pad);
+static GstCaps *gst_stream_selector_getcaps (GstPad * pad, GstCaps * filter);
 
 static GstElementClass *parent_class = NULL;
 
@@ -611,7 +552,7 @@ gst_stream_selector_get_linked_pad (GstPad * pad, gboolean strict)
 }
 
 static GstCaps *
-gst_stream_selector_getcaps (GstPad * pad)
+gst_stream_selector_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstPad *otherpad;
   GstObject *parent;
@@ -622,15 +563,15 @@ gst_stream_selector_getcaps (GstPad * pad)
   if (!otherpad) {
     GST_DEBUG_OBJECT (parent,
         "Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad));
-    caps = gst_caps_new_any ();
+    caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
   } else {
     GST_DEBUG_OBJECT (parent,
         "Pad %s:%s is linked (to %s:%s), returning peer caps",
         GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad));
     /* if the peer has caps, use those. If the pad is not linked, this function
      * returns NULL and we return ANY */
-    if (!(caps = gst_pad_peer_get_caps (otherpad)))
-      caps = gst_caps_new_any ();
+    if (!(caps = gst_pad_peer_get_caps (otherpad, filter)))
+      caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
     gst_object_unref (otherpad);
   }
 
@@ -677,16 +618,18 @@ static GstIterator *
 gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
 {
   GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
+  GValue value = { 0, };
   GstPad *otherpad;
-  GstIterator *ret;
+  GstIterator *ret = NULL;
 
   otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
-  ret =
-      gst_iterator_new_single (GST_TYPE_PAD, otherpad,
-      (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
-
-  if (otherpad)
+  if (otherpad) {
+    g_value_init (&value, GST_TYPE_PAD);
+    g_value_set_object (&value, otherpad);
+    ret = gst_iterator_new_single (GST_TYPE_PAD, &value);
+    g_value_unset (&value);
     gst_object_unref (otherpad);
+  }
   gst_object_unref (sel);
 
   return ret;
@@ -694,7 +637,7 @@ gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
 
 static GstPad *
 gst_stream_selector_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * unused)
+    GstPadTemplate * templ, const gchar * unused, const GstCaps * caps)
 {
   GstStreamSelector *sel;
   gchar *name = NULL;
@@ -719,8 +662,6 @@ gst_stream_selector_request_new_pad (GstElement * element,
       GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
   gst_pad_set_iterate_internal_links_function (sinkpad,
       GST_DEBUG_FUNCPTR (gst_stream_selector_pad_iterate_linked_pads));
-  gst_pad_set_bufferalloc_function (sinkpad,
-      GST_DEBUG_FUNCPTR (gst_selector_pad_bufferalloc));
 
   gst_pad_set_active (sinkpad, TRUE);
   gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
index 9a48ab0..017a944 100644 (file)
@@ -54,8 +54,9 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink_%d",
 
 static const gboolean passthrough = TRUE;
 
-GST_BOILERPLATE (GstStreamSynchronizer, gst_stream_synchronizer,
-    GstElement, GST_TYPE_ELEMENT);
+#define gst_stream_synchronizer_parent_class parent_class
+G_DEFINE_TYPE (GstStreamSynchronizer, gst_stream_synchronizer,
+    GST_TYPE_ELEMENT);
 
 typedef struct
 {
@@ -120,8 +121,12 @@ gst_stream_synchronizer_iterate_internal_links (GstPad * pad)
 
   opad = gst_stream_get_other_pad_from_pad (pad);
   if (opad) {
-    it = gst_iterator_new_single (GST_TYPE_PAD, opad,
-        (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
+    GValue value = { 0, };
+
+    g_value_init (&value, GST_TYPE_PAD);
+    g_value_set_object (&value, opad);
+    it = gst_iterator_new_single (GST_TYPE_PAD, &value);
+    g_value_unset (&value);
     gst_object_unref (opad);
   }
 
@@ -146,19 +151,19 @@ gst_stream_synchronizer_query (GstPad * pad, GstQuery * query)
 }
 
 static GstCaps *
-gst_stream_synchronizer_getcaps (GstPad * pad)
+gst_stream_synchronizer_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstPad *opad;
   GstCaps *ret = NULL;
 
   opad = gst_stream_get_other_pad_from_pad (pad);
   if (opad) {
-    ret = gst_pad_peer_get_caps (opad);
+    ret = gst_pad_peer_get_caps (opad, filter);
     gst_object_unref (opad);
   }
 
   if (ret == NULL)
-    ret = gst_caps_new_any ();
+    ret = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
 
   GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);
 
@@ -196,7 +201,7 @@ gst_stream_synchronizer_src_event (GstPad * pad, GstEvent * event)
     goto skip_adjustments;
 
   GST_LOG_OBJECT (pad, "Handling event %s: %" GST_PTR_FORMAT,
-      GST_EVENT_TYPE_NAME (event), event->structure);
+      GST_EVENT_TYPE_NAME (event), event);
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_QOS:{
@@ -206,7 +211,7 @@ gst_stream_synchronizer_src_event (GstPad * pad, GstEvent * event)
       gint64 running_time_diff;
       GstStream *stream;
 
-      gst_event_parse_qos (event, &proportion, &diff, &timestamp);
+      gst_event_parse_qos (event, NULL, &proportion, &diff, &timestamp);
       gst_event_unref (event);
 
       GST_STREAM_SYNCHRONIZER_LOCK (self);
@@ -240,7 +245,9 @@ gst_stream_synchronizer_src_event (GstPad * pad, GstEvent * event)
         goto out;
       }
 
-      event = gst_event_new_qos (proportion, diff, timestamp);
+      event =
+          gst_event_new_qos (GST_QOS_TYPE_UNDERFLOW, proportion, diff,
+          timestamp);
       break;
     }
     default:
@@ -274,16 +281,14 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
     goto skip_adjustments;
 
   GST_LOG_OBJECT (pad, "Handling event %s: %" GST_PTR_FORMAT,
-      GST_EVENT_TYPE_NAME (event), event->structure);
+      GST_EVENT_TYPE_NAME (event), event);
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SINK_MESSAGE:{
       GstMessage *message;
 
       gst_event_parse_sink_message (event, &message);
-      if (message->structure
-          && gst_structure_has_name (message->structure,
-              "playbin2-stream-changed")) {
+      if (gst_message_has_name (message, "playbin-stream-changed")) {
         GstStream *stream;
 
         GST_STREAM_SYNCHRONIZER_LOCK (self);
@@ -306,29 +311,29 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
               break;
           }
           if (all_wait) {
-            gint64 last_stop = 0;
+            gint64 position = 0;
 
             GST_DEBUG_OBJECT (self, "All streams have changed -- unblocking");
 
             for (l = self->streams; l; l = l->next) {
               GstStream *ostream = l->data;
               gint64 stop_running_time;
-              gint64 last_stop_running_time;
+              gint64 position_running_time;
 
               ostream->wait = FALSE;
 
               stop_running_time =
                   gst_segment_to_running_time (&ostream->segment,
                   GST_FORMAT_TIME, ostream->segment.stop);
-              last_stop_running_time =
+              position_running_time =
                   gst_segment_to_running_time (&ostream->segment,
-                  GST_FORMAT_TIME, ostream->segment.last_stop);
-              last_stop =
-                  MAX (last_stop, MAX (stop_running_time,
-                      last_stop_running_time));
+                  GST_FORMAT_TIME, ostream->segment.position);
+              position =
+                  MAX (position, MAX (stop_running_time,
+                      position_running_time));
             }
-            last_stop = MAX (0, last_stop);
-            self->group_start_time = MAX (self->group_start_time, last_stop);
+            position = MAX (0, position);
+            self->group_start_time = MAX (self->group_start_time, position);
 
             GST_DEBUG_OBJECT (self, "New group start time: %" GST_TIME_FORMAT,
                 GST_TIME_ARGS (self->group_start_time));
@@ -341,15 +346,11 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
       gst_message_unref (message);
       break;
     }
-    case GST_EVENT_NEWSEGMENT:{
+    case GST_EVENT_SEGMENT:{
       GstStream *stream;
-      gboolean update;
-      gdouble rate, applied_rate;
-      GstFormat format;
-      gint64 start, stop, position;
+      GstSegment segment;
 
-      gst_event_parse_new_segment_full (event,
-          &update, &rate, &applied_rate, &format, &start, &stop, &position);
+      gst_event_copy_segment (event, &segment);
 
       GST_STREAM_SYNCHRONIZER_LOCK (self);
       stream = gst_pad_get_element_private (pad);
@@ -369,41 +370,35 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
         goto done;
       }
 
-      if (stream && format == GST_FORMAT_TIME) {
+      if (stream && segment.format == GST_FORMAT_TIME) {
         if (stream->new_stream) {
-          gint64 last_stop_running_time = 0;
+          gint64 position_running_time = 0;
           gint64 stop_running_time = 0;
 
           if (stream->segment.format == GST_FORMAT_TIME) {
-            last_stop_running_time =
+            position_running_time =
                 gst_segment_to_running_time (&stream->segment, GST_FORMAT_TIME,
-                stream->segment.last_stop);
-            last_stop_running_time = MAX (last_stop_running_time, 0);
+                stream->segment.position);
+            position_running_time = MAX (position_running_time, 0);
             stop_running_time =
                 gst_segment_to_running_time (&stream->segment, GST_FORMAT_TIME,
                 stream->segment.stop);
-            stop_running_time = MAX (last_stop_running_time, 0);
+            stop_running_time = MAX (position_running_time, 0);
 
-            if (stop_running_time != last_stop_running_time) {
+            if (stop_running_time != position_running_time) {
               GST_WARNING_OBJECT (pad,
-                  "Gap between last_stop and segment stop: %" GST_TIME_FORMAT
+                  "Gap between position and segment stop: %" GST_TIME_FORMAT
                   " != %" GST_TIME_FORMAT, GST_TIME_ARGS (stop_running_time),
-                  GST_TIME_ARGS (last_stop_running_time));
+                  GST_TIME_ARGS (position_running_time));
             }
 
-            if (stop_running_time < last_stop_running_time) {
+            if (stop_running_time < position_running_time) {
               GST_DEBUG_OBJECT (pad, "Updating stop position");
+              stream->segment.stop = stream->segment.position;
               gst_pad_push_event (stream->srcpad,
-                  gst_event_new_new_segment_full (TRUE, stream->segment.rate,
-                      stream->segment.applied_rate, GST_FORMAT_TIME,
-                      stream->segment.start, stream->segment.last_stop,
-                      stream->segment.time));
-              gst_segment_set_newsegment_full (&stream->segment, TRUE,
-                  stream->segment.rate, stream->segment.applied_rate,
-                  GST_FORMAT_TIME, stream->segment.start,
-                  stream->segment.last_stop, stream->segment.time);
+                  gst_event_new_segment (&stream->segment));
             }
-            stop_running_time = MAX (stop_running_time, last_stop_running_time);
+            stop_running_time = MAX (stop_running_time, position_running_time);
             GST_DEBUG_OBJECT (pad,
                 "Stop running time of last group: %" GST_TIME_FORMAT,
                 GST_TIME_ARGS (stop_running_time));
@@ -417,27 +412,23 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
             GST_DEBUG_OBJECT (pad,
                 "Advancing running time for other streams by: %"
                 GST_TIME_FORMAT, GST_TIME_ARGS (diff));
-            gst_pad_push_event (stream->srcpad,
-                gst_event_new_new_segment_full (FALSE, 1.0, 1.0,
-                    GST_FORMAT_TIME, 0, diff, 0));
-            gst_segment_set_newsegment_full (&stream->segment, FALSE, 1.0, 1.0,
-                GST_FORMAT_TIME, 0, diff, 0);
+
+            segment.base += diff;
           }
         }
 
         GST_DEBUG_OBJECT (pad, "Segment was: %" GST_SEGMENT_FORMAT,
             &stream->segment);
-        gst_segment_set_newsegment_full (&stream->segment, update, rate,
-            applied_rate, format, start, stop, position);
+        gst_segment_copy_into (&segment, &stream->segment);
         GST_DEBUG_OBJECT (pad, "Segment now is: %" GST_SEGMENT_FORMAT,
             &stream->segment);
 
         GST_DEBUG_OBJECT (pad, "Stream start running time: %" GST_TIME_FORMAT,
-            GST_TIME_ARGS (stream->segment.accum));
-        stream->running_time_diff = stream->segment.accum;
+            GST_TIME_ARGS (stream->segment.base));
+        stream->running_time_diff = stream->segment.base;
       } else if (stream) {
         GST_WARNING_OBJECT (pad, "Non-TIME segment: %s",
-            gst_format_get_name (format));
+            gst_format_get_name (segment.format));
         gst_segment_init (&stream->segment, GST_FORMAT_UNDEFINED);
       }
       GST_STREAM_SYNCHRONIZER_UNLOCK (self);
@@ -523,7 +514,6 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
         if (!seen_data) {
           GstBuffer *buf = gst_buffer_new ();
 
-          GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_PREROLL);
           gst_pad_push (srcpad, buf);
         }
       }
@@ -550,26 +540,6 @@ done:
 }
 
 static GstFlowReturn
-gst_stream_synchronizer_sink_bufferalloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf)
-{
-  GstPad *opad;
-  GstFlowReturn ret = GST_FLOW_ERROR;
-
-  GST_LOG_OBJECT (pad, "Allocating buffer: size=%u", size);
-
-  opad = gst_stream_get_other_pad_from_pad (pad);
-  if (opad) {
-    ret = gst_pad_alloc_buffer (opad, offset, size, caps, buf);
-    gst_object_unref (opad);
-  }
-
-  GST_LOG_OBJECT (pad, "Allocation: %s", gst_flow_get_name (ret));
-
-  return ret;
-}
-
-static GstFlowReturn
 gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstStreamSynchronizer *self =
@@ -589,10 +559,10 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
     goto done;
   }
 
-  GST_LOG_OBJECT (pad, "Handling buffer %p: size=%u, timestamp=%"
-      GST_TIME_FORMAT " duration=%" GST_TIME_FORMAT
+  GST_LOG_OBJECT (pad, "Handling buffer %p: size=%" G_GSIZE_FORMAT
+      ", timestamp=%" GST_TIME_FORMAT " duration=%" GST_TIME_FORMAT
       " offset=%" G_GUINT64_FORMAT " offset_end=%" G_GUINT64_FORMAT,
-      buffer, GST_BUFFER_SIZE (buffer),
+      buffer, gst_buffer_get_size (buffer),
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
       GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)),
       GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer));
@@ -607,7 +577,7 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
 
   stream->seen_data = TRUE;
   if (stream && stream->drop_discont) {
-    buffer = gst_buffer_make_metadata_writable (buffer);
+    buffer = gst_buffer_make_writable (buffer);
     GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
     stream->drop_discont = FALSE;
   }
@@ -616,8 +586,8 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
       && GST_CLOCK_TIME_IS_VALID (timestamp)) {
     GST_LOG_OBJECT (pad,
         "Updating last-stop from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
-        GST_TIME_ARGS (stream->segment.last_stop), GST_TIME_ARGS (timestamp));
-    gst_segment_set_last_stop (&stream->segment, GST_FORMAT_TIME, timestamp);
+        GST_TIME_ARGS (stream->segment.position), GST_TIME_ARGS (timestamp));
+    stream->segment.position = timestamp;
   }
   GST_STREAM_SYNCHRONIZER_UNLOCK (self);
 
@@ -637,28 +607,27 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
         && GST_CLOCK_TIME_IS_VALID (timestamp_end)) {
       GST_LOG_OBJECT (pad,
           "Updating last-stop from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (stream->segment.last_stop),
+          GST_TIME_ARGS (stream->segment.position),
           GST_TIME_ARGS (timestamp_end));
-      gst_segment_set_last_stop (&stream->segment, GST_FORMAT_TIME,
-          timestamp_end);
+      stream->segment.position = timestamp_end;
     }
 
     /* Advance EOS streams if necessary. For non-EOS
      * streams the demuxers should already do this! */
     for (l = self->streams; l; l = l->next) {
       GstStream *ostream = l->data;
-      gint64 last_stop;
+      gint64 position;
 
       if (!ostream->is_eos || ostream->segment.format != GST_FORMAT_TIME)
         continue;
 
-      if (ostream->segment.last_stop != -1)
-        last_stop = ostream->segment.last_stop;
+      if (ostream->segment.position != -1)
+        position = ostream->segment.position;
       else
-        last_stop = ostream->segment.start;
+        position = ostream->segment.start;
 
       /* Is there a 1 second lag? */
-      if (last_stop != -1 && last_stop + GST_SECOND < timestamp_end) {
+      if (position != -1 && position + GST_SECOND < timestamp_end) {
         gint64 new_start, new_stop;
 
         new_start = timestamp_end - GST_SECOND;
@@ -669,18 +638,16 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
 
         GST_DEBUG_OBJECT (ostream->sinkpad,
             "Advancing stream %u from %" GST_TIME_FORMAT " to %"
-            GST_TIME_FORMAT, ostream->stream_number, GST_TIME_ARGS (last_stop),
+            GST_TIME_FORMAT, ostream->stream_number, GST_TIME_ARGS (position),
             GST_TIME_ARGS (new_start));
 
+        ostream->segment.start = new_start;
+        ostream->segment.stop = new_stop;
+        ostream->segment.time = new_start;
+        ostream->segment.position = new_start;
+
         gst_pad_push_event (ostream->srcpad,
-            gst_event_new_new_segment_full (TRUE, ostream->segment.rate,
-                ostream->segment.applied_rate, ostream->segment.format,
-                new_start, new_stop, new_start));
-        gst_segment_set_newsegment_full (&ostream->segment, TRUE,
-            ostream->segment.rate, ostream->segment.applied_rate,
-            ostream->segment.format, new_start, new_stop, new_start);
-        gst_segment_set_last_stop (&ostream->segment, GST_FORMAT_TIME,
-            new_start);
+            gst_event_new_segment (&ostream->segment));
       }
     }
     GST_STREAM_SYNCHRONIZER_UNLOCK (self);
@@ -696,7 +663,7 @@ done:
 /* GstElement vfuncs */
 static GstPad *
 gst_stream_synchronizer_request_new_pad (GstElement * element,
-    GstPadTemplate * temp, const gchar * name)
+    GstPadTemplate * temp, const gchar * name, const GstCaps * caps)
 {
   GstStreamSynchronizer *self = GST_STREAM_SYNCHRONIZER (element);
   GstStream *stream;
@@ -726,8 +693,6 @@ gst_stream_synchronizer_request_new_pad (GstElement * element,
       GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_event));
   gst_pad_set_chain_function (stream->sinkpad,
       GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_chain));
-  gst_pad_set_bufferalloc_function (stream->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_bufferalloc));
 
   tmp = g_strdup_printf ("src_%d", self->current_stream_number);
   stream->srcpad = gst_pad_new_from_static_template (&srctemplate, tmp);
@@ -794,15 +759,15 @@ gst_stream_synchronizer_release_stream (GstStreamSynchronizer * self,
 
   if (stream->segment.format == GST_FORMAT_TIME) {
     gint64 stop_running_time;
-    gint64 last_stop_running_time;
+    gint64 position_running_time;
 
     stop_running_time =
         gst_segment_to_running_time (&stream->segment, GST_FORMAT_TIME,
         stream->segment.stop);
-    last_stop_running_time =
+    position_running_time =
         gst_segment_to_running_time (&stream->segment, GST_FORMAT_TIME,
-        stream->segment.last_stop);
-    stop_running_time = MAX (stop_running_time, last_stop_running_time);
+        stream->segment.position);
+    stop_running_time = MAX (stop_running_time, position_running_time);
 
     GST_DEBUG_OBJECT (stream->sinkpad,
         "Stop running time was: %" GST_TIME_FORMAT,
@@ -943,30 +908,13 @@ gst_stream_synchronizer_finalize (GObject * object)
 
 /* GObject type initialization */
 static void
-gst_stream_synchronizer_init (GstStreamSynchronizer * self,
-    GstStreamSynchronizerClass * klass)
+gst_stream_synchronizer_init (GstStreamSynchronizer * self)
 {
   self->lock = g_mutex_new ();
   self->stream_finish_cond = g_cond_new ();
 }
 
 static void
-gst_stream_synchronizer_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&srctemplate));
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&sinktemplate));
-
-  gst_element_class_set_details_simple (gstelement_class,
-      "Stream Synchronizer", "Generic",
-      "Synchronizes a group of streams to have equal durations and starting points",
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
 gst_stream_synchronizer_class_init (GstStreamSynchronizerClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
@@ -977,6 +925,16 @@ gst_stream_synchronizer_class_init (GstStreamSynchronizerClass * klass)
 
   gobject_class->finalize = gst_stream_synchronizer_finalize;
 
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&srctemplate));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sinktemplate));
+
+  gst_element_class_set_details_simple (element_class,
+      "Stream Synchronizer", "Generic",
+      "Synchronizes a group of streams to have equal durations and starting points",
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
   element_class->change_state =
       GST_DEBUG_FUNCPTR (gst_stream_synchronizer_change_state);
   element_class->request_new_pad =
index 0ec7ee5..6b9e1c8 100644 (file)
@@ -29,7 +29,7 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch -v filesrc location=test.mkv ! matroskademux name=demux ! "video/x-h264" ! queue2 ! decodebin2 ! subtitleoverlay name=overlay ! ffmpegcolorspace ! autovideosink  demux. ! "video/x-dvd-subpicture" ! queue2 ! overlay.
+ * gst-launch -v filesrc location=test.mkv ! matroskademux name=demux ! "video/x-h264" ! queue2 ! decodebin ! subtitleoverlay name=overlay ! videoconvert ! autovideosink  demux. ! "video/x-dvd-subpicture" ! queue2 ! overlay.
  * ]| This will play back the given Matroska file with h264 video and subpicture subtitles.
  * </refsect2>
  */
@@ -79,11 +79,8 @@ enum
   PROP_SUBTITLE_ENCODING
 };
 
-GST_BOILERPLATE (GstSubtitleOverlay, gst_subtitle_overlay, GstBin,
-    GST_TYPE_BIN);
-
-static void _pad_blocked_cb (GstPad * pad, gboolean blocked,
-    gpointer user_data);
+#define gst_subtitle_overlay_parent_class parent_class
+G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN);
 
 static GQuark _subtitle_overlay_event_marker_id = 0;
 
@@ -91,11 +88,10 @@ static void
 do_async_start (GstSubtitleOverlay * self)
 {
   if (!self->do_async) {
-    GstMessage *msg =
-        gst_message_new_async_start (GST_OBJECT_CAST (self), FALSE);
+    GstMessage *msg = gst_message_new_async_start (GST_OBJECT_CAST (self));
 
     GST_DEBUG_OBJECT (self, "Posting async-start");
-    parent_class->handle_message (GST_BIN_CAST (self), msg);
+    GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (self), msg);
     self->do_async = TRUE;
   }
 }
@@ -104,14 +100,67 @@ static void
 do_async_done (GstSubtitleOverlay * self)
 {
   if (self->do_async) {
-    GstMessage *msg = gst_message_new_async_done (GST_OBJECT_CAST (self));
+    GstMessage *msg =
+        gst_message_new_async_done (GST_OBJECT_CAST (self), FALSE);
 
     GST_DEBUG_OBJECT (self, "Posting async-done");
-    parent_class->handle_message (GST_BIN_CAST (self), msg);
+    GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (self), msg);
     self->do_async = FALSE;
   }
 }
 
+static GstProbeReturn
+_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data);
+
+static void
+block_video (GstSubtitleOverlay * self)
+{
+  if (self->video_block_id != 0)
+    return;
+
+  if (self->video_block_pad) {
+    self->video_block_id =
+        gst_pad_add_probe (self->video_block_pad, GST_PROBE_TYPE_BLOCK,
+        _pad_blocked_cb, gst_object_ref (self),
+        (GDestroyNotify) gst_object_unref);
+  }
+}
+
+static void
+unblock_video (GstSubtitleOverlay * self)
+{
+  if (self->video_block_id) {
+    gst_pad_remove_probe (self->video_block_pad, self->video_block_id);
+    self->video_sink_blocked = FALSE;
+    self->video_block_id = 0;
+  }
+}
+
+static void
+block_subtitle (GstSubtitleOverlay * self)
+{
+  if (self->subtitle_block_id != 0)
+    return;
+
+  if (self->subtitle_block_pad) {
+    self->subtitle_block_id =
+        gst_pad_add_probe (self->subtitle_block_pad, GST_PROBE_TYPE_BLOCK,
+        _pad_blocked_cb, gst_object_ref (self),
+        (GDestroyNotify) gst_object_unref);
+  }
+}
+
+static void
+unblock_subtitle (GstSubtitleOverlay * self)
+{
+  if (self->subtitle_block_id) {
+    gst_pad_remove_probe (self->subtitle_block_pad, self->subtitle_block_id);
+    self->subtitle_sink_blocked = FALSE;
+    self->subtitle_block_id = 0;
+  }
+}
+
 static void
 gst_subtitle_overlay_finalize (GObject * object)
 {
@@ -495,26 +544,16 @@ _remove_element (GstSubtitleOverlay * self, GstElement ** element)
 }
 
 static void
-_generate_update_newsegment_event (GstSegment * segment, GstEvent ** event1,
-    GstEvent ** event2)
+_generate_update_segment_event (GstSegment * segment, GstEvent ** event1)
 {
   GstEvent *event;
+  GstStructure *structure;
 
-  *event1 = NULL;
-  *event2 = NULL;
-
-  event = gst_event_new_new_segment_full (FALSE, segment->rate,
-      segment->applied_rate, segment->format, 0, segment->accum, 0);
-  gst_structure_id_set (event->structure, _subtitle_overlay_event_marker_id,
+  event = gst_event_new_segment (segment);
+  structure = gst_event_writable_structure (event);
+  gst_structure_id_set (structure, _subtitle_overlay_event_marker_id,
       G_TYPE_BOOLEAN, TRUE, NULL);
   *event1 = event;
-
-  event = gst_event_new_new_segment_full (FALSE, segment->rate,
-      segment->applied_rate, segment->format,
-      segment->start, segment->stop, segment->time);
-  gst_structure_id_set (event->structure, _subtitle_overlay_event_marker_id,
-      G_TYPE_BOOLEAN, TRUE, NULL);
-  *event2 = event;
 }
 
 static gboolean
@@ -578,17 +617,12 @@ _setup_passthrough (GstSubtitleOverlay * self)
   /* Send segment to the identity. This is dropped because identity
    * is not linked downstream yet */
   if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
-    GstEvent *event1, *event2;
+    GstEvent *event1;
 
-    _generate_update_newsegment_event (&self->video_segment, &event1, &event2);
-    GST_DEBUG_OBJECT (self,
-        "Pushing video accumulate newsegment event: %" GST_PTR_FORMAT,
-        event1->structure);
+    _generate_update_segment_event (&self->video_segment, &event1);
     GST_DEBUG_OBJECT (self,
-        "Pushing video update newsegment event: %" GST_PTR_FORMAT,
-        event2->structure);
+        "Pushing video segment event: %" GST_PTR_FORMAT, event1);
     gst_pad_send_event (sink, event1);
-    gst_pad_send_event (sink, event2);
   }
 
   /* Link sink ghostpads to identity */
@@ -605,14 +639,8 @@ _setup_passthrough (GstSubtitleOverlay * self)
 
 out:
   /* Unblock pads */
-  gst_pad_set_blocked_async_full (self->video_block_pad, FALSE,
-      _pad_blocked_cb, gst_object_ref (self),
-      (GDestroyNotify) gst_object_unref);
-
-  if (self->subtitle_sink_blocked)
-    gst_pad_set_blocked_async_full (self->subtitle_block_pad, FALSE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
+  unblock_video (self);
+  unblock_subtitle (self);
 
   return TRUE;
 }
@@ -683,25 +711,21 @@ _has_font_desc_property (GstElement * element)
   return (pspec && pspec->value_type == G_TYPE_STRING);
 }
 
-static void
-_pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
+static GstProbeReturn
+_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
   GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (user_data);
   GstCaps *subcaps;
   GList *l, *factories = NULL;
 
-  GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
+  GST_DEBUG_OBJECT (pad, "Pad blocked");
 
   GST_SUBTITLE_OVERLAY_LOCK (self);
   if (pad == self->video_block_pad)
-    self->video_sink_blocked = blocked;
+    self->video_sink_blocked = TRUE;
   else if (pad == self->subtitle_block_pad)
-    self->subtitle_sink_blocked = blocked;
-
-  if (!blocked) {
-    GST_SUBTITLE_OVERLAY_UNLOCK (self);
-    return;
-  }
+    self->subtitle_sink_blocked = TRUE;
 
   /* Now either both or the video sink are blocked */
 
@@ -712,9 +736,9 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
     peer = gst_pad_get_peer (self->subtitle_sinkpad);
     if (peer) {
-      subcaps = gst_pad_get_negotiated_caps (peer);
+      subcaps = gst_pad_get_current_caps (peer);
       if (!subcaps) {
-        subcaps = gst_pad_get_caps_reffed (peer);
+        subcaps = gst_pad_get_caps (peer, NULL);
         if (!gst_caps_is_fixed (subcaps)) {
           gst_caps_unref (subcaps);
           subcaps = NULL;
@@ -754,14 +778,9 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       gst_object_unref (target);
 
       /* Unblock pads */
-      gst_pad_set_blocked_async_full (self->video_block_pad, FALSE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
-
-      if (self->subtitle_sink_blocked)
-        gst_pad_set_blocked_async_full (self->subtitle_block_pad, FALSE,
-            _pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
+      unblock_video (self);
+      unblock_subtitle (self);
+
       goto out;
     } else if (target) {
       gst_object_unref (target);
@@ -770,9 +789,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
   if (self->subtitle_sink_blocked && !self->video_sink_blocked) {
     GST_DEBUG_OBJECT (self, "Subtitle sink blocked but video not blocked");
-    gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
+    block_video (self);
     goto out;
   }
 
@@ -853,9 +870,9 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
         GstCaps *video_caps;
         gint fps_n, fps_d;
 
-        video_caps = gst_pad_get_negotiated_caps (video_peer);
+        video_caps = gst_pad_get_current_caps (video_peer);
         if (!video_caps) {
-          video_caps = gst_pad_get_caps_reffed (video_peer);
+          video_caps = gst_pad_get_caps (video_peer, NULL);
           if (!gst_caps_is_fixed (video_caps)) {
             gst_caps_unref (video_caps);
             video_caps = NULL;
@@ -919,7 +936,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       gst_object_unref (src);
 
       if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
-                  "ffmpegcolorspace", NULL, "post-colorspace", FALSE))) {
+                  "videoconvert", NULL, "post-colorspace", FALSE))) {
         continue;
       }
 
@@ -931,13 +948,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
       sink = gst_element_get_static_pad (self->post_colorspace, "sink");
       if (G_UNLIKELY (!sink)) {
-        GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get sink pad from videoconvert");
         gst_object_unref (src);
         continue;
       }
 
       if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
-        GST_WARNING_OBJECT (self, "Can't link overlay with ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't link overlay with videoconvert");
         gst_object_unref (src);
         gst_object_unref (sink);
         continue;
@@ -946,7 +963,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       gst_object_unref (sink);
 
       if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
-                  "ffmpegcolorspace", NULL, "pre-colorspace", FALSE))) {
+                  "videoconvert", NULL, "pre-colorspace", FALSE))) {
         continue;
       }
 
@@ -958,13 +975,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
       src = gst_element_get_static_pad (self->pre_colorspace, "src");
       if (G_UNLIKELY (!src)) {
-        GST_WARNING_OBJECT (self, "Can't get srcpad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get srcpad from videoconvert");
         gst_object_unref (sink);
         continue;
       }
 
       if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
-        GST_WARNING_OBJECT (self, "Can't link ffmpegcolorspace to textoverlay");
+        GST_WARNING_OBJECT (self, "Can't link videoconvert to textoverlay");
         gst_object_unref (src);
         gst_object_unref (sink);
         continue;
@@ -975,7 +992,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       /* Set src ghostpad target */
       src = gst_element_get_static_pad (self->post_colorspace, "src");
       if (G_UNLIKELY (!src)) {
-        GST_WARNING_OBJECT (self, "Can't get src pad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get src pad from videoconvert");
         continue;
       }
 
@@ -990,30 +1007,24 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       /* Send segments to the parser/overlay if necessary. These are not sent
        * outside this element because of the proxy pad event function */
       if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
-        GstEvent *event1, *event2;
+        GstEvent *event1;
 
         sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
         if (G_UNLIKELY (!sink)) {
-          GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
+          GST_WARNING_OBJECT (self, "Can't get sink pad from videoconvert");
           continue;
         }
 
-        _generate_update_newsegment_event (&self->video_segment, &event1,
-            &event2);
-        GST_DEBUG_OBJECT (self,
-            "Pushing video accumulate newsegment event: %" GST_PTR_FORMAT,
-            event1->structure);
+        _generate_update_segment_event (&self->video_segment, &event1);
         GST_DEBUG_OBJECT (self,
-            "Pushing video update newsegment event: %" GST_PTR_FORMAT,
-            event2->structure);
+            "Pushing video segment event: %" GST_PTR_FORMAT, event1);
         gst_pad_send_event (sink, event1);
-        gst_pad_send_event (sink, event2);
 
         gst_object_unref (sink);
       }
 
       if (self->subtitle_segment.format != GST_FORMAT_UNDEFINED) {
-        GstEvent *event1, *event2;
+        GstEvent *event1;
 
         sink = gst_element_get_static_pad (element, "sink");
         if (G_UNLIKELY (!sink)) {
@@ -1021,16 +1032,10 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
           continue;
         }
 
-        _generate_update_newsegment_event (&self->subtitle_segment, &event1,
-            &event2);
+        _generate_update_segment_event (&self->subtitle_segment, &event1);
         GST_DEBUG_OBJECT (self,
-            "Pushing subtitle accumulate newsegment event: %" GST_PTR_FORMAT,
-            event1->structure);
-        GST_DEBUG_OBJECT (self,
-            "Pushing subtitle update newsegment event: %" GST_PTR_FORMAT,
-            event2->structure);
+            "Pushing subtitle segment event: %" GST_PTR_FORMAT, event1);
         gst_pad_send_event (sink, event1);
-        gst_pad_send_event (sink, event2);
 
         gst_object_unref (sink);
       }
@@ -1038,7 +1043,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       /* Set the sink ghostpad targets */
       sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
       if (G_UNLIKELY (!sink)) {
-        GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get sink pad from videoconvert");
         continue;
       }
 
@@ -1088,7 +1093,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
       /* First link everything internally */
       if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
-                  "ffmpegcolorspace", NULL, "post-colorspace", FALSE))) {
+                  "videoconvert", NULL, "post-colorspace", FALSE))) {
         continue;
       }
 
@@ -1100,13 +1105,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
       sink = gst_element_get_static_pad (self->post_colorspace, "sink");
       if (G_UNLIKELY (!sink)) {
-        GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get sink pad from videoconvert");
         gst_object_unref (src);
         continue;
       }
 
       if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
-        GST_WARNING_OBJECT (self, "Can't link renderer with ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't link renderer with videoconvert");
         gst_object_unref (src);
         gst_object_unref (sink);
         continue;
@@ -1115,7 +1120,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       gst_object_unref (sink);
 
       if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
-                  "ffmpegcolorspace", NULL, "pre-colorspace", FALSE))) {
+                  "videoconvert", NULL, "pre-colorspace", FALSE))) {
         continue;
       }
 
@@ -1127,13 +1132,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
 
       src = gst_element_get_static_pad (self->pre_colorspace, "src");
       if (G_UNLIKELY (!src)) {
-        GST_WARNING_OBJECT (self, "Can't get srcpad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get srcpad from videoconvert");
         gst_object_unref (sink);
         continue;
       }
 
       if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
-        GST_WARNING_OBJECT (self, "Can't link ffmpegcolorspace to renderer");
+        GST_WARNING_OBJECT (self, "Can't link videoconvert to renderer");
         gst_object_unref (src);
         gst_object_unref (sink);
         continue;
@@ -1144,7 +1149,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       /* Set src ghostpad target */
       src = gst_element_get_static_pad (self->post_colorspace, "src");
       if (G_UNLIKELY (!src)) {
-        GST_WARNING_OBJECT (self, "Can't get src pad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get src pad from videoconvert");
         continue;
       }
 
@@ -1159,29 +1164,23 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
       /* Send segments to the renderer if necessary. These are not sent
        * outside this element because of the proxy pad event handler */
       if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
-        GstEvent *event1, *event2;
+        GstEvent *event1;
 
         sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
         if (G_UNLIKELY (!sink)) {
-          GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
+          GST_WARNING_OBJECT (self, "Can't get sink pad from videoconvert");
           continue;
         }
 
-        _generate_update_newsegment_event (&self->video_segment, &event1,
-            &event2);
-        GST_DEBUG_OBJECT (self,
-            "Pushing video accumulate newsegment event: %" GST_PTR_FORMAT,
-            event1->structure);
+        _generate_update_segment_event (&self->video_segment, &event1);
         GST_DEBUG_OBJECT (self,
-            "Pushing video update newsegment event: %" GST_PTR_FORMAT,
-            event2->structure);
+            "Pushing video segment event: %" GST_PTR_FORMAT, event1);
         gst_pad_send_event (sink, event1);
-        gst_pad_send_event (sink, event2);
         gst_object_unref (sink);
       }
 
       if (self->subtitle_segment.format != GST_FORMAT_UNDEFINED) {
-        GstEvent *event1, *event2;
+        GstEvent *event1;
 
         sink = _get_sub_pad (element);
         if (G_UNLIKELY (!sink)) {
@@ -1189,23 +1188,17 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
           continue;
         }
 
-        _generate_update_newsegment_event (&self->subtitle_segment, &event1,
-            &event2);
+        _generate_update_segment_event (&self->subtitle_segment, &event1);
         GST_DEBUG_OBJECT (self,
-            "Pushing subtitle accumulate newsegment event: %" GST_PTR_FORMAT,
-            event1->structure);
-        GST_DEBUG_OBJECT (self,
-            "Pushing subtitle update newsegment event: %" GST_PTR_FORMAT,
-            event2->structure);
+            "Pushing subtitle segment event: %" GST_PTR_FORMAT, event1);
         gst_pad_send_event (sink, event1);
-        gst_pad_send_event (sink, event2);
         gst_object_unref (sink);
       }
 
       /* Set the sink ghostpad targets */
       sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
       if (G_UNLIKELY (!sink)) {
-        GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
+        GST_WARNING_OBJECT (self, "Can't get sink pad from videoconvert");
         continue;
       }
 
@@ -1243,12 +1236,8 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
     do_async_done (self);
   } else {
     GST_DEBUG_OBJECT (self, "Everything worked, unblocking pads");
-    gst_pad_set_blocked_async_full (self->video_block_pad, FALSE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
-    gst_pad_set_blocked_async_full (self->subtitle_block_pad, FALSE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
+    unblock_video (self);
+    unblock_subtitle (self);
     do_async_done (self);
   }
 
@@ -1256,6 +1245,8 @@ out:
   if (factories)
     gst_plugin_feature_list_free (factories);
   GST_SUBTITLE_OVERLAY_UNLOCK (self);
+
+  return GST_PROBE_OK;
 }
 
 static GstStateChangeReturn
@@ -1277,12 +1268,8 @@ gst_subtitle_overlay_change_state (GstElement * element,
 
       GST_SUBTITLE_OVERLAY_LOCK (self);
       /* Set the internal pads to blocking */
-      gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
-      gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_video (self);
+      block_subtitle (self);
       GST_SUBTITLE_OVERLAY_UNLOCK (self);
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
@@ -1331,9 +1318,7 @@ gst_subtitle_overlay_change_state (GstElement * element,
       do_async_done (self);
 
       break;
-    case GST_STATE_CHANGE_READY_TO_NULL:{
-      GstPad *pad;
-
+    case GST_STATE_CHANGE_READY_TO_NULL:
       GST_DEBUG_OBJECT (self, "State change READY->NULL");
 
       GST_SUBTITLE_OVERLAY_LOCK (self);
@@ -1346,17 +1331,8 @@ gst_subtitle_overlay_change_state (GstElement * element,
           NULL);
 
       /* Unblock pads */
-      if (self->video_block_pad) {
-        pad = self->video_block_pad;
-        gst_pad_set_blocked_async_full (pad, FALSE, _pad_blocked_cb,
-            gst_object_ref (self), (GDestroyNotify) gst_object_unref);
-      }
-
-      if (self->subtitle_block_pad) {
-        pad = self->subtitle_block_pad;
-        gst_pad_set_blocked_async_full (pad, FALSE, _pad_blocked_cb,
-            gst_object_ref (self), (GDestroyNotify) gst_object_unref);
-      }
+      unblock_video (self);
+      unblock_subtitle (self);
 
       /* Remove elements */
       self->silent_property = NULL;
@@ -1369,7 +1345,6 @@ gst_subtitle_overlay_change_state (GstElement * element,
       GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
       break;
-    }
     default:
       break;
   }
@@ -1414,13 +1389,8 @@ gst_subtitle_overlay_handle_message (GstBin * bin, GstMessage * message)
       GST_SUBTITLE_OVERLAY_LOCK (self);
       self->subtitle_error = TRUE;
 
-      gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
-
-      gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_subtitle (self);
+      block_video (self);
       GST_SUBTITLE_OVERLAY_UNLOCK (self);
     }
   }
@@ -1475,13 +1445,8 @@ gst_subtitle_overlay_set_property (GObject * object, guint prop_id,
         else if (self->renderer)
           g_object_set (self->renderer, self->silent_property, silent, NULL);
       } else {
-        gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-            _pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
-
-        gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-            _pad_blocked_cb, gst_object_ref (self),
-            (GDestroyNotify) gst_object_unref);
+        block_subtitle (self);
+        block_video (self);
       }
       GST_SUBTITLE_OVERLAY_UNLOCK (self);
       break;
@@ -1513,25 +1478,6 @@ gst_subtitle_overlay_set_property (GObject * object, guint prop_id,
 }
 
 static void
-gst_subtitle_overlay_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&srctemplate));
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&video_sinktemplate));
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&subtitle_sinktemplate));
-
-  gst_element_class_set_details_simple (gstelement_class, "Subtitle Overlay",
-      "Video/Overlay/Subtitle",
-      "Overlays a video stream with subtitles",
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
 gst_subtitle_overlay_class_init (GstSubtitleOverlayClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
@@ -1563,6 +1509,19 @@ gst_subtitle_overlay_class_init (GstSubtitleOverlayClass * klass)
           "ISO-8859-15 will be assumed.", NULL,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&srctemplate));
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&video_sinktemplate));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&subtitle_sinktemplate));
+
+  gst_element_class_set_details_simple (element_class, "Subtitle Overlay",
+      "Video/Overlay/Subtitle",
+      "Overlays a video stream with subtitles",
+      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
   element_class->change_state =
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_change_state);
 
@@ -1621,7 +1580,7 @@ gst_subtitle_overlay_src_proxy_event (GstPad * proxypad, GstEvent * event)
   s = gst_event_get_structure (event);
   if (s && gst_structure_id_has_field (s, _subtitle_overlay_event_marker_id)) {
     GST_DEBUG_OBJECT (ghostpad, "Dropping event with marker: %" GST_PTR_FORMAT,
-        event->structure);
+        event);
     gst_event_unref (event);
     event = NULL;
     ret = TRUE;
@@ -1641,16 +1600,16 @@ out:
 }
 
 static gboolean
-gst_subtitle_overlay_video_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_subtitle_overlay_video_sink_setcaps (GstSubtitleOverlay * self,
+    GstCaps * caps)
 {
-  GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
   gboolean ret = TRUE;
   gint fps_n, fps_d;
 
-  GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (self, "Setting caps: %" GST_PTR_FORMAT, caps);
 
   if (!gst_video_parse_caps_framerate (caps, &fps_n, &fps_d)) {
-    GST_ERROR_OBJECT (pad, "Failed to parse framerate from caps");
+    GST_ERROR_OBJECT (self, "Failed to parse framerate from caps");
     ret = FALSE;
     goto out;
   }
@@ -1664,10 +1623,7 @@ gst_subtitle_overlay_video_sink_setcaps (GstPad * pad, GstCaps * caps)
   }
   GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
-  ret = gst_ghost_pad_setcaps_default (pad, caps);
-
 out:
-  gst_object_unref (self);
   return ret;
 }
 
@@ -1677,45 +1633,53 @@ gst_subtitle_overlay_video_sink_event (GstPad * pad, GstEvent * event)
   GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
   gboolean ret;
 
-  if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
-    GST_DEBUG_OBJECT (pad,
-        "Resetting video segment because of flush-stop event");
-    gst_segment_init (&self->video_segment, GST_FORMAT_UNDEFINED);
-    self->fps_n = self->fps_d = 0;
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_FLUSH_STOP:
+    {
+      GST_DEBUG_OBJECT (pad,
+          "Resetting video segment because of flush-stop event");
+      gst_segment_init (&self->video_segment, GST_FORMAT_UNDEFINED);
+      self->fps_n = self->fps_d = 0;
+      break;
+    }
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_subtitle_overlay_video_sink_setcaps (self, caps);
+      if (!ret)
+        goto done;
+      break;
+    }
+    default:
+      break;
   }
 
   ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
 
-  if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
-    gboolean update;
-    gdouble rate, applied_rate;
-    GstFormat format;
-    gint64 start, stop, position;
-
-    GST_DEBUG_OBJECT (pad, "Newsegment event: %" GST_PTR_FORMAT,
-        event->structure);
-    gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-        &format, &start, &stop, &position);
-
-    if (format != GST_FORMAT_TIME) {
-      GST_ERROR_OBJECT (pad, "Newsegment event in non-time format: %s",
-          gst_format_get_name (format));
-      gst_object_unref (event);
-      gst_object_unref (self);
-      return FALSE;
-    }
+  if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
+    GST_DEBUG_OBJECT (pad, "segment event: %" GST_PTR_FORMAT, event);
+    gst_event_copy_segment (event, &self->video_segment);
 
-    GST_DEBUG_OBJECT (pad, "Old video segment: %" GST_SEGMENT_FORMAT,
-        &self->video_segment);
-    gst_segment_set_newsegment_full (&self->video_segment, update, rate,
-        applied_rate, format, start, stop, position);
-    GST_DEBUG_OBJECT (pad, "New video segment: %" GST_SEGMENT_FORMAT,
-        &self->video_segment);
+    if (self->video_segment.format != GST_FORMAT_TIME)
+      goto invalid_format;
   }
 
+done:
   gst_event_unref (event);
   gst_object_unref (self);
+
   return ret;
+
+  /* ERRORS */
+invalid_format:
+  {
+    GST_ERROR_OBJECT (pad, "Newsegment event in non-time format: %s",
+        gst_format_get_name (self->video_segment.format));
+    ret = FALSE;
+    goto done;
+  }
 }
 
 static GstFlowReturn
@@ -1731,13 +1695,8 @@ gst_subtitle_overlay_video_sink_chain (GstPad * pad, GstBuffer * buffer)
         gst_flow_get_name (ret));
     GST_SUBTITLE_OVERLAY_LOCK (self);
     self->subtitle_error = TRUE;
-    gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
-
-    gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
+    block_subtitle (self);
+    block_video (self);
     GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
     return GST_FLOW_OK;
@@ -1762,13 +1721,8 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
           gst_flow_get_name (ret));
       GST_SUBTITLE_OVERLAY_LOCK (self);
       self->subtitle_error = TRUE;
-      gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
-
-      gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+      block_subtitle (self);
+      block_video (self);
       GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
       return GST_FLOW_OK;
@@ -1779,7 +1733,7 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
 }
 
 static GstCaps *
-gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad)
+gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
   GstCaps *ret;
@@ -1787,6 +1741,10 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad)
   g_mutex_lock (self->factories_lock);
   if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self)))
     ret = GST_CAPS_NONE;
+  else if (filter)
+    ret =
+        gst_caps_intersect_full (filter, self->factory_caps,
+        GST_CAPS_INTERSECT_FIRST);
   else
     ret = gst_caps_ref (self->factory_caps);
   g_mutex_unlock (self->factories_lock);
@@ -1801,7 +1759,7 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad)
 static gboolean
 gst_subtitle_overlay_subtitle_sink_acceptcaps (GstPad * pad, GstCaps * caps)
 {
-  GstCaps *othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad);
+  GstCaps *othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad, NULL);
   gboolean ret = gst_caps_can_intersect (caps, othercaps);
 
   gst_caps_unref (othercaps);
@@ -1810,13 +1768,13 @@ gst_subtitle_overlay_subtitle_sink_acceptcaps (GstPad * pad, GstCaps * caps)
 }
 
 static gboolean
-gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_subtitle_overlay_subtitle_sink_setcaps (GstSubtitleOverlay * self,
+    GstCaps * caps)
 {
-  GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
   gboolean ret = TRUE;
   GstPad *target = NULL;;
 
-  GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (self, "Setting caps: %" GST_PTR_FORMAT, caps);
 
   target =
       gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad));
@@ -1825,29 +1783,22 @@ gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
   gst_caps_replace (&self->subcaps, caps);
 
   if (target && gst_pad_accept_caps (target, caps)) {
-    GST_DEBUG_OBJECT (pad, "Target accepts caps");
-    ret = gst_ghost_pad_setcaps_default (pad, caps);
+    GST_DEBUG_OBJECT (self, "Target accepts caps");
     GST_SUBTITLE_OVERLAY_UNLOCK (self);
     goto out;
   }
 
-  GST_DEBUG_OBJECT (pad, "Target did not accept caps");
+  GST_DEBUG_OBJECT (self, "Target did not accept caps");
 
   self->subtitle_error = FALSE;
-
-  gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-      _pad_blocked_cb, gst_object_ref (self),
-      (GDestroyNotify) gst_object_unref);
-
-  gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-      _pad_blocked_cb, gst_object_ref (self),
-      (GDestroyNotify) gst_object_unref);
+  block_subtitle (self);
+  block_video (self);
   GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
 out:
   if (target)
     gst_object_unref (target);
-  gst_object_unref (self);
+
   return ret;
 }
 
@@ -1860,9 +1811,9 @@ gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer)
 
   GST_DEBUG_OBJECT (pad, "Linking pad to peer %" GST_PTR_FORMAT, peer);
 
-  caps = gst_pad_get_negotiated_caps (peer);
+  caps = gst_pad_get_current_caps (peer);
   if (!caps) {
-    caps = gst_pad_get_caps_reffed (peer);
+    caps = gst_pad_get_caps (peer, NULL);
     if (!gst_caps_is_fixed (caps)) {
       gst_caps_unref (caps);
       caps = NULL;
@@ -1876,13 +1827,8 @@ gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer)
 
     self->subtitle_error = FALSE;
 
-    gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
-
-    gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
+    block_subtitle (self);
+    block_video (self);
     GST_SUBTITLE_OVERLAY_UNLOCK (self);
     gst_caps_unref (caps);
   }
@@ -1911,15 +1857,8 @@ gst_subtitle_overlay_subtitle_sink_unlink (GstPad * pad)
   GST_SUBTITLE_OVERLAY_LOCK (self);
   self->subtitle_error = FALSE;
 
-  if (self->subtitle_block_pad)
-    gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
-
-  if (self->video_block_pad)
-    gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-        _pad_blocked_cb, gst_object_ref (self),
-        (GDestroyNotify) gst_object_unref);
+  block_subtitle (self);
+  block_video (self);
   GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
   gst_object_unref (self);
@@ -1930,92 +1869,63 @@ gst_subtitle_overlay_subtitle_sink_event (GstPad * pad, GstEvent * event)
 {
   GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
   gboolean ret;
-  GstFormat format;
 
   if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_DOWNSTREAM_OOB &&
-      event->structure
-      && strcmp (gst_structure_get_name (event->structure),
-          "subtitleoverlay-flush-subtitle") == 0) {
+      gst_event_has_name (event, "subtitleoverlay-flush-subtitle")) {
     GST_DEBUG_OBJECT (pad, "Custom subtitle flush event");
     GST_SUBTITLE_OVERLAY_LOCK (self);
     self->subtitle_flush = TRUE;
     self->subtitle_error = FALSE;
-    if (self->subtitle_block_pad)
-      gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
-    if (self->video_block_pad)
-      gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
-          _pad_blocked_cb, gst_object_ref (self),
-          (GDestroyNotify) gst_object_unref);
+    block_subtitle (self);
+    block_video (self);
     GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
     gst_event_unref (event);
     event = NULL;
     ret = TRUE;
     goto out;
-  } else if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
-    gst_event_parse_new_segment_full (event, NULL, NULL, NULL,
-        &format, NULL, NULL, NULL);
-    if (self->subtitle_segment.format != GST_FORMAT_UNDEFINED &&
-        self->subtitle_segment.format != format) {
-      GST_DEBUG_OBJECT (pad, "Subtitle segment format changed: %s -> %s",
-          gst_format_get_name (self->subtitle_segment.format),
-          gst_format_get_name (format));
-      gst_segment_init (&self->subtitle_segment, GST_FORMAT_UNDEFINED);
-    }
   }
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_subtitle_overlay_subtitle_sink_setcaps (self, caps);
+      if (!ret)
+        goto out;
+      break;
+    }
     case GST_EVENT_FLUSH_STOP:
       GST_DEBUG_OBJECT (pad,
           "Resetting subtitle segment because of flush-stop");
       gst_segment_init (&self->subtitle_segment, GST_FORMAT_UNDEFINED);
       /* fall through */
     case GST_EVENT_FLUSH_START:
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     case GST_EVENT_EOS:
+    {
+      GstStructure *structure;
+
       /* Add our event marker to make sure no events from here go ever outside
        * the element, they're only interesting for our internal elements */
-      event =
-          GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
-              (event)));
-      if (!event->structure) {
-        event->structure =
-            gst_structure_id_empty_new (_subtitle_overlay_event_marker_id);
-        gst_structure_set_parent_refcount (event->structure,
-            &event->mini_object.refcount);
-      }
-      gst_structure_id_set (event->structure, _subtitle_overlay_event_marker_id,
+      event = GST_EVENT_CAST (gst_event_make_writable (event));
+      structure = gst_event_writable_structure (event);
+
+      gst_structure_id_set (structure, _subtitle_overlay_event_marker_id,
           G_TYPE_BOOLEAN, TRUE, NULL);
       break;
+    }
     default:
       break;
   }
 
   ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
 
-  if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
-    gboolean update;
-    gdouble rate, applied_rate;
-    gint64 start, stop, position;
-
-    GST_DEBUG_OBJECT (pad, "Newsegment event: %" GST_PTR_FORMAT,
-        event->structure);
-    gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
-        &format, &start, &stop, &position);
-
-    GST_DEBUG_OBJECT (pad, "Old subtitle segment: %" GST_SEGMENT_FORMAT,
-        &self->subtitle_segment);
-    if (self->subtitle_segment.format != format) {
-      GST_DEBUG_OBJECT (pad, "Subtitle segment format changed: %s -> %s",
-          gst_format_get_name (self->subtitle_segment.format),
-          gst_format_get_name (format));
-      gst_segment_init (&self->subtitle_segment, format);
-    }
-
-    gst_segment_set_newsegment_full (&self->subtitle_segment, update, rate,
-        applied_rate, format, start, stop, position);
+  if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
+    GST_DEBUG_OBJECT (pad, "segment event: %" GST_PTR_FORMAT, event);
+    gst_event_copy_segment (event, &self->subtitle_segment);
     GST_DEBUG_OBJECT (pad, "New subtitle segment: %" GST_SEGMENT_FORMAT,
         &self->subtitle_segment);
   }
@@ -2027,8 +1937,7 @@ out:
 }
 
 static void
-gst_subtitle_overlay_init (GstSubtitleOverlay * self,
-    GstSubtitleOverlayClass * klass)
+gst_subtitle_overlay_init (GstSubtitleOverlay * self)
 {
   GstPadTemplate *templ;
   GstPad *proxypad = NULL;
@@ -2054,8 +1963,6 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self,
       gst_ghost_pad_new_no_target_from_template ("video_sink", templ);
   gst_pad_set_event_function (self->video_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_event));
-  gst_pad_set_setcaps_function (self->video_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_setcaps));
   gst_pad_set_chain_function (self->video_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_chain));
 
@@ -2063,6 +1970,7 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self,
       GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
           (self->video_sinkpad)));
   self->video_block_pad = proxypad;
+
   gst_element_add_pad (GST_ELEMENT_CAST (self), self->video_sinkpad);
 
   templ = gst_static_pad_template_get (&subtitle_sinktemplate);
@@ -2074,15 +1982,12 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_unlink));
   gst_pad_set_event_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_event));
-  gst_pad_set_setcaps_function (self->subtitle_sinkpad,
-      GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_setcaps));
   gst_pad_set_chain_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_chain));
   gst_pad_set_getcaps_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_getcaps));
   gst_pad_set_acceptcaps_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_acceptcaps));
-  gst_pad_set_bufferalloc_function (self->subtitle_sinkpad, NULL);
 
   proxypad =
       GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
index a6e0d39..0fe6b1b 100644 (file)
@@ -72,12 +72,14 @@ struct _GstSubtitleOverlay
 
   GstPad *video_sinkpad;
   GstPad *video_block_pad;
+  gulong video_block_id;
   gboolean video_sink_blocked;
   GstSegment video_segment;
   gint fps_n, fps_d;
 
   GstPad *subtitle_sinkpad;
   GstPad *subtitle_block_pad;
+  gulong subtitle_block_id;
   gboolean subtitle_sink_blocked;
   GstSegment subtitle_segment;
   gboolean subtitle_flush;
index 2404242..1988b63 100644 (file)
@@ -21,7 +21,7 @@
  * SECTION:element-uridecodebin
  *
  * Decodes data from a URI into raw media. It selects a source element that can
- * handle the given #GstURIDecodeBin:uri scheme and connects it to a decodebin2.
+ * handle the given #GstURIDecodeBin:uri scheme and connects it to a decodebin.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -37,6 +37,7 @@
 #include "gstplay-marshal.h"
 #include "gstplay-enum.h"
 #include "gstrawcaps.h"
+#include "gstplayback.h"
 
 #define GST_TYPE_URI_DECODE_BIN \
   (gst_uri_decode_bin_get_type())
@@ -192,7 +193,8 @@ enum
 static guint gst_uri_decode_bin_signals[LAST_SIGNAL] = { 0 };
 
 GType gst_uri_decode_bin_get_type (void);
-GST_BOILERPLATE (GstURIDecodeBin, gst_uri_decode_bin, GstBin, GST_TYPE_BIN);
+#define gst_uri_decode_bin_parent_class parent_class
+G_DEFINE_TYPE (GstURIDecodeBin, gst_uri_decode_bin, GST_TYPE_BIN);
 
 static void remove_decoders (GstURIDecodeBin * bin, gboolean force);
 static void gst_uri_decode_bin_set_property (GObject * object, guint prop_id,
@@ -208,19 +210,6 @@ static gboolean gst_uri_decode_bin_query (GstElement * element,
 static GstStateChangeReturn gst_uri_decode_bin_change_state (GstElement *
     element, GstStateChange transition);
 
-static void
-gst_uri_decode_bin_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&srctemplate));
-  gst_element_class_set_details_simple (gstelement_class,
-      "URI Decoder", "Generic/Bin/Decoder",
-      "Autoplug and decode an URI to raw media",
-      "Wim Taymans <wim.taymans@gmail.com>");
-}
-
 static gboolean
 _gst_boolean_accumulator (GSignalInvocationHint * ihint,
     GValue * return_accu, const GValue * handler_return, gpointer dummy)
@@ -497,8 +486,8 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
    *
    * Returns: #TRUE if you wish uridecodebin to look for elements that can
    * handle the given @caps. If #FALSE, those caps will be considered as
-   * final and the pad will be exposed as such (see 'new-decoded-pad'
-   * signal).
+   * final and the pad will be exposed as such (see 'pad-added' signal of
+   * #GstElement).
    */
   gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE] =
       g_signal_new ("autoplug-continue", G_TYPE_FROM_CLASS (klass),
@@ -546,7 +535,7 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
    * @caps: The #GstCaps.
    * @factories: A #GValueArray of possible #GstElementFactory to use.
    *
-   * Once decodebin2 has found the possible #GstElementFactory objects to try
+   * Once decodebin has found the possible #GstElementFactory objects to try
    * for @caps on @pad, this signal is emited. The purpose of the signal is for
    * the application to perform additional sorting or filtering on the element
    * factory array.
@@ -585,7 +574,7 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
    * those factories, this signal is emited.
    *
    * The signal handler should return a #GST_TYPE_AUTOPLUG_SELECT_RESULT enum
-   * value indicating what decodebin2 should do next.
+   * value indicating what decodebin should do next.
    *
    * A value of #GST_AUTOPLUG_SELECT_TRY will try to autoplug an element from
    * @factory.
@@ -643,6 +632,13 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
       G_SIGNAL_RUN_LAST, 0, NULL, NULL,
       gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&srctemplate));
+  gst_element_class_set_details_simple (gstelement_class,
+      "URI Decoder", "Generic/Bin/Decoder",
+      "Autoplug and decode an URI to raw media",
+      "Wim Taymans <wim.taymans@gmail.com>");
+
   gstelement_class->query = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_query);
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_uri_decode_bin_change_state);
@@ -659,7 +655,7 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
 }
 
 static void
-gst_uri_decode_bin_init (GstURIDecodeBin * dec, GstURIDecodeBinClass * klass)
+gst_uri_decode_bin_init (GstURIDecodeBin * dec)
 {
   /* first filter out the interesting element factories */
   dec->factories_lock = g_mutex_new ();
@@ -840,8 +836,8 @@ do_async_start (GstURIDecodeBin * dbin)
 
   dbin->async_pending = TRUE;
 
-  message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE);
-  parent_class->handle_message (GST_BIN_CAST (dbin), message);
+  message = gst_message_new_async_start (GST_OBJECT_CAST (dbin));
+  GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
 }
 
 static void
@@ -851,8 +847,8 @@ do_async_done (GstURIDecodeBin * dbin)
 
   if (dbin->async_pending) {
     GST_DEBUG_OBJECT (dbin, "posting ASYNC_DONE");
-    message = gst_message_new_async_done (GST_OBJECT_CAST (dbin));
-    parent_class->handle_message (GST_BIN_CAST (dbin), message);
+    message = gst_message_new_async_done (GST_OBJECT_CAST (dbin), FALSE);
+    GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
 
     dbin->async_pending = FALSE;
   }
@@ -991,10 +987,13 @@ configure_stream_buffering (GstURIDecodeBin * decoder)
   gst_object_unref (queue);
 }
 
-static gboolean
-decoded_pad_event_probe (GstPad * pad, GstEvent * event,
-    GstURIDecodeBin * decoder)
+static GstProbeReturn
+decoded_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstEvent *event = type_data;
+  GstURIDecodeBin *decoder = user_data;
+
   GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
 
   /* look for a bitrate tag */
@@ -1018,7 +1017,7 @@ decoded_pad_event_probe (GstPad * pad, GstEvent * event,
         if (stream) {
           stream->bitrate = bitrate;
           /* no longer need this probe now */
-          gst_pad_remove_event_probe (pad, stream->probe_id);
+          gst_pad_remove_probe (pad, stream->probe_id);
           /* configure buffer if possible */
           configure_stream_buffering (decoder);
         }
@@ -1030,14 +1029,12 @@ decoded_pad_event_probe (GstPad * pad, GstEvent * event,
   }
 
   /* never drop */
-  return TRUE;
+  return GST_PROBE_OK;
 }
 
-/* Called by the signal handlers when a decodebin has
- * found a new raw pad.  
- */
+/* Called by the signal handlers when a decodebin has found a new raw pad */
 static void
-new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
+new_decoded_pad_added_cb (GstElement * element, GstPad * pad,
     GstURIDecodeBin * decoder)
 {
   GstPad *newpad;
@@ -1045,8 +1042,7 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
   gchar *padname;
   GstURIDecodeBinStream *stream;
 
-  GST_DEBUG_OBJECT (element, "new decoded pad, name: <%s>. Last: %d",
-      GST_PAD_NAME (pad), last);
+  GST_DEBUG_OBJECT (element, "new decoded pad, name: <%s>", GST_PAD_NAME (pad));
 
   GST_URI_DECODE_BIN_LOCK (decoder);
   padname = g_strdup_printf ("src%d", decoder->numpads);
@@ -1064,8 +1060,8 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
   /* add event probe to monitor tags */
   stream = g_slice_alloc0 (sizeof (GstURIDecodeBinStream));
   stream->probe_id =
-      gst_pad_add_event_probe (pad, G_CALLBACK (decoded_pad_event_probe),
-      decoder);
+      gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, decoded_pad_event_probe,
+      decoder, NULL);
   GST_URI_DECODE_BIN_LOCK (decoder);
   g_hash_table_insert (decoder->streams, pad, stream);
   GST_URI_DECODE_BIN_UNLOCK (decoder);
@@ -1074,10 +1070,13 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
   gst_element_add_pad (GST_ELEMENT_CAST (decoder), newpad);
 }
 
-static gboolean
-source_pad_event_probe (GstPad * pad, GstEvent * event,
-    GstURIDecodeBin * decoder)
+static GstProbeReturn
+source_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstEvent *event = type_data;
+  GstURIDecodeBin *decoder = user_data;
+
   GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
 
   if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
@@ -1087,7 +1086,7 @@ source_pad_event_probe (GstPad * pad, GstEvent * event,
         gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL);
   }
   /* never drop events */
-  return TRUE;
+  return GST_PROBE_OK;
 }
 
 /* called when we found a raw pad on the source element. We need to set up a
@@ -1096,9 +1095,10 @@ static void
 expose_decoded_pad (GstElement * element, GstPad * pad,
     GstURIDecodeBin * decoder)
 {
-  gst_pad_add_event_probe (pad, G_CALLBACK (source_pad_event_probe), decoder);
+  gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, source_pad_event_probe, decoder,
+      NULL);
 
-  new_decoded_pad_cb (element, pad, FALSE, decoder);
+  new_decoded_pad_added_cb (element, pad, decoder);
 }
 
 static void
@@ -1307,7 +1307,7 @@ has_all_raw_caps (GstPad * pad, GstCaps * rawcaps, gboolean * all_raw)
   gint capssize;
   gboolean res = FALSE;
 
-  caps = gst_pad_get_caps_reffed (pad);
+  caps = gst_pad_get_caps (pad, NULL);
   if (caps == NULL)
     return FALSE;
 
@@ -1373,6 +1373,7 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
   gboolean res = TRUE;
   GstCaps *rawcaps;
   GstPad *pad;
+  GValue item = { 0, };
 
   *have_out = FALSE;
   *is_raw = FALSE;
@@ -1384,7 +1385,7 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
 
   pads_iter = gst_element_iterate_src_pads (decoder->source);
   while (!done) {
-    switch (gst_iterator_next (pads_iter, (gpointer) & pad)) {
+    switch (gst_iterator_next (pads_iter, &item)) {
       case GST_ITERATOR_ERROR:
         res = FALSE;
         /* FALLTROUGH */
@@ -1399,12 +1400,13 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
         gst_iterator_resync (pads_iter);
         break;
       case GST_ITERATOR_OK:
+        pad = g_value_get_object (&item);
         /* we now officially have an ouput pad */
         *have_out = TRUE;
 
         /* if FALSE, this pad has no caps and we continue with the next pad. */
         if (!has_all_raw_caps (pad, rawcaps, is_raw)) {
-          gst_object_unref (pad);
+          g_value_reset (&item);
           break;
         }
 
@@ -1437,10 +1439,11 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
           }
           expose_decoded_pad (outelem, pad, decoder);
         }
-        gst_object_unref (pad);
+        g_value_reset (&item);
         break;
     }
   }
+  g_value_unset (&item);
   gst_iterator_free (pads_iter);
   gst_caps_unref (rawcaps);
 
@@ -1471,7 +1474,7 @@ no_queue2:
   {
     post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "queue2");
 
-    gst_object_unref (pad);
+    g_value_unset (&item);
     gst_iterator_free (pads_iter);
     gst_caps_unref (rawcaps);
 
@@ -1479,10 +1482,10 @@ no_queue2:
   }
 }
 
-/* Remove all decodebin2 from ourself 
- * If force is FALSE, then the decodebin2 instances will be stored in
+/* Remove all decodebin from ourself
+ * If force is FALSE, then the decodebin instances will be stored in
  * pending_decodebins for re-use later on.
- * If force is TRUE, then all decodebin2 instances will be unreferenced
+ * If force is TRUE, then all decodebin instances will be unreferenced
  * and cleared, including the pending ones. */
 static void
 remove_decoders (GstURIDecodeBin * bin, gboolean force)
@@ -1615,18 +1618,18 @@ make_decoder (GstURIDecodeBin * decoder)
 {
   GstElement *decodebin;
 
-  /* re-use pending decodebin2 */
+  /* re-use pending decodebin */
   if (decoder->pending_decodebins) {
     GSList *first = decoder->pending_decodebins;
-    GST_LOG_OBJECT (decoder, "re-using pending decodebin2");
+    GST_LOG_OBJECT (decoder, "re-using pending decodebin");
     decodebin = (GstElement *) first->data;
     decoder->pending_decodebins =
         g_slist_delete_link (decoder->pending_decodebins, first);
   } else {
-    GST_LOG_OBJECT (decoder, "making new decodebin2");
+    GST_LOG_OBJECT (decoder, "making new decodebin");
 
     /* now create the decoder element */
-    decodebin = gst_element_factory_make ("decodebin2", NULL);
+    decodebin = gst_element_factory_make ("decodebin", NULL);
 
     if (!decodebin)
       goto no_decodebin;
@@ -1652,7 +1655,7 @@ make_decoder (GstURIDecodeBin * decoder)
     /* set up callbacks to create the links between decoded data
      * and video/audio/subtitle rendering/output. */
     g_signal_connect (decodebin,
-        "new-decoded-pad", G_CALLBACK (new_decoded_pad_cb), decoder);
+        "pad-added", G_CALLBACK (new_decoded_pad_added_cb), decoder);
     g_signal_connect (decodebin,
         "pad-removed", G_CALLBACK (pad_removed_cb), decoder);
     g_signal_connect (decodebin, "no-more-pads",
@@ -1704,16 +1707,16 @@ make_decoder (GstURIDecodeBin * decoder)
   /* ERRORS */
 no_decodebin:
   {
-    post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "decodebin2");
+    post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "decodebin");
     GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN, (NULL),
-        ("No decodebin2 element, check your installation"));
+        ("No decodebin element, check your installation"));
     return NULL;
   }
 no_typefind:
   {
     gst_object_unref (decodebin);
     GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN, (NULL),
-        ("No typefind element, decodebin2 is unusable, check your installation"));
+        ("No typefind element, decodebin is unusable, check your installation"));
     return NULL;
   }
 }
@@ -1737,11 +1740,11 @@ type_found (GstElement * typefind, guint probability,
   decoder->is_download = IS_DOWNLOAD_MEDIA (media_type) && decoder->download;
   /* only enable download buffering if the upstream duration is known */
   if (decoder->is_download) {
-    GstFormat fmt = GST_FORMAT_BYTES;
     gint64 dur;
 
-    decoder->is_download = (gst_element_query_duration (typefind, &fmt, &dur)
-        && fmt == GST_FORMAT_BYTES && dur != -1);
+    decoder->is_download =
+        (gst_element_query_duration (typefind, GST_FORMAT_BYTES, &dur)
+        && dur != -1);
   }
 
   dec_elem = make_decoder (decoder);
@@ -1823,7 +1826,7 @@ no_decodebin:
 could_not_link:
   {
     GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION,
-        (NULL), ("Can't link typefind to decodebin2 element"));
+        (NULL), ("Can't link typefind to decodebin element"));
     return;
   }
 no_queue2:
@@ -1835,7 +1838,7 @@ no_queue2:
 
 /* setup a streaming source. This will first plug a typefind element to the
  * source. After we find the type, we decide to plug a queue2 and continue to
- * plug a decodebin2 starting from the found caps */
+ * plug a decodebin starting from the found caps */
 static gboolean
 setup_streaming (GstURIDecodeBin * decoder)
 {
@@ -2139,14 +2142,16 @@ handle_redirect_message (GstURIDecodeBin * dec, GstMessage * msg)
   GList *l_good = NULL, *l_neutral = NULL, *l_bad = NULL;
   GValue new_list = { 0, };
   guint size, i;
+  const GstStructure *structure;
 
   GST_DEBUG_OBJECT (dec, "redirect message: %" GST_PTR_FORMAT, msg);
   GST_DEBUG_OBJECT (dec, "connection speed: %u", dec->connection_speed);
 
-  if (dec->connection_speed == 0 || msg->structure == NULL)
+  structure = gst_message_get_structure (msg);
+  if (dec->connection_speed == 0 || structure == NULL)
     return msg;
 
-  locations_list = gst_structure_get_value (msg->structure, "locations");
+  locations_list = gst_structure_get_value (structure, "locations");
   if (locations_list == NULL)
     return msg;
 
@@ -2198,8 +2203,8 @@ handle_redirect_message (GstURIDecodeBin * dec, GstMessage * msg)
 static void
 handle_message (GstBin * bin, GstMessage * msg)
 {
-  if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT && msg->structure != NULL
-      && gst_structure_has_name (msg->structure, "redirect")) {
+  if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT
+      && gst_message_has_name (msg, "redirect")) {
     /* sort redirect messages based on the connection speed. This simplifies
      * the user of this element as it can in most cases just pick the first item
      * of the sorted list as a good redirection candidate. It can of course
@@ -2236,9 +2241,12 @@ decoder_query_init (GstURIDecodeBin * dec, QueryFold * fold)
 }
 
 static gboolean
-decoder_query_duration_fold (GstPad * item, GValue * ret, QueryFold * fold)
+decoder_query_duration_fold (const GValue * item, GValue * ret,
+    QueryFold * fold)
 {
-  if (gst_pad_query (item, fold->query)) {
+  GstPad *pad = g_value_get_object (item);
+
+  if (gst_pad_query (pad, fold->query)) {
     gint64 duration;
 
     g_value_set_boolean (ret, TRUE);
@@ -2250,7 +2258,6 @@ decoder_query_duration_fold (GstPad * item, GValue * ret, QueryFold * fold)
     if (duration > fold->max)
       fold->max = duration;
   }
-  gst_object_unref (item);
   return TRUE;
 }
 
@@ -2267,9 +2274,12 @@ decoder_query_duration_done (GstURIDecodeBin * dec, QueryFold * fold)
 }
 
 static gboolean
-decoder_query_position_fold (GstPad * item, GValue * ret, QueryFold * fold)
+decoder_query_position_fold (const GValue * item, GValue * ret,
+    QueryFold * fold)
 {
-  if (gst_pad_query (item, fold->query)) {
+  GstPad *pad = g_value_get_object (item);
+
+  if (gst_pad_query (pad, fold->query)) {
     gint64 position;
 
     g_value_set_boolean (ret, TRUE);
@@ -2282,7 +2292,6 @@ decoder_query_position_fold (GstPad * item, GValue * ret, QueryFold * fold)
       fold->max = position;
   }
 
-  gst_object_unref (item);
   return TRUE;
 }
 
@@ -2299,9 +2308,11 @@ decoder_query_position_done (GstURIDecodeBin * dec, QueryFold * fold)
 }
 
 static gboolean
-decoder_query_latency_fold (GstPad * item, GValue * ret, QueryFold * fold)
+decoder_query_latency_fold (const GValue * item, GValue * ret, QueryFold * fold)
 {
-  if (gst_pad_query (item, fold->query)) {
+  GstPad *pad = g_value_get_object (item);
+
+  if (gst_pad_query (pad, fold->query)) {
     GstClockTime min, max;
     gboolean live;
 
@@ -2325,7 +2336,6 @@ decoder_query_latency_fold (GstPad * item, GValue * ret, QueryFold * fold)
       fold->live = live;
   }
 
-  gst_object_unref (item);
   return TRUE;
 }
 
@@ -2343,9 +2353,11 @@ decoder_query_latency_done (GstURIDecodeBin * dec, QueryFold * fold)
 
 /* we are seekable if all srcpads are seekable */
 static gboolean
-decoder_query_seeking_fold (GstPad * item, GValue * ret, QueryFold * fold)
+decoder_query_seeking_fold (const GValue * item, GValue * ret, QueryFold * fold)
 {
-  if (gst_pad_query (item, fold->query)) {
+  GstPad *pad = g_value_get_object (item);
+
+  if (gst_pad_query (pad, fold->query)) {
     gboolean seekable;
 
     g_value_set_boolean (ret, TRUE);
@@ -2356,7 +2368,6 @@ decoder_query_seeking_fold (GstPad * item, GValue * ret, QueryFold * fold)
     if (fold->seekable == TRUE)
       fold->seekable = seekable;
   }
-  gst_object_unref (item);
 
   return TRUE;
 }
@@ -2374,17 +2385,16 @@ decoder_query_seeking_done (GstURIDecodeBin * dec, QueryFold * fold)
 
 /* generic fold, return first valid result */
 static gboolean
-decoder_query_generic_fold (GstPad * item, GValue * ret, QueryFold * fold)
+decoder_query_generic_fold (const GValue * item, GValue * ret, QueryFold * fold)
 {
+  GstPad *pad = g_value_get_object (item);
   gboolean res;
 
-  if ((res = gst_pad_query (item, fold->query))) {
+  if ((res = gst_pad_query (pad, fold->query))) {
     g_value_set_boolean (ret, TRUE);
     GST_DEBUG_OBJECT (item, "answered query %p", fold->query);
   }
 
-  gst_object_unref (item);
-
   /* and stop as soon as we have a valid result */
   return !res;
 }
@@ -2532,38 +2542,12 @@ setup_failed:
   }
 }
 
-gboolean gst_decode_bin_plugin_init (GstPlugin * plugin);
-
-static gboolean
+gboolean
 gst_uri_decode_bin_plugin_init (GstPlugin * plugin)
 {
   GST_DEBUG_CATEGORY_INIT (gst_uri_decode_bin_debug, "uridecodebin", 0,
       "URI decoder element");
 
-#ifdef ENABLE_NLS
-  GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
-      LOCALEDIR);
-  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
   return gst_element_register (plugin, "uridecodebin", GST_RANK_NONE,
       GST_TYPE_URI_DECODE_BIN);
 }
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  if (!gst_decode_bin_plugin_init (plugin))
-    return FALSE;
-  if (!gst_uri_decode_bin_plugin_init (plugin))
-    return FALSE;
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    "uridecodebin",
-    "URI Decoder bin", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME,
-    GST_PACKAGE_ORIGIN)
index 5aa68e3..dc75364 100644 (file)
@@ -44,7 +44,8 @@ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
     GST_STATIC_CAPS ("text/x-pango-markup")
     );
 
-GST_BOILERPLATE (GstSsaParse, gst_ssa_parse, GstElement, GST_TYPE_ELEMENT);
+#define gst_ssa_parse_parent_class parent_class
+G_DEFINE_TYPE (GstSsaParse, gst_ssa_parse, GST_TYPE_ELEMENT);
 
 static GstStateChangeReturn gst_ssa_parse_change_state (GstElement *
     element, GstStateChange transition);
@@ -54,24 +55,6 @@ static gboolean gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event);
 static GstFlowReturn gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf);
 
 static void
-gst_ssa_parse_base_init (gpointer klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_templ));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-  gst_element_class_set_details_simple (element_class,
-      "SSA Subtitle Parser", "Codec/Parser/Subtitle",
-      "Parses SSA subtitle streams",
-      "Tim-Philipp Müller <tim centricular net>");
-
-  GST_DEBUG_CATEGORY_INIT (ssa_parse_debug, "ssaparse", 0,
-      "SSA subtitle parser");
-}
-
-static void
 gst_ssa_parse_dispose (GObject * object)
 {
   GstSsaParse *parse = GST_SSA_PARSE (object);
@@ -83,11 +66,9 @@ gst_ssa_parse_dispose (GObject * object)
 }
 
 static void
-gst_ssa_parse_init (GstSsaParse * parse, GstSsaParseClass * klass)
+gst_ssa_parse_init (GstSsaParse * parse)
 {
   parse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
-  gst_pad_set_setcaps_function (parse->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_ssa_parse_setcaps));
   gst_pad_set_chain_function (parse->sinkpad,
       GST_DEBUG_FUNCPTR (gst_ssa_parse_chain));
   gst_pad_set_event_function (parse->sinkpad,
@@ -115,6 +96,18 @@ gst_ssa_parse_class_init (GstSsaParseClass * klass)
 
   object_class->dispose = gst_ssa_parse_dispose;
 
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_templ));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_templ));
+  gst_element_class_set_details_simple (element_class,
+      "SSA Subtitle Parser", "Codec/Parser/Subtitle",
+      "Parses SSA subtitle streams",
+      "Tim-Philipp Müller <tim centricular net>");
+
+  GST_DEBUG_CATEGORY_INIT (ssa_parse_debug, "ssaparse", 0,
+      "SSA subtitle parser");
+
   element_class->change_state = GST_DEBUG_FUNCPTR (gst_ssa_parse_change_state);
 }
 
@@ -127,7 +120,23 @@ gst_ssa_parse_src_event (GstPad * pad, GstEvent * event)
 static gboolean
 gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event)
 {
-  return gst_pad_event_default (pad, event);
+  gboolean res;
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      res = gst_ssa_parse_setcaps (pad, caps);
+      gst_event_unref (event);
+      break;
+    }
+    default:
+      res = gst_pad_event_default (pad, event);
+      break;
+  }
+  return res;
 }
 
 static gboolean
@@ -138,8 +147,8 @@ gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps)
   GstStructure *s;
   const guchar bom_utf8[] = { 0xEF, 0xBB, 0xBF };
   GstBuffer *priv;
-  gchar *data;
-  guint size;
+  gchar *data, *ptr;
+  gsize size, left;
 
   s = gst_caps_get_structure (caps, 0);
   val = gst_structure_get_value (s, "codec_data");
@@ -152,17 +161,20 @@ gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps)
   parse->framed = TRUE;
   parse->send_tags = TRUE;
 
-  priv = (GstBuffer *) gst_value_get_mini_object (val);
+  priv = (GstBuffer *) g_value_get_boxed (val);
   g_return_val_if_fail (priv != NULL, FALSE);
 
   gst_buffer_ref (priv);
 
-  data = (gchar *) GST_BUFFER_DATA (priv);
-  size = GST_BUFFER_SIZE (priv);
+  data = gst_buffer_map (priv, &size, NULL, GST_MAP_READ);
+
+  ptr = data;
+  left = size;
+
   /* skip UTF-8 BOM */
-  if (size >= 3 && memcmp (data, bom_utf8, 3) == 0) {
-    data += 3;
-    size -= 3;
+  if (left >= 3 && memcmp (ptr, bom_utf8, 3) == 0) {
+    ptr += 3;
+    left -= 3;
   }
 
   if (!strstr (data, "[Script Info]")) {
@@ -171,16 +183,17 @@ gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps)
     return FALSE;
   }
 
-  if (!g_utf8_validate (data, size, NULL)) {
+  if (!g_utf8_validate (ptr, left, NULL)) {
     GST_WARNING_OBJECT (parse, "Init section is not valid UTF-8");
     gst_buffer_unref (priv);
     return FALSE;
   }
 
   /* FIXME: parse initial section */
-  parse->ini = g_strndup (data, size);
+  parse->ini = g_strndup (ptr, left);
   GST_LOG_OBJECT (parse, "Init section:\n%s", parse->ini);
 
+  gst_buffer_unmap (priv, data, size);
   gst_buffer_unref (priv);
 
   return TRUE;
@@ -269,15 +282,13 @@ gst_ssa_parse_push_line (GstSsaParse * parse, gchar * txt,
 
   /* allocate enough for a terminating NUL, but don't include it in buf size */
   buf = gst_buffer_new_and_alloc (len + 1);
-  memcpy (GST_BUFFER_DATA (buf), escaped, len + 1);
-  GST_BUFFER_SIZE (buf) = len;
+  gst_buffer_fill (buf, 0, escaped, len + 1);
+  gst_buffer_set_size (buf, len);
   g_free (escaped);
 
   GST_BUFFER_TIMESTAMP (buf) = start;
   GST_BUFFER_DURATION (buf) = duration;
 
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
   GST_LOG_OBJECT (parse, "Pushing buffer with timestamp %" GST_TIME_FORMAT
       " and duration %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
       GST_TIME_ARGS (duration));
@@ -299,6 +310,8 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
   GstSsaParse *parse = GST_SSA_PARSE (GST_PAD_PARENT (sinkpad));
   GstClockTime ts;
   gchar *txt;
+  gchar *data;
+  gsize size;
 
   if (G_UNLIKELY (!parse->framed))
     goto not_framed;
@@ -314,7 +327,10 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
   }
 
   /* make double-sure it's 0-terminated and all */
-  txt = g_strndup ((gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  txt = g_strndup (data, size);
+  gst_buffer_unmap (buf, data, size);
+
   if (txt == NULL)
     goto empty_text;
 
@@ -322,9 +338,13 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
   ret = gst_ssa_parse_push_line (parse, txt, ts, GST_BUFFER_DURATION (buf));
 
   if (ret != GST_FLOW_OK && GST_CLOCK_TIME_IS_VALID (ts)) {
+    GstSegment segment;
+
     /* just advance time without sending anything */
-    gst_pad_push_event (parse->srcpad,
-        gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, ts, -1, ts));
+    gst_segment_init (&segment, GST_FORMAT_TIME);
+    segment.start = ts;
+    segment.time = ts;
+    gst_pad_push_event (parse->srcpad, gst_event_new_segment (&segment));
     ret = GST_FLOW_OK;
   }
 
@@ -363,7 +383,7 @@ gst_ssa_parse_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
   if (ret == GST_STATE_CHANGE_FAILURE)
     return ret;
 
index 8d495f0..c910cb2 100644 (file)
@@ -79,9 +79,6 @@ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
     GST_STATIC_CAPS ("text/plain; text/x-pango-markup")
     );
 
-static void gst_sub_parse_base_init (GstSubParseClass * klass);
-static void gst_sub_parse_class_init (GstSubParseClass * klass);
-static void gst_sub_parse_init (GstSubParse * subparse);
 
 static gboolean gst_sub_parse_src_event (GstPad * pad, GstEvent * event);
 static gboolean gst_sub_parse_src_query (GstPad * pad, GstQuery * query);
@@ -92,48 +89,8 @@ static GstStateChangeReturn gst_sub_parse_change_state (GstElement * element,
 
 static GstFlowReturn gst_sub_parse_chain (GstPad * sinkpad, GstBuffer * buf);
 
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_sub_parse_get_type (void)
-{
-  static GType sub_parse_type = 0;
-
-  if (!sub_parse_type) {
-    static const GTypeInfo sub_parse_info = {
-      sizeof (GstSubParseClass),
-      (GBaseInitFunc) gst_sub_parse_base_init,
-      NULL,
-      (GClassInitFunc) gst_sub_parse_class_init,
-      NULL,
-      NULL,
-      sizeof (GstSubParse),
-      0,
-      (GInstanceInitFunc) gst_sub_parse_init,
-    };
-
-    sub_parse_type = g_type_register_static (GST_TYPE_ELEMENT,
-        "GstSubParse", &sub_parse_info, 0);
-  }
-
-  return sub_parse_type;
-}
-
-static void
-gst_sub_parse_base_init (GstSubParseClass * klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_templ));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-  gst_element_class_set_details_simple (element_class,
-      "Subtitle parser", "Codec/Parser/Subtitle",
-      "Parses subtitle (.sub) files into text streams",
-      "Gustavo J. A. M. Carneiro <gjc@inescporto.pt>, "
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-}
+#define gst_sub_parse_parent_class parent_class
+G_DEFINE_TYPE (GstSubParse, gst_sub_parse, GST_TYPE_ELEMENT);
 
 static void
 gst_sub_parse_dispose (GObject * object)
@@ -184,12 +141,20 @@ gst_sub_parse_class_init (GstSubParseClass * klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
-  parent_class = g_type_class_peek_parent (klass);
-
   object_class->dispose = gst_sub_parse_dispose;
   object_class->set_property = gst_sub_parse_set_property;
   object_class->get_property = gst_sub_parse_get_property;
 
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_templ));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_templ));
+  gst_element_class_set_details_simple (element_class,
+      "Subtitle parser", "Codec/Parser/Subtitle",
+      "Parses subtitle (.sub) files into text streams",
+      "Gustavo J. A. M. Carneiro <gjc@inescporto.pt>, "
+      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
+
   element_class->change_state = gst_sub_parse_change_state;
 
   g_object_class_install_property (object_class, PROP_ENCODING,
@@ -260,8 +225,7 @@ gst_sub_parse_src_query (GstPad * pad, GstQuery * query)
         ret = gst_pad_peer_query (self->sinkpad, query);
       } else {
         ret = TRUE;
-        gst_query_set_position (query, GST_FORMAT_TIME,
-            self->segment.last_stop);
+        gst_query_set_position (query, GST_FORMAT_TIME, self->segment.position);
       }
       break;
     }
@@ -307,12 +271,13 @@ gst_sub_parse_src_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_SEEK:
     {
       GstFormat format;
+      GstSeekFlags flags;
       GstSeekType start_type, stop_type;
       gint64 start, stop;
       gdouble rate;
       gboolean update;
 
-      gst_event_parse_seek (event, &rate, &format, &self->segment_flags,
+      gst_event_parse_seek (event, &rate, &format, &flags,
           &start_type, &start, &stop_type, &stop);
 
       if (format != GST_FORMAT_TIME) {
@@ -324,12 +289,12 @@ gst_sub_parse_src_event (GstPad * pad, GstEvent * event)
       /* Convert that seek to a seeking in bytes at position 0,
          FIXME: could use an index */
       ret = gst_pad_push_event (self->sinkpad,
-          gst_event_new_seek (rate, GST_FORMAT_BYTES, self->segment_flags,
+          gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
               GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, 0));
 
       if (ret) {
         /* Apply the seek to our segment */
-        gst_segment_set_seek (&self->segment, rate, format, self->segment_flags,
+        gst_segment_do_seek (&self->segment, rate, format, flags,
             start_type, start, stop_type, stop, &update);
 
         GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
@@ -588,7 +553,7 @@ parse_mdvdsub (ParserState * state, const gchar * line)
   const gchar *line_split;
   gchar *line_chunk;
   guint start_frame, end_frame;
-  gint64 clip_start = 0, clip_stop = 0;
+  guint64 clip_start = 0, clip_stop = 0;
   gboolean in_seg = FALSE;
   GString *markup;
   gchar *ret;
@@ -941,7 +906,7 @@ parse_subrip (ParserState * state, const gchar * line)
     case 2:
     {
       /* No need to parse that text if it's out of segment */
-      gint64 clip_start = 0, clip_stop = 0;
+      guint64 clip_start = 0, clip_stop = 0;
       gboolean in_seg = FALSE;
 
       /* Check our segment start/stop */
@@ -1030,7 +995,7 @@ parse_subviewer (ParserState * state, const gchar * line)
     case 1:
     {
       /* No need to parse that text if it's out of segment */
-      gint64 clip_start = 0, clip_stop = 0;
+      guint64 clip_start = 0, clip_stop = 0;
       gboolean in_seg = FALSE;
 
       /* Check our segment start/stop */
@@ -1082,7 +1047,7 @@ parse_mpsub (ParserState * state, const gchar * line)
       return NULL;
     case 1:
     {                           /* No need to parse that text if it's out of segment */
-      gint64 clip_start = 0, clip_stop = 0;
+      guint64 clip_start = 0, clip_stop = 0;
       gboolean in_seg = FALSE;
 
       /* Check our segment start/stop */
@@ -1146,7 +1111,7 @@ parse_dks (ParserState * state, const gchar * line)
       return NULL;
     case 1:
     {
-      gint64 clip_start = 0, clip_stop = 0;
+      guint64 clip_start = 0, clip_stop = 0;
       gboolean in_seg;
       gchar *ret;
 
@@ -1419,6 +1384,8 @@ feed_textbuf (GstSubParse * self, GstBuffer * buf)
   gboolean discont;
   gsize consumed;
   gchar *input = NULL;
+  const guint8 *data;
+  gsize avail;
 
   discont = GST_BUFFER_IS_DISCONT (buf);
 
@@ -1443,19 +1410,20 @@ feed_textbuf (GstSubParse * self, GstBuffer * buf)
      * subtitles which are discontinuous by nature. */
   }
 
-  self->offset = GST_BUFFER_OFFSET (buf) + GST_BUFFER_SIZE (buf);
+  self->offset = GST_BUFFER_OFFSET (buf) + gst_buffer_get_size (buf);
   self->next_offset = self->offset;
 
   gst_adapter_push (self->adapter, buf);
 
-  input =
-      convert_encoding (self, (const gchar *) gst_adapter_peek (self->adapter,
-          gst_adapter_available (self->adapter)),
-      (gsize) gst_adapter_available (self->adapter), &consumed);
+  avail = gst_adapter_available (self->adapter);
+  data = gst_adapter_map (self->adapter, avail);
+  input = convert_encoding (self, (const gchar *) data, avail, &consumed);
 
   if (input && consumed > 0) {
     self->textbuf = g_string_append (self->textbuf, input);
-    gst_adapter_flush (self->adapter, consumed);
+    gst_adapter_unmap (self->adapter, consumed);
+  } else {
+    gst_adapter_unmap (self->adapter, 0);
   }
 
   g_free (input);
@@ -1466,12 +1434,13 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
 {
   GstFlowReturn ret = GST_FLOW_OK;
   GstCaps *caps = NULL;
-  gchar *line, *subtitle;
+  gchar *line, *subtitle, *data;
+  gsize size;
 
   if (self->first_buffer) {
-    self->detected_encoding =
-        detect_encoding ((gchar *) GST_BUFFER_DATA (buf),
-        GST_BUFFER_SIZE (buf));
+    data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+    self->detected_encoding = detect_encoding (data, size);
+    gst_buffer_unmap (buf, data, size);
     self->first_buffer = FALSE;
     self->state.fps_n = self->fps_n;
     self->state.fps_d = self->fps_d;
@@ -1515,36 +1484,32 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
       guint subtitle_len = strlen (subtitle);
 
       /* +1 for terminating NUL character */
-      ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad,
-          GST_BUFFER_OFFSET_NONE, subtitle_len + 1,
-          GST_PAD_CAPS (self->srcpad), &buf);
-
-      if (ret == GST_FLOW_OK) {
-        /* copy terminating NUL character as well */
-        memcpy (GST_BUFFER_DATA (buf), subtitle, subtitle_len + 1);
-        GST_BUFFER_SIZE (buf) = subtitle_len;
-        GST_BUFFER_TIMESTAMP (buf) = self->state.start_time;
-        GST_BUFFER_DURATION (buf) = self->state.duration;
-
-        /* in some cases (e.g. tmplayer) we can only determine the duration
-         * of a text chunk from the timestamp of the next text chunk; in those
-         * cases, we probably want to limit the duration to something
-         * reasonable, so we don't end up showing some text for e.g. 40 seconds
-         * just because nothing else is being said during that time */
-        if (self->state.max_duration > 0 && GST_BUFFER_DURATION_IS_VALID (buf)) {
-          if (GST_BUFFER_DURATION (buf) > self->state.max_duration)
-            GST_BUFFER_DURATION (buf) = self->state.max_duration;
-        }
+      buf = gst_buffer_new_and_alloc (subtitle_len + 1);
+
+      /* copy terminating NUL character as well */
+      gst_buffer_fill (buf, 0, subtitle, subtitle_len + 1);
+      gst_buffer_set_size (buf, subtitle_len);
+
+      GST_BUFFER_TIMESTAMP (buf) = self->state.start_time;
+      GST_BUFFER_DURATION (buf) = self->state.duration;
+
+      /* in some cases (e.g. tmplayer) we can only determine the duration
+       * of a text chunk from the timestamp of the next text chunk; in those
+       * cases, we probably want to limit the duration to something
+       * reasonable, so we don't end up showing some text for e.g. 40 seconds
+       * just because nothing else is being said during that time */
+      if (self->state.max_duration > 0 && GST_BUFFER_DURATION_IS_VALID (buf)) {
+        if (GST_BUFFER_DURATION (buf) > self->state.max_duration)
+          GST_BUFFER_DURATION (buf) = self->state.max_duration;
+      }
 
-        gst_segment_set_last_stop (&self->segment, GST_FORMAT_TIME,
-            self->state.start_time);
+      self->segment.position = self->state.start_time;
 
-        GST_DEBUG_OBJECT (self, "Sending text '%s', %" GST_TIME_FORMAT " + %"
-            GST_TIME_FORMAT, subtitle, GST_TIME_ARGS (self->state.start_time),
-            GST_TIME_ARGS (self->state.duration));
+      GST_DEBUG_OBJECT (self, "Sending text '%s', %" GST_TIME_FORMAT " + %"
+          GST_TIME_FORMAT, subtitle, GST_TIME_ARGS (self->state.start_time),
+          GST_TIME_ARGS (self->state.duration));
 
-        ret = gst_pad_push (self->srcpad, buf);
-      }
+      ret = gst_pad_push (self->srcpad, buf);
 
       /* move this forward (the tmplayer parser needs this) */
       if (self->state.duration != GST_CLOCK_TIME_NONE)
@@ -1576,9 +1541,7 @@ gst_sub_parse_chain (GstPad * sinkpad, GstBuffer * buf)
     GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
         &self->segment);
 
-    gst_pad_push_event (self->srcpad, gst_event_new_new_segment (FALSE,
-            self->segment.rate, self->segment.format,
-            self->segment.last_stop, self->segment.stop, self->segment.time));
+    gst_pad_push_event (self->srcpad, gst_event_new_segment (&self->segment));
     self->need_segment = FALSE;
   }
 
@@ -1603,45 +1566,33 @@ gst_sub_parse_sink_event (GstPad * pad, GstEvent * event)
           self->parser_type == GST_SUB_PARSE_FORMAT_TMPLAYER ||
           self->parser_type == GST_SUB_PARSE_FORMAT_MPL2 ||
           self->parser_type == GST_SUB_PARSE_FORMAT_QTTEXT) {
+        gchar term_chars[] = { '\n', '\n', '\0' };
         GstBuffer *buf = gst_buffer_new_and_alloc (2 + 1);
 
         GST_DEBUG ("EOS. Pushing remaining text (if any)");
-        GST_BUFFER_DATA (buf)[0] = '\n';
-        GST_BUFFER_DATA (buf)[1] = '\n';
-        GST_BUFFER_DATA (buf)[2] = '\0';        /* play it safe */
-        GST_BUFFER_SIZE (buf) = 2;
+        gst_buffer_fill (buf, 0, term_chars, 3);
+        gst_buffer_set_size (buf, 2);
+
         GST_BUFFER_OFFSET (buf) = self->offset;
         gst_sub_parse_chain (pad, buf);
       }
       ret = gst_pad_event_default (pad, event);
       break;
     }
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      GstFormat format;
-      gdouble rate;
-      gint64 start, stop, time;
-      gboolean update;
-
-      gst_event_parse_new_segment (event, &update, &rate, &format, &start,
-          &stop, &time);
-
-      GST_DEBUG_OBJECT (self, "newsegment (%s)", gst_format_get_name (format));
-
-      if (format == GST_FORMAT_TIME) {
-        gst_segment_set_newsegment (&self->segment, update, rate, format,
-            start, stop, time);
-      } else {
-        /* if not time format, we'll either start with a 0 timestamp anyway or
-         * it's following a seek in which case we'll have saved the requested
-         * seek segment and don't want to overwrite it (remember that on a seek
-         * we always just seek back to the start in BYTES format and just throw
-         * away all text that's before the requested position; if the subtitles
-         * come from an upstream demuxer, it won't be able to handle our BYTES
-         * seek request and instead send us a newsegment from the seek request
-         * it received via its video pads instead, so all is fine then too) */
-      }
-
+      gst_event_copy_segment (event, &self->segment);
+      GST_DEBUG_OBJECT (self, "newsegment (%s)",
+          gst_format_get_name (self->segment.format));
+
+      /* if not time format, we'll either start with a 0 timestamp anyway or
+       * it's following a seek in which case we'll have saved the requested
+       * seek segment and don't want to overwrite it (remember that on a seek
+       * we always just seek back to the start in BYTES format and just throw
+       * away all text that's before the requested position; if the subtitles
+       * come from an upstream demuxer, it won't be able to handle our BYTES
+       * seek request and instead send us a newsegment from the seek request
+       * it received via its video pads instead, so all is fine then too) */
       ret = TRUE;
       gst_event_unref (event);
       break;
@@ -1694,7 +1645,7 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
   if (ret == GST_STATE_CHANGE_FAILURE)
     return ret;
 
index 5731d91..93c1968 100644 (file)
@@ -95,7 +95,6 @@ struct _GstSubParse {
   
   /* Segment */
   GstSegment    segment;
-  GstSeekFlags  segment_flags;
   gboolean      need_segment;
   
   gboolean flushing;
index 98c62d7..e4e6310 100644 (file)
@@ -153,7 +153,6 @@ enum
 
 
 /* this is really arbitrarily chosen */
-#define DEFAULT_PROTOCOL                GST_TCP_PROTOCOL_NONE
 #define DEFAULT_MODE                    1
 #define DEFAULT_BUFFERS_MAX             -1
 #define DEFAULT_BUFFERS_SOFT_MAX        -1
@@ -178,7 +177,6 @@ enum
 enum
 {
   PROP_0,
-  PROP_PROTOCOL,
   PROP_MODE,
   PROP_BUFFERS_QUEUED,
   PROP_BYTES_QUEUED,
@@ -345,27 +343,12 @@ static void gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
 static void gst_multi_fd_sink_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-GST_BOILERPLATE (GstMultiFdSink, gst_multi_fd_sink, GstBaseSink,
-    GST_TYPE_BASE_SINK);
+#define gst_multi_fd_sink_parent_class parent_class
+G_DEFINE_TYPE (GstMultiFdSink, gst_multi_fd_sink, GST_TYPE_BASE_SINK);
 
 static guint gst_multi_fd_sink_signals[LAST_SIGNAL] = { 0 };
 
 static void
-gst_multi_fd_sink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sinktemplate));
-
-  gst_element_class_set_details_simple (element_class,
-      "Multi filedescriptor sink", "Sink/Network",
-      "Send data to multiple filedescriptors",
-      "Thomas Vander Stichele <thomas at apestaart dot org>, "
-      "Wim Taymans <wim@fluendo.com>");
-}
-
-static void
 gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
 {
   GObjectClass *gobject_class;
@@ -380,12 +363,6 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
   gobject_class->get_property = gst_multi_fd_sink_get_property;
   gobject_class->finalize = gst_multi_fd_sink_finalize;
 
-  g_object_class_install_property (gobject_class, PROP_PROTOCOL,
-      g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in"
-          ". GDP protocol here is deprecated. Please use gdppay element.",
-          GST_TYPE_TCP_PROTOCOL, DEFAULT_PROTOCOL,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
   /**
    * GstMultiFdSink::mode
    *
@@ -671,6 +648,15 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
           client_fd_removed), NULL, NULL, gst_tcp_marshal_VOID__INT,
       G_TYPE_NONE, 1, G_TYPE_INT);
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sinktemplate));
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "Multi filedescriptor sink", "Sink/Network",
+      "Send data to multiple filedescriptors",
+      "Thomas Vander Stichele <thomas at apestaart dot org>, "
+      "Wim Taymans <wim@fluendo.com>");
+
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_multi_fd_sink_change_state);
 
@@ -687,11 +673,10 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
 }
 
 static void
-gst_multi_fd_sink_init (GstMultiFdSink * this, GstMultiFdSinkClass * klass)
+gst_multi_fd_sink_init (GstMultiFdSink * this)
 {
   GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN);
 
-  this->protocol = DEFAULT_PROTOCOL;
   this->mode = DEFAULT_MODE;
 
   CLIENTS_LOCK_INIT (this);
@@ -1294,60 +1279,6 @@ ioctl_failed:
   }
 }
 
-/* Queue raw data for this client, creating a new buffer.
- * This takes ownership of the data by
- * setting it as GST_BUFFER_MALLOCDATA() on the created buffer so
- * be sure to pass g_free()-able @data.
- */
-static gboolean
-gst_multi_fd_sink_client_queue_data (GstMultiFdSink * sink,
-    GstTCPClient * client, gchar * data, gint len)
-{
-  GstBuffer *buf;
-
-  buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) data;
-  GST_BUFFER_MALLOCDATA (buf) = (guint8 *) data;
-  GST_BUFFER_SIZE (buf) = len;
-
-  GST_LOG_OBJECT (sink, "[fd %5d] queueing data of length %d",
-      client->fd.fd, len);
-
-  client->sending = g_slist_append (client->sending, buf);
-
-  return TRUE;
-}
-
-/* GDP-encode given caps and queue them for sending */
-static gboolean
-gst_multi_fd_sink_client_queue_caps (GstMultiFdSink * sink,
-    GstTCPClient * client, const GstCaps * caps)
-{
-  guint8 *header;
-  guint8 *payload;
-  guint length;
-  gchar *string;
-
-  g_return_val_if_fail (caps != NULL, FALSE);
-
-  string = gst_caps_to_string (caps);
-  GST_DEBUG_OBJECT (sink, "[fd %5d] Queueing caps %s through GDP",
-      client->fd.fd, string);
-  g_free (string);
-
-  if (!gst_dp_packet_from_caps (caps, sink->header_flags, &length, &header,
-          &payload)) {
-    GST_DEBUG_OBJECT (sink, "Could not create GDP packet from caps");
-    return FALSE;
-  }
-  gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header, length);
-
-  length = gst_dp_header_payload_length (header);
-  gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) payload, length);
-
-  return TRUE;
-}
-
 static gboolean
 is_sync_frame (GstMultiFdSink * sink, GstBuffer * buffer)
 {
@@ -1372,9 +1303,13 @@ gst_multi_fd_sink_client_queue_buffer (GstMultiFdSink * sink,
   gboolean send_streamheader = FALSE;
   GstStructure *s;
 
+#if 0
   /* before we queue the buffer, we check if we need to queue streamheader
    * buffers (because it's a new client, or because they changed) */
   caps = gst_buffer_get_caps (buffer);  /* cleaned up after streamheader */
+#else
+  caps = NULL;
+#endif
   if (!client->caps) {
     GST_DEBUG_OBJECT (sink,
         "[fd %5d] no previous caps for this client, send streamheader",
@@ -1456,25 +1391,10 @@ gst_multi_fd_sink_client_queue_buffer (GstMultiFdSink * sink,
         g_assert (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER);
         buffer = g_value_peek_pointer (bufval);
         GST_DEBUG_OBJECT (sink,
-            "[fd %5d] queueing streamheader buffer of length %d",
-            client->fd.fd, GST_BUFFER_SIZE (buffer));
+            "[fd %5d] queueing streamheader buffer of length %" G_GSIZE_FORMAT,
+            client->fd.fd, gst_buffer_get_size (buffer));
         gst_buffer_ref (buffer);
 
-        if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
-          guint8 *header;
-          guint len;
-
-          if (!gst_dp_header_from_buffer (buffer, sink->header_flags, &len,
-                  &header)) {
-            GST_DEBUG_OBJECT (sink,
-                "[fd %5d] could not create header, removing client",
-                client->fd.fd);
-            return FALSE;
-          }
-          gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header,
-              len);
-        }
-
         client->sending = g_slist_append (client->sending, buffer);
       }
     }
@@ -1482,21 +1402,9 @@ gst_multi_fd_sink_client_queue_buffer (GstMultiFdSink * sink,
 
   gst_caps_unref (caps);
   caps = NULL;
-  /* now we can send the buffer, possibly sending a GDP header first */
-  if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
-    guint8 *header;
-    guint len;
-
-    if (!gst_dp_header_from_buffer (buffer, sink->header_flags, &len, &header)) {
-      GST_DEBUG_OBJECT (sink,
-          "[fd %5d] could not create header, removing client", client->fd.fd);
-      return FALSE;
-    }
-    gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header, len);
-  }
 
-  GST_LOG_OBJECT (sink, "[fd %5d] queueing buffer of length %d",
-      client->fd.fd, GST_BUFFER_SIZE (buffer));
+  GST_LOG_OBJECT (sink, "[fd %5d] queueing buffer of length %" G_GSIZE_FORMAT,
+      client->fd.fd, gst_buffer_get_size (buffer));
 
   gst_buffer_ref (buffer);
   client->sending = g_slist_append (client->sending, buffer);
@@ -1583,7 +1491,7 @@ get_buffers_max (GstMultiFdSink * sink, gint64 max)
 
       for (i = 0; i < len; i++) {
         buf = g_array_index (sink->bufqueue, GstBuffer *, i);
-        acc += GST_BUFFER_SIZE (buf);
+        acc += gst_buffer_get_size (buf);
 
         if (acc > max)
           return i + 1;
@@ -1666,7 +1574,7 @@ find_limits (GstMultiFdSink * sink,
     }
     buf = g_array_index (sink->bufqueue, GstBuffer *, i);
 
-    bytes += GST_BUFFER_SIZE (buf);
+    bytes += gst_buffer_get_size (buf);
 
     /* take timestamp and save for the base first timestamp */
     if ((time = GST_BUFFER_TIMESTAMP (buf)) != -1) {
@@ -1992,7 +1900,6 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
 {
   int fd = client->fd.fd;
   gboolean more;
-  gboolean res;
   gboolean flushing;
   GstClockTime now;
   GTimeVal nowtv;
@@ -2002,39 +1909,6 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
 
   flushing = client->status == GST_CLIENT_STATUS_FLUSHING;
 
-  /* when using GDP, first check if we have queued caps yet */
-  if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
-    /* don't need to do anything when the client is flushing */
-    if (!client->caps_sent && !flushing) {
-      GstPad *peer;
-      GstCaps *caps;
-
-      peer = gst_pad_get_peer (GST_BASE_SINK_PAD (sink));
-      if (!peer) {
-        GST_WARNING_OBJECT (sink, "pad has no peer");
-        return FALSE;
-      }
-      gst_object_unref (peer);
-
-      caps = gst_pad_get_negotiated_caps (GST_BASE_SINK_PAD (sink));
-      if (!caps) {
-        GST_WARNING_OBJECT (sink, "pad caps not yet negotiated");
-        return FALSE;
-      }
-
-      /* queue caps for sending */
-      res = gst_multi_fd_sink_client_queue_caps (sink, client, caps);
-
-      gst_caps_unref (caps);
-
-      if (!res) {
-        GST_DEBUG_OBJECT (sink, "Failed queueing caps, removing client");
-        return FALSE;
-      }
-      client->caps_sent = TRUE;
-    }
-  }
-
   more = TRUE;
   do {
     gint maxsize;
@@ -2105,10 +1979,14 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
     if (client->sending) {
       ssize_t wrote;
       GstBuffer *head;
+      guint8 *data;
+      gsize size;
 
       /* pick first buffer from list */
       head = GST_BUFFER (client->sending->data);
-      maxsize = GST_BUFFER_SIZE (head) - client->bufoffset;
+
+      data = gst_buffer_map (head, &size, NULL, GST_MAP_READ);
+      maxsize = size - client->bufoffset;
 
       /* try to write the complete buffer */
 #ifdef MSG_NOSIGNAL
@@ -2117,12 +1995,11 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
 #define FLAGS 0
 #endif
       if (client->is_socket) {
-        wrote =
-            send (fd, GST_BUFFER_DATA (head) + client->bufoffset, maxsize,
-            FLAGS);
+        wrote = send (fd, data + client->bufoffset, maxsize, FLAGS);
       } else {
-        wrote = write (fd, GST_BUFFER_DATA (head) + client->bufoffset, maxsize);
+        wrote = write (fd, data + client->bufoffset, maxsize);
       }
+      gst_buffer_unmap (head, data, size);
 
       if (wrote < 0) {
         /* hmm error.. */
@@ -2603,13 +2480,16 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
 {
   GstMultiFdSink *sink;
   gboolean in_caps;
+#if 0
   GstCaps *bufcaps, *padcaps;
+#endif
 
   sink = GST_MULTI_FD_SINK (bsink);
 
   g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_MULTI_FD_SINK_OPEN),
       GST_FLOW_WRONG_STATE);
 
+#if 0
   /* since we check every buffer for streamheader caps, we need to make
    * sure every buffer has caps set */
   bufcaps = gst_buffer_get_caps (buf);
@@ -2618,20 +2498,22 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   /* make sure we have caps on the pad */
   if (!padcaps && !bufcaps)
     goto no_caps;
+#endif
 
   /* get IN_CAPS first, code below might mess with the flags */
   in_caps = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
 
+#if 0
   /* stamp the buffer with previous caps if no caps set */
   if (!bufcaps) {
-    if (!gst_buffer_is_metadata_writable (buf)) {
+    if (!gst_buffer_is_writable (buf)) {
       /* metadata is not writable, copy will be made and original buffer
        * will be unreffed so we need to ref so that we don't lose the
        * buffer in the render method. */
       gst_buffer_ref (buf);
       /* the new buffer is ours only, we keep it out of the scope of this
        * function */
-      buf = gst_buffer_make_metadata_writable (buf);
+      buf = gst_buffer_make_writable (buf);
     } else {
       /* else the metadata is writable, we ref because we keep the buffer
        * out of the scope of this method */
@@ -2645,6 +2527,7 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
     /* since we keep this buffer out of the scope of this method */
     gst_buffer_ref (buf);
   }
+#endif
 
   GST_LOG_OBJECT (sink, "received buffer %p, in_caps: %s, offset %"
       G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT
@@ -2677,25 +2560,26 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
    * We don't send the buffer to the client, since streamheaders are sent
    * separately when necessary. */
   if (in_caps) {
-    GST_DEBUG_OBJECT (sink,
-        "appending IN_CAPS buffer with length %d to streamheader",
-        GST_BUFFER_SIZE (buf));
+    GST_DEBUG_OBJECT (sink, "appending IN_CAPS buffer with length %"
+        G_GSIZE_FORMAT " to streamheader", gst_buffer_get_size (buf));
     sink->streamheader = g_slist_append (sink->streamheader, buf);
   } else {
     /* queue the buffer, this is a regular data buffer. */
     gst_multi_fd_sink_queue_buffer (sink, buf);
 
-    sink->bytes_to_serve += GST_BUFFER_SIZE (buf);
+    sink->bytes_to_serve += gst_buffer_get_size (buf);
   }
   return GST_FLOW_OK;
 
   /* ERRORS */
+#if 0
 no_caps:
   {
     GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL),
         ("Received first buffer without caps set"));
     return GST_FLOW_NOT_NEGOTIATED;
   }
+#endif
 }
 
 static void
@@ -2707,9 +2591,6 @@ gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
   multifdsink = GST_MULTI_FD_SINK (object);
 
   switch (prop_id) {
-    case PROP_PROTOCOL:
-      multifdsink->protocol = g_value_get_enum (value);
-      break;
     case PROP_MODE:
       multifdsink->mode = g_value_get_enum (value);
       break;
@@ -2778,9 +2659,6 @@ gst_multi_fd_sink_get_property (GObject * object, guint prop_id, GValue * value,
   multifdsink = GST_MULTI_FD_SINK (object);
 
   switch (prop_id) {
-    case PROP_PROTOCOL:
-      g_value_set_enum (value, multifdsink->protocol);
-      break;
     case PROP_MODE:
       g_value_set_enum (value, multifdsink->mode);
       break;
index 0ee7888..b0465af 100644 (file)
@@ -153,8 +153,6 @@ typedef struct {
 
   gboolean discont;
 
-  GstTCPProtocol protocol;
-
   gboolean caps_sent;
   gboolean new_connection;
 
@@ -208,7 +206,6 @@ struct _GstMultiFdSink {
   GSList *streamheader; /* GSList of GstBuffers to use as streamheader */
   gboolean previous_buffer_in_caps;
 
-  GstTCPProtocol protocol;
   guint mtu;
   gint qos_dscp;
   gboolean handle_read;
index 894fcb8..f1b83a4 100644 (file)
@@ -226,8 +226,9 @@ gst_tcp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
     GstBuffer ** buf)
 {
   int ret;
-  ssize_t bytes_read;
+  gssize bytes_read;
   int readsize;
+  guint8 *data;
 
   *buf = NULL;
 
@@ -251,7 +252,9 @@ gst_tcp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
 
   *buf = gst_buffer_new_and_alloc (readsize);
 
-  bytes_read = read (socket, GST_BUFFER_DATA (*buf), readsize);
+  data = gst_buffer_map (*buf, NULL, NULL, GST_MAP_WRITE);
+  bytes_read = read (socket, data, readsize);
+  gst_buffer_unmap (*buf, data, bytes_read);
 
   if (bytes_read < 0)
     goto read_error;
@@ -260,7 +263,8 @@ gst_tcp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
     /* but mom, you promised to give me readsize bytes! */
     goto short_read;
 
-  GST_LOG_OBJECT (this, "returning buffer of size %d", GST_BUFFER_SIZE (*buf));
+  GST_LOG_OBJECT (this,
+      "returning buffer of size %" G_GSSIZE_FORMAT, bytes_read);
   return GST_FLOW_OK;
 
   /* ERRORS */
@@ -317,6 +321,8 @@ gst_tcp_gdp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
 {
   GstFlowReturn ret;
   guint8 *header = NULL;
+  guint8 *data;
+  gsize size;
 
   GST_LOG_OBJECT (this, "Reading %d bytes for buffer packet header",
       GST_DP_HEADER_LENGTH);
@@ -341,8 +347,9 @@ gst_tcp_gdp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
 
   g_free (header);
 
-  ret = gst_tcp_socket_read (this, socket, GST_BUFFER_DATA (*buf),
-      GST_BUFFER_SIZE (*buf), fdset);
+  data = gst_buffer_map (*buf, &size, NULL, GST_MAP_WRITE);
+  ret = gst_tcp_socket_read (this, socket, data, size, fdset);
+  gst_buffer_unmap (*buf, data, size);
 
   if (ret != GST_FLOW_OK)
     goto data_read_error;
@@ -466,104 +473,3 @@ payload_validate_error:
     return GST_FLOW_ERROR;
   }
 }
-
-/* write a GDP header to the socket.  Return false if fails. */
-gboolean
-gst_tcp_gdp_write_buffer (GstElement * this, int socket, GstBuffer * buffer,
-    gboolean fatal, const gchar * host, int port)
-{
-  guint length;
-  guint8 *header;
-  size_t wrote;
-
-  if (!gst_dp_header_from_buffer (buffer, 0, &length, &header))
-    goto create_error;
-
-  GST_LOG_OBJECT (this, "writing %d bytes for GDP buffer header", length);
-  wrote = gst_tcp_socket_write (socket, header, length);
-  g_free (header);
-
-  if (wrote != length)
-    goto write_error;
-
-  return TRUE;
-
-  /* ERRORS */
-create_error:
-  {
-    if (fatal)
-      GST_ELEMENT_ERROR (this, CORE, TOO_LAZY, (NULL),
-          ("Could not create GDP header from buffer"));
-    return FALSE;
-  }
-write_error:
-  {
-    if (fatal)
-      GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
-          (_("Error while sending data to \"%s:%d\"."), host, port),
-          ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
-              wrote, GST_BUFFER_SIZE (buffer), g_strerror (errno)));
-    return FALSE;
-  }
-}
-
-/* write GDP header and payload to the given socket for the given caps.
- * Return false if fails. */
-gboolean
-gst_tcp_gdp_write_caps (GstElement * this, int socket, const GstCaps * caps,
-    gboolean fatal, const char *host, int port)
-{
-  guint length;
-  guint8 *header;
-  guint8 *payload;
-  size_t wrote;
-
-  if (!gst_dp_packet_from_caps (caps, 0, &length, &header, &payload))
-    goto create_error;
-
-  GST_LOG_OBJECT (this, "writing %d bytes for GDP caps header", length);
-  wrote = gst_tcp_socket_write (socket, header, length);
-  if (wrote != length)
-    goto write_header_error;
-
-  length = gst_dp_header_payload_length (header);
-  g_free (header);
-
-  GST_LOG_OBJECT (this, "writing %d bytes for GDP caps payload", length);
-  wrote = gst_tcp_socket_write (socket, payload, length);
-  g_free (payload);
-
-  if (wrote != length)
-    goto write_payload_error;
-
-  return TRUE;
-
-  /* ERRORS */
-create_error:
-  {
-    if (fatal)
-      GST_ELEMENT_ERROR (this, CORE, TOO_LAZY, (NULL),
-          ("Could not create GDP packet from caps"));
-    return FALSE;
-  }
-write_header_error:
-  {
-    g_free (header);
-    g_free (payload);
-    if (fatal)
-      GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
-          (_("Error while sending gdp header data to \"%s:%d\"."), host, port),
-          ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
-              wrote, length, g_strerror (errno)));
-    return FALSE;
-  }
-write_payload_error:
-  {
-    if (fatal)
-      GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
-          (_("Error while sending gdp payload data to \"%s:%d\"."), host, port),
-          ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
-              wrote, length, g_strerror (errno)));
-    return FALSE;
-  }
-}
index 533c162..64299ef 100644 (file)
 
 G_BEGIN_DECLS
 
-/**
- * GstTCPProtocol:
- * @GST_TCP_PROTOCOL_NONE: Raw data transmission
- * @GST_TCP_PROTOCOL_GDP: #GstBuffers are wrapped and sent/received using the
- *      GDP protocol.
- *
- * This enum is provided by the tcp/multifd elements to configure the format of
- * data transmission/reception.
- *
- * The GDP protocol wraps data buffers in a header that also carries format
- * information and timestamps. The None value indicates the data is
- * sent/received as-is. In that case, format information and timestamping
- * must be transmitted separately, or implicit in the bytestream itself.
- */
-typedef enum
-{
-  GST_TCP_PROTOCOL_NONE,
-  GST_TCP_PROTOCOL_GDP
-} GstTCPProtocol;
-
 gchar * gst_tcp_host_to_ip (GstElement *element, const gchar *host);
 
 gint gst_tcp_socket_write (int socket, const void *buf, size_t count);
@@ -65,12 +45,6 @@ GstFlowReturn gst_tcp_read_buffer (GstElement * this, int socket, GstPoll * fdse
 GstFlowReturn gst_tcp_gdp_read_buffer (GstElement * this, int socket, GstPoll * fdset, GstBuffer **buf);
 GstFlowReturn gst_tcp_gdp_read_caps (GstElement * this, int socket, GstPoll * fdset, GstCaps **caps);
 
-GstEvent * gst_tcp_gdp_read_event (GstElement *elem, int socket, GstPoll * fdset);
-
-gboolean gst_tcp_gdp_write_buffer (GstElement *elem, int socket, GstBuffer *buffer, gboolean fatal, const gchar *host, int port);
-gboolean gst_tcp_gdp_write_event (GstElement *elem, int socket, GstEvent *event, gboolean fatal, const gchar *host, int port);
-gboolean gst_tcp_gdp_write_caps (GstElement *elem, int socket, const GstCaps *caps, gboolean fatal, const gchar *host, int port);
-
 G_END_DECLS
 
 #endif /* __GST_TCP_HELP_H__ */
index ca60578..a8dc756 100644 (file)
@@ -57,9 +57,7 @@ enum
 {
   ARG_0,
   ARG_HOST,
-  ARG_PORT,
-  ARG_PROTOCOL
-      /* FILL ME */
+  ARG_PORT
 };
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
@@ -67,9 +65,6 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS_ANY);
 
-static void gst_tcp_client_sink_base_init (gpointer g_class);
-static void gst_tcp_client_sink_class_init (GstTCPClientSink * klass);
-static void gst_tcp_client_sink_init (GstTCPClientSink * tcpclientsink);
 static void gst_tcp_client_sink_finalize (GObject * gobject);
 
 static gboolean gst_tcp_client_sink_setcaps (GstBaseSink * bsink,
@@ -85,53 +80,13 @@ static void gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
 
-static GstElementClass *parent_class = NULL;
-
 /*static guint gst_tcp_client_sink_signals[LAST_SIGNAL] = { 0 }; */
 
-GType
-gst_tcp_client_sink_get_type (void)
-{
-  static GType tcpclientsink_type = 0;
-
-
-  if (!tcpclientsink_type) {
-    static const GTypeInfo tcpclientsink_info = {
-      sizeof (GstTCPClientSinkClass),
-      gst_tcp_client_sink_base_init,
-      NULL,
-      (GClassInitFunc) gst_tcp_client_sink_class_init,
-      NULL,
-      NULL,
-      sizeof (GstTCPClientSink),
-      0,
-      (GInstanceInitFunc) gst_tcp_client_sink_init,
-      NULL
-    };
-
-    tcpclientsink_type =
-        g_type_register_static (GST_TYPE_BASE_SINK, "GstTCPClientSink",
-        &tcpclientsink_info, 0);
-  }
-  return tcpclientsink_type;
-}
-
-static void
-gst_tcp_client_sink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sinktemplate));
-
-  gst_element_class_set_details_simple (element_class,
-      "TCP client sink", "Sink/Network",
-      "Send data as a client over the network via TCP",
-      "Thomas Vander Stichele <thomas at apestaart dot org>");
-}
+#define gst_tcp_client_sink_parent_class parent_class
+G_DEFINE_TYPE (GstTCPClientSink, gst_tcp_client_sink, GST_TYPE_BASE_SINK);
 
 static void
-gst_tcp_client_sink_class_init (GstTCPClientSink * klass)
+gst_tcp_client_sink_class_init (GstTCPClientSinkClass * klass)
 {
   GObjectClass *gobject_class;
   GstElementClass *gstelement_class;
@@ -154,10 +109,14 @@ gst_tcp_client_sink_class_init (GstTCPClientSink * klass)
       g_param_spec_int ("port", "Port", "The port to send the packets to",
           0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, ARG_PROTOCOL,
-      g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
-          GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sinktemplate));
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "TCP client sink", "Sink/Network",
+      "Send data as a client over the network via TCP",
+      "Thomas Vander Stichele <thomas at apestaart dot org>");
 
   gstelement_class->change_state = gst_tcp_client_sink_change_state;
 
@@ -174,7 +133,6 @@ gst_tcp_client_sink_init (GstTCPClientSink * this)
   this->port = TCP_DEFAULT_PORT;
 
   this->sock_fd.fd = -1;
-  this->protocol = GST_TCP_PROTOCOL_NONE;
   GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SINK_OPEN);
 }
 
@@ -191,45 +149,7 @@ gst_tcp_client_sink_finalize (GObject * gobject)
 static gboolean
 gst_tcp_client_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 {
-  GstTCPClientSink *sink;
-
-  sink = GST_TCP_CLIENT_SINK (bsink);
-
-  /* write the buffer header if we have one */
-  switch (sink->protocol) {
-    case GST_TCP_PROTOCOL_NONE:
-      break;
-
-    case GST_TCP_PROTOCOL_GDP:
-      /* if we haven't send caps yet, send them first */
-      if (!sink->caps_sent) {
-        const GstCaps *caps;
-        gchar *string;
-
-        caps = GST_PAD_CAPS (GST_PAD_PEER (GST_BASE_SINK_PAD (bsink)));
-        string = gst_caps_to_string (caps);
-        GST_DEBUG_OBJECT (sink, "Sending caps %s through GDP", string);
-        g_free (string);
-
-        if (!gst_tcp_gdp_write_caps (GST_ELEMENT (sink), sink->sock_fd.fd,
-                caps, TRUE, sink->host, sink->port))
-          goto gdp_write_error;
-
-        sink->caps_sent = TRUE;
-      }
-      break;
-    default:
-      g_warning ("Unhandled protocol type");
-      break;
-  }
-
   return TRUE;
-
-  /* ERRORS */
-gdp_write_error:
-  {
-    return FALSE;
-  }
 }
 
 static GstFlowReturn
@@ -237,33 +157,21 @@ gst_tcp_client_sink_render (GstBaseSink * bsink, GstBuffer * buf)
 {
   size_t wrote = 0;
   GstTCPClientSink *sink;
-  gint size;
+  guint8 *data;
+  gsize size;
 
   sink = GST_TCP_CLIENT_SINK (bsink);
 
   g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_TCP_CLIENT_SINK_OPEN),
       GST_FLOW_WRONG_STATE);
 
-  size = GST_BUFFER_SIZE (buf);
-
-  GST_LOG_OBJECT (sink, "writing %d bytes for buffer data", size);
-
-  /* write the buffer header if we have one */
-  switch (sink->protocol) {
-    case GST_TCP_PROTOCOL_NONE:
-      break;
-    case GST_TCP_PROTOCOL_GDP:
-      GST_LOG_OBJECT (sink, "Sending buffer header through GDP");
-      if (!gst_tcp_gdp_write_buffer (GST_ELEMENT (sink), sink->sock_fd.fd, buf,
-              TRUE, sink->host, sink->port))
-        goto gdp_write_error;
-      break;
-    default:
-      break;
-  }
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  GST_LOG_OBJECT (sink, "writing %" G_GSIZE_FORMAT " bytes for buffer data",
+      size);
 
   /* write buffer data */
-  wrote = gst_tcp_socket_write (sink->sock_fd.fd, GST_BUFFER_DATA (buf), size);
+  wrote = gst_tcp_socket_write (sink->sock_fd.fd, data, size);
+  gst_buffer_unmap (buf, data, size);
 
   if (wrote < size)
     goto write_error;
@@ -273,16 +181,12 @@ gst_tcp_client_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   return GST_FLOW_OK;
 
   /* ERRORS */
-gdp_write_error:
-  {
-    return FALSE;
-  }
 write_error:
   {
     GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
         (_("Error while sending data to \"%s:%d\"."), sink->host, sink->port),
-        ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
-            wrote, GST_BUFFER_SIZE (buf), g_strerror (errno)));
+        ("Only %" G_GSIZE_FORMAT " of %" G_GSIZE_FORMAT " bytes written: %s",
+            wrote, size, g_strerror (errno)));
     return GST_FLOW_ERROR;
   }
 }
@@ -308,9 +212,6 @@ gst_tcp_client_sink_set_property (GObject * object, guint prop_id,
     case ARG_PORT:
       tcpclientsink->port = g_value_get_int (value);
       break;
-    case ARG_PROTOCOL:
-      tcpclientsink->protocol = g_value_get_enum (value);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -334,9 +235,6 @@ gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
     case ARG_PORT:
       g_value_set_int (value, tcpclientsink->port);
       break;
-    case ARG_PROTOCOL:
-      g_value_set_enum (value, tcpclientsink->protocol);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
index 4399870..09556ff 100644 (file)
@@ -76,7 +76,6 @@ struct _GstTCPClientSink {
   GstPollFD sock_fd;
 
   size_t data_written; /* how much bytes have we written ? */
-  GstTCPProtocol protocol; /* used with the protocol enum */
   gboolean caps_sent; /* whether or not we sent caps already */
 };
 
index b8ac849..3a83fba 100644 (file)
@@ -62,18 +62,17 @@ enum
 {
   PROP_0,
   PROP_HOST,
-  PROP_PORT,
-  PROP_PROTOCOL
+  PROP_PORT
 };
 
-
-GST_BOILERPLATE (GstTCPClientSrc, gst_tcp_client_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC);
+#define gst_tcp_client_src_parent_class parent_class
+G_DEFINE_TYPE (GstTCPClientSrc, gst_tcp_client_src, GST_TYPE_PUSH_SRC);
 
 
 static void gst_tcp_client_src_finalize (GObject * gobject);
 
-static GstCaps *gst_tcp_client_src_getcaps (GstBaseSrc * psrc);
+static GstCaps *gst_tcp_client_src_getcaps (GstBaseSrc * psrc,
+    GstCaps * filter);
 
 static GstFlowReturn gst_tcp_client_src_create (GstPushSrc * psrc,
     GstBuffer ** outbuf);
@@ -87,29 +86,16 @@ static void gst_tcp_client_src_set_property (GObject * object, guint prop_id,
 static void gst_tcp_client_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-
-static void
-gst_tcp_client_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&srctemplate));
-
-  gst_element_class_set_details_simple (element_class,
-      "TCP client source", "Source/Network",
-      "Receive data as a client over the network via TCP",
-      "Thomas Vander Stichele <thomas at apestaart dot org>");
-}
-
 static void
 gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   GstBaseSrcClass *gstbasesrc_class;
   GstPushSrcClass *gstpush_src_class;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
   gstpush_src_class = (GstPushSrcClass *) klass;
 
@@ -125,10 +111,14 @@ gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
       g_param_spec_int ("port", "Port", "The port to receive packets from", 0,
           TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_PROTOCOL,
-      g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
-          GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&srctemplate));
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "TCP client source", "Source/Network",
+      "Receive data as a client over the network via TCP",
+      "Thomas Vander Stichele <thomas at apestaart dot org>");
 
   gstbasesrc_class->get_caps = gst_tcp_client_src_getcaps;
   gstbasesrc_class->start = gst_tcp_client_src_start;
@@ -143,12 +133,11 @@ gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
 }
 
 static void
-gst_tcp_client_src_init (GstTCPClientSrc * this, GstTCPClientSrcClass * g_class)
+gst_tcp_client_src_init (GstTCPClientSrc * this)
 {
   this->port = TCP_DEFAULT_PORT;
   this->host = g_strdup (TCP_DEFAULT_HOST);
   this->sock_fd.fd = -1;
-  this->protocol = GST_TCP_PROTOCOL_NONE;
   this->caps = NULL;
 
   GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SRC_OPEN);
@@ -165,7 +154,7 @@ gst_tcp_client_src_finalize (GObject * gobject)
 }
 
 static GstCaps *
-gst_tcp_client_src_getcaps (GstBaseSrc * bsrc)
+gst_tcp_client_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
 {
   GstTCPClientSrc *src;
   GstCaps *caps = NULL;
@@ -173,11 +162,15 @@ gst_tcp_client_src_getcaps (GstBaseSrc * bsrc)
   src = GST_TCP_CLIENT_SRC (bsrc);
 
   if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_CLIENT_SRC_OPEN))
-    caps = gst_caps_new_any ();
+    caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
+  else if (src->caps && filter)
+    caps =
+        gst_caps_intersect_full (filter, src->caps, GST_CAPS_INTERSECT_FIRST);
   else if (src->caps)
     caps = gst_caps_copy (src->caps);
   else
-    caps = gst_caps_new_any ();
+    caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
+
   GST_DEBUG_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps);
   g_assert (GST_IS_CAPS (caps));
   return caps;
@@ -196,49 +189,19 @@ gst_tcp_client_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
 
   GST_LOG_OBJECT (src, "asked for a buffer");
 
-  /* read the buffer header if we're using a protocol */
-  switch (src->protocol) {
-    case GST_TCP_PROTOCOL_NONE:
-      ret = gst_tcp_read_buffer (GST_ELEMENT (src), src->sock_fd.fd,
-          src->fdset, outbuf);
-      break;
-
-    case GST_TCP_PROTOCOL_GDP:
-      /* get the caps if we're using GDP */
-      if (!src->caps_received) {
-        GstCaps *caps;
-
-        GST_DEBUG_OBJECT (src, "getting caps through GDP");
-        ret = gst_tcp_gdp_read_caps (GST_ELEMENT (src), src->sock_fd.fd,
-            src->fdset, &caps);
-
-        if (ret != GST_FLOW_OK)
-          goto no_caps;
-
-        src->caps_received = TRUE;
-        src->caps = caps;
-      }
-
-      ret = gst_tcp_gdp_read_buffer (GST_ELEMENT (src), src->sock_fd.fd,
-          src->fdset, outbuf);
-      break;
-    default:
-      /* need to assert as buf == NULL */
-      g_assert ("Unhandled protocol type");
-      break;
-  }
+  /* read the buffer header */
+  ret = gst_tcp_read_buffer (GST_ELEMENT (src), src->sock_fd.fd,
+      src->fdset, outbuf);
 
   if (ret == GST_FLOW_OK) {
     GST_LOG_OBJECT (src,
-        "Returning buffer from _get of size %d, ts %"
+        "Returning buffer from _get of size %" G_GSIZE_FORMAT ", ts %"
         GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT
         ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
-        GST_BUFFER_SIZE (*outbuf),
+        gst_buffer_get_size (*outbuf),
         GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*outbuf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (*outbuf)),
         GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
-
-    gst_buffer_set_caps (*outbuf, src->caps);
   }
 
   return ret;
@@ -248,12 +211,6 @@ wrong_state:
     GST_DEBUG_OBJECT (src, "connection to closed, cannot read data");
     return GST_FLOW_WRONG_STATE;
   }
-no_caps:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
-        ("Could not read caps through GDP"));
-    return ret;
-  }
 }
 
 static void
@@ -274,9 +231,6 @@ gst_tcp_client_src_set_property (GObject * object, guint prop_id,
     case PROP_PORT:
       tcpclientsrc->port = g_value_get_int (value);
       break;
-    case PROP_PROTOCOL:
-      tcpclientsrc->protocol = g_value_get_enum (value);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -297,9 +251,6 @@ gst_tcp_client_src_get_property (GObject * object, guint prop_id,
     case PROP_PORT:
       g_value_set_int (value, tcpclientsrc->port);
       break;
-    case PROP_PROTOCOL:
-      g_value_set_enum (value, tcpclientsrc->protocol);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
index 24d31e8..77d5702 100644 (file)
@@ -67,7 +67,6 @@ struct _GstTCPClientSrc {
   GstPollFD sock_fd;
   GstPoll *fdset;
 
-  GstTCPProtocol protocol; /* protocol used for reading data */
   gboolean caps_received;      /* if we have received caps yet */
   GstCaps *caps;
 };
index fdca0ec..1c9ea4a 100644 (file)
@@ -74,29 +74,18 @@ static void gst_tcp_server_sink_set_property (GObject * object, guint prop_id,
 static void gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-
-GST_BOILERPLATE (GstTCPServerSink, gst_tcp_server_sink, GstMultiFdSink,
-    GST_TYPE_MULTI_FD_SINK);
-
-
-static void
-gst_tcp_server_sink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "TCP server sink", "Sink/Network",
-      "Send data as a server over the network via TCP",
-      "Thomas Vander Stichele <thomas at apestaart dot org>");
-}
+#define gst_tcp_server_sink_parent_class parent_class
+G_DEFINE_TYPE (GstTCPServerSink, gst_tcp_server_sink, GST_TYPE_MULTI_FD_SINK);
 
 static void
 gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   GstMultiFdSinkClass *gstmultifdsink_class;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
   gstmultifdsink_class = (GstMultiFdSinkClass *) klass;
 
   gobject_class->set_property = gst_tcp_server_sink_set_property;
@@ -111,6 +100,11 @@ gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
           0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "TCP server sink", "Sink/Network",
+      "Send data as a server over the network via TCP",
+      "Thomas Vander Stichele <thomas at apestaart dot org>");
+
   gstmultifdsink_class->init = gst_tcp_server_sink_init_send;
   gstmultifdsink_class->wait = gst_tcp_server_sink_handle_wait;
   gstmultifdsink_class->close = gst_tcp_server_sink_close;
@@ -120,8 +114,7 @@ gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
 }
 
 static void
-gst_tcp_server_sink_init (GstTCPServerSink * this,
-    GstTCPServerSinkClass * klass)
+gst_tcp_server_sink_init (GstTCPServerSink * this)
 {
   this->server_port = TCP_DEFAULT_PORT;
   /* should support as minimum 576 for IPV4 and 1500 for IPV6 */
index c4244da..786557e 100644 (file)
@@ -63,13 +63,11 @@ enum
 {
   PROP_0,
   PROP_HOST,
-  PROP_PORT,
-  PROP_PROTOCOL
+  PROP_PORT
 };
 
-
-GST_BOILERPLATE (GstTCPServerSrc, gst_tcp_server_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC);
+#define gst_tcp_server_src_parent_class parent_class
+G_DEFINE_TYPE (GstTCPServerSrc, gst_tcp_server_src, GST_TYPE_PUSH_SRC);
 
 
 static void gst_tcp_server_src_finalize (GObject * gobject);
@@ -85,29 +83,16 @@ static void gst_tcp_server_src_set_property (GObject * object, guint prop_id,
 static void gst_tcp_server_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-
-static void
-gst_tcp_server_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&srctemplate));
-
-  gst_element_class_set_details_simple (element_class,
-      "TCP server source", "Source/Network",
-      "Receive data as a server over the network via TCP",
-      "Thomas Vander Stichele <thomas at apestaart dot org>");
-}
-
 static void
 gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   GstBaseSrcClass *gstbasesrc_class;
   GstPushSrcClass *gstpush_src_class;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
   gstpush_src_class = (GstPushSrcClass *) klass;
 
@@ -122,10 +107,14 @@ gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
       g_param_spec_int ("port", "Port", "The port to listen to",
           0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_PROTOCOL,
-      g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
-          GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&srctemplate));
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "TCP server source", "Source/Network",
+      "Receive data as a server over the network via TCP",
+      "Thomas Vander Stichele <thomas at apestaart dot org>");
 
   gstbasesrc_class->start = gst_tcp_server_src_start;
   gstbasesrc_class->stop = gst_tcp_server_src_stop;
@@ -138,13 +127,12 @@ gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
 }
 
 static void
-gst_tcp_server_src_init (GstTCPServerSrc * src, GstTCPServerSrcClass * g_class)
+gst_tcp_server_src_init (GstTCPServerSrc * src)
 {
   src->server_port = TCP_DEFAULT_PORT;
   src->host = g_strdup (TCP_DEFAULT_HOST);
   src->server_sock_fd.fd = -1;
   src->client_sock_fd.fd = -1;
-  src->protocol = GST_TCP_PROTOCOL_NONE;
 
   GST_OBJECT_FLAG_UNSET (src, GST_TCP_SERVER_SRC_OPEN);
 }
@@ -205,54 +193,15 @@ restart:
 
   GST_LOG_OBJECT (src, "asked for a buffer");
 
-  switch (src->protocol) {
-    case GST_TCP_PROTOCOL_NONE:
-      ret = gst_tcp_read_buffer (GST_ELEMENT (src), src->client_sock_fd.fd,
-          src->fdset, outbuf);
-      break;
-
-    case GST_TCP_PROTOCOL_GDP:
-      if (!src->caps_received) {
-        GstCaps *caps;
-        gchar *string;
-
-        ret = gst_tcp_gdp_read_caps (GST_ELEMENT (src), src->client_sock_fd.fd,
-            src->fdset, &caps);
-
-        if (ret == GST_FLOW_WRONG_STATE)
-          goto gdp_cancelled;
-
-        if (ret != GST_FLOW_OK)
-          goto gdp_caps_read_error;
-
-        src->caps_received = TRUE;
-        string = gst_caps_to_string (caps);
-        GST_DEBUG_OBJECT (src, "Received caps through GDP: %s", string);
-        g_free (string);
-
-        gst_pad_set_caps (GST_BASE_SRC_PAD (psrc), caps);
-      }
-
-      ret = gst_tcp_gdp_read_buffer (GST_ELEMENT (src), src->client_sock_fd.fd,
-          src->fdset, outbuf);
-
-      if (ret == GST_FLOW_OK)
-        gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
-
-      break;
-
-    default:
-      /* need to assert as buf == NULL */
-      g_assert ("Unhandled protocol type");
-      break;
-  }
+  ret = gst_tcp_read_buffer (GST_ELEMENT (src), src->client_sock_fd.fd,
+      src->fdset, outbuf);
 
   if (ret == GST_FLOW_OK) {
     GST_LOG_OBJECT (src,
-        "Returning buffer from _get of size %d, ts %"
+        "Returning buffer from _get of size %" G_GSIZE_FORMAT ", ts %"
         GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT
         ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
-        GST_BUFFER_SIZE (*outbuf),
+        gst_buffer_get_size (*outbuf),
         GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*outbuf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (*outbuf)),
         GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
@@ -282,20 +231,6 @@ accept_error:
         ("Could not accept client on server socket: %s", g_strerror (errno)));
     return GST_FLOW_ERROR;
   }
-gdp_cancelled:
-  {
-    GST_DEBUG_OBJECT (src, "reading gdp canceled");
-    return GST_FLOW_WRONG_STATE;
-  }
-gdp_caps_read_error:
-  {
-    /* if we did not get canceled, report an error */
-    if (ret != GST_FLOW_WRONG_STATE) {
-      GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
-          ("Could not read caps through GDP"));
-    }
-    return ret;
-  }
 }
 
 static void
@@ -316,9 +251,6 @@ gst_tcp_server_src_set_property (GObject * object, guint prop_id,
     case PROP_PORT:
       tcpserversrc->server_port = g_value_get_int (value);
       break;
-    case PROP_PROTOCOL:
-      tcpserversrc->protocol = g_value_get_enum (value);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -339,9 +271,6 @@ gst_tcp_server_src_get_property (GObject * object, guint prop_id,
     case PROP_PORT:
       g_value_set_int (value, tcpserversrc->server_port);
       break;
-    case PROP_PROTOCOL:
-      g_value_set_enum (value, tcpserversrc->protocol);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
index 22c7afe..f5e80e2 100644 (file)
@@ -74,7 +74,6 @@ struct _GstTCPServerSrc {
 
   GstPoll *fdset;
 
-  GstTCPProtocol protocol; /* protocol used for reading data */
   gboolean caps_received;      /* if we have received caps yet */
 };
 
index 5d3d95c..b9dd5d9 100644 (file)
@@ -130,7 +130,7 @@ static gboolean
 utf8_type_find_have_valid_utf8_at_offset (GstTypeFind * tf, guint64 offset,
     GstTypeFindProbability * prob)
 {
-  guint8 *data;
+  const guint8 *data;
 
   /* randomly decided values */
   guint min_size = 16;          /* minimum size  */
@@ -222,7 +222,7 @@ static GstStaticCaps uri_caps = GST_STATIC_CAPS ("text/uri-list");
 static void
 uri_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, BUFFER_SIZE);
+  const guint8 *data = gst_type_find_peek (tf, 0, BUFFER_SIZE);
   guint pos = 0;
   guint offset = 0;
 
@@ -322,7 +322,7 @@ xml_check_first_element (GstTypeFind * tf, const gchar * element, guint elen,
     gboolean strict)
 {
   gboolean got_xmldec;
-  guint8 *data;
+  const guint8 *data;
   guint offset = 0;
   guint pos = 0;
 
@@ -386,7 +386,7 @@ static GstStaticCaps sdp_caps = GST_STATIC_CAPS ("application/sdp");
 static gboolean
 sdp_check_header (GstTypeFind * tf)
 {
-  guint8 *data;
+  const guint8 *data;
 
   data = gst_type_find_peek (tf, 0, 5);
   if (!data)
@@ -433,9 +433,9 @@ static GstStaticCaps html_caps = GST_STATIC_CAPS ("text/html");
 static void
 html_type_find (GstTypeFind * tf, gpointer unused)
 {
-  gchar *d, *data;
+  const gchar *d, *data;
 
-  data = (gchar *) gst_type_find_peek (tf, 0, 16);
+  data = (const gchar *) gst_type_find_peek (tf, 0, 16);
   if (!data)
     return;
 
@@ -444,7 +444,7 @@ html_type_find (GstTypeFind * tf, gpointer unused)
   } else if (xml_check_first_element (tf, "html", 4, FALSE)) {
     gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
   } else if ((d = memchr (data, '<', 16))) {
-    data = (gchar *) gst_type_find_peek (tf, d - data, 6);
+    data = (const gchar *) gst_type_find_peek (tf, d - data, 6);
     if (data && g_ascii_strncasecmp (data, "<html>", 6) == 0) {
       gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
     }
@@ -459,7 +459,7 @@ static GstStaticCaps mid_caps = GST_STATIC_CAPS ("audio/midi");
 static void
 mid_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   /* http://jedi.ks.uiuc.edu/~johns/links/music/midifile.html */
   if (data && data[0] == 'M' && data[1] == 'T' && data[2] == 'h'
@@ -475,7 +475,7 @@ static GstStaticCaps mxmf_caps = GST_STATIC_CAPS ("audio/mobile-xmf");
 static void
 mxmf_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = NULL;
+  const guint8 *data = NULL;
 
   /* Search FileId "XMF_" 4 bytes */
   data = gst_type_find_peek (tf, 0, 4);
@@ -503,7 +503,7 @@ static GstStaticCaps flx_caps = GST_STATIC_CAPS ("video/x-fli");
 static void
 flx_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 134);
+  const guint8 *data = gst_type_find_peek (tf, 0, 134);
 
   if (data) {
     /* check magic and the frame type of the first frame */
@@ -534,7 +534,7 @@ static GstStaticCaps id3_caps = GST_STATIC_CAPS ("application/x-id3");
 static void
 id3v2_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 10);
+  const guint8 *data = gst_type_find_peek (tf, 0, 10);
 
   if (data && memcmp (data, "ID3", 3) == 0 &&
       data[3] != 0xFF && data[4] != 0xFF &&
@@ -547,7 +547,7 @@ id3v2_type_find (GstTypeFind * tf, gpointer unused)
 static void
 id3v1_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, -128, 3);
+  const guint8 *data = gst_type_find_peek (tf, -128, 3);
 
   if (data && memcmp (data, "TAG", 3) == 0) {
     gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS);
@@ -562,7 +562,7 @@ static GstStaticCaps apetag_caps = GST_STATIC_CAPS ("application/x-apetag");
 static void
 apetag_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data;
+  const guint8 *data;
 
   /* APEv1/2 at start of file */
   data = gst_type_find_peek (tf, 0, 8);
@@ -587,7 +587,7 @@ static GstStaticCaps tta_caps = GST_STATIC_CAPS ("audio/x-ttafile");
 static void
 tta_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 3);
+  const guint8 *data = gst_type_find_peek (tf, 0, 3);
 
   if (data) {
     if (memcmp (data, "TTA", 3) == 0) {
@@ -985,8 +985,8 @@ static void
 mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
     guint * found_layer, GstTypeFindProbability * found_prob)
 {
-  guint8 *data = NULL;
-  guint8 *data_end = NULL;
+  const guint8 *data = NULL;
+  const guint8 *data_end = NULL;
   guint size;
   guint64 skipped;
   gint last_free_offset = -1;
@@ -1010,7 +1010,7 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
       data_end = data + size;
     }
     if (*data == 0xFF) {
-      guint8 *head_data = NULL;
+      const guint8 *head_data = NULL;
       guint layer = 0, bitrate, samplerate, channels;
       guint found = 0;          /* number of valid headers found */
       guint64 offset = skipped;
@@ -1128,7 +1128,7 @@ static void
 mp3_type_find (GstTypeFind * tf, gpointer unused)
 {
   GstTypeFindProbability prob, mid_prob;
-  guint8 *data;
+  const guint8 *data;
   guint layer, mid_layer;
   guint64 length;
 
@@ -1198,7 +1198,7 @@ GST_STATIC_CAPS ("audio/x-musepack, streamversion= (int) { 7, 8 }");
 static void
 musepack_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
   GstTypeFindProbability prop = GST_TYPE_FIND_MINIMUM;
   gint streamversion = -1;
 
@@ -1520,7 +1520,7 @@ wavpack_type_find (GstTypeFind * tf, gpointer unused)
 {
   guint64 offset;
   guint32 blocksize;
-  guint8 *data;
+  const guint8 *data;
 
   data = gst_type_find_peek (tf, 0, 32);
   if (!data)
@@ -1583,7 +1583,7 @@ GST_STATIC_CAPS ("application/postscript");
 static void
 postscript_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 3);
+  const guint8 *data = gst_type_find_peek (tf, 0, 3);
   if (!data)
     return;
 
@@ -1633,8 +1633,8 @@ GST_STATIC_CAPS ("multipart/x-mixed-replace");
 static void
 multipart_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data;
-  guint8 *x;
+  const guint8 *data;
+  const guint8 *x;
 
 #define MULTIPART_MAX_BOUNDARY_OFFSET 16
   data = gst_type_find_peek (tf, 0, MULTIPART_MAX_BOUNDARY_OFFSET);
@@ -1743,7 +1743,7 @@ mpeg_sys_is_valid_pack (GstTypeFind * tf, const guint8 * data, guint len,
 }
 
 static gboolean
-mpeg_sys_is_valid_pes (GstTypeFind * tf, guint8 * data, guint len,
+mpeg_sys_is_valid_pes (GstTypeFind * tf, const guint8 * data, guint len,
     guint * pack_size)
 {
   guint pes_packet_len;
@@ -1771,7 +1771,7 @@ mpeg_sys_is_valid_pes (GstTypeFind * tf, guint8 * data, guint len,
 }
 
 static gboolean
-mpeg_sys_is_valid_sys (GstTypeFind * tf, guint8 * data, guint len,
+mpeg_sys_is_valid_sys (GstTypeFind * tf, const guint8 * data, guint len,
     guint * pack_size)
 {
   guint sys_hdr_len;
@@ -1812,7 +1812,7 @@ mpeg_sys_is_valid_sys (GstTypeFind * tf, guint8 * data, guint len,
 static void
 mpeg_sys_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data, *data0, *first_sync, *end;
+  const guint8 *data, *data0, *first_sync, *end;
   gint mpegversion = 0;
   guint pack_headers = 0;
   guint pes_headers = 0;
@@ -1953,7 +1953,7 @@ mpeg_ts_probe_headers (GstTypeFind * tf, guint64 offset, gint packet_size)
 {
   /* We always enter this function having found at least one header already */
   gint found = 1;
-  guint8 *data = NULL;
+  const guint8 *data = NULL;
 
   GST_LOG ("looking for mpeg-ts packets of size %u", packet_size);
   while (found < GST_MPEGTS_TYPEFIND_MAX_HEADERS) {
@@ -1978,8 +1978,7 @@ mpeg_ts_type_find (GstTypeFind * tf, gpointer unused)
   /* TS packet sizes to test: normal, DVHS packet size and 
    * FEC with 16 or 20 byte codes packet size. */
   const gint pack_sizes[] = { 188, 192, 204, 208 };
-
-  guint8 *data = NULL;
+  const guint8 *data = NULL;
   guint size = 0;
   guint64 skipped = 0;
 
@@ -2414,7 +2413,7 @@ static GstStaticCaps aiff_caps = GST_STATIC_CAPS ("audio/x-aiff");
 static void
 aiff_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data && memcmp (data, "FORM", 4) == 0) {
     data += 8;
@@ -2431,7 +2430,7 @@ static GstStaticCaps svx_caps = GST_STATIC_CAPS ("audio/x-svx");
 static void
 svx_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data && memcmp (data, "FORM", 4) == 0) {
     data += 8;
@@ -2448,7 +2447,7 @@ static GstStaticCaps shn_caps = GST_STATIC_CAPS ("audio/x-shorten");
 static void
 shn_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data && memcmp (data, "ajkg", 4) == 0) {
     gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SHN_CAPS);
@@ -2467,7 +2466,7 @@ static GstStaticCaps ape_caps = GST_STATIC_CAPS ("application/x-ape");
 static void
 ape_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data && memcmp (data, "MAC ", 4) == 0) {
     gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 10, APE_CAPS);
@@ -2484,7 +2483,7 @@ static GstStaticCaps m4a_caps = GST_STATIC_CAPS ("audio/x-m4a");
 static void
 m4a_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 4, 8);
+  const guint8 *data = gst_type_find_peek (tf, 4, 8);
 
   if (data && (memcmp (data, "ftypM4A ", 8) == 0)) {
     gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, M4A_CAPS);
@@ -2521,7 +2520,7 @@ q3gp_type_find (GstTypeFind * tf, gpointer unused)
   const gchar *profile;
   guint32 ftyp_size = 0;
   gint offset = 0;
-  guint8 *data = NULL;
+  const guint8 *data = NULL;
 
   if ((data = gst_type_find_peek (tf, 0, 12)) == NULL) {
     return;
@@ -2571,7 +2570,7 @@ static GstStaticCaps jp2_caps = GST_STATIC_CAPS ("image/jp2");
 static void
 jp2_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data;
+  const guint8 *data;
 
   data = gst_type_find_peek (tf, 0, 24);
   if (!data)
@@ -2602,7 +2601,7 @@ static GstStaticCaps qt_caps = GST_STATIC_CAPS ("video/quicktime");
 static void
 qt_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data;
+  const guint8 *data;
   guint tip = 0;
   guint64 offset = 0;
   guint64 size;
@@ -2669,7 +2668,7 @@ qt_type_find (GstTypeFind * tf, gpointer unused)
       }
     }
     if (size == 1) {
-      guint8 *sizedata;
+      const guint8 *sizedata;
 
       sizedata = gst_type_find_peek (tf, offset + 8, 8);
       if (sizedata == NULL)
@@ -2765,7 +2764,7 @@ static GstStaticCaps mod_caps = GST_STATIC_CAPS ("audio/x-mod");
 static void
 mod_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data;
+  const guint8 *data;
 
   /* MOD */
   if ((data = gst_type_find_peek (tf, 1080, 4)) != NULL) {
@@ -2821,7 +2820,7 @@ mod_type_find (GstTypeFind * tf, gpointer unused)
     }
     /* DSM */
     if (memcmp (data, "RIFF", 4) == 0) {
-      guint8 *data2 = gst_type_find_peek (tf, 8, 4);
+      const guint8 *data2 = gst_type_find_peek (tf, 8, 4);
 
       if (data2) {
         if (memcmp (data2, "DSMF", 4) == 0) {
@@ -2832,7 +2831,7 @@ mod_type_find (GstTypeFind * tf, gpointer unused)
     }
     /* FAM */
     if (memcmp (data, "FAM\xFE", 4) == 0) {
-      guint8 *data2 = gst_type_find_peek (tf, 44, 3);
+      const guint8 *data2 = gst_type_find_peek (tf, 44, 3);
 
       if (data2) {
         if (memcmp (data2, "compare", 3) == 0) {
@@ -2846,7 +2845,7 @@ mod_type_find (GstTypeFind * tf, gpointer unused)
     }
     /* GDM */
     if (memcmp (data, "GDM\xFE", 4) == 0) {
-      guint8 *data2 = gst_type_find_peek (tf, 71, 4);
+      const guint8 *data2 = gst_type_find_peek (tf, 71, 4);
 
       if (data2) {
         if (memcmp (data2, "GMFS", 4) == 0) {
@@ -2877,7 +2876,7 @@ mod_type_find (GstTypeFind * tf, gpointer unused)
   if ((data = gst_type_find_peek (tf, 20, 8)) != NULL) {
     if (g_ascii_strncasecmp ((gchar *) data, "!Scream!", 8) == 0 ||
         g_ascii_strncasecmp ((gchar *) data, "BMOD2STM", 8) == 0) {
-      guint8 *id, *stmtype;
+      const guint8 *id, *stmtype;
 
       if ((id = gst_type_find_peek (tf, 28, 1)) == NULL)
         return;
@@ -2898,7 +2897,7 @@ GST_STATIC_CAPS ("application/x-shockwave-flash");
 static void
 swf_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data && (data[0] == 'F' || data[0] == 'C') &&
       data[1] == 'W' && data[2] == 'S') {
@@ -3089,7 +3088,7 @@ static GstStaticCaps tiff_le_caps = GST_STATIC_CAPS ("image/tiff, "
 static void
 tiff_type_find (GstTypeFind * tf, gpointer ununsed)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 8);
+  const guint8 *data = gst_type_find_peek (tf, 0, 8);
   guint8 le_header[4] = { 0x49, 0x49, 0x2A, 0x00 };
   guint8 be_header[4] = { 0x4D, 0x4D, 0x00, 0x2A };
 
@@ -3206,7 +3205,7 @@ static GstStaticCaps sds_caps = GST_STATIC_CAPS ("audio/x-sds");
 static void
 sds_type_find (GstTypeFind * tf, gpointer ununsed)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
   guint8 mask[4] = { 0xFF, 0xFF, 0x80, 0xFF };
   guint8 match[4] = { 0xF0, 0x7E, 0, 0x01 };
   gint x;
@@ -3227,7 +3226,7 @@ static GstStaticCaps ircam_caps = GST_STATIC_CAPS ("audio/x-ircam");
 static void
 ircam_type_find (GstTypeFind * tf, gpointer ununsed)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
   guint8 mask[4] = { 0xFF, 0xFF, 0xF8, 0xFF };
   guint8 match[4] = { 0x64, 0xA3, 0x00, 0x00 };
   gint x;
@@ -3259,7 +3258,7 @@ static gboolean
 ebml_check_header (GstTypeFind * tf, const gchar * doctype, int doctype_len)
 {
   /* 4 bytes for EBML ID, 1 byte for header length identifier */
-  guint8 *data = gst_type_find_peek (tf, 0, 4 + 1);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4 + 1);
   gint len_mask = 0x80, size = 1, n = 1, total;
 
   if (!data)
@@ -3387,7 +3386,7 @@ static GstStaticCaps dv_caps = GST_STATIC_CAPS ("video/x-dv, "
 static void
 dv_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data;
+  const guint8 *data;
 
   data = gst_type_find_peek (tf, 0, 5);
 
@@ -3419,7 +3418,7 @@ static GstStaticCaps ogg_annodex_caps =
 static void
 ogganx_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if ((data != NULL) && (memcmp (data, "OggS", 4) == 0)) {
 
@@ -3441,7 +3440,7 @@ static GstStaticCaps vorbis_caps = GST_STATIC_CAPS ("audio/x-vorbis");
 static void
 vorbis_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 30);
+  const guint8 *data = gst_type_find_peek (tf, 0, 30);
 
   if (data) {
     guint blocksize_0;
@@ -3486,7 +3485,7 @@ static GstStaticCaps theora_caps = GST_STATIC_CAPS ("video/x-theora");
 static void
 theora_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 7); //42);
+  const guint8 *data = gst_type_find_peek (tf, 0, 7);   //42);
 
   if (data) {
     if (data[0] != 0x80)
@@ -3503,7 +3502,7 @@ theora_type_find (GstTypeFind * tf, gpointer private)
 static void
 kate_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 64);
+  const guint8 *data = gst_type_find_peek (tf, 0, 64);
   gchar category[16] = { 0, };
 
   if (G_UNLIKELY (data == NULL))
@@ -3536,7 +3535,7 @@ GST_STATIC_CAPS ("application/x-ogm-video");
 static void
 ogmvideo_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 9);
+  const guint8 *data = gst_type_find_peek (tf, 0, 9);
 
   if (data) {
     if (memcmp (data, "\001video\000\000\000", 9) != 0)
@@ -3551,7 +3550,7 @@ GST_STATIC_CAPS ("application/x-ogm-audio");
 static void
 ogmaudio_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 9);
+  const guint8 *data = gst_type_find_peek (tf, 0, 9);
 
   if (data) {
     if (memcmp (data, "\001audio\000\000\000", 9) != 0)
@@ -3566,7 +3565,7 @@ static GstStaticCaps ogmtext_caps = GST_STATIC_CAPS ("application/x-ogm-text");
 static void
 ogmtext_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 9);
+  const guint8 *data = gst_type_find_peek (tf, 0, 9);
 
   if (data) {
     if (memcmp (data, "\001text\000\000\000\000", 9) != 0)
@@ -3583,7 +3582,7 @@ static GstStaticCaps speex_caps = GST_STATIC_CAPS ("audio/x-speex");
 static void
 speex_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 80);
+  const guint8 *data = gst_type_find_peek (tf, 0, 80);
 
   if (data) {
     /* 8 byte string "Speex   "
@@ -3619,7 +3618,7 @@ static GstStaticCaps celt_caps = GST_STATIC_CAPS ("audio/x-celt");
 static void
 celt_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 8);
+  const guint8 *data = gst_type_find_peek (tf, 0, 8);
 
   if (data) {
     /* 8 byte string "CELT   " */
@@ -3638,7 +3637,7 @@ GST_STATIC_CAPS ("application/x-ogg-skeleton, parsed=(boolean)FALSE");
 static void
 oggskel_type_find (GstTypeFind * tf, gpointer private)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 12);
+  const guint8 *data = gst_type_find_peek (tf, 0, 12);
 
   if (data) {
     /* 8 byte string "fishead\0" for the ogg skeleton stream */
@@ -3664,7 +3663,7 @@ static void
 cmml_type_find (GstTypeFind * tf, gpointer private)
 {
   /* Header is 12 bytes minimum (though we don't check the minor version */
-  guint8 *data = gst_type_find_peek (tf, 0, 12);
+  const guint8 *data = gst_type_find_peek (tf, 0, 12);
 
   if (data) {
 
@@ -3691,7 +3690,7 @@ static GstStaticCaps tar_caps = GST_STATIC_CAPS ("application/x-tar");
 static void
 tar_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 257, 8);
+  const guint8 *data = gst_type_find_peek (tf, 257, 8);
 
   /* of course we are not certain, but we don't want other typefind funcs
    * to detect formats of files within the tar archive, e.g. mp3s */
@@ -3713,7 +3712,7 @@ static GstStaticCaps ar_caps = GST_STATIC_CAPS ("application/x-ar");
 static void
 ar_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 24);
+  const guint8 *data = gst_type_find_peek (tf, 0, 24);
 
   if (data && memcmp (data, "!<arch>", 7) == 0) {
     gint i;
@@ -3740,7 +3739,7 @@ static GstStaticCaps au_caps = GST_STATIC_CAPS ("audio/x-au");
 static void
 au_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data) {
     if (memcmp (data, ".snd", 4) == 0 || memcmp (data, "dns.", 4) == 0) {
@@ -3762,7 +3761,7 @@ static GstStaticCaps nuv_caps = GST_STATIC_CAPS ("video/x-nuv");
 static void
 nuv_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 11);
+  const guint8 *data = gst_type_find_peek (tf, 0, 11);
 
   if (data) {
     if (memcmp (data, "MythTVVideo", 11) == 0
@@ -3780,7 +3779,7 @@ static GstStaticCaps paris_caps = GST_STATIC_CAPS ("audio/x-paris");
 static void
 paris_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 4);
+  const guint8 *data = gst_type_find_peek (tf, 0, 4);
 
   if (data) {
     if (memcmp (data, " paf", 4) == 0 || memcmp (data, "fap ", 4) == 0) {
@@ -3797,7 +3796,7 @@ static GstStaticCaps ilbc_caps = GST_STATIC_CAPS ("audio/iLBC-sh");
 static void
 ilbc_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 8);
+  const guint8 *data = gst_type_find_peek (tf, 0, 8);
 
   if (data) {
     if (memcmp (data, "#!iLBC30", 8) == 0 || memcmp (data, "#!iLBC20", 8) == 0) {
@@ -3815,7 +3814,7 @@ GST_STATIC_CAPS ("application/x-ms-dos-executable");
 static void
 msdos_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 64);
+  const guint8 *data = gst_type_find_peek (tf, 0, 64);
 
   if (data && data[0] == 'M' && data[1] == 'Z' &&
       GST_READ_UINT16_LE (data + 8) == 4) {
@@ -3842,7 +3841,7 @@ mmsh_type_find (GstTypeFind * tf, gpointer unused)
     0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
   };
 
-  guint8 *data;
+  const guint8 *data;
 
   data = gst_type_find_peek (tf, 0, 2 + 2 + 4 + 2 + 2 + 16);
   if (data && data[0] == 0x24 && data[1] == 0x48 &&
@@ -3864,7 +3863,7 @@ static GstStaticCaps dirac_caps = GST_STATIC_CAPS ("video/x-dirac");
 static void
 dirac_type_find (GstTypeFind * tf, gpointer unused)
 {
-  guint8 *data = gst_type_find_peek (tf, 0, 8);
+  const guint8 *data = gst_type_find_peek (tf, 0, 8);
 
   if (data) {
     if (memcmp (data, "BBCD", 4) == 0 || memcmp (data, "KW-DIRAC", 8) == 0) {
@@ -3885,7 +3884,7 @@ vivo_type_find (GstTypeFind * tf, gpointer unused)
   static const guint8 vivo_marker[] = { 'V', 'e', 'r', 's', 'i', 'o', 'n',
     ':', 'V', 'i', 'v', 'o', '/'
   };
-  guint8 *data;
+  const guint8 *data;
   guint hdr_len, pos;
 
   data = gst_type_find_peek (tf, 0, 1024);
@@ -3923,7 +3922,7 @@ xdgmime_typefind (GstTypeFind * find, gpointer user_data)
   gchar *mimetype;
   gsize length = 16384;
   guint64 tf_length;
-  guint8 *data;
+  const guint8 *data;
   gchar *tmp;
 
   if ((tf_length = gst_type_find_get_length (find)) > 0)
@@ -3975,7 +3974,7 @@ xdgmime_typefind (GstTypeFind * find, gpointer user_data)
 static void
 windows_icon_typefind (GstTypeFind * find, gpointer user_data)
 {
-  guint8 *data;
+  const guint8 *data;
   gint64 datalen;
   guint16 type, nimages;
   gint32 size, offset;
@@ -4017,7 +4016,7 @@ windows_icon_typefind (GstTypeFind * find, gpointer user_data)
 static void
 wbmp_typefind (GstTypeFind * find, gpointer user_data)
 {
-  guint8 *data;
+  const guint8 *data;
   gint64 datalen;
   guint w, h, size;
 
@@ -4096,7 +4095,7 @@ degas_type_find (GstTypeFind * tf, gpointer private)
     if (resolution <= 2) {
       data = gst_type_find_peek (tf, len - 16, 8);
       if (G_UNLIKELY (data == NULL))
-       return;
+        return;
       for (n = 0; n < 4; n++) {
         if (GST_READ_UINT16_BE (data + n * 2) > 2)
           return;
@@ -4110,7 +4109,7 @@ degas_type_find (GstTypeFind * tf, gpointer private)
     if ((resolution & 0x8000) && (resolution & 0x7fff) <= 2) {
       data = gst_type_find_peek (tf, len - 16, 8);
       if (G_UNLIKELY (data == NULL))
-       return;
+        return;
       for (n = 0; n < 4; n++) {
         if (GST_READ_UINT16_BE (data + n * 2) > 2)
           return;
@@ -4135,7 +4134,7 @@ static void
 start_with_type_find (GstTypeFind * tf, gpointer private)
 {
   GstTypeFindData *start_with = (GstTypeFindData *) private;
-  guint8 *data;
+  const guint8 *data;
 
   GST_LOG ("trying to find mime type %s with the first %u bytes of data",
       gst_structure_get_name (gst_caps_get_structure (start_with->caps, 0)),
@@ -4175,7 +4174,7 @@ static void
 riff_type_find (GstTypeFind * tf, gpointer private)
 {
   GstTypeFindData *riff_data = (GstTypeFindData *) private;
-  guint8 *data = gst_type_find_peek (tf, 0, 12);
+  const guint8 *data = gst_type_find_peek (tf, 0, 12);
 
   if (data && (memcmp (data, "RIFF", 4) == 0 || memcmp (data, "AVF0", 4) == 0)) {
     data += 8;
diff --git a/gst/videoconvert/Makefile.am b/gst/videoconvert/Makefile.am
new file mode 100644 (file)
index 0000000..e9c8f78
--- /dev/null
@@ -0,0 +1,35 @@
+plugin_LTLIBRARIES = libgstvideoconvert.la
+
+ORC_SOURCE=gstvideoconvertorc
+include $(top_srcdir)/common/orc.mak
+
+libgstvideoconvert_la_SOURCES = gstvideoconvert.c videoconvert.c
+nodist_libgstvideoconvert_la_SOURCES = $(ORC_NODIST_SOURCES)
+libgstvideoconvert_la_CFLAGS = \
+       $(GST_PLUGINS_BASE_CFLAGS) \
+       $(GST_CFLAGS) \
+       $(ORC_CFLAGS)
+libgstvideoconvert_la_LIBADD = \
+       $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
+       $(GST_BASE_LIBS) \
+       $(GST_LIBS) \
+       $(ORC_LIBS)
+libgstvideoconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstvideoconvert_la_LIBTOOLFLAGS = --tag=disable-static
+
+noinst_HEADERS = gstvideoconvert.h videoconvert.h
+
+Android.mk: Makefile.am $(BUILT_SOURCES)
+       androgenizer \
+       -:PROJECT libgstvideoconvert -:SHARED libgstvideoconvert \
+        -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+        -:SOURCES $(libgstvideoconvert_la_SOURCES) \
+                  $(nodist_libgstvideoconvert_la_SOURCES) \
+        -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideoconvert_la_CFLAGS) \
+        -:LDFLAGS $(libgstvideoconvert_la_LDFLAGS) \
+                  $(libgstvideoconvert_la_LIBADD) \
+                  -ldl \
+        -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+                      LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+       > $@
diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c
new file mode 100644 (file)
index 0000000..937e650
--- /dev/null
@@ -0,0 +1,516 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * This file:
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) 2010 David Schleef <ds@schleef.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:element-videoconvert
+ *
+ * Convert video frames between a great variety of video formats.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch -v videotestsrc ! video/x-raw,format=\(fourcc\)YUY2 ! videoconvert ! ximagesink
+ * ]|
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "gstvideoconvert.h"
+#include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideopool.h>
+
+#include <string.h>
+
+GST_DEBUG_CATEGORY (videoconvert_debug);
+#define GST_CAT_DEFAULT videoconvert_debug
+GST_DEBUG_CATEGORY (videoconvert_performance);
+
+enum
+{
+  PROP_0,
+  PROP_DITHER
+};
+
+#define CSP_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)
+
+static GstStaticPadTemplate gst_video_convert_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (CSP_VIDEO_CAPS)
+    );
+
+static GstStaticPadTemplate gst_video_convert_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (CSP_VIDEO_CAPS)
+    );
+
+GType gst_video_convert_get_type (void);
+
+static void gst_video_convert_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_video_convert_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec);
+
+static gboolean gst_video_convert_set_caps (GstBaseTransform * btrans,
+    GstCaps * incaps, GstCaps * outcaps);
+static gboolean gst_video_convert_get_unit_size (GstBaseTransform * btrans,
+    GstCaps * caps, gsize * size);
+static GstFlowReturn gst_video_convert_transform (GstBaseTransform * btrans,
+    GstBuffer * inbuf, GstBuffer * outbuf);
+
+static GType
+dither_method_get_type (void)
+{
+  static GType gtype = 0;
+
+  if (gtype == 0) {
+    static const GEnumValue values[] = {
+      {DITHER_NONE, "No dithering (default)", "none"},
+      {DITHER_VERTERR, "Vertical error propogation", "verterr"},
+      {DITHER_HALFTONE, "Half-tone", "halftone"},
+      {0, NULL, NULL}
+    };
+
+    gtype = g_enum_register_static ("GstColorspaceDitherMethod", values);
+  }
+  return gtype;
+}
+
+/* copies the given caps */
+static GstCaps *
+gst_video_convert_caps_remove_format_info (GstCaps * caps)
+{
+  GstStructure *st;
+  gint i, n;
+  GstCaps *res;
+
+  res = gst_caps_new_empty ();
+
+  n = gst_caps_get_size (caps);
+  for (i = 0; i < n; i++) {
+    st = gst_caps_get_structure (caps, i);
+
+    /* If this is already expressed by the existing caps
+     * skip this structure */
+    if (i > 0 && gst_caps_is_subset_structure (res, st))
+      continue;
+
+    st = gst_structure_copy (st);
+    gst_structure_remove_fields (st, "format", "palette_data",
+        "color-matrix", "chroma-site", NULL);
+
+    gst_caps_append_structure (res, st);
+  }
+
+  return res;
+}
+
+/* The caps can be transformed into any other caps with format info removed.
+ * However, we should prefer passthrough, so if passthrough is possible,
+ * put it first in the list. */
+static GstCaps *
+gst_video_convert_transform_caps (GstBaseTransform * btrans,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+{
+  GstCaps *tmp, *tmp2;
+  GstCaps *result;
+
+  result = gst_caps_copy (caps);
+
+  /* Get all possible caps that we can transform to */
+  tmp = gst_video_convert_caps_remove_format_info (caps);
+
+  if (filter) {
+    tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+    tmp = tmp2;
+  }
+
+  result = tmp;
+
+  GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %"
+      GST_PTR_FORMAT, caps, result);
+
+  return result;
+}
+
+static gboolean
+gst_video_convert_setup_allocation (GstBaseTransform * trans, GstQuery * query)
+{
+  GstBufferPool *pool = NULL;
+  guint size, min, max, prefix, alignment;
+
+  gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
+      &alignment, &pool);
+
+  if (pool) {
+    GstStructure *config;
+
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_add_option (config,
+        GST_BUFFER_POOL_OPTION_META_VIDEO);
+    gst_buffer_pool_set_config (pool, config);
+  }
+  return TRUE;
+}
+
+static gboolean
+gst_video_convert_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
+    GstCaps * outcaps)
+{
+  GstVideoConvert *space;
+  GstVideoInfo in_info;
+  GstVideoInfo out_info;
+  ColorSpaceColorSpec in_spec, out_spec;
+  gboolean interlaced;
+
+  space = GST_VIDEO_CONVERT_CAST (btrans);
+
+  if (space->convert) {
+    videoconvert_convert_free (space->convert);
+  }
+
+  /* input caps */
+  if (!gst_video_info_from_caps (&in_info, incaps))
+    goto invalid_caps;
+
+  if (in_info.finfo->flags & GST_VIDEO_FORMAT_FLAG_RGB) {
+    in_spec = COLOR_SPEC_RGB;
+  } else if (in_info.finfo->flags & GST_VIDEO_FORMAT_FLAG_YUV) {
+    if (in_info.color_matrix && g_str_equal (in_info.color_matrix, "hdtv"))
+      in_spec = COLOR_SPEC_YUV_BT709;
+    else
+      in_spec = COLOR_SPEC_YUV_BT470_6;
+  } else {
+    in_spec = COLOR_SPEC_GRAY;
+  }
+
+  /* output caps */
+  if (!gst_video_info_from_caps (&out_info, outcaps))
+    goto invalid_caps;
+
+  if (out_info.finfo->flags & GST_VIDEO_FORMAT_FLAG_RGB) {
+    out_spec = COLOR_SPEC_RGB;
+  } else if (out_info.finfo->flags & GST_VIDEO_FORMAT_FLAG_YUV) {
+    if (out_info.color_matrix && g_str_equal (out_info.color_matrix, "hdtv"))
+      out_spec = COLOR_SPEC_YUV_BT709;
+    else
+      out_spec = COLOR_SPEC_YUV_BT470_6;
+  } else {
+    out_spec = COLOR_SPEC_GRAY;
+  }
+
+  /* these must match */
+  if (in_info.width != out_info.width || in_info.height != out_info.height ||
+      in_info.fps_n != out_info.fps_n || in_info.fps_d != out_info.fps_d)
+    goto format_mismatch;
+
+  /* if present, these must match too */
+  if (in_info.par_n != out_info.par_n || in_info.par_d != out_info.par_d)
+    goto format_mismatch;
+
+  /* if present, these must match too */
+  if ((in_info.flags & GST_VIDEO_FLAG_INTERLACED) !=
+      (out_info.flags & GST_VIDEO_FLAG_INTERLACED))
+    goto format_mismatch;
+
+  space->from_info = in_info;
+  space->from_spec = in_spec;
+  space->to_info = out_info;
+  space->to_spec = out_spec;
+
+  interlaced = (in_info.flags & GST_VIDEO_FLAG_INTERLACED) != 0;
+
+  space->convert =
+      videoconvert_convert_new (GST_VIDEO_INFO_FORMAT (&out_info), out_spec,
+      GST_VIDEO_INFO_FORMAT (&in_info), in_spec, in_info.width, in_info.height);
+  if (space->convert == NULL)
+    goto no_convert;
+
+  videoconvert_convert_set_interlaced (space->convert, interlaced);
+
+  /* palette, only for from data */
+  if (GST_VIDEO_INFO_FORMAT (&space->from_info) ==
+      GST_VIDEO_FORMAT_RGB8_PALETTED
+      && GST_VIDEO_INFO_FORMAT (&space->to_info) ==
+      GST_VIDEO_FORMAT_RGB8_PALETTED) {
+    goto format_mismatch;
+  } else if (GST_VIDEO_INFO_FORMAT (&space->from_info) ==
+      GST_VIDEO_FORMAT_RGB8_PALETTED) {
+    GstBuffer *palette;
+    guint32 *data;
+
+    palette = gst_video_parse_caps_palette (incaps);
+
+    if (!palette || gst_buffer_get_size (palette) < 256 * 4) {
+      if (palette)
+        gst_buffer_unref (palette);
+      goto invalid_palette;
+    }
+
+    data = gst_buffer_map (palette, NULL, NULL, GST_MAP_READ);
+    videoconvert_convert_set_palette (space->convert, data);
+    gst_buffer_unmap (palette, data, -1);
+
+    gst_buffer_unref (palette);
+  } else if (GST_VIDEO_INFO_FORMAT (&space->to_info) ==
+      GST_VIDEO_FORMAT_RGB8_PALETTED) {
+    const guint32 *palette;
+    GstBuffer *p_buf;
+
+    palette = videoconvert_convert_get_palette (space->convert);
+
+    p_buf = gst_buffer_new_and_alloc (256 * 4);
+    gst_buffer_fill (p_buf, 0, palette, 256 * 4);
+    gst_caps_set_simple (outcaps, "palette_data", GST_TYPE_BUFFER, p_buf, NULL);
+    gst_buffer_unref (p_buf);
+  }
+
+  GST_DEBUG ("reconfigured %d %d", GST_VIDEO_INFO_FORMAT (&space->from_info),
+      GST_VIDEO_INFO_FORMAT (&space->to_info));
+
+  space->negotiated = TRUE;
+
+  return TRUE;
+
+  /* ERRORS */
+invalid_caps:
+  {
+    GST_ERROR_OBJECT (space, "invalid caps");
+    goto error_done;
+  }
+format_mismatch:
+  {
+    GST_ERROR_OBJECT (space, "input and output formats do not match");
+    goto error_done;
+  }
+no_convert:
+  {
+    GST_ERROR_OBJECT (space, "could not create converter");
+    goto error_done;
+  }
+invalid_palette:
+  {
+    GST_ERROR_OBJECT (space, "invalid palette");
+    goto error_done;
+  }
+error_done:
+  {
+    space->negotiated = FALSE;
+    return FALSE;
+  }
+}
+
+#define gst_video_convert_parent_class parent_class
+G_DEFINE_TYPE (GstVideoConvert, gst_video_convert, GST_TYPE_VIDEO_FILTER);
+
+static void
+gst_video_convert_finalize (GObject * obj)
+{
+  GstVideoConvert *space = GST_VIDEO_CONVERT (obj);
+
+  if (space->convert) {
+    videoconvert_convert_free (space->convert);
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
+gst_video_convert_class_init (GstVideoConvertClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
+  GstBaseTransformClass *gstbasetransform_class =
+      (GstBaseTransformClass *) klass;
+
+  gobject_class->set_property = gst_video_convert_set_property;
+  gobject_class->get_property = gst_video_convert_get_property;
+  gobject_class->finalize = gst_video_convert_finalize;
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_video_convert_src_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_video_convert_sink_template));
+
+  gst_element_class_set_details_simple (gstelement_class,
+      " Colorspace converter", "Filter/Converter/Video",
+      "Converts video from one colorspace to another",
+      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
+
+  gstbasetransform_class->transform_caps =
+      GST_DEBUG_FUNCPTR (gst_video_convert_transform_caps);
+  gstbasetransform_class->set_caps =
+      GST_DEBUG_FUNCPTR (gst_video_convert_set_caps);
+  gstbasetransform_class->get_unit_size =
+      GST_DEBUG_FUNCPTR (gst_video_convert_get_unit_size);
+  gstbasetransform_class->setup_allocation =
+      GST_DEBUG_FUNCPTR (gst_video_convert_setup_allocation);
+  gstbasetransform_class->transform =
+      GST_DEBUG_FUNCPTR (gst_video_convert_transform);
+
+  gstbasetransform_class->passthrough_on_same_caps = TRUE;
+
+  g_object_class_install_property (gobject_class, PROP_DITHER,
+      g_param_spec_enum ("dither", "Dither", "Apply dithering while converting",
+          dither_method_get_type (), DITHER_NONE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_video_convert_init (GstVideoConvert * space)
+{
+  space->negotiated = FALSE;
+}
+
+void
+gst_video_convert_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstVideoConvert *csp;
+
+  csp = GST_VIDEO_CONVERT (object);
+
+  switch (property_id) {
+    case PROP_DITHER:
+      csp->dither = g_value_get_enum (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_video_convert_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstVideoConvert *csp;
+
+  csp = GST_VIDEO_CONVERT (object);
+
+  switch (property_id) {
+    case PROP_DITHER:
+      g_value_set_enum (value, csp->dither);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_video_convert_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
+    gsize * size)
+{
+  gboolean ret = TRUE;
+  GstVideoInfo info;
+
+  g_assert (size);
+
+  ret = gst_video_info_from_caps (&info, caps);
+  if (ret) {
+    *size = info.size;
+  }
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_video_convert_transform (GstBaseTransform * btrans, GstBuffer * inbuf,
+    GstBuffer * outbuf)
+{
+  GstVideoConvert *space;
+  GstVideoFrame in_frame, out_frame;
+
+  space = GST_VIDEO_CONVERT_CAST (btrans);
+
+  GST_DEBUG ("from %s -> to %s", GST_VIDEO_INFO_NAME (&space->from_info),
+      GST_VIDEO_INFO_NAME (&space->to_info));
+
+  if (G_UNLIKELY (!space->negotiated))
+    goto unknown_format;
+
+  videoconvert_convert_set_dither (space->convert, space->dither);
+
+  if (!gst_video_frame_map (&in_frame, &space->from_info, inbuf, GST_MAP_READ))
+    goto invalid_buffer;
+
+  if (!gst_video_frame_map (&out_frame, &space->to_info, outbuf, GST_MAP_WRITE))
+    goto invalid_buffer;
+
+  videoconvert_convert_convert (space->convert, &out_frame, &in_frame);
+
+  gst_video_frame_unmap (&out_frame);
+  gst_video_frame_unmap (&in_frame);
+
+  /* baseclass copies timestamps */
+  GST_DEBUG ("from %s -> to %s done", GST_VIDEO_INFO_NAME (&space->from_info),
+      GST_VIDEO_INFO_NAME (&space->to_info));
+
+  return GST_FLOW_OK;
+
+  /* ERRORS */
+unknown_format:
+  {
+    GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
+        ("attempting to convert colorspaces between unknown formats"));
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+invalid_buffer:
+  {
+    GST_ELEMENT_WARNING (space, CORE, NOT_IMPLEMENTED, (NULL),
+        ("invalid video buffer received"));
+    return GST_FLOW_OK;
+  }
+#if 0
+not_supported:
+  {
+    GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
+        ("cannot convert between formats"));
+    return GST_FLOW_NOT_SUPPORTED;
+  }
+#endif
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (videoconvert_debug, "videoconvert", 0,
+      "Colorspace Converter");
+  GST_DEBUG_CATEGORY_GET (videoconvert_performance, "GST_PERFORMANCE");
+
+  return gst_element_register (plugin, "videoconvert",
+      GST_RANK_NONE, GST_TYPE_VIDEO_CONVERT);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "videoconvert", "Colorspace conversion", plugin_init, VERSION, "LGPL", "",
+    "")
similarity index 50%
rename from gst/ffmpegcolorspace/gstffmpegcolorspace.h
rename to gst/videoconvert/gstvideoconvert.h
index 198ab8a..abd8270 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __GST_FFMPEGCOLORSPACE_H__
-#define __GST_FFMPEGCOLORSPACE_H__
+#ifndef __GST_VIDEOCONVERT_H__
+#define __GST_VIDEOCONVERT_H__
 
 #include <gst/gst.h>
+#include <gst/video/video.h>
 #include <gst/video/gstvideofilter.h>
-#include "avcodec.h"
+#include "videoconvert.h"
 
 G_BEGIN_DECLS
 
-#define GST_TYPE_FFMPEGCSP           (gst_ffmpegcsp_get_type())
-#define GST_FFMPEGCSP(obj)           (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGCSP,GstFFMpegCsp))
-#define GST_FFMPEGCSP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGCSP,GstFFMpegCspClass))
-#define GST_IS_FFMPEGCSP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGCSP))
-#define GST_IS_FFMPEGCSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGCSP))
+#define GST_TYPE_VIDEO_CONVERT           (gst_video_convert_get_type())
+#define GST_VIDEO_CONVERT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_CONVERT,GstVideoConvert))
+#define GST_VIDEO_CONVERT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_CONVERT,GstVideoConvertClass))
+#define GST_IS_VIDEO_CONVERT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_CONVERT))
+#define GST_IS_VIDEO_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_CONVERT))
+#define GST_VIDEO_CONVERT_CAST(obj)       ((GstVideoConvert *)(obj))
 
-typedef struct _GstFFMpegCsp GstFFMpegCsp;
-typedef struct _GstFFMpegCspClass GstFFMpegCspClass;
+typedef struct _GstVideoConvert GstVideoConvert;
+typedef struct _GstVideoConvertClass GstVideoConvertClass;
 
 /**
- * GstFFMpegCsp:
+ * GstVideoConvert:
  *
  * Opaque object data structure.
  */
-struct _GstFFMpegCsp {
+struct _GstVideoConvert {
   GstVideoFilter element;
 
-  gint width, height;
-  gboolean interlaced;
-  gfloat fps;
-  enum PixelFormat from_pixfmt, to_pixfmt;
-  AVPicture from_frame, to_frame;
-  AVPaletteControl *palette;
+  GstVideoInfo from_info;
+  GstVideoInfo to_info;
+  gboolean negotiated;
+
+  ColorSpaceColorSpec from_spec;
+  ColorSpaceColorSpec to_spec;
+
+  VideoConvert *convert;
+  gboolean dither;
 };
 
-struct _GstFFMpegCspClass
+struct _GstVideoConvertClass
 {
   GstVideoFilterClass parent_class;
 };
 
 G_END_DECLS
 
-#endif /* __GST_FFMPEGCOLORSPACE_H__ */
+#endif /* __GST_VIDEOCONVERT_H__ */
diff --git a/gst/videoconvert/gstvideoconvertorc-dist.c b/gst/videoconvert/gstvideoconvertorc-dist.c
new file mode 100644 (file)
index 0000000..6645465
--- /dev/null
@@ -0,0 +1,19395 @@
+
+/* autogenerated from gstvideoconvertorc.orc */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <glib.h>
+
+#ifndef _ORC_INTEGER_TYPEDEFS_
+#define _ORC_INTEGER_TYPEDEFS_
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+typedef int8_t orc_int8;
+typedef int16_t orc_int16;
+typedef int32_t orc_int32;
+typedef int64_t orc_int64;
+typedef uint8_t orc_uint8;
+typedef uint16_t orc_uint16;
+typedef uint32_t orc_uint32;
+typedef uint64_t orc_uint64;
+#define ORC_UINT64_C(x) UINT64_C(x)
+#elif defined(_MSC_VER)
+typedef signed __int8 orc_int8;
+typedef signed __int16 orc_int16;
+typedef signed __int32 orc_int32;
+typedef signed __int64 orc_int64;
+typedef unsigned __int8 orc_uint8;
+typedef unsigned __int16 orc_uint16;
+typedef unsigned __int32 orc_uint32;
+typedef unsigned __int64 orc_uint64;
+#define ORC_UINT64_C(x) (x##Ui64)
+#define inline __inline
+#else
+#include <limits.h>
+typedef signed char orc_int8;
+typedef short orc_int16;
+typedef int orc_int32;
+typedef unsigned char orc_uint8;
+typedef unsigned short orc_uint16;
+typedef unsigned int orc_uint32;
+#if INT_MAX == LONG_MAX
+typedef long long orc_int64;
+typedef unsigned long long orc_uint64;
+#define ORC_UINT64_C(x) (x##ULL)
+#else
+typedef long orc_int64;
+typedef unsigned long orc_uint64;
+#define ORC_UINT64_C(x) (x##UL)
+#endif
+#endif
+typedef union
+{
+  orc_int16 i;
+  orc_int8 x2[2];
+} orc_union16;
+typedef union
+{
+  orc_int32 i;
+  float f;
+  orc_int16 x2[2];
+  orc_int8 x4[4];
+} orc_union32;
+typedef union
+{
+  orc_int64 i;
+  double f;
+  orc_int32 x2[2];
+  float x2f[2];
+  orc_int16 x4[4];
+} orc_union64;
+#endif
+#ifndef ORC_RESTRICT
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define ORC_RESTRICT restrict
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define ORC_RESTRICT __restrict__
+#else
+#define ORC_RESTRICT
+#endif
+#endif
+
+#ifndef DISABLE_ORC
+#include <orc/orc.h>
+#endif
+void cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n);
+void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1,
+    int p2, int n);
+void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1,
+    int p2, int n);
+void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int p4, int n);
+void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n);
+void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5,
+    int n);
+void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5,
+    int n);
+void orc_pack_123x (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int n);
+void orc_pack_x123 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int n);
+void cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1,
+    int p2, int n);
+void cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1,
+    guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+    const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1,
+    guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+    const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1,
+    guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+    const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1,
+    guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3,
+    guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1,
+    int s1_stride, int n, int m);
+void cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1,
+    int s1_stride, int n, int m);
+void cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
+void cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
+void cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1,
+    guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3,
+    guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
+void cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
+    const guint8 * ORC_RESTRICT s5, int n);
+void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, int n);
+
+
+/* begin Orc C target preamble */
+#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
+#define ORC_ABS(a) ((a)<0 ? -(a) : (a))
+#define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))
+#define ORC_MAX(a,b) ((a)>(b) ? (a) : (b))
+#define ORC_SB_MAX 127
+#define ORC_SB_MIN (-1-ORC_SB_MAX)
+#define ORC_UB_MAX 255
+#define ORC_UB_MIN 0
+#define ORC_SW_MAX 32767
+#define ORC_SW_MIN (-1-ORC_SW_MAX)
+#define ORC_UW_MAX 65535
+#define ORC_UW_MIN 0
+#define ORC_SL_MAX 2147483647
+#define ORC_SL_MIN (-1-ORC_SL_MAX)
+#define ORC_UL_MAX 4294967295U
+#define ORC_UL_MIN 0
+#define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX)
+#define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX)
+#define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX)
+#define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)
+#define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)
+#define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)
+#define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
+#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
+#define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56))
+#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
+#define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
+#define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0))
+#define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff)))
+#define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0))
+#ifndef ORC_RESTRICT
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define ORC_RESTRICT restrict
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define ORC_RESTRICT __restrict__
+#else
+#define ORC_RESTRICT
+#endif
+#endif
+/* end Orc C target preamble */
+
+
+
+/* cogorc_memcpy_2d */
+#ifdef DISABLE_ORC
+void
+cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var32;
+  orc_int8 var33;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var32 = ptr4[i];
+      /* 1: copyb */
+      var33 = var32;
+      /* 2: storeb */
+      ptr0[i] = var33;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_memcpy_2d (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var32;
+  orc_int8 var33;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var32 = ptr4[i];
+      /* 1: copyb */
+      var33 = var32;
+      /* 2: storeb */
+      ptr0[i] = var33;
+    }
+  }
+
+}
+
+void
+cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_memcpy_2d");
+      orc_program_set_backup_function (p, _backup_cogorc_memcpy_2d);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+
+      orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_downsample_horiz_cosite_1tap */
+#ifdef DISABLE_ORC
+void
+cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var32;
+  orc_int8 var33;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union16 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var32 = ptr4[i];
+    /* 1: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var32.i;
+      var33 = _src.x2[0];
+    }
+    /* 2: storeb */
+    ptr0[i] = var33;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var32;
+  orc_int8 var33;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var32 = ptr4[i];
+    /* 1: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var32.i;
+      var33 = _src.x2[0];
+    }
+    /* 2: storeb */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_downsample_horiz_cosite_1tap");
+      orc_program_set_backup_function (p,
+          _backup_cogorc_downsample_horiz_cosite_1tap);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_downsample_horiz_cosite_3tap */
+#ifdef DISABLE_ORC
+void
+cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_union16 *) s2;
+
+  /* 9: loadpw */
+  var40.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+  /* 13: loadpw */
+  var41.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var38 = ptr4[i];
+    /* 1: copyw */
+    var43.i = var38.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var44 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var45 = _src.x2[1];
+    }
+    /* 4: loadw */
+    var39 = ptr5[i];
+    /* 5: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var39.i;
+      var46 = _src.x2[0];
+    }
+    /* 6: convubw */
+    var47.i = (orc_uint8) var44;
+    /* 7: convubw */
+    var48.i = (orc_uint8) var45;
+    /* 8: convubw */
+    var49.i = (orc_uint8) var46;
+    /* 10: mullw */
+    var50.i = (var48.i * var40.i) & 0xffff;
+    /* 11: addw */
+    var51.i = var47.i + var49.i;
+    /* 12: addw */
+    var52.i = var51.i + var50.i;
+    /* 14: addw */
+    var53.i = var52.i + var41.i;
+    /* 15: shrsw */
+    var54.i = var53.i >> 2;
+    /* 16: convsuswb */
+    var42 = ORC_CLAMP_UB (var54.i);
+    /* 17: storeb */
+    ptr0[i] = var42;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_union16 *) ex->arrays[5];
+
+  /* 9: loadpw */
+  var40.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+  /* 13: loadpw */
+  var41.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var38 = ptr4[i];
+    /* 1: copyw */
+    var43.i = var38.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var44 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var45 = _src.x2[1];
+    }
+    /* 4: loadw */
+    var39 = ptr5[i];
+    /* 5: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var39.i;
+      var46 = _src.x2[0];
+    }
+    /* 6: convubw */
+    var47.i = (orc_uint8) var44;
+    /* 7: convubw */
+    var48.i = (orc_uint8) var45;
+    /* 8: convubw */
+    var49.i = (orc_uint8) var46;
+    /* 10: mullw */
+    var50.i = (var48.i * var40.i) & 0xffff;
+    /* 11: addw */
+    var51.i = var47.i + var49.i;
+    /* 12: addw */
+    var52.i = var51.i + var50.i;
+    /* 14: addw */
+    var53.i = var52.i + var41.i;
+    /* 15: shrsw */
+    var54.i = var53.i >> 2;
+    /* 16: convsuswb */
+    var42 = ORC_CLAMP_UB (var54.i);
+    /* 17: storeb */
+    ptr0[i] = var42;
+  }
+
+}
+
+void
+cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_downsample_horiz_cosite_3tap");
+      orc_program_set_backup_function (p,
+          _backup_cogorc_downsample_horiz_cosite_3tap);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_constant (p, 4, 0x00000002, "c1");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+
+      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T3, ORC_VAR_S2,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T4, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_downsample_420_jpeg */
+#ifdef DISABLE_ORC
+void
+cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_union16 *) s2;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var37 = ptr4[i];
+    /* 1: copyw */
+    var40.i = var37.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.i;
+      var41 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.i;
+      var42 = _src.x2[1];
+    }
+    /* 4: avgub */
+    var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1;
+    /* 5: loadw */
+    var38 = ptr5[i];
+    /* 6: copyw */
+    var44.i = var38.i;
+    /* 7: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var45 = _src.x2[0];
+    }
+    /* 8: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var46 = _src.x2[1];
+    }
+    /* 9: avgub */
+    var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1;
+    /* 10: avgub */
+    var39 = ((orc_uint8) var43 + (orc_uint8) var47 + 1) >> 1;
+    /* 11: storeb */
+    ptr0[i] = var39;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_downsample_420_jpeg (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_union16 *) ex->arrays[5];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var37 = ptr4[i];
+    /* 1: copyw */
+    var40.i = var37.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.i;
+      var41 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.i;
+      var42 = _src.x2[1];
+    }
+    /* 4: avgub */
+    var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1;
+    /* 5: loadw */
+    var38 = ptr5[i];
+    /* 6: copyw */
+    var44.i = var38.i;
+    /* 7: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var45 = _src.x2[0];
+    }
+    /* 8: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var46 = _src.x2[1];
+    }
+    /* 9: avgub */
+    var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1;
+    /* 10: avgub */
+    var39 = ((orc_uint8) var43 + (orc_uint8) var47 + 1) >> 1;
+    /* 11: storeb */
+    ptr0[i] = var39;
+  }
+
+}
+
+void
+cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_downsample_420_jpeg");
+      orc_program_set_backup_function (p, _backup_cogorc_downsample_420_jpeg);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+
+      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T3, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T4, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_downsample_vert_halfsite_2tap */
+#ifdef DISABLE_ORC
+void
+cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var32 = ptr4[i];
+    /* 1: loadb */
+    var33 = ptr5[i];
+    /* 2: avgub */
+    var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1;
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var32 = ptr4[i];
+    /* 1: loadb */
+    var33 = ptr5[i];
+    /* 2: avgub */
+    var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1;
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_downsample_vert_halfsite_2tap");
+      orc_program_set_backup_function (p,
+          _backup_cogorc_downsample_vert_halfsite_2tap);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_downsample_vert_cosite_3tap */
+#ifdef DISABLE_ORC
+void
+cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 6: loadpw */
+  var38.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+  /* 10: loadpw */
+  var39.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var35 = ptr4[i];
+    /* 1: convubw */
+    var41.i = (orc_uint8) var35;
+    /* 2: loadb */
+    var36 = ptr5[i];
+    /* 3: convubw */
+    var42.i = (orc_uint8) var36;
+    /* 4: loadb */
+    var37 = ptr6[i];
+    /* 5: convubw */
+    var43.i = (orc_uint8) var37;
+    /* 7: mullw */
+    var44.i = (var42.i * var38.i) & 0xffff;
+    /* 8: addw */
+    var45.i = var41.i + var43.i;
+    /* 9: addw */
+    var46.i = var45.i + var44.i;
+    /* 11: addw */
+    var47.i = var46.i + var39.i;
+    /* 12: shrsw */
+    var48.i = var47.i >> 2;
+    /* 13: convsuswb */
+    var40 = ORC_CLAMP_UB (var48.i);
+    /* 14: storeb */
+    ptr0[i] = var40;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 6: loadpw */
+  var38.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+  /* 10: loadpw */
+  var39.i = (int) 0x00000002;   /* 2 or 9.88131e-324f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var35 = ptr4[i];
+    /* 1: convubw */
+    var41.i = (orc_uint8) var35;
+    /* 2: loadb */
+    var36 = ptr5[i];
+    /* 3: convubw */
+    var42.i = (orc_uint8) var36;
+    /* 4: loadb */
+    var37 = ptr6[i];
+    /* 5: convubw */
+    var43.i = (orc_uint8) var37;
+    /* 7: mullw */
+    var44.i = (var42.i * var38.i) & 0xffff;
+    /* 8: addw */
+    var45.i = var41.i + var43.i;
+    /* 9: addw */
+    var46.i = var45.i + var44.i;
+    /* 11: addw */
+    var47.i = var46.i + var39.i;
+    /* 12: shrsw */
+    var48.i = var47.i >> 2;
+    /* 13: convsuswb */
+    var40 = ORC_CLAMP_UB (var48.i);
+    /* 14: storeb */
+    ptr0[i] = var40;
+  }
+
+}
+
+void
+cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_downsample_vert_cosite_3tap");
+      orc_program_set_backup_function (p,
+          _backup_cogorc_downsample_vert_cosite_3tap);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 4, 0x00000002, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T3, ORC_VAR_S3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_downsample_vert_halfsite_4tap */
+#ifdef DISABLE_ORC
+void
+cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+  ptr7 = (orc_int8 *) s4;
+
+  /* 9: loadpw */
+  var40.i = (int) 0x0000001a;   /* 26 or 1.28457e-322f */
+  /* 12: loadpw */
+  var41.i = (int) 0x00000006;   /* 6 or 2.96439e-323f */
+  /* 15: loadpw */
+  var42.i = (int) 0x00000020;   /* 32 or 1.58101e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr4[i];
+    /* 1: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 2: loadb */
+    var37 = ptr5[i];
+    /* 3: convubw */
+    var45.i = (orc_uint8) var37;
+    /* 4: loadb */
+    var38 = ptr6[i];
+    /* 5: convubw */
+    var46.i = (orc_uint8) var38;
+    /* 6: loadb */
+    var39 = ptr7[i];
+    /* 7: convubw */
+    var47.i = (orc_uint8) var39;
+    /* 8: addw */
+    var48.i = var45.i + var46.i;
+    /* 10: mullw */
+    var49.i = (var48.i * var40.i) & 0xffff;
+    /* 11: addw */
+    var50.i = var44.i + var47.i;
+    /* 13: mullw */
+    var51.i = (var50.i * var41.i) & 0xffff;
+    /* 14: addw */
+    var52.i = var49.i + var51.i;
+    /* 16: addw */
+    var53.i = var52.i + var42.i;
+    /* 17: shrsw */
+    var54.i = var53.i >> 6;
+    /* 18: convsuswb */
+    var43 = ORC_CLAMP_UB (var54.i);
+    /* 19: storeb */
+    ptr0[i] = var43;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+  ptr7 = (orc_int8 *) ex->arrays[7];
+
+  /* 9: loadpw */
+  var40.i = (int) 0x0000001a;   /* 26 or 1.28457e-322f */
+  /* 12: loadpw */
+  var41.i = (int) 0x00000006;   /* 6 or 2.96439e-323f */
+  /* 15: loadpw */
+  var42.i = (int) 0x00000020;   /* 32 or 1.58101e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr4[i];
+    /* 1: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 2: loadb */
+    var37 = ptr5[i];
+    /* 3: convubw */
+    var45.i = (orc_uint8) var37;
+    /* 4: loadb */
+    var38 = ptr6[i];
+    /* 5: convubw */
+    var46.i = (orc_uint8) var38;
+    /* 6: loadb */
+    var39 = ptr7[i];
+    /* 7: convubw */
+    var47.i = (orc_uint8) var39;
+    /* 8: addw */
+    var48.i = var45.i + var46.i;
+    /* 10: mullw */
+    var49.i = (var48.i * var40.i) & 0xffff;
+    /* 11: addw */
+    var50.i = var44.i + var47.i;
+    /* 13: mullw */
+    var51.i = (var50.i * var41.i) & 0xffff;
+    /* 14: addw */
+    var52.i = var49.i + var51.i;
+    /* 16: addw */
+    var53.i = var52.i + var42.i;
+    /* 17: shrsw */
+    var54.i = var53.i >> 6;
+    /* 18: convsuswb */
+    var43 = ORC_CLAMP_UB (var54.i);
+    /* 19: storeb */
+    ptr0[i] = var43;
+  }
+
+}
+
+void
+cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_downsample_vert_halfsite_4tap");
+      orc_program_set_backup_function (p,
+          _backup_cogorc_downsample_vert_halfsite_4tap);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_source (p, 1, "s4");
+      orc_program_add_constant (p, 4, 0x0000001a, "c1");
+      orc_program_add_constant (p, 4, 0x00000006, "c2");
+      orc_program_add_constant (p, 4, 0x00000020, "c3");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T3, ORC_VAR_S3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T4, ORC_VAR_S4, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T2,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->arrays[ORC_VAR_S4] = (void *) s4;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_upsample_horiz_cosite_1tap */
+#ifdef DISABLE_ORC
+void
+cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_union16 var34;
+  orc_int8 var35;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr4 = (orc_int8 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var33 = ptr4[i];
+    /* 1: copyb */
+    var35 = var33;
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35;
+      _dest.x2[1] = var35;
+      var34.i = _dest.i;
+    }
+    /* 3: storew */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_union16 var34;
+  orc_int8 var35;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var33 = ptr4[i];
+    /* 1: copyb */
+    var35 = var33;
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35;
+      _dest.x2[1] = var35;
+      var34.i = _dest.i;
+    }
+    /* 3: storew */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_upsample_horiz_cosite_1tap");
+      orc_program_set_backup_function (p,
+          _backup_cogorc_upsample_horiz_cosite_1tap);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_temporary (p, 1, "t1");
+
+      orc_program_append_2 (p, "copyb", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_upsample_horiz_cosite */
+#ifdef DISABLE_ORC
+void
+cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: copyb */
+    var37 = var34;
+    /* 2: loadb */
+    var35 = ptr5[i];
+    /* 3: avgub */
+    var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1;
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37;
+      _dest.x2[1] = var38;
+      var36.i = _dest.i;
+    }
+    /* 5: storew */
+    ptr0[i] = var36;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_upsample_horiz_cosite (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: copyb */
+    var37 = var34;
+    /* 2: loadb */
+    var35 = ptr5[i];
+    /* 3: avgub */
+    var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1;
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37;
+      _dest.x2[1] = var38;
+      var36.i = _dest.i;
+    }
+    /* 5: storew */
+    ptr0[i] = var36;
+  }
+
+}
+
+void
+cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_upsample_horiz_cosite");
+      orc_program_set_backup_function (p, _backup_cogorc_upsample_horiz_cosite);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+
+      orc_program_append_2 (p, "copyb", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_upsample_vert_avgub */
+#ifdef DISABLE_ORC
+void
+cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var32 = ptr4[i];
+    /* 1: loadb */
+    var33 = ptr5[i];
+    /* 2: avgub */
+    var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1;
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_upsample_vert_avgub (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var32 = ptr4[i];
+    /* 1: loadb */
+    var33 = ptr5[i];
+    /* 2: avgub */
+    var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1;
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_upsample_vert_avgub");
+      orc_program_set_backup_function (p, _backup_cogorc_upsample_vert_avgub);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_unpack_yuyv_y */
+#ifdef DISABLE_ORC
+void
+orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var32;
+  orc_int8 var33;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union16 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var32 = ptr4[i];
+    /* 1: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var32.i;
+      var33 = _src.x2[0];
+    }
+    /* 2: storeb */
+    ptr0[i] = var33;
+  }
+
+}
+
+#else
+static void
+_backup_orc_unpack_yuyv_y (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var32;
+  orc_int8 var33;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var32 = ptr4[i];
+    /* 1: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var32.i;
+      var33 = _src.x2[0];
+    }
+    /* 2: storeb */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_unpack_yuyv_y");
+      orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_y);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_unpack_yuyv_u */
+#ifdef DISABLE_ORC
+void
+orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[1];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_orc_unpack_yuyv_u (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[1];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_unpack_yuyv_u");
+      orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_u);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_unpack_yuyv_v */
+#ifdef DISABLE_ORC
+void
+orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select1lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[1];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[1];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_orc_unpack_yuyv_v (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select1lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[1];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[1];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_unpack_yuyv_v");
+      orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_v);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_pack_yuyv */
+#ifdef DISABLE_ORC
+void
+orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_int8 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var37 = ptr4[i];
+    /* 1: copyw */
+    var41.i = var37.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var42 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var43 = _src.x2[1];
+    }
+    /* 4: loadb */
+    var38 = ptr5[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var42;
+      _dest.x2[1] = var38;
+      var44.i = _dest.i;
+    }
+    /* 6: loadb */
+    var39 = ptr6[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var43;
+      _dest.x2[1] = var39;
+      var45.i = _dest.i;
+    }
+    /* 8: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.i;
+      _dest.x2[1] = var45.i;
+      var40.i = _dest.i;
+    }
+    /* 9: storel */
+    ptr0[i] = var40;
+  }
+
+}
+
+#else
+static void
+_backup_orc_pack_yuyv (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_int8 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var37 = ptr4[i];
+    /* 1: copyw */
+    var41.i = var37.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var42 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var43 = _src.x2[1];
+    }
+    /* 4: loadb */
+    var38 = ptr5[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var42;
+      _dest.x2[1] = var38;
+      var44.i = _dest.i;
+    }
+    /* 6: loadb */
+    var39 = ptr6[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var43;
+      _dest.x2[1] = var39;
+      var45.i = _dest.i;
+    }
+    /* 8: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.i;
+      _dest.x2[1] = var45.i;
+      var40.i = _dest.i;
+    }
+    /* 9: storel */
+    ptr0[i] = var40;
+  }
+
+}
+
+void
+orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_pack_yuyv");
+      orc_program_set_backup_function (p, _backup_orc_pack_yuyv);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+
+      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T1, ORC_VAR_T5,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T5,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_unpack_uyvy_y */
+#ifdef DISABLE_ORC
+void
+orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var32;
+  orc_int8 var33;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union16 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var32 = ptr4[i];
+    /* 1: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var32.i;
+      var33 = _src.x2[1];
+    }
+    /* 2: storeb */
+    ptr0[i] = var33;
+  }
+
+}
+
+#else
+static void
+_backup_orc_unpack_uyvy_y (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var32;
+  orc_int8 var33;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var32 = ptr4[i];
+    /* 1: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var32.i;
+      var33 = _src.x2[1];
+    }
+    /* 2: storeb */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_unpack_uyvy_y");
+      orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_y);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_unpack_uyvy_u */
+#ifdef DISABLE_ORC
+void
+orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[0];
+    }
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[0];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_orc_unpack_uyvy_u (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[0];
+    }
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[0];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_unpack_uyvy_u");
+      orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_u);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_unpack_uyvy_v */
+#ifdef DISABLE_ORC
+void
+orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select1lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[1];
+    }
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[0];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_orc_unpack_uyvy_v (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select1lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[1];
+    }
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[0];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_unpack_uyvy_v");
+      orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_v);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_pack_uyvy */
+#ifdef DISABLE_ORC
+void
+orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_int8 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var37 = ptr4[i];
+    /* 1: copyw */
+    var41.i = var37.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var42 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var43 = _src.x2[1];
+    }
+    /* 4: loadb */
+    var38 = ptr5[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var38;
+      _dest.x2[1] = var42;
+      var44.i = _dest.i;
+    }
+    /* 6: loadb */
+    var39 = ptr6[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var43;
+      var45.i = _dest.i;
+    }
+    /* 8: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.i;
+      _dest.x2[1] = var45.i;
+      var40.i = _dest.i;
+    }
+    /* 9: storel */
+    ptr0[i] = var40;
+  }
+
+}
+
+#else
+static void
+_backup_orc_pack_uyvy (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_int8 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var37 = ptr4[i];
+    /* 1: copyw */
+    var41.i = var37.i;
+    /* 2: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var42 = _src.x2[0];
+    }
+    /* 3: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.i;
+      var43 = _src.x2[1];
+    }
+    /* 4: loadb */
+    var38 = ptr5[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var38;
+      _dest.x2[1] = var42;
+      var44.i = _dest.i;
+    }
+    /* 6: loadb */
+    var39 = ptr6[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var43;
+      var45.i = _dest.i;
+    }
+    /* 8: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.i;
+      _dest.x2[1] = var45.i;
+      var40.i = _dest.i;
+    }
+    /* 9: storel */
+    ptr0[i] = var40;
+  }
+
+}
+
+void
+orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_pack_uyvy");
+      orc_program_set_backup_function (p, _backup_orc_pack_uyvy);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+
+      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T1, ORC_VAR_T5,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T5,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T4, ORC_VAR_S3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix2_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+  /* 2: loadpw */
+  var35.i = p1;
+  /* 6: loadpw */
+  var37.i = p2;
+  /* 9: loadpw */
+  var38.i = p3;
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var40.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var41.i = (var40.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var42.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var43.i = (var42.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var44.i = var41.i + var43.i;
+    /* 10: addw */
+    var45.i = var44.i + var38.i;
+    /* 11: shrsw */
+    var46.i = var45.i >> 6;
+    /* 12: convsuswb */
+    var39 = ORC_CLAMP_UB (var46.i);
+    /* 13: storeb */
+    ptr0[i] = var39;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix2_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+  /* 2: loadpw */
+  var35.i = ex->params[24];
+  /* 6: loadpw */
+  var37.i = ex->params[25];
+  /* 9: loadpw */
+  var38.i = ex->params[26];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var40.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var41.i = (var40.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var42.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var43.i = (var42.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var44.i = var41.i + var43.i;
+    /* 10: addw */
+    var45.i = var44.i + var38.i;
+    /* 11: shrsw */
+    var46.i = var45.i >> 6;
+    /* 12: convsuswb */
+    var39 = ORC_CLAMP_UB (var46.i);
+    /* 13: storeb */
+    ptr0[i] = var39;
+  }
+
+}
+
+void
+orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix2_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix2_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_constant (p, 4, 0x00000006, "c1");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_parameter (p, 2, "p3");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+  ex->params[ORC_VAR_P3] = p3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix2_11_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+  /* 2: loadpw */
+  var37.i = (int) 0x00000010;   /* 16 or 7.90505e-323f */
+  /* 4: loadpw */
+  var38.i = p1;
+  /* 8: loadpw */
+  var40.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 10: loadpw */
+  var41.i = p2;
+  /* 13: loadpw */
+  var42.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr4[i];
+    /* 1: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 3: subw */
+    var45.i = var44.i - var37.i;
+    /* 5: mullw */
+    var46.i = (var45.i * var38.i) & 0xffff;
+    /* 6: loadb */
+    var39 = ptr5[i];
+    /* 7: convubw */
+    var47.i = (orc_uint8) var39;
+    /* 9: subw */
+    var48.i = var47.i - var40.i;
+    /* 11: mullw */
+    var49.i = (var48.i * var41.i) & 0xffff;
+    /* 12: addw */
+    var50.i = var46.i + var49.i;
+    /* 14: addw */
+    var51.i = var50.i + var42.i;
+    /* 15: shrsw */
+    var52.i = var51.i >> 8;
+    /* 16: addw */
+    var53.i = var52.i + var45.i;
+    /* 17: addw */
+    var54.i = var53.i + var48.i;
+    /* 18: convsuswb */
+    var43 = ORC_CLAMP_UB (var54.i);
+    /* 19: storeb */
+    ptr0[i] = var43;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix2_11_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+  /* 2: loadpw */
+  var37.i = (int) 0x00000010;   /* 16 or 7.90505e-323f */
+  /* 4: loadpw */
+  var38.i = ex->params[24];
+  /* 8: loadpw */
+  var40.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 10: loadpw */
+  var41.i = ex->params[25];
+  /* 13: loadpw */
+  var42.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr4[i];
+    /* 1: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 3: subw */
+    var45.i = var44.i - var37.i;
+    /* 5: mullw */
+    var46.i = (var45.i * var38.i) & 0xffff;
+    /* 6: loadb */
+    var39 = ptr5[i];
+    /* 7: convubw */
+    var47.i = (orc_uint8) var39;
+    /* 9: subw */
+    var48.i = var47.i - var40.i;
+    /* 11: mullw */
+    var49.i = (var48.i * var41.i) & 0xffff;
+    /* 12: addw */
+    var50.i = var46.i + var49.i;
+    /* 14: addw */
+    var51.i = var50.i + var42.i;
+    /* 15: shrsw */
+    var52.i = var51.i >> 8;
+    /* 16: addw */
+    var53.i = var52.i + var45.i;
+    /* 17: addw */
+    var54.i = var53.i + var48.i;
+    /* 18: convsuswb */
+    var43 = ORC_CLAMP_UB (var54.i);
+    /* 19: storeb */
+    ptr0[i] = var43;
+  }
+
+}
+
+void
+orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix2_11_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix2_11_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_constant (p, 4, 0x00000010, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x00000008, "c3");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix2_12_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union16 var55;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+  /* 2: loadpw */
+  var37.i = (int) 0x00000010;   /* 16 or 7.90505e-323f */
+  /* 4: loadpw */
+  var38.i = p1;
+  /* 8: loadpw */
+  var40.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 10: loadpw */
+  var41.i = p2;
+  /* 13: loadpw */
+  var42.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr4[i];
+    /* 1: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 3: subw */
+    var45.i = var44.i - var37.i;
+    /* 5: mullw */
+    var46.i = (var45.i * var38.i) & 0xffff;
+    /* 6: loadb */
+    var39 = ptr5[i];
+    /* 7: convubw */
+    var47.i = (orc_uint8) var39;
+    /* 9: subw */
+    var48.i = var47.i - var40.i;
+    /* 11: mullw */
+    var49.i = (var48.i * var41.i) & 0xffff;
+    /* 12: addw */
+    var50.i = var46.i + var49.i;
+    /* 14: addw */
+    var51.i = var50.i + var42.i;
+    /* 15: shrsw */
+    var52.i = var51.i >> 8;
+    /* 16: addw */
+    var53.i = var52.i + var45.i;
+    /* 17: addw */
+    var54.i = var53.i + var48.i;
+    /* 18: addw */
+    var55.i = var54.i + var48.i;
+    /* 19: convsuswb */
+    var43 = ORC_CLAMP_UB (var55.i);
+    /* 20: storeb */
+    ptr0[i] = var43;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix2_12_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union16 var55;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+  /* 2: loadpw */
+  var37.i = (int) 0x00000010;   /* 16 or 7.90505e-323f */
+  /* 4: loadpw */
+  var38.i = ex->params[24];
+  /* 8: loadpw */
+  var40.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 10: loadpw */
+  var41.i = ex->params[25];
+  /* 13: loadpw */
+  var42.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr4[i];
+    /* 1: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 3: subw */
+    var45.i = var44.i - var37.i;
+    /* 5: mullw */
+    var46.i = (var45.i * var38.i) & 0xffff;
+    /* 6: loadb */
+    var39 = ptr5[i];
+    /* 7: convubw */
+    var47.i = (orc_uint8) var39;
+    /* 9: subw */
+    var48.i = var47.i - var40.i;
+    /* 11: mullw */
+    var49.i = (var48.i * var41.i) & 0xffff;
+    /* 12: addw */
+    var50.i = var46.i + var49.i;
+    /* 14: addw */
+    var51.i = var50.i + var42.i;
+    /* 15: shrsw */
+    var52.i = var51.i >> 8;
+    /* 16: addw */
+    var53.i = var52.i + var45.i;
+    /* 17: addw */
+    var54.i = var53.i + var48.i;
+    /* 18: addw */
+    var55.i = var54.i + var48.i;
+    /* 19: convsuswb */
+    var43 = ORC_CLAMP_UB (var55.i);
+    /* 20: storeb */
+    ptr0[i] = var43;
+  }
+
+}
+
+void
+orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix2_12_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix2_12_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_constant (p, 4, 0x00000010, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x00000008, "c3");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix3_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int p4, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 2: loadpw */
+  var35.i = p1;
+  /* 6: loadpw */
+  var37.i = p2;
+  /* 11: loadpw */
+  var39.i = p3;
+  /* 14: loadpw */
+  var40.i = p4;
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var42.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var43.i = (var42.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var45.i = (var44.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var46.i = var43.i + var45.i;
+    /* 9: loadb */
+    var38 = ptr6[i];
+    /* 10: convubw */
+    var47.i = (orc_uint8) var38;
+    /* 12: mullw */
+    var48.i = (var47.i * var39.i) & 0xffff;
+    /* 13: addw */
+    var49.i = var46.i + var48.i;
+    /* 15: addw */
+    var50.i = var49.i + var40.i;
+    /* 16: shrsw */
+    var51.i = var50.i >> 6;
+    /* 17: convsuswb */
+    var41 = ORC_CLAMP_UB (var51.i);
+    /* 18: storeb */
+    ptr0[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix3_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 2: loadpw */
+  var35.i = ex->params[24];
+  /* 6: loadpw */
+  var37.i = ex->params[25];
+  /* 11: loadpw */
+  var39.i = ex->params[26];
+  /* 14: loadpw */
+  var40.i = ex->params[27];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var42.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var43.i = (var42.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var45.i = (var44.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var46.i = var43.i + var45.i;
+    /* 9: loadb */
+    var38 = ptr6[i];
+    /* 10: convubw */
+    var47.i = (orc_uint8) var38;
+    /* 12: mullw */
+    var48.i = (var47.i * var39.i) & 0xffff;
+    /* 13: addw */
+    var49.i = var46.i + var48.i;
+    /* 15: addw */
+    var50.i = var49.i + var40.i;
+    /* 16: shrsw */
+    var51.i = var50.i >> 6;
+    /* 17: convsuswb */
+    var41 = ORC_CLAMP_UB (var51.i);
+    /* 18: storeb */
+    ptr0[i] = var41;
+  }
+
+}
+
+void
+orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int p4, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix3_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix3_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 4, 0x00000006, "c1");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_parameter (p, 2, "p3");
+      orc_program_add_parameter (p, 2, "p4");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+  ex->params[ORC_VAR_P3] = p3;
+  ex->params[ORC_VAR_P4] = p4;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix3_100_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_int8 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union16 var55;
+  orc_union16 var56;
+  orc_union16 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 2: loadpw */
+  var36.i = (int) 0x00000010;   /* 16 or 7.90505e-323f */
+  /* 4: loadpw */
+  var37.i = p1;
+  /* 8: loadpw */
+  var39.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 10: loadpw */
+  var40.i = p2;
+  /* 15: loadpw */
+  var42.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 17: loadpw */
+  var43.i = p3;
+  /* 20: loadpw */
+  var44.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var35 = ptr4[i];
+    /* 1: convubw */
+    var46.i = (orc_uint8) var35;
+    /* 3: subw */
+    var47.i = var46.i - var36.i;
+    /* 5: mullw */
+    var48.i = (var47.i * var37.i) & 0xffff;
+    /* 6: loadb */
+    var38 = ptr5[i];
+    /* 7: convubw */
+    var49.i = (orc_uint8) var38;
+    /* 9: subw */
+    var50.i = var49.i - var39.i;
+    /* 11: mullw */
+    var51.i = (var50.i * var40.i) & 0xffff;
+    /* 12: addw */
+    var52.i = var48.i + var51.i;
+    /* 13: loadb */
+    var41 = ptr6[i];
+    /* 14: convubw */
+    var53.i = (orc_uint8) var41;
+    /* 16: subw */
+    var54.i = var53.i - var42.i;
+    /* 18: mullw */
+    var55.i = (var54.i * var43.i) & 0xffff;
+    /* 19: addw */
+    var56.i = var52.i + var55.i;
+    /* 21: addw */
+    var57.i = var56.i + var44.i;
+    /* 22: shrsw */
+    var58.i = var57.i >> 8;
+    /* 23: addw */
+    var59.i = var58.i + var47.i;
+    /* 24: convsuswb */
+    var45 = ORC_CLAMP_UB (var59.i);
+    /* 25: storeb */
+    ptr0[i] = var45;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix3_100_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_int8 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union16 var55;
+  orc_union16 var56;
+  orc_union16 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 2: loadpw */
+  var36.i = (int) 0x00000010;   /* 16 or 7.90505e-323f */
+  /* 4: loadpw */
+  var37.i = ex->params[24];
+  /* 8: loadpw */
+  var39.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 10: loadpw */
+  var40.i = ex->params[25];
+  /* 15: loadpw */
+  var42.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+  /* 17: loadpw */
+  var43.i = ex->params[26];
+  /* 20: loadpw */
+  var44.i = (int) 0x00000080;   /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var35 = ptr4[i];
+    /* 1: convubw */
+    var46.i = (orc_uint8) var35;
+    /* 3: subw */
+    var47.i = var46.i - var36.i;
+    /* 5: mullw */
+    var48.i = (var47.i * var37.i) & 0xffff;
+    /* 6: loadb */
+    var38 = ptr5[i];
+    /* 7: convubw */
+    var49.i = (orc_uint8) var38;
+    /* 9: subw */
+    var50.i = var49.i - var39.i;
+    /* 11: mullw */
+    var51.i = (var50.i * var40.i) & 0xffff;
+    /* 12: addw */
+    var52.i = var48.i + var51.i;
+    /* 13: loadb */
+    var41 = ptr6[i];
+    /* 14: convubw */
+    var53.i = (orc_uint8) var41;
+    /* 16: subw */
+    var54.i = var53.i - var42.i;
+    /* 18: mullw */
+    var55.i = (var54.i * var43.i) & 0xffff;
+    /* 19: addw */
+    var56.i = var52.i + var55.i;
+    /* 21: addw */
+    var57.i = var56.i + var44.i;
+    /* 22: shrsw */
+    var58.i = var57.i >> 8;
+    /* 23: addw */
+    var59.i = var58.i + var47.i;
+    /* 24: convsuswb */
+    var45 = ORC_CLAMP_UB (var59.i);
+    /* 25: storeb */
+    ptr0[i] = var45;
+  }
+
+}
+
+void
+orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix3_100_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix3_100_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 4, 0x00000010, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x00000008, "c3");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_parameter (p, 2, "p3");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+  ex->params[ORC_VAR_P3] = p3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix3_100_offset_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 2: loadpw */
+  var36.i = p1;
+  /* 6: loadpw */
+  var38.i = p2;
+  /* 11: loadpw */
+  var40.i = p3;
+  /* 14: loadpw */
+  var41.i = p4;
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var35 = ptr4[i];
+    /* 1: convubw */
+    var43.i = (orc_uint8) var35;
+    /* 3: mullw */
+    var44.i = (var43.i * var36.i) & 0xffff;
+    /* 4: loadb */
+    var37 = ptr5[i];
+    /* 5: convubw */
+    var45.i = (orc_uint8) var37;
+    /* 7: mullw */
+    var46.i = (var45.i * var38.i) & 0xffff;
+    /* 8: addw */
+    var47.i = var44.i + var46.i;
+    /* 9: loadb */
+    var39 = ptr6[i];
+    /* 10: convubw */
+    var48.i = (orc_uint8) var39;
+    /* 12: mullw */
+    var49.i = (var48.i * var40.i) & 0xffff;
+    /* 13: addw */
+    var50.i = var47.i + var49.i;
+    /* 15: addw */
+    var51.i = var50.i + var41.i;
+    /* 16: shrsw */
+    var52.i = var51.i >> p5;
+    /* 17: addw */
+    var53.i = var52.i + var43.i;
+    /* 18: convsuswb */
+    var42 = ORC_CLAMP_UB (var53.i);
+    /* 19: storeb */
+    ptr0[i] = var42;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix3_100_offset_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_int8 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 2: loadpw */
+  var36.i = ex->params[24];
+  /* 6: loadpw */
+  var38.i = ex->params[25];
+  /* 11: loadpw */
+  var40.i = ex->params[26];
+  /* 14: loadpw */
+  var41.i = ex->params[27];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var35 = ptr4[i];
+    /* 1: convubw */
+    var43.i = (orc_uint8) var35;
+    /* 3: mullw */
+    var44.i = (var43.i * var36.i) & 0xffff;
+    /* 4: loadb */
+    var37 = ptr5[i];
+    /* 5: convubw */
+    var45.i = (orc_uint8) var37;
+    /* 7: mullw */
+    var46.i = (var45.i * var38.i) & 0xffff;
+    /* 8: addw */
+    var47.i = var44.i + var46.i;
+    /* 9: loadb */
+    var39 = ptr6[i];
+    /* 10: convubw */
+    var48.i = (orc_uint8) var39;
+    /* 12: mullw */
+    var49.i = (var48.i * var40.i) & 0xffff;
+    /* 13: addw */
+    var50.i = var47.i + var49.i;
+    /* 15: addw */
+    var51.i = var50.i + var41.i;
+    /* 16: shrsw */
+    var52.i = var51.i >> ex->params[28];
+    /* 17: addw */
+    var53.i = var52.i + var43.i;
+    /* 18: convsuswb */
+    var42 = ORC_CLAMP_UB (var53.i);
+    /* 19: storeb */
+    ptr0[i] = var42;
+  }
+
+}
+
+void
+orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix3_100_offset_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix3_100_offset_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_parameter (p, 2, "p3");
+      orc_program_add_parameter (p, 2, "p4");
+      orc_program_add_parameter (p, 2, "p5");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+  ex->params[ORC_VAR_P3] = p3;
+  ex->params[ORC_VAR_P4] = p4;
+  ex->params[ORC_VAR_P5] = p5;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_matrix3_000_u8 */
+#ifdef DISABLE_ORC
+void
+orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int p4, int p5, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 2: loadpw */
+  var35.i = p1;
+  /* 6: loadpw */
+  var37.i = p2;
+  /* 11: loadpw */
+  var39.i = p3;
+  /* 14: loadpw */
+  var40.i = p4;
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var42.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var43.i = (var42.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var45.i = (var44.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var46.i = var43.i + var45.i;
+    /* 9: loadb */
+    var38 = ptr6[i];
+    /* 10: convubw */
+    var47.i = (orc_uint8) var38;
+    /* 12: mullw */
+    var48.i = (var47.i * var39.i) & 0xffff;
+    /* 13: addw */
+    var49.i = var46.i + var48.i;
+    /* 15: addw */
+    var50.i = var49.i + var40.i;
+    /* 16: shrsw */
+    var51.i = var50.i >> p5;
+    /* 17: convwb */
+    var41 = var51.i;
+    /* 18: storeb */
+    ptr0[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_orc_matrix3_000_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_union16 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 2: loadpw */
+  var35.i = ex->params[24];
+  /* 6: loadpw */
+  var37.i = ex->params[25];
+  /* 11: loadpw */
+  var39.i = ex->params[26];
+  /* 14: loadpw */
+  var40.i = ex->params[27];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var42.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var43.i = (var42.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var44.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var45.i = (var44.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var46.i = var43.i + var45.i;
+    /* 9: loadb */
+    var38 = ptr6[i];
+    /* 10: convubw */
+    var47.i = (orc_uint8) var38;
+    /* 12: mullw */
+    var48.i = (var47.i * var39.i) & 0xffff;
+    /* 13: addw */
+    var49.i = var46.i + var48.i;
+    /* 15: addw */
+    var50.i = var49.i + var40.i;
+    /* 16: shrsw */
+    var51.i = var50.i >> ex->params[28];
+    /* 17: convwb */
+    var41 = var51.i;
+    /* 18: storeb */
+    ptr0[i] = var41;
+  }
+
+}
+
+void
+orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int p2, int p3, int p4, int p5, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_matrix3_000_u8");
+      orc_program_set_backup_function (p, _backup_orc_matrix3_000_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_parameter (p, 2, "p3");
+      orc_program_add_parameter (p, 2, "p4");
+      orc_program_add_parameter (p, 2, "p5");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+  ex->params[ORC_VAR_P3] = p3;
+  ex->params[ORC_VAR_P4] = p4;
+  ex->params[ORC_VAR_P5] = p5;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_pack_123x */
+#ifdef DISABLE_ORC
+void
+orc_pack_123x (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 4: loadpb */
+  var37 = p1;
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: loadb */
+    var35 = ptr5[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var34;
+      _dest.x2[1] = var35;
+      var39.i = _dest.i;
+    }
+    /* 3: loadb */
+    var36 = ptr6[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var40.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var40.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_orc_pack_123x (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 4: loadpb */
+  var37 = ex->params[24];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: loadb */
+    var35 = ptr5[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var34;
+      _dest.x2[1] = var35;
+      var39.i = _dest.i;
+    }
+    /* 3: loadb */
+    var36 = ptr6[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var40.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var40.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+orc_pack_123x (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_pack_123x");
+      orc_program_set_backup_function (p, _backup_orc_pack_123x);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_parameter (p, 1, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_P1] = p1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* orc_pack_x123 */
+#ifdef DISABLE_ORC
+void
+orc_pack_x123 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 0: loadpb */
+  var34 = p1;
+
+  for (i = 0; i < n; i++) {
+    /* 1: loadb */
+    var35 = ptr4[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var34;
+      _dest.x2[1] = var35;
+      var39.i = _dest.i;
+    }
+    /* 3: loadb */
+    var36 = ptr5[i];
+    /* 4: loadb */
+    var37 = ptr6[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var40.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var40.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_orc_pack_x123 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 0: loadpb */
+  var34 = ex->params[24];
+
+  for (i = 0; i < n; i++) {
+    /* 1: loadb */
+    var35 = ptr4[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var34;
+      _dest.x2[1] = var35;
+      var39.i = _dest.i;
+    }
+    /* 3: loadb */
+    var36 = ptr5[i];
+    /* 4: loadb */
+    var37 = ptr6[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var40.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var40.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+orc_pack_x123 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "orc_pack_x123");
+      orc_program_set_backup_function (p, _backup_orc_pack_x123);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_parameter (p, 1, "p1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_P1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_P1] = p1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_combine2_u8 */
+#ifdef DISABLE_ORC
+void
+cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+
+  /* 2: loadpw */
+  var35.i = p1;
+  /* 6: loadpw */
+  var37.i = p2;
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var39.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var40.i = (var39.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var41.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var42.i = (var41.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var43.i = var40.i + var42.i;
+    /* 9: shruw */
+    var44.i = ((orc_uint16) var43.i) >> 8;
+    /* 10: convsuswb */
+    var38 = ORC_CLAMP_UB (var44.i);
+    /* 11: storeb */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_combine2_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+
+  /* 2: loadpw */
+  var35.i = ex->params[24];
+  /* 6: loadpw */
+  var37.i = ex->params[25];
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr4[i];
+    /* 1: convubw */
+    var39.i = (orc_uint8) var34;
+    /* 3: mullw */
+    var40.i = (var39.i * var35.i) & 0xffff;
+    /* 4: loadb */
+    var36 = ptr5[i];
+    /* 5: convubw */
+    var41.i = (orc_uint8) var36;
+    /* 7: mullw */
+    var42.i = (var41.i * var37.i) & 0xffff;
+    /* 8: addw */
+    var43.i = var40.i + var42.i;
+    /* 9: shruw */
+    var44.i = ((orc_uint16) var43.i) >> 8;
+    /* 10: convsuswb */
+    var38 = ORC_CLAMP_UB (var44.i);
+    /* 11: storeb */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int p1, int p2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_combine2_u8");
+      orc_program_set_backup_function (p, _backup_cogorc_combine2_u8);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_constant (p, 4, 0x00000008, "c1");
+      orc_program_add_parameter (p, 2, "p1");
+      orc_program_add_parameter (p, 2, "p2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shruw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_P1] = p1;
+  ex->params[ORC_VAR_P2] = p2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_I420_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  orc_union32 *ORC_RESTRICT ptr1;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr1 = (orc_union32 *) d2;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_union16 *) s2;
+  ptr6 = (orc_int8 *) s3;
+  ptr7 = (orc_int8 *) s4;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var33 = ptr6[i];
+    /* 1: loadb */
+    var34 = ptr7[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var33;
+      _dest.x2[1] = var34;
+      var39.i = _dest.i;
+    }
+    /* 3: loadw */
+    var35 = ptr4[i];
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[0];
+      _dest.x2[1] = var35.x2[0];
+      var36.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[1];
+      _dest.x2[1] = var35.x2[1];
+      var36.x2[1] = _dest.i;
+    }
+    /* 5: storel */
+    ptr0[i] = var36;
+    /* 6: loadw */
+    var37 = ptr5[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[0];
+      _dest.x2[1] = var37.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[1];
+      _dest.x2[1] = var37.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 8: storel */
+    ptr1[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_I420_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  orc_union32 *ORC_RESTRICT ptr1;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr1 = (orc_union32 *) ex->arrays[1];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_union16 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+  ptr7 = (orc_int8 *) ex->arrays[7];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var33 = ptr6[i];
+    /* 1: loadb */
+    var34 = ptr7[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var33;
+      _dest.x2[1] = var34;
+      var39.i = _dest.i;
+    }
+    /* 3: loadw */
+    var35 = ptr4[i];
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[0];
+      _dest.x2[1] = var35.x2[0];
+      var36.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[1];
+      _dest.x2[1] = var35.x2[1];
+      var36.x2[1] = _dest.i;
+    }
+    /* 5: storel */
+    ptr0[i] = var36;
+    /* 6: loadw */
+    var37 = ptr5[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[0];
+      _dest.x2[1] = var37.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39.x2[1];
+      _dest.x2[1] = var37.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 8: storel */
+    ptr1[i] = var38;
+  }
+
+}
+
+void
+cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_I420_UYVY");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_I420_UYVY);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_destination (p, 4, "d2");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_source (p, 1, "s4");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S3, ORC_VAR_S4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_S2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->arrays[ORC_VAR_S4] = (void *) s4;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_I420_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  orc_union32 *ORC_RESTRICT ptr1;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr1 = (orc_union32 *) d2;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_union16 *) s2;
+  ptr6 = (orc_int8 *) s3;
+  ptr7 = (orc_int8 *) s4;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var33 = ptr6[i];
+    /* 1: loadb */
+    var34 = ptr7[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var33;
+      _dest.x2[1] = var34;
+      var39.i = _dest.i;
+    }
+    /* 3: loadw */
+    var35 = ptr4[i];
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var36.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var36.x2[1] = _dest.i;
+    }
+    /* 5: storel */
+    ptr0[i] = var36;
+    /* 6: loadw */
+    var37 = ptr5[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 8: storel */
+    ptr1[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_I420_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  orc_union32 *ORC_RESTRICT ptr1;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr1 = (orc_union32 *) ex->arrays[1];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_union16 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+  ptr7 = (orc_int8 *) ex->arrays[7];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var33 = ptr6[i];
+    /* 1: loadb */
+    var34 = ptr7[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var33;
+      _dest.x2[1] = var34;
+      var39.i = _dest.i;
+    }
+    /* 3: loadw */
+    var35 = ptr4[i];
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var36.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var36.x2[1] = _dest.i;
+    }
+    /* 5: storel */
+    ptr0[i] = var36;
+    /* 6: loadw */
+    var37 = ptr5[i];
+    /* 7: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 8: storel */
+    ptr1[i] = var38;
+  }
+
+}
+
+void
+cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_I420_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_I420_YUY2);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_destination (p, 4, "d2");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_source (p, 1, "s4");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S3, ORC_VAR_S4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_S2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->arrays[ORC_VAR_S4] = (void *) s4;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_I420_AYUV */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  orc_union32 *ORC_RESTRICT ptr1;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+  orc_union32 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr1 = (orc_union32 *) d2;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+  ptr7 = (orc_int8 *) s4;
+
+  /* 3: loadpb */
+  var36 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 8: loadpb */
+  var39 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var42 = ptr6[i >> 1];
+    /* 1: loadupdb */
+    var43 = ptr7[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var42;
+      _dest.x2[1] = var43;
+      var44.i = _dest.i;
+    }
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var45.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var45.i;
+      _dest.x2[1] = var44.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+    /* 9: loadb */
+    var40 = ptr5[i];
+    /* 10: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var40;
+      var46.i = _dest.i;
+    }
+    /* 11: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var46.i;
+      _dest.x2[1] = var44.i;
+      var41.i = _dest.i;
+    }
+    /* 12: storel */
+    ptr1[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_I420_AYUV (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  orc_union32 *ORC_RESTRICT ptr1;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+  orc_union32 var41;
+  orc_int8 var42;
+  orc_int8 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr1 = (orc_union32 *) ex->arrays[1];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+  ptr7 = (orc_int8 *) ex->arrays[7];
+
+  /* 3: loadpb */
+  var36 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 8: loadpb */
+  var39 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var42 = ptr6[i >> 1];
+    /* 1: loadupdb */
+    var43 = ptr7[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var42;
+      _dest.x2[1] = var43;
+      var44.i = _dest.i;
+    }
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var45.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var45.i;
+      _dest.x2[1] = var44.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+    /* 9: loadb */
+    var40 = ptr5[i];
+    /* 10: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var40;
+      var46.i = _dest.i;
+    }
+    /* 11: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var46.i;
+      _dest.x2[1] = var44.i;
+      var41.i = _dest.i;
+    }
+    /* 12: storel */
+    ptr1[i] = var41;
+  }
+
+}
+
+void
+cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_I420_AYUV");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_I420_AYUV);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_destination (p, 4, "d2");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_source (p, 1, "s4");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T3, ORC_VAR_S3,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->arrays[ORC_VAR_S4] = (void *) s4;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_YUY2_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_int8 *ORC_RESTRICT ptr3;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  const orc_union32 *ORC_RESTRICT ptr5;
+  orc_union32 var35;
+  orc_union32 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_union16 *) d2;
+  ptr2 = (orc_int8 *) d3;
+  ptr3 = (orc_int8 *) d4;
+  ptr4 = (orc_union32 *) s1;
+  ptr5 = (orc_union32 *) s2;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var35 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: storew */
+    ptr0[i] = var40;
+    /* 3: loadl */
+    var36 = ptr5[i];
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var41.x2[0] = _src.x2[1];
+      var42.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var41.x2[1] = _src.x2[1];
+      var42.x2[1] = _src.x2[0];
+    }
+    /* 5: storew */
+    ptr1[i] = var42;
+    /* 6: avgub */
+    var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1;
+    /* 7: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var37 = _src.x2[1];
+      var38 = _src.x2[0];
+    }
+    /* 8: storeb */
+    ptr3[i] = var37;
+    /* 9: storeb */
+    ptr2[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_YUY2_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_int8 *ORC_RESTRICT ptr3;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  const orc_union32 *ORC_RESTRICT ptr5;
+  orc_union32 var35;
+  orc_union32 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_union16 *) ex->arrays[1];
+  ptr2 = (orc_int8 *) ex->arrays[2];
+  ptr3 = (orc_int8 *) ex->arrays[3];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+  ptr5 = (orc_union32 *) ex->arrays[5];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var35 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: storew */
+    ptr0[i] = var40;
+    /* 3: loadl */
+    var36 = ptr5[i];
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var41.x2[0] = _src.x2[1];
+      var42.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var41.x2[1] = _src.x2[1];
+      var42.x2[1] = _src.x2[0];
+    }
+    /* 5: storew */
+    ptr1[i] = var42;
+    /* 6: avgub */
+    var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1;
+    /* 7: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var37 = _src.x2[1];
+      var38 = _src.x2[0];
+    }
+    /* 8: storeb */
+    ptr3[i] = var37;
+    /* 9: storeb */
+    ptr2[i] = var38;
+  }
+
+}
+
+void
+cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_YUY2_I420");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_I420);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_destination (p, 1, "d4");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_source (p, 4, "s2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->arrays[ORC_VAR_D4] = d4;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_UYVY_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union32 var33;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var32 = ptr4[i];
+      /* 1: swapw */
+      var33.x2[0] = ORC_SWAP_W (var32.x2[0]);
+      var33.x2[1] = ORC_SWAP_W (var32.x2[1]);
+      /* 2: storel */
+      ptr0[i] = var33;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union32 var33;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var32 = ptr4[i];
+      /* 1: swapw */
+      var33.x2[0] = ORC_SWAP_W (var32.x2[0]);
+      var33.x2[1] = ORC_SWAP_W (var32.x2[1]);
+      /* 2: storel */
+      ptr0[i] = var33;
+    }
+  }
+
+}
+
+void
+cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_UYVY_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_YUY2);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+
+      orc_program_append_2 (p, "swapw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_planar_chroma_420_422 */
+#ifdef DISABLE_ORC
+void
+cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1,
+    int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_int8 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_int8 var35;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var32 = ptr4[i];
+      /* 1: copyb */
+      var33 = var32;
+      /* 2: storeb */
+      ptr0[i] = var33;
+      /* 3: loadb */
+      var34 = ptr4[i];
+      /* 4: copyb */
+      var35 = var34;
+      /* 5: storeb */
+      ptr1[i] = var35;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_planar_chroma_420_422 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_int8 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_int8 var35;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var32 = ptr4[i];
+      /* 1: copyb */
+      var33 = var32;
+      /* 2: storeb */
+      ptr0[i] = var33;
+      /* 3: loadb */
+      var34 = ptr4[i];
+      /* 4: copyb */
+      var35 = var34;
+      /* 5: storeb */
+      ptr1[i] = var35;
+    }
+  }
+
+}
+
+void
+cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1,
+    int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_planar_chroma_420_422");
+      orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_420_422);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_source (p, 1, "s1");
+
+      orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "copyb", 0, ORC_VAR_D2, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_planar_chroma_420_444 */
+#ifdef DISABLE_ORC
+void
+cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1,
+    int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_union16 var34;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr4[i];
+      /* 1: splatbw */
+      var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff);
+      /* 2: storew */
+      ptr0[i] = var34;
+      /* 3: storew */
+      ptr1[i] = var34;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_planar_chroma_420_444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_union16 var34;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr4[i];
+      /* 1: splatbw */
+      var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff);
+      /* 2: storew */
+      ptr0[i] = var34;
+      /* 3: storew */
+      ptr1[i] = var34;
+    }
+  }
+
+}
+
+void
+cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1,
+    int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_planar_chroma_420_444");
+      orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_420_444);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_planar_chroma_422_444 */
+#ifdef DISABLE_ORC
+void
+cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_union16 var34;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr4[i];
+      /* 1: splatbw */
+      var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff);
+      /* 2: storew */
+      ptr0[i] = var34;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_planar_chroma_422_444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_union16 var34;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr4[i];
+      /* 1: splatbw */
+      var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff);
+      /* 2: storew */
+      ptr0[i] = var34;
+    }
+  }
+
+}
+
+void
+cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_planar_chroma_422_444");
+      orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_422_444);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_planar_chroma_444_422 */
+#ifdef DISABLE_ORC
+void
+cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var34 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var34.i;
+        var36 = _src.x2[1];
+        var37 = _src.x2[0];
+      }
+      /* 2: avgub */
+      var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1;
+      /* 3: storeb */
+      ptr0[i] = var35;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_planar_chroma_444_422 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var34 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var34.i;
+        var36 = _src.x2[1];
+        var37 = _src.x2[0];
+      }
+      /* 2: avgub */
+      var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1;
+      /* 3: storeb */
+      ptr0[i] = var35;
+    }
+  }
+
+}
+
+void
+cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_planar_chroma_444_422");
+      orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_444_422);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_planar_chroma_444_420 */
+#ifdef DISABLE_ORC
+void
+cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var35 = ptr4[i];
+      /* 1: loadw */
+      var36 = ptr5[i];
+      /* 2: avgub */
+      var38.x2[0] =
+          ((orc_uint8) var35.x2[0] + (orc_uint8) var36.x2[0] + 1) >> 1;
+      var38.x2[1] =
+          ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var38.i;
+        var39 = _src.x2[1];
+        var40 = _src.x2[0];
+      }
+      /* 4: avgub */
+      var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1;
+      /* 5: storeb */
+      ptr0[i] = var37;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_planar_chroma_444_420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var35 = ptr4[i];
+      /* 1: loadw */
+      var36 = ptr5[i];
+      /* 2: avgub */
+      var38.x2[0] =
+          ((orc_uint8) var35.x2[0] + (orc_uint8) var36.x2[0] + 1) >> 1;
+      var38.x2[1] =
+          ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var38.i;
+        var39 = _src.x2[1];
+        var40 = _src.x2[0];
+      }
+      /* 4: avgub */
+      var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1;
+      /* 5: storeb */
+      ptr0[i] = var37;
+    }
+  }
+
+}
+
+void
+cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_planar_chroma_444_420");
+      orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_444_420);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_planar_chroma_422_420 */
+#ifdef DISABLE_ORC
+void
+cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var32 = ptr4[i];
+      /* 1: loadb */
+      var33 = ptr5[i];
+      /* 2: avgub */
+      var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1;
+      /* 3: storeb */
+      ptr0[i] = var34;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_planar_chroma_422_420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  orc_int8 var32;
+  orc_int8 var33;
+  orc_int8 var34;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var32 = ptr4[i];
+      /* 1: loadb */
+      var33 = ptr5[i];
+      /* 2: avgub */
+      var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1;
+      /* 3: storeb */
+      ptr0[i] = var34;
+    }
+  }
+
+}
+
+void
+cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_planar_chroma_422_420");
+      orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_422_420);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_YUY2_AYUV */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+    /* 2: loadpb */
+    var37.x2[0] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+    var37.x2[1] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var36 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 3: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[0];
+        _dest.x2[1] = var40.x2[0];
+        var41.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[1];
+        _dest.x2[1] = var40.x2[1];
+        var41.x2[1] = _dest.i;
+      }
+      /* 4: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var39.i;
+        _dest.x2[1] = var39.i;
+        var42.i = _dest.i;
+      }
+      /* 5: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[0];
+        _dest.x2[1] = var42.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[1];
+        _dest.x2[1] = var42.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storeq */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+    /* 2: loadpb */
+    var37.x2[0] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+    var37.x2[1] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var36 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 3: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[0];
+        _dest.x2[1] = var40.x2[0];
+        var41.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[1];
+        _dest.x2[1] = var40.x2[1];
+        var41.x2[1] = _dest.i;
+      }
+      /* 4: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var39.i;
+        _dest.x2[1] = var39.i;
+        var42.i = _dest.i;
+      }
+      /* 5: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[0];
+        _dest.x2[1] = var42.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[1];
+        _dest.x2[1] = var42.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storeq */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_YUY2_AYUV");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_AYUV);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 2, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_UYVY_AYUV */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+    /* 2: loadpb */
+    var37.x2[0] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+    var37.x2[1] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var36 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 3: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[0];
+        _dest.x2[1] = var39.x2[0];
+        var41.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[1];
+        _dest.x2[1] = var39.x2[1];
+        var41.x2[1] = _dest.i;
+      }
+      /* 4: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var40.i;
+        _dest.x2[1] = var40.i;
+        var42.i = _dest.i;
+      }
+      /* 5: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[0];
+        _dest.x2[1] = var42.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[1];
+        _dest.x2[1] = var42.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storeq */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+    /* 2: loadpb */
+    var37.x2[0] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+    var37.x2[1] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var36 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var36.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 3: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[0];
+        _dest.x2[1] = var39.x2[0];
+        var41.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[1];
+        _dest.x2[1] = var39.x2[1];
+        var41.x2[1] = _dest.i;
+      }
+      /* 4: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var40.i;
+        _dest.x2[1] = var40.i;
+        var42.i = _dest.i;
+      }
+      /* 5: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[0];
+        _dest.x2[1] = var42.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.x2[1];
+        _dest.x2[1] = var42.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storeq */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_UYVY_AYUV");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_AYUV);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 2, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_YUY2_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var33 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[0];
+        var37.x2[0] = _src.x2[1];
+        var34.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[1];
+        var37.x2[1] = _src.x2[1];
+        var34.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var34;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var37.i;
+        var35 = _src.x2[1];
+        var36 = _src.x2[0];
+      }
+      /* 4: storeb */
+      ptr2[i] = var35;
+      /* 5: storeb */
+      ptr1[i] = var36;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var33 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[0];
+        var37.x2[0] = _src.x2[1];
+        var34.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[1];
+        var37.x2[1] = _src.x2[1];
+        var34.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var34;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var37.i;
+        var35 = _src.x2[1];
+        var36 = _src.x2[0];
+      }
+      /* 4: storeb */
+      ptr2[i] = var35;
+      /* 5: storeb */
+      ptr1[i] = var36;
+    }
+  }
+
+}
+
+void
+cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_YUY2_Y42B");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_Y42B);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_UYVY_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var33 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[0];
+        var34.x2[0] = _src.x2[1];
+        var37.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[1];
+        var34.x2[1] = _src.x2[1];
+        var37.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var34;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var37.i;
+        var35 = _src.x2[1];
+        var36 = _src.x2[0];
+      }
+      /* 4: storeb */
+      ptr2[i] = var35;
+      /* 5: storeb */
+      ptr1[i] = var36;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var33 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[0];
+        var34.x2[0] = _src.x2[1];
+        var37.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var33.x2[1];
+        var34.x2[1] = _src.x2[1];
+        var37.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var34;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var37.i;
+        var35 = _src.x2[1];
+        var36 = _src.x2[0];
+      }
+      /* 4: storeb */
+      ptr2[i] = var35;
+      /* 5: storeb */
+      ptr1[i] = var36;
+    }
+  }
+
+}
+
+void
+cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_UYVY_Y42B");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_Y42B);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_YUY2_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_union16 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var35 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var36.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var36.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var36;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var39.i;
+        var40 = _src.x2[1];
+        var41 = _src.x2[0];
+      }
+      /* 4: splatbw */
+      var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff);
+      /* 5: storew */
+      ptr1[i] = var37;
+      /* 6: splatbw */
+      var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff);
+      /* 7: storew */
+      ptr2[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_union16 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var35 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var36.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var36.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var36;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var39.i;
+        var40 = _src.x2[1];
+        var41 = _src.x2[0];
+      }
+      /* 4: splatbw */
+      var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff);
+      /* 5: storew */
+      ptr1[i] = var37;
+      /* 6: splatbw */
+      var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff);
+      /* 7: storew */
+      ptr2[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_YUY2_Y444");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_Y444);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_destination (p, 2, "d3");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_UYVY_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_union16 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var35 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[0];
+        var36.x2[0] = _src.x2[1];
+        var39.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[1];
+        var36.x2[1] = _src.x2[1];
+        var39.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var36;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var39.i;
+        var40 = _src.x2[1];
+        var41 = _src.x2[0];
+      }
+      /* 4: splatbw */
+      var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff);
+      /* 5: storew */
+      ptr1[i] = var37;
+      /* 6: splatbw */
+      var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff);
+      /* 7: storew */
+      ptr2[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_union16 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var35 = ptr4[i];
+      /* 1: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[0];
+        var36.x2[0] = _src.x2[1];
+        var39.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var35.x2[1];
+        var36.x2[1] = _src.x2[1];
+        var39.x2[1] = _src.x2[0];
+      }
+      /* 2: storew */
+      ptr0[i] = var36;
+      /* 3: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var39.i;
+        var40 = _src.x2[1];
+        var41 = _src.x2[0];
+      }
+      /* 4: splatbw */
+      var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff);
+      /* 5: storew */
+      ptr1[i] = var37;
+      /* 6: splatbw */
+      var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff);
+      /* 7: storew */
+      ptr2[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_UYVY_Y444");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_Y444);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_destination (p, 2, "d3");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_UYVY_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_int8 *ORC_RESTRICT ptr3;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  const orc_union32 *ORC_RESTRICT ptr5;
+  orc_union32 var35;
+  orc_union32 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_union16 *) d2;
+  ptr2 = (orc_int8 *) d3;
+  ptr3 = (orc_int8 *) d4;
+  ptr4 = (orc_union32 *) s1;
+  ptr5 = (orc_union32 *) s2;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var35 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: storew */
+    ptr0[i] = var39;
+    /* 3: loadl */
+    var36 = ptr5[i];
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var41.x2[0] = _src.x2[1];
+      var42.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var41.x2[1] = _src.x2[1];
+      var42.x2[1] = _src.x2[0];
+    }
+    /* 5: storew */
+    ptr1[i] = var41;
+    /* 6: avgub */
+    var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 7: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var37 = _src.x2[1];
+      var38 = _src.x2[0];
+    }
+    /* 8: storeb */
+    ptr3[i] = var37;
+    /* 9: storeb */
+    ptr2[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_UYVY_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_int8 *ORC_RESTRICT ptr3;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  const orc_union32 *ORC_RESTRICT ptr5;
+  orc_union32 var35;
+  orc_union32 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_union16 *) ex->arrays[1];
+  ptr2 = (orc_int8 *) ex->arrays[2];
+  ptr3 = (orc_int8 *) ex->arrays[3];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+  ptr5 = (orc_union32 *) ex->arrays[5];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var35 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var35.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: storew */
+    ptr0[i] = var39;
+    /* 3: loadl */
+    var36 = ptr5[i];
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var41.x2[0] = _src.x2[1];
+      var42.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var41.x2[1] = _src.x2[1];
+      var42.x2[1] = _src.x2[0];
+    }
+    /* 5: storew */
+    ptr1[i] = var41;
+    /* 6: avgub */
+    var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 7: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var37 = _src.x2[1];
+      var38 = _src.x2[0];
+    }
+    /* 8: storeb */
+    ptr3[i] = var37;
+    /* 9: storeb */
+    ptr2[i] = var38;
+  }
+
+}
+
+void
+cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_UYVY_I420");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_I420);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_destination (p, 1, "d4");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_source (p, 4, "s2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->arrays[ORC_VAR_D4] = d4;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_int8 *ORC_RESTRICT ptr3;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  const orc_union64 *ORC_RESTRICT ptr5;
+  orc_union64 var40;
+  orc_union16 var41;
+  orc_union64 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_union32 var46;
+  orc_union32 var47;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union32 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_int8 var53;
+  orc_int8 var54;
+  orc_int8 var55;
+  orc_int8 var56;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr3 = ORC_PTR_OFFSET (d4, d4_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var40 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.x2[0];
+        var46.x2[0] = _src.x2[1];
+        var47.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var40.x2[1];
+        var46.x2[1] = _src.x2[1];
+        var47.x2[1] = _src.x2[0];
+      }
+      /* 2: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var47.x2[0];
+        var41.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var47.x2[1];
+        var41.x2[1] = _src.x2[1];
+      }
+      /* 3: storew */
+      ptr0[i] = var41;
+      /* 4: loadq */
+      var42 = ptr5[i];
+      /* 5: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var42.x2[0];
+        var48.x2[0] = _src.x2[1];
+        var49.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var42.x2[1];
+        var48.x2[1] = _src.x2[1];
+        var49.x2[1] = _src.x2[0];
+      }
+      /* 6: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var49.x2[0];
+        var43.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var49.x2[1];
+        var43.x2[1] = _src.x2[1];
+      }
+      /* 7: storew */
+      ptr1[i] = var43;
+      /* 8: avgub */
+      var50.x4[0] =
+          ((orc_uint8) var46.x4[0] + (orc_uint8) var48.x4[0] + 1) >> 1;
+      var50.x4[1] =
+          ((orc_uint8) var46.x4[1] + (orc_uint8) var48.x4[1] + 1) >> 1;
+      var50.x4[2] =
+          ((orc_uint8) var46.x4[2] + (orc_uint8) var48.x4[2] + 1) >> 1;
+      var50.x4[3] =
+          ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1;
+      /* 9: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var50.x2[0];
+        var51.x2[0] = _src.x2[1];
+        var52.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var50.x2[1];
+        var51.x2[1] = _src.x2[1];
+        var52.x2[1] = _src.x2[0];
+      }
+      /* 10: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var52.i;
+        var53 = _src.x2[1];
+        var54 = _src.x2[0];
+      }
+      /* 11: avgub */
+      var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1;
+      /* 12: storeb */
+      ptr2[i] = var44;
+      /* 13: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var51.i;
+        var55 = _src.x2[1];
+        var56 = _src.x2[0];
+      }
+      /* 14: avgub */
+      var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1;
+      /* 15: storeb */
+      ptr3[i] = var45;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_int8 *ORC_RESTRICT ptr3;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  const orc_union64 *ORC_RESTRICT ptr5;
+  orc_union64 var40;
+  orc_union16 var41;
+  orc_union64 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_union32 var46;
+  orc_union32 var47;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union32 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_int8 var53;
+  orc_int8 var54;
+  orc_int8 var55;
+  orc_int8 var56;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr3 = ORC_PTR_OFFSET (ex->arrays[3], ex->params[3] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var40 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.x2[0];
+        var46.x2[0] = _src.x2[1];
+        var47.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var40.x2[1];
+        var46.x2[1] = _src.x2[1];
+        var47.x2[1] = _src.x2[0];
+      }
+      /* 2: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var47.x2[0];
+        var41.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var47.x2[1];
+        var41.x2[1] = _src.x2[1];
+      }
+      /* 3: storew */
+      ptr0[i] = var41;
+      /* 4: loadq */
+      var42 = ptr5[i];
+      /* 5: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var42.x2[0];
+        var48.x2[0] = _src.x2[1];
+        var49.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var42.x2[1];
+        var48.x2[1] = _src.x2[1];
+        var49.x2[1] = _src.x2[0];
+      }
+      /* 6: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var49.x2[0];
+        var43.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var49.x2[1];
+        var43.x2[1] = _src.x2[1];
+      }
+      /* 7: storew */
+      ptr1[i] = var43;
+      /* 8: avgub */
+      var50.x4[0] =
+          ((orc_uint8) var46.x4[0] + (orc_uint8) var48.x4[0] + 1) >> 1;
+      var50.x4[1] =
+          ((orc_uint8) var46.x4[1] + (orc_uint8) var48.x4[1] + 1) >> 1;
+      var50.x4[2] =
+          ((orc_uint8) var46.x4[2] + (orc_uint8) var48.x4[2] + 1) >> 1;
+      var50.x4[3] =
+          ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1;
+      /* 9: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var50.x2[0];
+        var51.x2[0] = _src.x2[1];
+        var52.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var50.x2[1];
+        var51.x2[1] = _src.x2[1];
+        var52.x2[1] = _src.x2[0];
+      }
+      /* 10: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var52.i;
+        var53 = _src.x2[1];
+        var54 = _src.x2[0];
+      }
+      /* 11: avgub */
+      var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1;
+      /* 12: storeb */
+      ptr2[i] = var44;
+      /* 13: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var51.i;
+        var55 = _src.x2[1];
+        var56 = _src.x2[0];
+      }
+      /* 14: avgub */
+      var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1;
+      /* 15: storeb */
+      ptr3[i] = var45;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_I420");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_I420);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_destination (p, 1, "d4");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_source (p, 8, "s2");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 1, "t7");
+      orc_program_add_temporary (p, 1, "t8");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D2, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 2, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D4, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_D4] = d4;
+  ex->params[ORC_VAR_D4] = d4_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var37 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 2: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var39.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 3: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 4: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[0];
+        var44.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[1];
+        var44.x2[1] = _src.x2[1];
+      }
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var44.x2[0];
+        _dest.x2[1] = var43.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var44.x2[1];
+        _dest.x2[1] = var43.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storel */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var37 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 2: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var39.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 3: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 4: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[0];
+        var44.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[1];
+        var44.x2[1] = _src.x2[1];
+      }
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var44.x2[0];
+        _dest.x2[1] = var43.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var44.x2[1];
+        _dest.x2[1] = var43.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storel */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_YUY2);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+      orc_program_add_temporary (p, 4, "t5");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var37 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 2: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var39.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 3: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 4: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[0];
+        var44.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[1];
+        var44.x2[1] = _src.x2[1];
+      }
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[0];
+        _dest.x2[1] = var44.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[1];
+        _dest.x2[1] = var44.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storel */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var37 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[0];
+        var39.x2[0] = _src.x2[1];
+        var40.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var37.x2[1];
+        var39.x2[1] = _src.x2[1];
+        var40.x2[1] = _src.x2[0];
+      }
+      /* 2: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var39.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 3: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 4: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[0];
+        var44.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var40.x2[1];
+        var44.x2[1] = _src.x2[1];
+      }
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[0];
+        _dest.x2[1] = var44.x2[0];
+        var38.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[1];
+        _dest.x2[1] = var44.x2[1];
+        var38.x2[1] = _dest.i;
+      }
+      /* 6: storel */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_UYVY");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_UYVY);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+      orc_program_add_temporary (p, 4, "t5");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var36 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var36.x2[0];
+        var40.x2[0] = _src.x2[1];
+        var41.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var36.x2[1];
+        var40.x2[1] = _src.x2[1];
+        var41.x2[1] = _src.x2[0];
+      }
+      /* 2: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.i;
+        var42.i = _src.x2[1];
+        var43.i = _src.x2[0];
+      }
+      /* 3: avgub */
+      var44.x2[0] =
+          ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+      var44.x2[1] =
+          ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var44.i;
+        var37 = _src.x2[1];
+        var38 = _src.x2[0];
+      }
+      /* 5: storeb */
+      ptr2[i] = var37;
+      /* 6: storeb */
+      ptr1[i] = var38;
+      /* 7: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var41.x2[0];
+        var39.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var41.x2[1];
+        var39.x2[1] = _src.x2[1];
+      }
+      /* 8: storew */
+      ptr0[i] = var39;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadq */
+      var36 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var36.x2[0];
+        var40.x2[0] = _src.x2[1];
+        var41.x2[0] = _src.x2[0];
+      }
+      {
+        orc_union32 _src;
+        _src.i = var36.x2[1];
+        var40.x2[1] = _src.x2[1];
+        var41.x2[1] = _src.x2[0];
+      }
+      /* 2: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.i;
+        var42.i = _src.x2[1];
+        var43.i = _src.x2[0];
+      }
+      /* 3: avgub */
+      var44.x2[0] =
+          ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+      var44.x2[1] =
+          ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var44.i;
+        var37 = _src.x2[1];
+        var38 = _src.x2[0];
+      }
+      /* 5: storeb */
+      ptr2[i] = var37;
+      /* 6: storeb */
+      ptr1[i] = var38;
+      /* 7: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var41.x2[0];
+        var39.x2[0] = _src.x2[1];
+      }
+      {
+        orc_union16 _src;
+        _src.i = var41.x2[1];
+        var39.x2[1] = _src.x2[1];
+      }
+      /* 8: storew */
+      ptr0[i] = var39;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_Y42B");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_Y42B);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_int8 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j);
+    ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var34 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var34.i;
+        var38.i = _src.x2[1];
+        var39.i = _src.x2[0];
+      }
+      /* 2: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var38.i;
+        var35 = _src.x2[1];
+        var36 = _src.x2[0];
+      }
+      /* 3: storeb */
+      ptr2[i] = var35;
+      /* 4: storeb */
+      ptr1[i] = var36;
+      /* 5: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var39.i;
+        var37 = _src.x2[1];
+      }
+      /* 6: storeb */
+      ptr0[i] = var37;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_int8 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j);
+    ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var34 = ptr4[i];
+      /* 1: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var34.i;
+        var38.i = _src.x2[1];
+        var39.i = _src.x2[0];
+      }
+      /* 2: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var38.i;
+        var35 = _src.x2[1];
+        var36 = _src.x2[0];
+      }
+      /* 3: storeb */
+      ptr2[i] = var35;
+      /* 4: storeb */
+      ptr1[i] = var36;
+      /* 5: select1wb */
+      {
+        orc_union16 _src;
+        _src.i = var39.i;
+        var37 = _src.x2[1];
+      }
+      /* 6: storeb */
+      ptr0[i] = var37;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3,
+    int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_Y444");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_Y444);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->params[ORC_VAR_D2] = d2_stride;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->params[ORC_VAR_D3] = d3_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_Y42B_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+    ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr5[i];
+      /* 1: loadb */
+      var34 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var33;
+        _dest.x2[1] = var34;
+        var37.i = _dest.i;
+      }
+      /* 3: loadw */
+      var35 = ptr4[i];
+      /* 4: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var35.x2[0];
+        _dest.x2[1] = var37.x2[0];
+        var36.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var35.x2[1];
+        _dest.x2[1] = var37.x2[1];
+        var36.x2[1] = _dest.i;
+      }
+      /* 5: storel */
+      ptr0[i] = var36;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+    ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr5[i];
+      /* 1: loadb */
+      var34 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var33;
+        _dest.x2[1] = var34;
+        var37.i = _dest.i;
+      }
+      /* 3: loadw */
+      var35 = ptr4[i];
+      /* 4: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var35.x2[0];
+        _dest.x2[1] = var37.x2[0];
+        var36.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var35.x2[1];
+        _dest.x2[1] = var37.x2[1];
+        var36.x2[1] = _dest.i;
+      }
+      /* 5: storel */
+      ptr0[i] = var36;
+    }
+  }
+
+}
+
+void
+cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_Y42B_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_Y42B_YUY2);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_S3] = s3_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_Y42B_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+    ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr5[i];
+      /* 1: loadb */
+      var34 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var33;
+        _dest.x2[1] = var34;
+        var37.i = _dest.i;
+      }
+      /* 3: loadw */
+      var35 = ptr4[i];
+      /* 4: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[0];
+        _dest.x2[1] = var35.x2[0];
+        var36.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[1];
+        _dest.x2[1] = var35.x2[1];
+        var36.x2[1] = _dest.i;
+      }
+      /* 5: storel */
+      ptr0[i] = var36;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+    ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var33 = ptr5[i];
+      /* 1: loadb */
+      var34 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var33;
+        _dest.x2[1] = var34;
+        var37.i = _dest.i;
+      }
+      /* 3: loadw */
+      var35 = ptr4[i];
+      /* 4: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[0];
+        _dest.x2[1] = var35.x2[0];
+        var36.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var37.x2[1];
+        _dest.x2[1] = var35.x2[1];
+        var36.x2[1] = _dest.i;
+      }
+      /* 5: storel */
+      ptr0[i] = var36;
+    }
+  }
+
+}
+
+void
+cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_Y42B_UYVY");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_Y42B_UYVY);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_S3] = s3_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_Y42B_AYUV */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union64 var40;
+  orc_union16 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+    ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j);
+
+    /* 3: loadpb */
+    var38.x2[0] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+    var38.x2[1] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var36 = ptr5[i];
+      /* 1: loadb */
+      var37 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36;
+        _dest.x2[1] = var37;
+        var41.i = _dest.i;
+      }
+      /* 4: loadw */
+      var39 = ptr4[i];
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[0];
+        _dest.x2[1] = var39.x2[0];
+        var42.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[1];
+        _dest.x2[1] = var39.x2[1];
+        var42.x2[1] = _dest.i;
+      }
+      /* 6: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.i;
+        _dest.x2[1] = var41.i;
+        var43.i = _dest.i;
+      }
+      /* 7: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var42.x2[0];
+        _dest.x2[1] = var43.x2[0];
+        var40.x2[0] = _dest.i;
+      }
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var42.x2[1];
+        _dest.x2[1] = var43.x2[1];
+        var40.x2[1] = _dest.i;
+      }
+      /* 8: storeq */
+      ptr0[i] = var40;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union64 var40;
+  orc_union16 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+    ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j);
+
+    /* 3: loadpb */
+    var38.x2[0] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+    var38.x2[1] = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var36 = ptr5[i];
+      /* 1: loadb */
+      var37 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36;
+        _dest.x2[1] = var37;
+        var41.i = _dest.i;
+      }
+      /* 4: loadw */
+      var39 = ptr4[i];
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[0];
+        _dest.x2[1] = var39.x2[0];
+        var42.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[1];
+        _dest.x2[1] = var39.x2[1];
+        var42.x2[1] = _dest.i;
+      }
+      /* 6: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var41.i;
+        _dest.x2[1] = var41.i;
+        var43.i = _dest.i;
+      }
+      /* 7: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var42.x2[0];
+        _dest.x2[1] = var43.x2[0];
+        var40.x2[0] = _dest.i;
+      }
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var42.x2[1];
+        _dest.x2[1] = var43.x2[1];
+        var40.x2[1] = _dest.i;
+      }
+      /* 8: storeq */
+      ptr0[i] = var40;
+    }
+  }
+
+}
+
+void
+cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_Y42B_AYUV");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_Y42B_AYUV);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_S3] = s3_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_Y444_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_union16 *ORC_RESTRICT ptr6;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+    ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var36 = ptr5[i];
+      /* 1: loadw */
+      var37 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[0];
+        _dest.x2[1] = var37.x2[0];
+        var40.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[1];
+        _dest.x2[1] = var37.x2[1];
+        var40.x2[1] = _dest.i;
+      }
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 4: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 5: loadw */
+      var38 = ptr4[i];
+      /* 6: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[0];
+        _dest.x2[1] = var43.x2[0];
+        var39.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[1];
+        _dest.x2[1] = var43.x2[1];
+        var39.x2[1] = _dest.i;
+      }
+      /* 7: storel */
+      ptr0[i] = var39;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_union16 *ORC_RESTRICT ptr6;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+    ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var36 = ptr5[i];
+      /* 1: loadw */
+      var37 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[0];
+        _dest.x2[1] = var37.x2[0];
+        var40.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[1];
+        _dest.x2[1] = var37.x2[1];
+        var40.x2[1] = _dest.i;
+      }
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 4: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 5: loadw */
+      var38 = ptr4[i];
+      /* 6: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[0];
+        _dest.x2[1] = var43.x2[0];
+        var39.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var38.x2[1];
+        _dest.x2[1] = var43.x2[1];
+        var39.x2[1] = _dest.i;
+      }
+      /* 7: storel */
+      ptr0[i] = var39;
+    }
+  }
+
+}
+
+void
+cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_Y444_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_Y444_YUY2);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_source (p, 2, "s3");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_S3] = s3_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_Y444_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_union16 *ORC_RESTRICT ptr6;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+    ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var36 = ptr5[i];
+      /* 1: loadw */
+      var37 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[0];
+        _dest.x2[1] = var37.x2[0];
+        var40.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[1];
+        _dest.x2[1] = var37.x2[1];
+        var40.x2[1] = _dest.i;
+      }
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 4: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 5: loadw */
+      var38 = ptr4[i];
+      /* 6: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[0];
+        _dest.x2[1] = var38.x2[0];
+        var39.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[1];
+        _dest.x2[1] = var38.x2[1];
+        var39.x2[1] = _dest.i;
+      }
+      /* 7: storel */
+      ptr0[i] = var39;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_Y444_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  const orc_union16 *ORC_RESTRICT ptr6;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+    ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j);
+
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadw */
+      var36 = ptr5[i];
+      /* 1: loadw */
+      var37 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[0];
+        _dest.x2[1] = var37.x2[0];
+        var40.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36.x2[1];
+        _dest.x2[1] = var37.x2[1];
+        var40.x2[1] = _dest.i;
+      }
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var40.i;
+        var41.i = _src.x2[1];
+        var42.i = _src.x2[0];
+      }
+      /* 4: avgub */
+      var43.x2[0] =
+          ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+      var43.x2[1] =
+          ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+      /* 5: loadw */
+      var38 = ptr4[i];
+      /* 6: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[0];
+        _dest.x2[1] = var38.x2[0];
+        var39.x2[0] = _dest.i;
+      }
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var43.x2[1];
+        _dest.x2[1] = var38.x2[1];
+        var39.x2[1] = _dest.i;
+      }
+      /* 7: storel */
+      ptr0[i] = var39;
+    }
+  }
+
+}
+
+void
+cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_Y444_UYVY");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_Y444_UYVY);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_source (p, 2, "s3");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_S3] = s3_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_Y444_AYUV */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+    ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j);
+    ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j);
+
+    /* 3: loadpb */
+    var36 = (int) 0x000000ff;   /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var34 = ptr5[i];
+      /* 1: loadb */
+      var35 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var34;
+        _dest.x2[1] = var35;
+        var39.i = _dest.i;
+      }
+      /* 4: loadb */
+      var37 = ptr4[i];
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36;
+        _dest.x2[1] = var37;
+        var40.i = _dest.i;
+      }
+      /* 6: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var40.i;
+        _dest.x2[1] = var39.i;
+        var38.i = _dest.i;
+      }
+      /* 7: storel */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_Y444_AYUV (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+    ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j);
+    ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j);
+
+    /* 3: loadpb */
+    var36 = (int) 0x000000ff;   /* 255 or 1.25987e-321f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadb */
+      var34 = ptr5[i];
+      /* 1: loadb */
+      var35 = ptr6[i];
+      /* 2: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var34;
+        _dest.x2[1] = var35;
+        var39.i = _dest.i;
+      }
+      /* 4: loadb */
+      var37 = ptr4[i];
+      /* 5: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var36;
+        _dest.x2[1] = var37;
+        var40.i = _dest.i;
+      }
+      /* 6: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var40.i;
+        _dest.x2[1] = var39.i;
+        var38.i = _dest.i;
+      }
+      /* 7: storel */
+      ptr0[i] = var38;
+    }
+  }
+
+}
+
+void
+cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride,
+    const guint8 * ORC_RESTRICT s2, int s2_stride,
+    const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_Y444_AYUV");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_Y444_AYUV);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->params[ORC_VAR_S2] = s2_stride;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->params[ORC_VAR_S3] = s3_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_ARGB */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var61;
+        _dest.x2[1] = var87;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var88;
+        _dest.x2[1] = var89;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var61;
+        _dest.x2[1] = var87;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var88;
+        _dest.x2[1] = var89;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_ARGB");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_ARGB);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 1, 0x00000008, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x0000002a, "c3");
+      orc_program_add_constant (p, 4, 0x00000067, "c4");
+      orc_program_add_constant (p, 4, 0x00000004, "c5");
+      orc_program_add_constant (p, 4, 0x00000064, "c6");
+      orc_program_add_constant (p, 4, 0x00000068, "c7");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+      orc_program_add_temporary (p, 1, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+      orc_program_add_temporary (p, 2, "t9");
+      orc_program_add_temporary (p, 2, "t10");
+      orc_program_add_temporary (p, 2, "t11");
+      orc_program_add_temporary (p, 2, "t12");
+      orc_program_add_temporary (p, 1, "t13");
+      orc_program_add_temporary (p, 1, "t14");
+      orc_program_add_temporary (p, 1, "t15");
+      orc_program_add_temporary (p, 4, "t16");
+
+      orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T9, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T8, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3,
+          ORC_VAR_T13, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T14,
+          ORC_VAR_T15, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_BGRA */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var89;
+        _dest.x2[1] = var88;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var87;
+        _dest.x2[1] = var61;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var89;
+        _dest.x2[1] = var88;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var87;
+        _dest.x2[1] = var61;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_BGRA");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_BGRA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 1, 0x00000008, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x0000002a, "c3");
+      orc_program_add_constant (p, 4, 0x00000067, "c4");
+      orc_program_add_constant (p, 4, 0x00000004, "c5");
+      orc_program_add_constant (p, 4, 0x00000064, "c6");
+      orc_program_add_constant (p, 4, 0x00000068, "c7");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+      orc_program_add_temporary (p, 1, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+      orc_program_add_temporary (p, 2, "t9");
+      orc_program_add_temporary (p, 2, "t10");
+      orc_program_add_temporary (p, 2, "t11");
+      orc_program_add_temporary (p, 2, "t12");
+      orc_program_add_temporary (p, 1, "t13");
+      orc_program_add_temporary (p, 1, "t14");
+      orc_program_add_temporary (p, 1, "t15");
+      orc_program_add_temporary (p, 4, "t16");
+
+      orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T9, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T8, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T15,
+          ORC_VAR_T14, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T13,
+          ORC_VAR_T3, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_ABGR */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var61;
+        _dest.x2[1] = var89;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var88;
+        _dest.x2[1] = var87;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var61;
+        _dest.x2[1] = var89;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var88;
+        _dest.x2[1] = var87;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_ABGR");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_ABGR);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 1, 0x00000008, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x0000002a, "c3");
+      orc_program_add_constant (p, 4, 0x00000067, "c4");
+      orc_program_add_constant (p, 4, 0x00000004, "c5");
+      orc_program_add_constant (p, 4, 0x00000064, "c6");
+      orc_program_add_constant (p, 4, 0x00000068, "c7");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+      orc_program_add_temporary (p, 1, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+      orc_program_add_temporary (p, 2, "t9");
+      orc_program_add_temporary (p, 2, "t10");
+      orc_program_add_temporary (p, 2, "t11");
+      orc_program_add_temporary (p, 2, "t12");
+      orc_program_add_temporary (p, 1, "t13");
+      orc_program_add_temporary (p, 1, "t14");
+      orc_program_add_temporary (p, 1, "t15");
+      orc_program_add_temporary (p, 4, "t16");
+
+      orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T9, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T8, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3,
+          ORC_VAR_T15, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T14,
+          ORC_VAR_T13, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_AYUV_RGBA */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  int i;
+  int j;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
+    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var87;
+        _dest.x2[1] = var88;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var89;
+        _dest.x2[1] = var61;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int j;
+  int n = ex->n;
+  int m = ex->params[ORC_VAR_A1];
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var48;
+  orc_union32 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_union16 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_int8 var87;
+  orc_int8 var88;
+  orc_int8 var89;
+  orc_union16 var90;
+  orc_union16 var91;
+  orc_union32 var92;
+
+  for (j = 0; j < m; j++) {
+    ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j);
+    ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j);
+
+    /* 1: loadpb */
+    var49.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var49.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    /* 9: loadpw */
+    var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */
+    /* 14: loadpw */
+    var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */
+    /* 21: loadpw */
+    var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */
+    /* 25: loadpw */
+    var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */
+    /* 29: loadpw */
+    var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */
+    /* 40: loadpb */
+    var55.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+    var55.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+
+    for (i = 0; i < n; i++) {
+      /* 0: loadl */
+      var48 = ptr4[i];
+      /* 2: subb */
+      var57.x4[0] = var48.x4[0] - var49.x4[0];
+      var57.x4[1] = var48.x4[1] - var49.x4[1];
+      var57.x4[2] = var48.x4[2] - var49.x4[2];
+      var57.x4[3] = var48.x4[3] - var49.x4[3];
+      /* 3: splitlw */
+      {
+        orc_union32 _src;
+        _src.i = var57.i;
+        var58.i = _src.x2[1];
+        var59.i = _src.x2[0];
+      }
+      /* 4: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var59.i;
+        var60 = _src.x2[1];
+        var61 = _src.x2[0];
+      }
+      /* 5: splitwb */
+      {
+        orc_union16 _src;
+        _src.i = var58.i;
+        var62 = _src.x2[1];
+        var63 = _src.x2[0];
+      }
+      /* 6: convsbw */
+      var64.i = var60;
+      /* 7: convsbw */
+      var65.i = var63;
+      /* 8: convsbw */
+      var66.i = var62;
+      /* 10: mullw */
+      var67.i = (var64.i * var50.i) & 0xffff;
+      /* 11: shrsw */
+      var68.i = var67.i >> 8;
+      /* 12: addssw */
+      var69.i = ORC_CLAMP_SW (var64.i + var68.i);
+      /* 13: addssw */
+      var70.i = ORC_CLAMP_SW (var69.i + var66.i);
+      /* 15: mullw */
+      var71.i = (var66.i * var51.i) & 0xffff;
+      /* 16: shrsw */
+      var72.i = var71.i >> 8;
+      /* 17: subssw */
+      var73.i = ORC_CLAMP_SW (var70.i - var72.i);
+      /* 18: addssw */
+      var74.i = ORC_CLAMP_SW (var73.i + var66.i);
+      /* 19: addssw */
+      var75.i = ORC_CLAMP_SW (var69.i + var65.i);
+      /* 20: addssw */
+      var76.i = ORC_CLAMP_SW (var75.i + var65.i);
+      /* 22: mullw */
+      var77.i = (var65.i * var52.i) & 0xffff;
+      /* 23: shrsw */
+      var78.i = var77.i >> 8;
+      /* 24: addssw */
+      var79.i = ORC_CLAMP_SW (var76.i + var78.i);
+      /* 26: mullw */
+      var80.i = (var65.i * var53.i) & 0xffff;
+      /* 27: shrsw */
+      var81.i = var80.i >> 8;
+      /* 28: subssw */
+      var82.i = ORC_CLAMP_SW (var69.i - var81.i);
+      /* 30: mullw */
+      var83.i = (var66.i * var54.i) & 0xffff;
+      /* 31: shrsw */
+      var84.i = var83.i >> 8;
+      /* 32: subssw */
+      var85.i = ORC_CLAMP_SW (var82.i - var84.i);
+      /* 33: subssw */
+      var86.i = ORC_CLAMP_SW (var85.i - var84.i);
+      /* 34: convssswb */
+      var87 = ORC_CLAMP_SB (var74.i);
+      /* 35: convssswb */
+      var88 = ORC_CLAMP_SB (var86.i);
+      /* 36: convssswb */
+      var89 = ORC_CLAMP_SB (var79.i);
+      /* 37: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var87;
+        _dest.x2[1] = var88;
+        var90.i = _dest.i;
+      }
+      /* 38: mergebw */
+      {
+        orc_union16 _dest;
+        _dest.x2[0] = var89;
+        _dest.x2[1] = var61;
+        var91.i = _dest.i;
+      }
+      /* 39: mergewl */
+      {
+        orc_union32 _dest;
+        _dest.x2[0] = var90.i;
+        _dest.x2[1] = var91.i;
+        var92.i = _dest.i;
+      }
+      /* 41: addb */
+      var56.x4[0] = var92.x4[0] + var55.x4[0];
+      var56.x4[1] = var92.x4[1] + var55.x4[1];
+      var56.x4[2] = var92.x4[2] + var55.x4[2];
+      var56.x4[3] = var92.x4[3] + var55.x4[3];
+      /* 42: storel */
+      ptr0[i] = var56;
+    }
+  }
+
+}
+
+void
+cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride,
+    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_2d (p);
+      orc_program_set_name (p, "cogorc_convert_AYUV_RGBA");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_RGBA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 1, 0x00000008, "c1");
+      orc_program_add_constant (p, 4, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x0000002a, "c3");
+      orc_program_add_constant (p, 4, 0x00000067, "c4");
+      orc_program_add_constant (p, 4, 0x00000004, "c5");
+      orc_program_add_constant (p, 4, 0x00000064, "c6");
+      orc_program_add_constant (p, 4, 0x00000068, "c7");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+      orc_program_add_temporary (p, 1, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+      orc_program_add_temporary (p, 2, "t9");
+      orc_program_add_temporary (p, 2, "t10");
+      orc_program_add_temporary (p, 2, "t11");
+      orc_program_add_temporary (p, 2, "t12");
+      orc_program_add_temporary (p, 1, "t13");
+      orc_program_add_temporary (p, 1, "t14");
+      orc_program_add_temporary (p, 1, "t15");
+      orc_program_add_temporary (p, 4, "t16");
+
+      orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T9, ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T8, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T13,
+          ORC_VAR_T14, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T15,
+          ORC_VAR_T3, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ORC_EXECUTOR_M (ex) = m;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->params[ORC_VAR_D1] = d1_stride;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->params[ORC_VAR_S1] = s1_stride;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_I420_BGRA */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_int8 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_int8 var57;
+  orc_union16 var58;
+  orc_int8 var59;
+  orc_int8 var60;
+  orc_union16 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_int8 var85;
+  orc_int8 var86;
+  orc_int8 var87;
+  orc_union16 var88;
+  orc_union16 var89;
+  orc_union32 var90;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 1: loadpb */
+  var46 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 5: loadpb */
+  var47 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 9: loadpb */
+  var48 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 12: loadpw */
+  var49.i = (int) 0x0000002a;   /* 42 or 2.07508e-322f */
+  /* 17: loadpw */
+  var50.i = (int) 0x00000067;   /* 103 or 5.08888e-322f */
+  /* 24: loadpw */
+  var51.i = (int) 0x00000004;   /* 4 or 1.97626e-323f */
+  /* 28: loadpw */
+  var52.i = (int) 0x00000064;   /* 100 or 4.94066e-322f */
+  /* 32: loadpw */
+  var53.i = (int) 0x00000068;   /* 104 or 5.13828e-322f */
+  /* 41: loadpb */
+  var54 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 44: loadpb */
+  var55.x4[0] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var55.x4[1] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var55.x4[2] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var55.x4[3] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var45 = ptr4[i];
+    /* 2: subb */
+    var57 = var45 - var46;
+    /* 3: convsbw */
+    var58.i = var57;
+    /* 4: loadupib */
+    var59 =
+        (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] +
+        1) >> 1 : ptr5[i >> 1];
+    /* 6: subb */
+    var60 = var59 - var47;
+    /* 7: convsbw */
+    var61.i = var60;
+    /* 8: loadupib */
+    var62 =
+        (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] +
+        1) >> 1 : ptr6[i >> 1];
+    /* 10: subb */
+    var63 = var62 - var48;
+    /* 11: convsbw */
+    var64.i = var63;
+    /* 13: mullw */
+    var65.i = (var58.i * var49.i) & 0xffff;
+    /* 14: shrsw */
+    var66.i = var65.i >> 8;
+    /* 15: addssw */
+    var67.i = ORC_CLAMP_SW (var58.i + var66.i);
+    /* 16: addssw */
+    var68.i = ORC_CLAMP_SW (var67.i + var64.i);
+    /* 18: mullw */
+    var69.i = (var64.i * var50.i) & 0xffff;
+    /* 19: shrsw */
+    var70.i = var69.i >> 8;
+    /* 20: subssw */
+    var71.i = ORC_CLAMP_SW (var68.i - var70.i);
+    /* 21: addssw */
+    var72.i = ORC_CLAMP_SW (var71.i + var64.i);
+    /* 22: addssw */
+    var73.i = ORC_CLAMP_SW (var67.i + var61.i);
+    /* 23: addssw */
+    var74.i = ORC_CLAMP_SW (var73.i + var61.i);
+    /* 25: mullw */
+    var75.i = (var61.i * var51.i) & 0xffff;
+    /* 26: shrsw */
+    var76.i = var75.i >> 8;
+    /* 27: addssw */
+    var77.i = ORC_CLAMP_SW (var74.i + var76.i);
+    /* 29: mullw */
+    var78.i = (var61.i * var52.i) & 0xffff;
+    /* 30: shrsw */
+    var79.i = var78.i >> 8;
+    /* 31: subssw */
+    var80.i = ORC_CLAMP_SW (var67.i - var79.i);
+    /* 33: mullw */
+    var81.i = (var64.i * var53.i) & 0xffff;
+    /* 34: shrsw */
+    var82.i = var81.i >> 8;
+    /* 35: subssw */
+    var83.i = ORC_CLAMP_SW (var80.i - var82.i);
+    /* 36: subssw */
+    var84.i = ORC_CLAMP_SW (var83.i - var82.i);
+    /* 37: convssswb */
+    var85 = ORC_CLAMP_SB (var72.i);
+    /* 38: convssswb */
+    var86 = ORC_CLAMP_SB (var84.i);
+    /* 39: convssswb */
+    var87 = ORC_CLAMP_SB (var77.i);
+    /* 40: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var87;
+      _dest.x2[1] = var86;
+      var88.i = _dest.i;
+    }
+    /* 42: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var85;
+      _dest.x2[1] = var54;
+      var89.i = _dest.i;
+    }
+    /* 43: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var88.i;
+      _dest.x2[1] = var89.i;
+      var90.i = _dest.i;
+    }
+    /* 45: addb */
+    var56.x4[0] = var90.x4[0] + var55.x4[0];
+    var56.x4[1] = var90.x4[1] + var55.x4[1];
+    var56.x4[2] = var90.x4[2] + var55.x4[2];
+    var56.x4[3] = var90.x4[3] + var55.x4[3];
+    /* 46: storel */
+    ptr0[i] = var56;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_I420_BGRA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_union16 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_int8 var54;
+  orc_union32 var55;
+  orc_union32 var56;
+  orc_int8 var57;
+  orc_union16 var58;
+  orc_int8 var59;
+  orc_int8 var60;
+  orc_union16 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_union16 var65;
+  orc_union16 var66;
+  orc_union16 var67;
+  orc_union16 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_int8 var85;
+  orc_int8 var86;
+  orc_int8 var87;
+  orc_union16 var88;
+  orc_union16 var89;
+  orc_union32 var90;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 1: loadpb */
+  var46 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 5: loadpb */
+  var47 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 9: loadpb */
+  var48 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 12: loadpw */
+  var49.i = (int) 0x0000002a;   /* 42 or 2.07508e-322f */
+  /* 17: loadpw */
+  var50.i = (int) 0x00000067;   /* 103 or 5.08888e-322f */
+  /* 24: loadpw */
+  var51.i = (int) 0x00000004;   /* 4 or 1.97626e-323f */
+  /* 28: loadpw */
+  var52.i = (int) 0x00000064;   /* 100 or 4.94066e-322f */
+  /* 32: loadpw */
+  var53.i = (int) 0x00000068;   /* 104 or 5.13828e-322f */
+  /* 41: loadpb */
+  var54 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 44: loadpb */
+  var55.x4[0] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var55.x4[1] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var55.x4[2] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var55.x4[3] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var45 = ptr4[i];
+    /* 2: subb */
+    var57 = var45 - var46;
+    /* 3: convsbw */
+    var58.i = var57;
+    /* 4: loadupib */
+    var59 =
+        (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] +
+        1) >> 1 : ptr5[i >> 1];
+    /* 6: subb */
+    var60 = var59 - var47;
+    /* 7: convsbw */
+    var61.i = var60;
+    /* 8: loadupib */
+    var62 =
+        (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] +
+        1) >> 1 : ptr6[i >> 1];
+    /* 10: subb */
+    var63 = var62 - var48;
+    /* 11: convsbw */
+    var64.i = var63;
+    /* 13: mullw */
+    var65.i = (var58.i * var49.i) & 0xffff;
+    /* 14: shrsw */
+    var66.i = var65.i >> 8;
+    /* 15: addssw */
+    var67.i = ORC_CLAMP_SW (var58.i + var66.i);
+    /* 16: addssw */
+    var68.i = ORC_CLAMP_SW (var67.i + var64.i);
+    /* 18: mullw */
+    var69.i = (var64.i * var50.i) & 0xffff;
+    /* 19: shrsw */
+    var70.i = var69.i >> 8;
+    /* 20: subssw */
+    var71.i = ORC_CLAMP_SW (var68.i - var70.i);
+    /* 21: addssw */
+    var72.i = ORC_CLAMP_SW (var71.i + var64.i);
+    /* 22: addssw */
+    var73.i = ORC_CLAMP_SW (var67.i + var61.i);
+    /* 23: addssw */
+    var74.i = ORC_CLAMP_SW (var73.i + var61.i);
+    /* 25: mullw */
+    var75.i = (var61.i * var51.i) & 0xffff;
+    /* 26: shrsw */
+    var76.i = var75.i >> 8;
+    /* 27: addssw */
+    var77.i = ORC_CLAMP_SW (var74.i + var76.i);
+    /* 29: mullw */
+    var78.i = (var61.i * var52.i) & 0xffff;
+    /* 30: shrsw */
+    var79.i = var78.i >> 8;
+    /* 31: subssw */
+    var80.i = ORC_CLAMP_SW (var67.i - var79.i);
+    /* 33: mullw */
+    var81.i = (var64.i * var53.i) & 0xffff;
+    /* 34: shrsw */
+    var82.i = var81.i >> 8;
+    /* 35: subssw */
+    var83.i = ORC_CLAMP_SW (var80.i - var82.i);
+    /* 36: subssw */
+    var84.i = ORC_CLAMP_SW (var83.i - var82.i);
+    /* 37: convssswb */
+    var85 = ORC_CLAMP_SB (var72.i);
+    /* 38: convssswb */
+    var86 = ORC_CLAMP_SB (var84.i);
+    /* 39: convssswb */
+    var87 = ORC_CLAMP_SB (var77.i);
+    /* 40: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var87;
+      _dest.x2[1] = var86;
+      var88.i = _dest.i;
+    }
+    /* 42: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var85;
+      _dest.x2[1] = var54;
+      var89.i = _dest.i;
+    }
+    /* 43: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var88.i;
+      _dest.x2[1] = var89.i;
+      var90.i = _dest.i;
+    }
+    /* 45: addb */
+    var56.x4[0] = var90.x4[0] + var55.x4[0];
+    var56.x4[1] = var90.x4[1] + var55.x4[1];
+    var56.x4[2] = var90.x4[2] + var55.x4[2];
+    var56.x4[3] = var90.x4[3] + var55.x4[3];
+    /* 46: storel */
+    ptr0[i] = var56;
+  }
+
+}
+
+void
+cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_I420_BGRA");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_I420_BGRA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x00000008, "c1");
+      orc_program_add_constant (p, 1, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x0000002a, "c3");
+      orc_program_add_constant (p, 4, 0x00000067, "c4");
+      orc_program_add_constant (p, 4, 0x00000004, "c5");
+      orc_program_add_constant (p, 4, 0x00000064, "c6");
+      orc_program_add_constant (p, 4, 0x00000068, "c7");
+      orc_program_add_constant (p, 4, 0x000000ff, "c8");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+      orc_program_add_temporary (p, 2, "t9");
+      orc_program_add_temporary (p, 1, "t10");
+      orc_program_add_temporary (p, 1, "t11");
+      orc_program_add_temporary (p, 1, "t12");
+      orc_program_add_temporary (p, 4, "t13");
+
+      orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S2,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S3,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T4, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T4, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_C5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_C6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T4, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T10, ORC_VAR_T7,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T11, ORC_VAR_T8,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T12, ORC_VAR_T9,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T12,
+          ORC_VAR_T11, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T10,
+          ORC_VAR_C8, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T13, ORC_VAR_T1,
+          ORC_VAR_T2, ORC_VAR_D1);
+      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T13, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_convert_I420_BGRA_avg */
+#ifdef DISABLE_ORC
+void
+cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
+    const guint8 * ORC_RESTRICT s5, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  const orc_int8 *ORC_RESTRICT ptr8;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_int8 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_int8 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_int8 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_int8 var65;
+  orc_int8 var66;
+  orc_int8 var67;
+  orc_int8 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_union16 var87;
+  orc_union16 var88;
+  orc_union16 var89;
+  orc_int8 var90;
+  orc_int8 var91;
+  orc_int8 var92;
+  orc_union16 var93;
+  orc_union16 var94;
+  orc_union32 var95;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+  ptr7 = (orc_int8 *) s4;
+  ptr8 = (orc_int8 *) s5;
+
+  /* 1: loadpb */
+  var47 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 7: loadpb */
+  var48 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 13: loadpb */
+  var49 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 16: loadpw */
+  var50.i = (int) 0x0000002a;   /* 42 or 2.07508e-322f */
+  /* 21: loadpw */
+  var51.i = (int) 0x00000067;   /* 103 or 5.08888e-322f */
+  /* 28: loadpw */
+  var52.i = (int) 0x00000004;   /* 4 or 1.97626e-323f */
+  /* 32: loadpw */
+  var53.i = (int) 0x00000064;   /* 100 or 4.94066e-322f */
+  /* 36: loadpw */
+  var54.i = (int) 0x00000068;   /* 104 or 5.13828e-322f */
+  /* 45: loadpb */
+  var55 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 48: loadpb */
+  var56.x4[0] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var56.x4[1] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var56.x4[2] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var56.x4[3] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var46 = ptr4[i];
+    /* 2: subb */
+    var58 = var46 - var47;
+    /* 3: convsbw */
+    var59.i = var58;
+    /* 4: loadupib */
+    var60 =
+        (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] +
+        1) >> 1 : ptr5[i >> 1];
+    /* 5: loadupib */
+    var61 =
+        (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] +
+        1) >> 1 : ptr6[i >> 1];
+    /* 6: avgub */
+    var62 = ((orc_uint8) var60 + (orc_uint8) var61 + 1) >> 1;
+    /* 8: subb */
+    var63 = var62 - var48;
+    /* 9: convsbw */
+    var64.i = var63;
+    /* 10: loadupib */
+    var65 =
+        (i & 1) ? ((orc_uint8) ptr7[i >> 1] + (orc_uint8) ptr7[(i >> 1) + 1] +
+        1) >> 1 : ptr7[i >> 1];
+    /* 11: loadupib */
+    var66 =
+        (i & 1) ? ((orc_uint8) ptr8[i >> 1] + (orc_uint8) ptr8[(i >> 1) + 1] +
+        1) >> 1 : ptr8[i >> 1];
+    /* 12: avgub */
+    var67 = ((orc_uint8) var65 + (orc_uint8) var66 + 1) >> 1;
+    /* 14: subb */
+    var68 = var67 - var49;
+    /* 15: convsbw */
+    var69.i = var68;
+    /* 17: mullw */
+    var70.i = (var59.i * var50.i) & 0xffff;
+    /* 18: shrsw */
+    var71.i = var70.i >> 8;
+    /* 19: addssw */
+    var72.i = ORC_CLAMP_SW (var59.i + var71.i);
+    /* 20: addssw */
+    var73.i = ORC_CLAMP_SW (var72.i + var69.i);
+    /* 22: mullw */
+    var74.i = (var69.i * var51.i) & 0xffff;
+    /* 23: shrsw */
+    var75.i = var74.i >> 8;
+    /* 24: subssw */
+    var76.i = ORC_CLAMP_SW (var73.i - var75.i);
+    /* 25: addssw */
+    var77.i = ORC_CLAMP_SW (var76.i + var69.i);
+    /* 26: addssw */
+    var78.i = ORC_CLAMP_SW (var72.i + var64.i);
+    /* 27: addssw */
+    var79.i = ORC_CLAMP_SW (var78.i + var64.i);
+    /* 29: mullw */
+    var80.i = (var64.i * var52.i) & 0xffff;
+    /* 30: shrsw */
+    var81.i = var80.i >> 8;
+    /* 31: addssw */
+    var82.i = ORC_CLAMP_SW (var79.i + var81.i);
+    /* 33: mullw */
+    var83.i = (var64.i * var53.i) & 0xffff;
+    /* 34: shrsw */
+    var84.i = var83.i >> 8;
+    /* 35: subssw */
+    var85.i = ORC_CLAMP_SW (var72.i - var84.i);
+    /* 37: mullw */
+    var86.i = (var69.i * var54.i) & 0xffff;
+    /* 38: shrsw */
+    var87.i = var86.i >> 8;
+    /* 39: subssw */
+    var88.i = ORC_CLAMP_SW (var85.i - var87.i);
+    /* 40: subssw */
+    var89.i = ORC_CLAMP_SW (var88.i - var87.i);
+    /* 41: convssswb */
+    var90 = ORC_CLAMP_SB (var77.i);
+    /* 42: convssswb */
+    var91 = ORC_CLAMP_SB (var89.i);
+    /* 43: convssswb */
+    var92 = ORC_CLAMP_SB (var82.i);
+    /* 44: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var92;
+      _dest.x2[1] = var91;
+      var93.i = _dest.i;
+    }
+    /* 46: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var90;
+      _dest.x2[1] = var55;
+      var94.i = _dest.i;
+    }
+    /* 47: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var93.i;
+      _dest.x2[1] = var94.i;
+      var95.i = _dest.i;
+    }
+    /* 49: addb */
+    var57.x4[0] = var95.x4[0] + var56.x4[0];
+    var57.x4[1] = var95.x4[1] + var56.x4[1];
+    var57.x4[2] = var95.x4[2] + var56.x4[2];
+    var57.x4[3] = var95.x4[3] + var56.x4[3];
+    /* 50: storel */
+    ptr0[i] = var57;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  const orc_int8 *ORC_RESTRICT ptr8;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_int8 var49;
+  orc_union16 var50;
+  orc_union16 var51;
+  orc_union16 var52;
+  orc_union16 var53;
+  orc_union16 var54;
+  orc_int8 var55;
+  orc_union32 var56;
+  orc_union32 var57;
+  orc_int8 var58;
+  orc_union16 var59;
+  orc_int8 var60;
+  orc_int8 var61;
+  orc_int8 var62;
+  orc_int8 var63;
+  orc_union16 var64;
+  orc_int8 var65;
+  orc_int8 var66;
+  orc_int8 var67;
+  orc_int8 var68;
+  orc_union16 var69;
+  orc_union16 var70;
+  orc_union16 var71;
+  orc_union16 var72;
+  orc_union16 var73;
+  orc_union16 var74;
+  orc_union16 var75;
+  orc_union16 var76;
+  orc_union16 var77;
+  orc_union16 var78;
+  orc_union16 var79;
+  orc_union16 var80;
+  orc_union16 var81;
+  orc_union16 var82;
+  orc_union16 var83;
+  orc_union16 var84;
+  orc_union16 var85;
+  orc_union16 var86;
+  orc_union16 var87;
+  orc_union16 var88;
+  orc_union16 var89;
+  orc_int8 var90;
+  orc_int8 var91;
+  orc_int8 var92;
+  orc_union16 var93;
+  orc_union16 var94;
+  orc_union32 var95;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+  ptr7 = (orc_int8 *) ex->arrays[7];
+  ptr8 = (orc_int8 *) ex->arrays[8];
+
+  /* 1: loadpb */
+  var47 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 7: loadpb */
+  var48 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 13: loadpb */
+  var49 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
+  /* 16: loadpw */
+  var50.i = (int) 0x0000002a;   /* 42 or 2.07508e-322f */
+  /* 21: loadpw */
+  var51.i = (int) 0x00000067;   /* 103 or 5.08888e-322f */
+  /* 28: loadpw */
+  var52.i = (int) 0x00000004;   /* 4 or 1.97626e-323f */
+  /* 32: loadpw */
+  var53.i = (int) 0x00000064;   /* 100 or 4.94066e-322f */
+  /* 36: loadpw */
+  var54.i = (int) 0x00000068;   /* 104 or 5.13828e-322f */
+  /* 45: loadpb */
+  var55 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 48: loadpb */
+  var56.x4[0] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var56.x4[1] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var56.x4[2] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+  var56.x4[3] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var46 = ptr4[i];
+    /* 2: subb */
+    var58 = var46 - var47;
+    /* 3: convsbw */
+    var59.i = var58;
+    /* 4: loadupib */
+    var60 =
+        (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] +
+        1) >> 1 : ptr5[i >> 1];
+    /* 5: loadupib */
+    var61 =
+        (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] +
+        1) >> 1 : ptr6[i >> 1];
+    /* 6: avgub */
+    var62 = ((orc_uint8) var60 + (orc_uint8) var61 + 1) >> 1;
+    /* 8: subb */
+    var63 = var62 - var48;
+    /* 9: convsbw */
+    var64.i = var63;
+    /* 10: loadupib */
+    var65 =
+        (i & 1) ? ((orc_uint8) ptr7[i >> 1] + (orc_uint8) ptr7[(i >> 1) + 1] +
+        1) >> 1 : ptr7[i >> 1];
+    /* 11: loadupib */
+    var66 =
+        (i & 1) ? ((orc_uint8) ptr8[i >> 1] + (orc_uint8) ptr8[(i >> 1) + 1] +
+        1) >> 1 : ptr8[i >> 1];
+    /* 12: avgub */
+    var67 = ((orc_uint8) var65 + (orc_uint8) var66 + 1) >> 1;
+    /* 14: subb */
+    var68 = var67 - var49;
+    /* 15: convsbw */
+    var69.i = var68;
+    /* 17: mullw */
+    var70.i = (var59.i * var50.i) & 0xffff;
+    /* 18: shrsw */
+    var71.i = var70.i >> 8;
+    /* 19: addssw */
+    var72.i = ORC_CLAMP_SW (var59.i + var71.i);
+    /* 20: addssw */
+    var73.i = ORC_CLAMP_SW (var72.i + var69.i);
+    /* 22: mullw */
+    var74.i = (var69.i * var51.i) & 0xffff;
+    /* 23: shrsw */
+    var75.i = var74.i >> 8;
+    /* 24: subssw */
+    var76.i = ORC_CLAMP_SW (var73.i - var75.i);
+    /* 25: addssw */
+    var77.i = ORC_CLAMP_SW (var76.i + var69.i);
+    /* 26: addssw */
+    var78.i = ORC_CLAMP_SW (var72.i + var64.i);
+    /* 27: addssw */
+    var79.i = ORC_CLAMP_SW (var78.i + var64.i);
+    /* 29: mullw */
+    var80.i = (var64.i * var52.i) & 0xffff;
+    /* 30: shrsw */
+    var81.i = var80.i >> 8;
+    /* 31: addssw */
+    var82.i = ORC_CLAMP_SW (var79.i + var81.i);
+    /* 33: mullw */
+    var83.i = (var64.i * var53.i) & 0xffff;
+    /* 34: shrsw */
+    var84.i = var83.i >> 8;
+    /* 35: subssw */
+    var85.i = ORC_CLAMP_SW (var72.i - var84.i);
+    /* 37: mullw */
+    var86.i = (var69.i * var54.i) & 0xffff;
+    /* 38: shrsw */
+    var87.i = var86.i >> 8;
+    /* 39: subssw */
+    var88.i = ORC_CLAMP_SW (var85.i - var87.i);
+    /* 40: subssw */
+    var89.i = ORC_CLAMP_SW (var88.i - var87.i);
+    /* 41: convssswb */
+    var90 = ORC_CLAMP_SB (var77.i);
+    /* 42: convssswb */
+    var91 = ORC_CLAMP_SB (var89.i);
+    /* 43: convssswb */
+    var92 = ORC_CLAMP_SB (var82.i);
+    /* 44: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var92;
+      _dest.x2[1] = var91;
+      var93.i = _dest.i;
+    }
+    /* 46: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var90;
+      _dest.x2[1] = var55;
+      var94.i = _dest.i;
+    }
+    /* 47: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var93.i;
+      _dest.x2[1] = var94.i;
+      var95.i = _dest.i;
+    }
+    /* 49: addb */
+    var57.x4[0] = var95.x4[0] + var56.x4[0];
+    var57.x4[1] = var95.x4[1] + var56.x4[1];
+    var57.x4[2] = var95.x4[2] + var56.x4[2];
+    var57.x4[3] = var95.x4[3] + var56.x4[3];
+    /* 50: storel */
+    ptr0[i] = var57;
+  }
+
+}
+
+void
+cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1,
+    const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+    const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
+    const guint8 * ORC_RESTRICT s5, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_convert_I420_BGRA_avg");
+      orc_program_set_backup_function (p, _backup_cogorc_convert_I420_BGRA_avg);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_source (p, 1, "s4");
+      orc_program_add_source (p, 1, "s5");
+      orc_program_add_constant (p, 1, 0x00000008, "c1");
+      orc_program_add_constant (p, 1, 0x00000080, "c2");
+      orc_program_add_constant (p, 4, 0x0000002a, "c3");
+      orc_program_add_constant (p, 4, 0x00000067, "c4");
+      orc_program_add_constant (p, 4, 0x00000004, "c5");
+      orc_program_add_constant (p, 4, 0x00000064, "c6");
+      orc_program_add_constant (p, 4, 0x00000068, "c7");
+      orc_program_add_constant (p, 4, 0x000000ff, "c8");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+      orc_program_add_temporary (p, 2, "t9");
+      orc_program_add_temporary (p, 2, "t10");
+      orc_program_add_temporary (p, 1, "t11");
+      orc_program_add_temporary (p, 1, "t12");
+      orc_program_add_temporary (p, 1, "t13");
+      orc_program_add_temporary (p, 4, "t14");
+
+      orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S2,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T4, ORC_VAR_S3,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T4, ORC_VAR_S5,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T3, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_C3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_T7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T5, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T6, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10,
+          ORC_VAR_T1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T9, ORC_VAR_T5, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "subssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T11, ORC_VAR_T8,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T12, ORC_VAR_T9,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T13,
+          ORC_VAR_T12, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T11,
+          ORC_VAR_C8, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T14, ORC_VAR_T1,
+          ORC_VAR_T2, ORC_VAR_D1);
+      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->arrays[ORC_VAR_S4] = (void *) s4;
+  ex->arrays[ORC_VAR_S5] = (void *) s5;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 3: loadpb */
+  var36 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var39 = ptr5[i >> 1];
+    /* 1: loadupdb */
+    var40 = ptr6[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var40;
+      var41.i = _dest.i;
+    }
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var42.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.i;
+      _dest.x2[1] = var41.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 3: loadpb */
+  var36 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var39 = ptr5[i >> 1];
+    /* 1: loadupdb */
+    var40 = ptr6[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var40;
+      var41.i = _dest.i;
+    }
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var42.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.i;
+      _dest.x2[1] = var41.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_I420");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_I420);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T3, ORC_VAR_S2,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S3,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_YUV9 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union64 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union32 var43;
+  orc_union32 var44;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 4: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var40 = ptr5[i >> 1];
+    /* 1: loadupdb */
+    var41 = ptr6[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var40;
+      _dest.x2[1] = var41;
+      var42.i = _dest.i;
+    }
+    /* 3: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.i;
+      _dest.x2[1] = var42.i;
+      var43.i = _dest.i;
+    }
+    /* 5: loadw */
+    var38 = ptr4[i];
+    /* 6: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var38.x2[0];
+      var44.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var38.x2[1];
+      var44.x2[1] = _dest.i;
+    }
+    /* 7: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var39.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var39.x2[1] = _dest.i;
+    }
+    /* 8: storeq */
+    ptr0[i] = var39;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_YUV9 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union64 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+  orc_union16 var42;
+  orc_union32 var43;
+  orc_union32 var44;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 4: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var40 = ptr5[i >> 1];
+    /* 1: loadupdb */
+    var41 = ptr6[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var40;
+      _dest.x2[1] = var41;
+      var42.i = _dest.i;
+    }
+    /* 3: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.i;
+      _dest.x2[1] = var42.i;
+      var43.i = _dest.i;
+    }
+    /* 5: loadw */
+    var38 = ptr4[i];
+    /* 6: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var38.x2[0];
+      var44.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var38.x2[1];
+      var44.x2[1] = _dest.i;
+    }
+    /* 7: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var39.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var44.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var39.x2[1] = _dest.i;
+    }
+    /* 8: storeq */
+    ptr0[i] = var39;
+  }
+
+}
+
+void
+cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_YUV9");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_YUV9);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S2,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T5, ORC_VAR_S3,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T4, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+  /* 2: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var36 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 3: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var40.x2[0];
+      var41.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var40.x2[1];
+      var41.x2[1] = _dest.i;
+    }
+    /* 4: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var39.i;
+      var42.i = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[0];
+      _dest.x2[1] = var42.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[1];
+      _dest.x2[1] = var42.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+  /* 2: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var36 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 3: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var40.x2[0];
+      var41.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var40.x2[1];
+      var41.x2[1] = _dest.i;
+    }
+    /* 4: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var39.i;
+      var42.i = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[0];
+      _dest.x2[1] = var42.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[1];
+      _dest.x2[1] = var42.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_YUY2);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 2, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+  /* 2: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var36 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 3: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var41.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var41.x2[1] = _dest.i;
+    }
+    /* 4: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.i;
+      _dest.x2[1] = var40.i;
+      var42.i = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[0];
+      _dest.x2[1] = var42.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[1];
+      _dest.x2[1] = var42.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union32 var41;
+  orc_union32 var42;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+  /* 2: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var36 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 3: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var41.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var41.x2[1] = _dest.i;
+    }
+    /* 4: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.i;
+      _dest.x2[1] = var40.i;
+      var42.i = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[0];
+      _dest.x2[1] = var42.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[1];
+      _dest.x2[1] = var42.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_UYVY");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_UYVY);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 2, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_YVYU */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+  /* 3: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var36 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: swapw */
+    var41.i = ORC_SWAP_W (var39.i);
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var40.x2[0];
+      var42.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var40.x2[1];
+      var42.x2[1] = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.i;
+      _dest.x2[1] = var41.i;
+      var43.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_YVYU (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_union16 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+  /* 3: loadpb */
+  var37.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var37.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var36 = ptr4[i];
+    /* 1: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: swapw */
+    var41.i = ORC_SWAP_W (var39.i);
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[0];
+      _dest.x2[1] = var40.x2[0];
+      var42.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var37.x2[1];
+      _dest.x2[1] = var40.x2[1];
+      var42.x2[1] = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.i;
+      _dest.x2[1] = var41.i;
+      var43.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_YVYU");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_YVYU);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 2, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union64 var40;
+  orc_union16 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 3: loadpb */
+  var38.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var38.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr5[i];
+    /* 1: loadb */
+    var37 = ptr6[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var41.i = _dest.i;
+    }
+    /* 4: loadw */
+    var39 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var38.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var42.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var38.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var42.x2[1] = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.i;
+      _dest.x2[1] = var41.i;
+      var43.i = _dest.i;
+    }
+    /* 7: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var40.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var40.x2[1] = _dest.i;
+    }
+    /* 8: storeq */
+    ptr0[i] = var40;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union64 var40;
+  orc_union16 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 3: loadpb */
+  var38.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var38.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var36 = ptr5[i];
+    /* 1: loadb */
+    var37 = ptr6[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var41.i = _dest.i;
+    }
+    /* 4: loadw */
+    var39 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var38.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var42.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var38.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var42.x2[1] = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.i;
+      _dest.x2[1] = var41.i;
+      var43.i = _dest.i;
+    }
+    /* 7: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var40.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var40.x2[1] = _dest.i;
+    }
+    /* 8: storeq */
+    ptr0[i] = var40;
+  }
+
+}
+
+void
+cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_Y42B");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_Y42B);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+
+  /* 3: loadpb */
+  var36 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr5[i];
+    /* 1: loadb */
+    var35 = ptr6[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var34;
+      _dest.x2[1] = var35;
+      var39.i = _dest.i;
+    }
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var40.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.i;
+      _dest.x2[1] = var39.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  orc_int8 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+
+  /* 3: loadpb */
+  var36 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadb */
+    var34 = ptr5[i];
+    /* 1: loadb */
+    var35 = ptr6[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var34;
+      _dest.x2[1] = var35;
+      var39.i = _dest.i;
+    }
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var40.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.i;
+      _dest.x2[1] = var39.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_Y444");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_Y444);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y800 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+
+  /* 0: loadpb */
+  var33 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 3: loadpw */
+  var35.i = (int) 0x00008080;   /* 32896 or 1.62528e-319f */
+
+  for (i = 0; i < n; i++) {
+    /* 1: loadb */
+    var34 = ptr4[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var33;
+      _dest.x2[1] = var34;
+      var37.i = _dest.i;
+    }
+    /* 4: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var37.i;
+      _dest.x2[1] = var35.i;
+      var36.i = _dest.i;
+    }
+    /* 5: storel */
+    ptr0[i] = var36;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y800 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  orc_int8 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+  orc_union32 var36;
+  orc_union16 var37;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+
+  /* 0: loadpb */
+  var33 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 3: loadpw */
+  var35.i = (int) 0x00008080;   /* 32896 or 1.62528e-319f */
+
+  for (i = 0; i < n; i++) {
+    /* 1: loadb */
+    var34 = ptr4[i];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var33;
+      _dest.x2[1] = var34;
+      var37.i = _dest.i;
+    }
+    /* 4: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var37.i;
+      _dest.x2[1] = var35.i;
+      var36.i = _dest.i;
+    }
+    /* 5: storel */
+    ptr0[i] = var36;
+  }
+
+}
+
+void
+cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_Y800");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_Y800);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_constant (p, 2, 0x00008080, "c2");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y16 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_union32 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union16 *) s1;
+
+  /* 2: loadpb */
+  var35 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 4: loadpw */
+  var36.i = (int) 0x00008080;   /* 32896 or 1.62528e-319f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var34 = ptr4[i];
+    /* 1: convhwb */
+    var38 = ((orc_uint16) var34.i) >> 8;
+    /* 3: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35;
+      _dest.x2[1] = var38;
+      var39.i = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var36.i;
+      var37.i = _dest.i;
+    }
+    /* 6: storel */
+    ptr0[i] = var37;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y16 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  orc_union16 var34;
+  orc_int8 var35;
+  orc_union16 var36;
+  orc_union32 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+
+  /* 2: loadpb */
+  var35 = (int) 0x000000ff;     /* 255 or 1.25987e-321f */
+  /* 4: loadpw */
+  var36.i = (int) 0x00008080;   /* 32896 or 1.62528e-319f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var34 = ptr4[i];
+    /* 1: convhwb */
+    var38 = ((orc_uint16) var34.i) >> 8;
+    /* 3: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var35;
+      _dest.x2[1] = var38;
+      var39.i = _dest.i;
+    }
+    /* 5: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var36.i;
+      var37.i = _dest.i;
+    }
+    /* 6: storel */
+    ptr0[i] = var37;
+  }
+
+}
+
+void
+cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_Y16");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_Y16);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_constant (p, 2, 0x00008080, "c2");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+
+      orc_program_append_2 (p, "convhwb", 0, ORC_VAR_T2, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_BGRA */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union32 var33;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var32 = ptr4[i];
+    /* 1: swapl */
+    var33.i = ORC_SWAP_L (var32.i);
+    /* 2: storel */
+    ptr0[i] = var33;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_BGRA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union32 var33;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var32 = ptr4[i];
+    /* 1: swapl */
+    var33.i = ORC_SWAP_L (var32.i);
+    /* 2: storel */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_BGRA");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_BGRA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_ABGR */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var47;
+      _dest.x2[1] = var44;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var45;
+      _dest.x2[1] = var46;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var48.i;
+      _dest.x2[1] = var49.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_ABGR (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var47;
+      _dest.x2[1] = var44;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var45;
+      _dest.x2[1] = var46;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var48.i;
+      _dest.x2[1] = var49.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+void
+cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_ABGR");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_ABGR);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T1, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T7, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T8, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_RGBA */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var46;
+      _dest.x2[1] = var45;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44;
+      _dest.x2[1] = var47;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var48.i;
+      _dest.x2[1] = var49.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_RGBA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var46;
+      _dest.x2[1] = var45;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44;
+      _dest.x2[1] = var47;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var48.i;
+      _dest.x2[1] = var49.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+void
+cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_RGBA");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_RGBA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T1, ORC_VAR_T4, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T7, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T8, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T7, ORC_VAR_T8,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_NV12 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var34;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_union16 *) s2;
+
+  /* 3: loadpb */
+  var36.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var36.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var34 = ptr5[i];
+    /* 1: loadw */
+    var35 = ptr5[i];
+    /* 2: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var34.i;
+      _dest.x2[1] = var35.i;
+      var39.i = _dest.i;
+    }
+    /* 4: loadw */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[0];
+      _dest.x2[1] = var37.x2[0];
+      var40.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[1];
+      _dest.x2[1] = var37.x2[1];
+      var40.x2[1] = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_NV12 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var34;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_union16 *) ex->arrays[5];
+
+  /* 3: loadpb */
+  var36.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var36.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var34 = ptr5[i];
+    /* 1: loadw */
+    var35 = ptr5[i];
+    /* 2: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var34.i;
+      _dest.x2[1] = var35.i;
+      var39.i = _dest.i;
+    }
+    /* 4: loadw */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[0];
+      _dest.x2[1] = var37.x2[0];
+      var40.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[1];
+      _dest.x2[1] = var37.x2[1];
+      var40.x2[1] = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.x2[0];
+      _dest.x2[1] = var39.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var40.x2[1];
+      _dest.x2[1] = var39.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_NV12");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_NV12);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_NV21 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int n)
+{
+  int i;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+
+  ptr0 = (orc_union64 *) d1;
+  ptr4 = (orc_union16 *) s1;
+  ptr5 = (orc_union16 *) s2;
+
+  /* 3: loadpb */
+  var36.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var36.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var35 = ptr5[i];
+    /* 1: swapw */
+    var39.i = ORC_SWAP_W (var35.i);
+    /* 2: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var39.i;
+      var40.i = _dest.i;
+    }
+    /* 4: loadw */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[0];
+      _dest.x2[1] = var37.x2[0];
+      var41.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[1];
+      _dest.x2[1] = var37.x2[1];
+      var41.x2[1] = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[0];
+      _dest.x2[1] = var40.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[1];
+      _dest.x2[1] = var40.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_NV21 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union64 *ORC_RESTRICT ptr0;
+  const orc_union16 *ORC_RESTRICT ptr4;
+  const orc_union16 *ORC_RESTRICT ptr5;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_union16 var37;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+
+  ptr0 = (orc_union64 *) ex->arrays[0];
+  ptr4 = (orc_union16 *) ex->arrays[4];
+  ptr5 = (orc_union16 *) ex->arrays[5];
+
+  /* 3: loadpb */
+  var36.x2[0] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+  var36.x2[1] = (int) 0x000000ff;       /* 255 or 1.25987e-321f */
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadw */
+    var35 = ptr5[i];
+    /* 1: swapw */
+    var39.i = ORC_SWAP_W (var35.i);
+    /* 2: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var39.i;
+      _dest.x2[1] = var39.i;
+      var40.i = _dest.i;
+    }
+    /* 4: loadw */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[0];
+      _dest.x2[1] = var37.x2[0];
+      var41.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36.x2[1];
+      _dest.x2[1] = var37.x2[1];
+      var41.x2[1] = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[0];
+      _dest.x2[1] = var40.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var41.x2[1];
+      _dest.x2[1] = var40.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storeq */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_NV21");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_NV21);
+      orc_program_add_destination (p, 8, "d1");
+      orc_program_add_source (p, 2, "s1");
+      orc_program_add_source (p, 2, "s2");
+      orc_program_add_constant (p, 1, 0x000000ff, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 4, "t3");
+
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_getline_A420 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+    const guint8 * ORC_RESTRICT s4, int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_int8 *) s1;
+  ptr5 = (orc_int8 *) s2;
+  ptr6 = (orc_int8 *) s3;
+  ptr7 = (orc_int8 *) s4;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var39 = ptr5[i >> 1];
+    /* 1: loadupdb */
+    var40 = ptr6[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var40;
+      var41.i = _dest.i;
+    }
+    /* 3: loadb */
+    var36 = ptr7[i];
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var42.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.i;
+      _dest.x2[1] = var41.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_A420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_int8 *ORC_RESTRICT ptr4;
+  const orc_int8 *ORC_RESTRICT ptr5;
+  const orc_int8 *ORC_RESTRICT ptr6;
+  const orc_int8 *ORC_RESTRICT ptr7;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union32 var38;
+  orc_int8 var39;
+  orc_int8 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_int8 *) ex->arrays[4];
+  ptr5 = (orc_int8 *) ex->arrays[5];
+  ptr6 = (orc_int8 *) ex->arrays[6];
+  ptr7 = (orc_int8 *) ex->arrays[7];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadupdb */
+    var39 = ptr5[i >> 1];
+    /* 1: loadupdb */
+    var40 = ptr6[i >> 1];
+    /* 2: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var39;
+      _dest.x2[1] = var40;
+      var41.i = _dest.i;
+    }
+    /* 3: loadb */
+    var36 = ptr7[i];
+    /* 4: loadb */
+    var37 = ptr4[i];
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var36;
+      _dest.x2[1] = var37;
+      var42.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var42.i;
+      _dest.x2[1] = var41.i;
+      var38.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+    const guint8 * ORC_RESTRICT s4, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_getline_A420");
+      orc_program_set_backup_function (p, _backup_cogorc_getline_A420);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 1, "s1");
+      orc_program_add_source (p, 1, "s2");
+      orc_program_add_source (p, 1, "s3");
+      orc_program_add_source (p, 1, "s4");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T3, ORC_VAR_S2,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S3,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_S4, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+  ex->arrays[ORC_VAR_S2] = (void *) s2;
+  ex->arrays[ORC_VAR_S3] = (void *) s3;
+  ex->arrays[ORC_VAR_S4] = (void *) s4;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_int8 var49;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_int8 *) d2;
+  ptr2 = (orc_int8 *) d3;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var38 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[0];
+      var42.x2[0] = _src.x2[1];
+      var43.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[1];
+      var42.x2[1] = _src.x2[1];
+      var43.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[0];
+      var39.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[1];
+      var39.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var39;
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.x2[0];
+      var44.x2[0] = _src.x2[1];
+      var45.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var42.x2[1];
+      var44.x2[1] = _src.x2[1];
+      var45.x2[1] = _src.x2[0];
+    }
+    /* 5: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var45.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 6: avgub */
+    var40 = ((orc_uint8) var46 + (orc_uint8) var47 + 1) >> 1;
+    /* 7: storeb */
+    ptr1[i] = var40;
+    /* 8: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var48 = _src.x2[1];
+      var49 = _src.x2[0];
+    }
+    /* 9: avgub */
+    var41 = ((orc_uint8) var48 + (orc_uint8) var49 + 1) >> 1;
+    /* 10: storeb */
+    ptr2[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_int8 var40;
+  orc_int8 var41;
+  orc_union32 var42;
+  orc_union32 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_int8 var49;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_int8 *) ex->arrays[1];
+  ptr2 = (orc_int8 *) ex->arrays[2];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var38 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[0];
+      var42.x2[0] = _src.x2[1];
+      var43.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[1];
+      var42.x2[1] = _src.x2[1];
+      var43.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[0];
+      var39.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[1];
+      var39.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var39;
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.x2[0];
+      var44.x2[0] = _src.x2[1];
+      var45.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var42.x2[1];
+      var44.x2[1] = _src.x2[1];
+      var45.x2[1] = _src.x2[0];
+    }
+    /* 5: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var45.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 6: avgub */
+    var40 = ((orc_uint8) var46 + (orc_uint8) var47 + 1) >> 1;
+    /* 7: storeb */
+    ptr1[i] = var40;
+    /* 8: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var48 = _src.x2[1];
+      var49 = _src.x2[0];
+    }
+    /* 9: avgub */
+    var41 = ((orc_uint8) var48 + (orc_uint8) var49 + 1) >> 1;
+    /* 10: storeb */
+    ptr2[i] = var41;
+  }
+
+}
+
+void
+cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_I420");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_I420);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+      orc_program_add_temporary (p, 1, "t6");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T5, ORC_VAR_T6,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 4: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var44.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var44.x2[1] = _src.x2[1];
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 4: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var44.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var44.x2[1] = _src.x2[1];
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[0];
+      _dest.x2[1] = var43.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[1];
+      _dest.x2[1] = var43.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_YUY2");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_YUY2);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+      orc_program_add_temporary (p, 4, "t5");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_YVYU */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 4: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var44.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var44.x2[1] = _src.x2[1];
+    }
+    /* 5: swapw */
+    var45.i = ORC_SWAP_W (var43.i);
+    /* 6: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[0];
+      _dest.x2[1] = var45.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[1];
+      _dest.x2[1] = var45.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_YVYU (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+  orc_union16 var45;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 4: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var44.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var44.x2[1] = _src.x2[1];
+    }
+    /* 5: swapw */
+    var45.i = ORC_SWAP_W (var43.i);
+    /* 6: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[0];
+      _dest.x2[1] = var45.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44.x2[1];
+      _dest.x2[1] = var45.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_YVYU");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_YVYU);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+      orc_program_add_temporary (p, 4, "t5");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 4: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var44.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var44.x2[1] = _src.x2[1];
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var43.x2[0];
+      _dest.x2[1] = var44.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var43.x2[1];
+      _dest.x2[1] = var44.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union32 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 4: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var44.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var44.x2[1] = _src.x2[1];
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var43.x2[0];
+      _dest.x2[1] = var44.x2[0];
+      var38.x2[0] = _dest.i;
+    }
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var43.x2[1];
+      _dest.x2[1] = var44.x2[1];
+      var38.x2[1] = _dest.i;
+    }
+    /* 6: storel */
+    ptr0[i] = var38;
+  }
+
+}
+
+void
+cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_UYVY");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_UYVY);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 4, "t4");
+      orc_program_add_temporary (p, 4, "t5");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_int8 *) d2;
+  ptr2 = (orc_int8 *) d3;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var36 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[0];
+      var40.x2[0] = _src.x2[1];
+      var41.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[1];
+      var40.x2[1] = _src.x2[1];
+      var41.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+    var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var37 = _src.x2[1];
+      var38 = _src.x2[0];
+    }
+    /* 5: storeb */
+    ptr2[i] = var37;
+    /* 6: storeb */
+    ptr1[i] = var38;
+    /* 7: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[0];
+      var39.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[1];
+      var39.x2[1] = _src.x2[1];
+    }
+    /* 8: storew */
+    ptr0[i] = var39;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var36;
+  orc_int8 var37;
+  orc_int8 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_int8 *) ex->arrays[1];
+  ptr2 = (orc_int8 *) ex->arrays[2];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var36 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[0];
+      var40.x2[0] = _src.x2[1];
+      var41.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[1];
+      var40.x2[1] = _src.x2[1];
+      var41.x2[1] = _src.x2[0];
+    }
+    /* 2: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 3: avgub */
+    var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+    var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+    /* 4: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var44.i;
+      var37 = _src.x2[1];
+      var38 = _src.x2[0];
+    }
+    /* 5: storeb */
+    ptr2[i] = var37;
+    /* 6: storeb */
+    ptr1[i] = var38;
+    /* 7: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[0];
+      var39.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[1];
+      var39.x2[1] = _src.x2[1];
+    }
+    /* 8: storew */
+    ptr0[i] = var39;
+  }
+
+}
+
+void
+cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_Y42B");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_Y42B);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr1 = (orc_int8 *) d2;
+  ptr2 = (orc_int8 *) d3;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var34 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var34.i;
+      var38.i = _src.x2[1];
+      var39.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var38.i;
+      var35 = _src.x2[1];
+      var36 = _src.x2[0];
+    }
+    /* 3: storeb */
+    ptr2[i] = var35;
+    /* 4: storeb */
+    ptr1[i] = var36;
+    /* 5: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var39.i;
+      var37 = _src.x2[1];
+    }
+    /* 6: storeb */
+    ptr0[i] = var37;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var34;
+  orc_int8 var35;
+  orc_int8 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr1 = (orc_int8 *) ex->arrays[1];
+  ptr2 = (orc_int8 *) ex->arrays[2];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var34 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var34.i;
+      var38.i = _src.x2[1];
+      var39.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var38.i;
+      var35 = _src.x2[1];
+      var36 = _src.x2[0];
+    }
+    /* 3: storeb */
+    ptr2[i] = var35;
+    /* 4: storeb */
+    ptr1[i] = var36;
+    /* 5: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var39.i;
+      var37 = _src.x2[1];
+    }
+    /* 6: storeb */
+    ptr0[i] = var37;
+  }
+
+}
+
+void
+cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_Y444");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_Y444);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 2, "t2");
+
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y800 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[1];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y800 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_int8 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var33;
+  orc_int8 var34;
+  orc_union16 var35;
+
+  ptr0 = (orc_int8 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var33 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var33.i;
+      var35.i = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var35.i;
+      var34 = _src.x2[1];
+    }
+    /* 3: storeb */
+    ptr0[i] = var34;
+  }
+
+}
+
+void
+cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_Y800");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_Y800);
+      orc_program_add_destination (p, 1, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 2, "t1");
+
+      orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y16 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var34;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var34 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var34.i;
+      var36.i = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var36.i;
+      var37 = _src.x2[1];
+    }
+    /* 3: convubw */
+    var38.i = (orc_uint8) var37;
+    /* 4: shlw */
+    var35.i = var38.i << 8;
+    /* 5: storew */
+    ptr0[i] = var35;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y16 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var34;
+  orc_union16 var35;
+  orc_union16 var36;
+  orc_int8 var37;
+  orc_union16 var38;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var34 = ptr4[i];
+    /* 1: select0lw */
+    {
+      orc_union32 _src;
+      _src.i = var34.i;
+      var36.i = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var36.i;
+      var37 = _src.x2[1];
+    }
+    /* 3: convubw */
+    var38.i = (orc_uint8) var37;
+    /* 4: shlw */
+    var35.i = var38.i << 8;
+    /* 5: storew */
+    ptr0[i] = var35;
+  }
+
+}
+
+void
+cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_Y16");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_Y16);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_constant (p, 4, 0x00000008, "c1");
+      orc_program_add_temporary (p, 2, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+
+      orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "shlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_BGRA */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union32 var33;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var32 = ptr4[i];
+    /* 1: swapl */
+    var33.i = ORC_SWAP_L (var32.i);
+    /* 2: storel */
+    ptr0[i] = var33;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_BGRA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var32;
+  orc_union32 var33;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var32 = ptr4[i];
+    /* 1: swapl */
+    var33.i = ORC_SWAP_L (var32.i);
+    /* 2: storel */
+    ptr0[i] = var33;
+  }
+
+}
+
+void
+cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_BGRA");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_BGRA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+
+      orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_ABGR */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var47;
+      _dest.x2[1] = var44;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var45;
+      _dest.x2[1] = var46;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var48.i;
+      _dest.x2[1] = var49.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_ABGR (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var47;
+      _dest.x2[1] = var44;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var45;
+      _dest.x2[1] = var46;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var48.i;
+      _dest.x2[1] = var49.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+void
+cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_ABGR");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_ABGR);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T6, ORC_VAR_T1, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T6, ORC_VAR_T5,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_RGBA */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  int i;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) d1;
+  ptr4 = (orc_union32 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44;
+      _dest.x2[1] = var47;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var46;
+      _dest.x2[1] = var45;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var49.i;
+      _dest.x2[1] = var48.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_RGBA (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union32 *ORC_RESTRICT ptr0;
+  const orc_union32 *ORC_RESTRICT ptr4;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_int8 var44;
+  orc_int8 var45;
+  orc_int8 var46;
+  orc_int8 var47;
+  orc_union16 var48;
+  orc_union16 var49;
+
+  ptr0 = (orc_union32 *) ex->arrays[0];
+  ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadl */
+    var40 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 2: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var42.i;
+      var44 = _src.x2[1];
+      var45 = _src.x2[0];
+    }
+    /* 3: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.i;
+      var46 = _src.x2[1];
+      var47 = _src.x2[0];
+    }
+    /* 4: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var44;
+      _dest.x2[1] = var47;
+      var48.i = _dest.i;
+    }
+    /* 5: mergebw */
+    {
+      orc_union16 _dest;
+      _dest.x2[0] = var46;
+      _dest.x2[1] = var45;
+      var49.i = _dest.i;
+    }
+    /* 6: mergewl */
+    {
+      orc_union32 _dest;
+      _dest.x2[0] = var49.i;
+      _dest.x2[1] = var48.i;
+      var41.i = _dest.i;
+    }
+    /* 7: storel */
+    ptr0[i] = var41;
+  }
+
+}
+
+void
+cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+    int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_RGBA");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_RGBA);
+      orc_program_add_destination (p, 4, "d1");
+      orc_program_add_source (p, 4, "s1");
+      orc_program_add_temporary (p, 1, "t1");
+      orc_program_add_temporary (p, 1, "t2");
+      orc_program_add_temporary (p, 1, "t3");
+      orc_program_add_temporary (p, 1, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+      orc_program_add_temporary (p, 2, "t6");
+      orc_program_add_temporary (p, 2, "t7");
+      orc_program_add_temporary (p, 2, "t8");
+
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T8,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T7,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T6, ORC_VAR_T4, ORC_VAR_T1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T5, ORC_VAR_T6,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_NV12 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_union16 *) d2;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var36 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var37.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var37.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var37;
+    /* 4: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 5: avgub */
+    var38.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var38.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 6: storew */
+    ptr1[i] = var38;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_NV12 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var36;
+  orc_union16 var37;
+  orc_union16 var38;
+  orc_union32 var39;
+  orc_union32 var40;
+  orc_union16 var41;
+  orc_union16 var42;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_union16 *) ex->arrays[1];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var36 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[0];
+      var39.x2[0] = _src.x2[1];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var36.x2[1];
+      var39.x2[1] = _src.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[0];
+      var37.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var40.x2[1];
+      var37.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var37;
+    /* 4: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var39.i;
+      var41.i = _src.x2[1];
+      var42.i = _src.x2[0];
+    }
+    /* 5: avgub */
+    var38.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+    var38.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+    /* 6: storew */
+    ptr1[i] = var38;
+  }
+
+}
+
+void
+cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_NV12");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_NV12);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_NV21 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_union16 *) d2;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var40.x2[0] = _src.x2[1];
+      var41.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var40.x2[1] = _src.x2[1];
+      var41.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[0];
+      var38.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[1];
+      var38.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var38;
+    /* 4: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 5: avgub */
+    var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+    var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+    /* 6: swapw */
+    var39.i = ORC_SWAP_W (var44.i);
+    /* 7: storew */
+    ptr1[i] = var39;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_NV21 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_union16 *ORC_RESTRICT ptr1;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var37;
+  orc_union16 var38;
+  orc_union16 var39;
+  orc_union32 var40;
+  orc_union32 var41;
+  orc_union16 var42;
+  orc_union16 var43;
+  orc_union16 var44;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_union16 *) ex->arrays[1];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var37 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[0];
+      var40.x2[0] = _src.x2[1];
+      var41.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var37.x2[1];
+      var40.x2[1] = _src.x2[1];
+      var41.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[0];
+      var38.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var41.x2[1];
+      var38.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var38;
+    /* 4: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var40.i;
+      var42.i = _src.x2[1];
+      var43.i = _src.x2[0];
+    }
+    /* 5: avgub */
+    var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+    var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+    /* 6: swapw */
+    var39.i = ORC_SWAP_W (var44.i);
+    /* 7: storew */
+    ptr1[i] = var39;
+  }
+
+}
+
+void
+cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_NV21");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_NV21);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 2, "d2");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 2, "t5");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "swapw", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_D1,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
+
+
+/* cogorc_putline_A420 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  int i;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_union16 *ORC_RESTRICT ptr3;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_int8 var42;
+  orc_union32 var43;
+  orc_union32 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_int8 var49;
+  orc_int8 var50;
+
+  ptr0 = (orc_union16 *) d1;
+  ptr1 = (orc_int8 *) d2;
+  ptr2 = (orc_int8 *) d3;
+  ptr3 = (orc_union16 *) d4;
+  ptr4 = (orc_union64 *) s1;
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var38 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[0];
+      var43.x2[0] = _src.x2[1];
+      var44.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[1];
+      var43.x2[1] = _src.x2[1];
+      var44.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[0];
+      var39.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[1];
+      var39.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var39;
+    /* 4: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[0];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 5: storew */
+    ptr3[i] = var40;
+    /* 6: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[0];
+      var45.x2[0] = _src.x2[1];
+      var46.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[1];
+      var45.x2[1] = _src.x2[1];
+      var46.x2[1] = _src.x2[0];
+    }
+    /* 7: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var46.i;
+      var47 = _src.x2[1];
+      var48 = _src.x2[0];
+    }
+    /* 8: avgub */
+    var41 = ((orc_uint8) var47 + (orc_uint8) var48 + 1) >> 1;
+    /* 9: storeb */
+    ptr1[i] = var41;
+    /* 10: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var45.i;
+      var49 = _src.x2[1];
+      var50 = _src.x2[0];
+    }
+    /* 11: avgub */
+    var42 = ((orc_uint8) var49 + (orc_uint8) var50 + 1) >> 1;
+    /* 12: storeb */
+    ptr2[i] = var42;
+  }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_A420 (OrcExecutor * ORC_RESTRICT ex)
+{
+  int i;
+  int n = ex->n;
+  orc_union16 *ORC_RESTRICT ptr0;
+  orc_int8 *ORC_RESTRICT ptr1;
+  orc_int8 *ORC_RESTRICT ptr2;
+  orc_union16 *ORC_RESTRICT ptr3;
+  const orc_union64 *ORC_RESTRICT ptr4;
+  orc_union64 var38;
+  orc_union16 var39;
+  orc_union16 var40;
+  orc_int8 var41;
+  orc_int8 var42;
+  orc_union32 var43;
+  orc_union32 var44;
+  orc_union16 var45;
+  orc_union16 var46;
+  orc_int8 var47;
+  orc_int8 var48;
+  orc_int8 var49;
+  orc_int8 var50;
+
+  ptr0 = (orc_union16 *) ex->arrays[0];
+  ptr1 = (orc_int8 *) ex->arrays[1];
+  ptr2 = (orc_int8 *) ex->arrays[2];
+  ptr3 = (orc_union16 *) ex->arrays[3];
+  ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+  for (i = 0; i < n; i++) {
+    /* 0: loadq */
+    var38 = ptr4[i];
+    /* 1: splitlw */
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[0];
+      var43.x2[0] = _src.x2[1];
+      var44.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union32 _src;
+      _src.i = var38.x2[1];
+      var43.x2[1] = _src.x2[1];
+      var44.x2[1] = _src.x2[0];
+    }
+    /* 2: select1wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[0];
+      var39.x2[0] = _src.x2[1];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[1];
+      var39.x2[1] = _src.x2[1];
+    }
+    /* 3: storew */
+    ptr0[i] = var39;
+    /* 4: select0wb */
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[0];
+      var40.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var44.x2[1];
+      var40.x2[1] = _src.x2[0];
+    }
+    /* 5: storew */
+    ptr3[i] = var40;
+    /* 6: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[0];
+      var45.x2[0] = _src.x2[1];
+      var46.x2[0] = _src.x2[0];
+    }
+    {
+      orc_union16 _src;
+      _src.i = var43.x2[1];
+      var45.x2[1] = _src.x2[1];
+      var46.x2[1] = _src.x2[0];
+    }
+    /* 7: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var46.i;
+      var47 = _src.x2[1];
+      var48 = _src.x2[0];
+    }
+    /* 8: avgub */
+    var41 = ((orc_uint8) var47 + (orc_uint8) var48 + 1) >> 1;
+    /* 9: storeb */
+    ptr1[i] = var41;
+    /* 10: splitwb */
+    {
+      orc_union16 _src;
+      _src.i = var45.i;
+      var49 = _src.x2[1];
+      var50 = _src.x2[0];
+    }
+    /* 11: avgub */
+    var42 = ((orc_uint8) var49 + (orc_uint8) var50 + 1) >> 1;
+    /* 12: storeb */
+    ptr2[i] = var42;
+  }
+
+}
+
+void
+cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+    guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+    const guint8 * ORC_RESTRICT s1, int n)
+{
+  OrcExecutor _ex, *ex = &_ex;
+  static int p_inited = 0;
+  static OrcProgram *p = 0;
+  void (*func) (OrcExecutor *);
+
+  if (!p_inited) {
+    orc_once_mutex_lock ();
+    if (!p_inited) {
+
+      p = orc_program_new ();
+      orc_program_set_name (p, "cogorc_putline_A420");
+      orc_program_set_backup_function (p, _backup_cogorc_putline_A420);
+      orc_program_add_destination (p, 2, "d1");
+      orc_program_add_destination (p, 1, "d2");
+      orc_program_add_destination (p, 1, "d3");
+      orc_program_add_destination (p, 2, "d4");
+      orc_program_add_source (p, 8, "s1");
+      orc_program_add_temporary (p, 4, "t1");
+      orc_program_add_temporary (p, 4, "t2");
+      orc_program_add_temporary (p, 2, "t3");
+      orc_program_add_temporary (p, 2, "t4");
+      orc_program_add_temporary (p, 1, "t5");
+      orc_program_add_temporary (p, 1, "t6");
+
+      orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "select0wb", 1, ORC_VAR_D4, ORC_VAR_T1,
+          ORC_VAR_D1, ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T3,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_T6,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T4,
+          ORC_VAR_D1);
+      orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T5, ORC_VAR_T6,
+          ORC_VAR_D1);
+
+      orc_program_compile (p);
+    }
+    p_inited = TRUE;
+    orc_once_mutex_unlock ();
+  }
+  ex->program = p;
+
+  ex->n = n;
+  ex->arrays[ORC_VAR_D1] = d1;
+  ex->arrays[ORC_VAR_D2] = d2;
+  ex->arrays[ORC_VAR_D3] = d3;
+  ex->arrays[ORC_VAR_D4] = d4;
+  ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+  func = p->code_exec;
+  func (ex);
+}
+#endif
diff --git a/gst/videoconvert/gstvideoconvertorc-dist.h b/gst/videoconvert/gstvideoconvertorc-dist.h
new file mode 100644 (file)
index 0000000..6ba5ae6
--- /dev/null
@@ -0,0 +1,168 @@
+
+/* autogenerated from gstvideoconvertorc.orc */
+
+#ifndef _GSTVIDEOCONVERTORC_H_
+#define _GSTVIDEOCONVERTORC_H_
+
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifndef _ORC_INTEGER_TYPEDEFS_
+#define _ORC_INTEGER_TYPEDEFS_
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+typedef int8_t orc_int8;
+typedef int16_t orc_int16;
+typedef int32_t orc_int32;
+typedef int64_t orc_int64;
+typedef uint8_t orc_uint8;
+typedef uint16_t orc_uint16;
+typedef uint32_t orc_uint32;
+typedef uint64_t orc_uint64;
+#define ORC_UINT64_C(x) UINT64_C(x)
+#elif defined(_MSC_VER)
+typedef signed __int8 orc_int8;
+typedef signed __int16 orc_int16;
+typedef signed __int32 orc_int32;
+typedef signed __int64 orc_int64;
+typedef unsigned __int8 orc_uint8;
+typedef unsigned __int16 orc_uint16;
+typedef unsigned __int32 orc_uint32;
+typedef unsigned __int64 orc_uint64;
+#define ORC_UINT64_C(x) (x##Ui64)
+#define inline __inline
+#else
+#include <limits.h>
+typedef signed char orc_int8;
+typedef short orc_int16;
+typedef int orc_int32;
+typedef unsigned char orc_uint8;
+typedef unsigned short orc_uint16;
+typedef unsigned int orc_uint32;
+#if INT_MAX == LONG_MAX
+typedef long long orc_int64;
+typedef unsigned long long orc_uint64;
+#define ORC_UINT64_C(x) (x##ULL)
+#else
+typedef long orc_int64;
+typedef unsigned long orc_uint64;
+#define ORC_UINT64_C(x) (x##UL)
+#endif
+#endif
+typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
+typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
+typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64;
+#endif
+#ifndef ORC_RESTRICT
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define ORC_RESTRICT restrict
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define ORC_RESTRICT __restrict__
+#else
+#define ORC_RESTRICT
+#endif
+#endif
+void cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n);
+void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n);
+void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n);
+void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int n);
+void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n);
+void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n);
+void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n);
+void orc_pack_123x (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n);
+void orc_pack_x123 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n);
+void cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n);
+void cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
+void cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
+void cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
+void cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
+void cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
+void cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, int n);
+void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, int n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/gst/videoconvert/gstvideoconvertorc.orc b/gst/videoconvert/gstvideoconvertorc.orc
new file mode 100644 (file)
index 0000000..086990e
--- /dev/null
@@ -0,0 +1,1757 @@
+
+.function cogorc_memcpy_2d
+.flags 2d
+.dest 1 d1 guint8
+.source 1 s1 guint8
+
+copyb d1, s1
+
+
+.function cogorc_downsample_horiz_cosite_1tap
+.dest 1 d1 guint8
+.source 2 s1 guint8
+
+select0wb d1, s1
+
+
+.function cogorc_downsample_horiz_cosite_3tap
+.dest 1 d1 guint8
+.source 2 s1 guint8
+.source 2 s2 guint8
+.temp 1 t1
+.temp 1 t2
+.temp 1 t3
+.temp 2 t4
+.temp 2 t5
+.temp 2 t6
+
+copyw t4, s1
+select0wb t1, t4
+select1wb t2, t4
+select0wb t3, s2
+convubw t4, t1
+convubw t5, t2
+convubw t6, t3
+mullw t5, t5, 2
+addw t4, t4, t6
+addw t4, t4, t5
+addw t4, t4, 2
+shrsw t4, t4, 2
+convsuswb d1, t4
+
+
+.function cogorc_downsample_420_jpeg
+.dest 1 d1 guint8
+.source 2 s1 guint8
+.source 2 s2 guint8
+.temp 2 t1
+.temp 1 t2
+.temp 1 t3
+.temp 1 t4
+.temp 1 t5
+
+copyw t1, s1
+select0wb t2, t1
+select1wb t3, t1
+avgub t2, t2, t3
+copyw t1, s2
+select0wb t4, t1
+select1wb t5, t1
+avgub t4, t4, t5
+avgub d1, t2, t4
+
+
+.function cogorc_downsample_vert_halfsite_2tap
+.dest 1 d1 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+
+avgub d1, s1, s2
+
+
+.function cogorc_downsample_vert_cosite_3tap
+.dest 1 d1 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+.source 1 s3 guint8
+.temp 2 t1
+.temp 2 t2
+.temp 2 t3
+
+convubw t1, s1
+convubw t2, s2
+convubw t3, s3
+mullw t2, t2, 2
+addw t1, t1, t3
+addw t1, t1, t2
+addw t1, t1, 2
+shrsw t1, t1, 2
+convsuswb d1, t1
+
+
+
+.function cogorc_downsample_vert_halfsite_4tap
+.dest 1 d1 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+.source 1 s3 guint8
+.source 1 s4 guint8
+.temp 2 t1
+.temp 2 t2
+.temp 2 t3
+.temp 2 t4
+
+convubw t1, s1
+convubw t2, s2
+convubw t3, s3
+convubw t4, s4
+addw t2, t2, t3
+mullw t2, t2, 26
+addw t1, t1, t4
+mullw t1, t1, 6
+addw t2, t2, t1
+addw t2, t2, 32
+shrsw t2, t2, 6
+convsuswb d1, t2
+
+
+.function cogorc_upsample_horiz_cosite_1tap
+.dest 2 d1 guint8 guint8
+.source 1 s1 guint8
+.temp 1 t1
+
+copyb t1, s1
+mergebw d1, t1, t1
+
+
+.function cogorc_upsample_horiz_cosite
+.dest 2 d1 guint8 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+.temp 1 t1
+.temp 1 t2
+
+copyb t1, s1
+avgub t2, t1, s2
+mergebw d1, t1, t2
+
+
+.function cogorc_upsample_vert_avgub
+.dest 1 d1 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+
+avgub d1, s1, s2
+
+
+
+
+.function orc_unpack_yuyv_y
+.dest 1 d1 guint8
+.source 2 s1 guint8
+
+select0wb d1, s1
+
+
+.function orc_unpack_yuyv_u
+.dest 1 d1 guint8
+.source 4 s1 guint8
+.temp 2 t1
+
+select0lw t1, s1
+select1wb d1, t1
+
+
+.function orc_unpack_yuyv_v
+.dest 1 d1 guint8
+.source 4 s1 guint8
+.temp 2 t1
+
+select1lw t1, s1
+select1wb d1, t1
+
+
+.function orc_pack_yuyv
+.dest 4 d1 guint8
+.source 2 s1 guint8 guint8
+.source 1 s2 guint8
+.source 1 s3 guint8
+.temp 1 t1
+.temp 1 t2
+.temp 2 t3
+.temp 2 t4
+.temp 2 t5
+
+copyw t5, s1
+select0wb t1, t5
+select1wb t2, t5
+mergebw t3, t1, s2
+mergebw t4, t2, s3
+mergewl d1, t3, t4
+
+
+.function orc_unpack_uyvy_y
+.dest 1 d1 guint8
+.source 2 s1 guint8
+
+select1wb d1, s1
+
+
+.function orc_unpack_uyvy_u
+.dest 1 d1 guint8
+.source 4 s1 guint8
+.temp 2 t1
+
+select0lw t1, s1
+select0wb d1, t1
+
+
+.function orc_unpack_uyvy_v
+.dest 1 d1 guint8
+.source 4 s1 guint8
+.temp 2 t1
+
+select1lw t1, s1
+select0wb d1, t1
+
+
+.function orc_pack_uyvy
+.dest 4 d1 guint8
+.source 2 s1 guint8 guint8
+.source 1 s2 guint8
+.source 1 s3 guint8
+.temp 1 t1
+.temp 1 t2
+.temp 2 t3
+.temp 2 t4
+.temp 2 t5
+
+copyw t5, s1
+select0wb t1, t5
+select1wb t2, t5
+mergebw t3, s2, t1
+mergebw t4, s3, t2
+mergewl d1, t3, t4
+
+
+.function orc_matrix2_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.param 2 p1
+.param 2 p2
+.param 2 p3
+.temp 2 t1
+.temp 2 t2
+
+convubw t1, s1
+mullw t1, t1, p1
+convubw t2, s2
+mullw t2, t2, p2
+addw t1, t1, t2
+addw t1, t1, p3
+shrsw t1, t1, 6
+convsuswb d1, t1
+
+
+.function orc_matrix2_11_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.param 2 p1
+.param 2 p2
+.temp 2 t1
+.temp 2 t2
+.temp 2 t3
+.temp 2 t4
+
+convubw t1, s1
+subw t1, t1, 16
+mullw t3, t1, p1
+convubw t2, s2
+subw t2, t2, 128
+mullw t4, t2, p2
+addw t3, t3, t4
+addw t3, t3, 128
+shrsw t3, t3, 8
+addw t3, t3, t1
+addw t3, t3, t2
+convsuswb d1, t3
+
+
+.function orc_matrix2_12_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.param 2 p1
+.param 2 p2
+.temp 2 t1
+.temp 2 t2
+.temp 2 t3
+.temp 2 t4
+
+convubw t1, s1
+subw t1, t1, 16
+mullw t3, t1, p1
+convubw t2, s2
+subw t2, t2, 128
+mullw t4, t2, p2
+addw t3, t3, t4
+addw t3, t3, 128
+shrsw t3, t3, 8
+addw t3, t3, t1
+addw t3, t3, t2
+addw t3, t3, t2
+convsuswb d1, t3
+
+
+.function orc_matrix3_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.source 1 s3 guint8 guint8
+.param 2 p1
+.param 2 p2
+.param 2 p3
+.param 2 p4
+.temp 2 t1
+.temp 2 t2
+
+convubw t1, s1
+mullw t1, t1, p1
+convubw t2, s2
+mullw t2, t2, p2
+addw t1, t1, t2
+convubw t2, s3
+mullw t2, t2, p3
+addw t1, t1, t2
+addw t1, t1, p4
+shrsw t1, t1, 6
+convsuswb d1, t1
+
+
+.function orc_matrix3_100_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.source 1 s3 guint8 guint8
+.param 2 p1
+.param 2 p2
+.param 2 p3
+.temp 2 t1
+.temp 2 t2
+.temp 2 t3
+#.temp 2 t4
+
+convubw t1, s1
+subw t1, t1, 16
+mullw t3, t1, p1
+convubw t2, s2
+subw t2, t2, 128
+mullw t2, t2, p2
+addw t3, t3, t2
+convubw t2, s3
+subw t2, t2, 128
+mullw t2, t2, p3
+addw t3, t3, t2
+addw t3, t3, 128
+shrsw t3, t3, 8
+addw t3, t3, t1
+convsuswb d1, t3
+
+
+.function orc_matrix3_100_offset_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.source 1 s3 guint8 guint8
+.param 2 p1
+.param 2 p2
+.param 2 p3
+.param 2 p4
+.param 2 p5
+#.param 2 p6
+.temp 2 t1
+.temp 2 t2
+.temp 2 t3
+#.temp 2 t3
+#.temp 2 t4
+
+convubw t3, s1
+mullw t1, t3, p1
+convubw t2, s2
+mullw t2, t2, p2
+addw t1, t1, t2
+convubw t2, s3
+mullw t2, t2, p3
+addw t1, t1, t2
+addw t1, t1, p4
+shrsw t1, t1, p5
+#addw t1, t1, p6
+addw t1, t1, t3
+convsuswb d1, t1
+
+
+
+.function orc_matrix3_000_u8
+.dest 1 d1 guint8 guint8
+.source 1 s1 guint8 guint8
+.source 1 s2 guint8 guint8
+.source 1 s3 guint8 guint8
+.param 2 p1
+.param 2 p2
+.param 2 p3
+.param 2 p4
+.param 2 p5
+#.param 2 p6
+.temp 2 t1
+.temp 2 t2
+#.temp 2 t3
+#.temp 2 t4
+
+convubw t1, s1
+mullw t1, t1, p1
+convubw t2, s2
+mullw t2, t2, p2
+addw t1, t1, t2
+convubw t2, s3
+mullw t2, t2, p3
+addw t1, t1, t2
+addw t1, t1, p4
+shrsw t1, t1, p5
+#addw t1, t1, p6
+convwb d1, t1
+
+
+
+.function orc_pack_123x
+.dest 4 d1 guint32 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+.source 1 s3 guint8
+.param 1 p1
+.temp 2 t1
+.temp 2 t2
+
+mergebw t1, s1, s2
+mergebw t2, s3, p1
+mergewl d1, t1, t2
+
+
+.function orc_pack_x123
+.dest 4 d1 guint32 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+.source 1 s3 guint8
+.param 1 p1
+.temp 2 t1
+.temp 2 t2
+
+mergebw t1, p1, s1
+mergebw t2, s2, s3
+mergewl d1, t1, t2
+
+
+.function cogorc_combine2_u8
+.dest 1 d1 guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+.param 2 p1
+.param 2 p2
+.temp 2 t1
+.temp 2 t2
+
+convubw t1, s1
+mullw t1, t1, p1
+convubw t2, s2
+mullw t2, t2, p2
+addw t1, t1, t2
+shruw t1, t1, 8
+convsuswb d1, t1
+
+
+.function cogorc_convert_I420_UYVY
+.dest 4 d1 guint8
+.dest 4 d2 guint8
+.source 2 y1 guint8
+.source 2 y2 guint8
+.source 1 u guint8
+.source 1 v guint8
+.temp 2 uv
+
+mergebw uv, u, v
+x2 mergebw d1, uv, y1
+x2 mergebw d2, uv, y2
+
+
+.function cogorc_convert_I420_YUY2
+.dest 4 d1 guint8
+.dest 4 d2 guint8
+.source 2 y1 guint8
+.source 2 y2 guint8
+.source 1 u guint8
+.source 1 v guint8
+.temp 2 uv
+
+mergebw uv, u, v
+x2 mergebw d1, y1, uv
+x2 mergebw d2, y2, uv
+
+
+
+.function cogorc_convert_I420_AYUV
+.dest 4 d1 guint8
+.dest 4 d2 guint8
+.source 1 y1 guint8
+.source 1 y2 guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw uv, tu, tv
+mergebw ay, c255, y1
+mergewl d1, ay, uv
+mergebw ay, c255, y2
+mergewl d2, ay, uv
+
+
+.function cogorc_convert_YUY2_I420
+.dest 2 y1 guint8
+.dest 2 y2 guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 yuv1 guint8
+.source 4 yuv2 guint8
+.temp 2 t1
+.temp 2 t2
+.temp 2 ty
+
+x2 splitwb t1, ty, yuv1
+storew y1, ty
+x2 splitwb t2, ty, yuv2
+storew y2, ty
+x2 avgub t1, t1, t2
+splitwb v, u, t1
+
+
+.function cogorc_convert_UYVY_YUY2
+.flags 2d
+.dest 4 yuy2 guint8
+.source 4 uyvy guint8
+
+x2 swapw yuy2, uyvy
+
+
+.function cogorc_planar_chroma_420_422
+.flags 2d
+.dest 1 d1 guint8
+.dest 1 d2 guint8
+.source 1 s guint8
+
+copyb d1, s
+copyb d2, s
+
+
+.function cogorc_planar_chroma_420_444
+.flags 2d
+.dest 2 d1 guint8
+.dest 2 d2 guint8
+.source 1 s guint8
+.temp 2 t
+
+splatbw t, s
+storew d1, t
+storew d2, t
+
+
+.function cogorc_planar_chroma_422_444
+.flags 2d
+.dest 2 d1 guint8
+.source 1 s guint8
+.temp 2 t
+
+splatbw t, s
+storew d1, t
+
+
+.function cogorc_planar_chroma_444_422
+.flags 2d
+.dest 1 d guint8
+.source 2 s guint8
+.temp 1 t1
+.temp 1 t2
+
+splitwb t1, t2, s
+avgub d, t1, t2
+
+
+.function cogorc_planar_chroma_444_420
+.flags 2d
+.dest 1 d guint8
+.source 2 s1 guint8
+.source 2 s2 guint8
+.temp 2 t
+.temp 1 t1
+.temp 1 t2
+
+x2 avgub t, s1, s2
+splitwb t1, t2, t
+avgub d, t1, t2
+
+
+.function cogorc_planar_chroma_422_420
+.flags 2d
+.dest 1 d guint8
+.source 1 s1 guint8
+.source 1 s2 guint8
+
+avgub d, s1, s2
+
+
+.function cogorc_convert_YUY2_AYUV
+.flags 2d
+.dest 8 ayuv guint8
+.source 4 yuy2 guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb uv, yy, yuy2
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_convert_UYVY_AYUV
+.flags 2d
+.dest 8 ayuv guint8
+.source 4 uyvy guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb yy, uv, uyvy
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_convert_YUY2_Y42B
+.flags 2d
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 yuy2 guint8
+.temp 2 uv
+
+x2 splitwb uv, y, yuy2
+splitwb v, u, uv
+
+
+.function cogorc_convert_UYVY_Y42B
+.flags 2d
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 uyvy guint8
+.temp 2 uv
+
+x2 splitwb y, uv, uyvy
+splitwb v, u, uv
+
+
+.function cogorc_convert_YUY2_Y444
+.flags 2d
+.dest 2 y guint8
+.dest 2 uu guint8
+.dest 2 vv guint8
+.source 4 yuy2 guint8
+.temp 2 uv
+.temp 1 u
+.temp 1 v
+
+x2 splitwb uv, y, yuy2
+splitwb v, u, uv
+splatbw uu, u
+splatbw vv, v
+
+
+.function cogorc_convert_UYVY_Y444
+.flags 2d
+.dest 2 y guint8
+.dest 2 uu guint8
+.dest 2 vv guint8
+.source 4 uyvy guint8
+.temp 2 uv
+.temp 1 u
+.temp 1 v
+
+x2 splitwb y, uv, uyvy
+splitwb v, u, uv
+splatbw uu, u
+splatbw vv, v
+
+
+.function cogorc_convert_UYVY_I420
+.dest 2 y1 guint8
+.dest 2 y2 guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 yuv1 guint8
+.source 4 yuv2 guint8
+.temp 2 t1
+.temp 2 t2
+.temp 2 ty
+
+x2 splitwb ty, t1, yuv1
+storew y1, ty
+x2 splitwb ty, t2, yuv2
+storew y2, ty
+x2 avgub t1, t1, t2
+splitwb v, u, t1
+
+
+
+.function cogorc_convert_AYUV_I420
+.flags 2d
+.dest 2 y1 guint8
+.dest 2 y2 guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 8 ayuv1 guint8
+.source 8 ayuv2 guint8
+.temp 4 ay
+.temp 4 uv1
+.temp 4 uv2
+.temp 4 uv
+.temp 2 uu
+.temp 2 vv
+.temp 1 t1
+.temp 1 t2
+
+x2 splitlw uv1, ay, ayuv1
+x2 select1wb y1, ay
+x2 splitlw uv2, ay, ayuv2
+x2 select1wb y2, ay
+x4 avgub uv, uv1, uv2
+x2 splitwb vv, uu, uv
+splitwb t1, t2, uu
+avgub u, t1, t2
+splitwb t1, t2, vv
+avgub v, t1, t2
+
+
+
+.function cogorc_convert_AYUV_YUY2
+.flags 2d
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+x2 mergebw yuy2, yy, uv1
+
+
+.function cogorc_convert_AYUV_UYVY
+.flags 2d
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+x2 mergebw yuy2, uv1, yy
+
+
+
+.function cogorc_convert_AYUV_Y42B
+.flags 2d
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 8 ayuv guint8
+.temp 4 ayay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+splitwb v, u, uv1
+x2 select1wb y, ayay
+
+
+.function cogorc_convert_AYUV_Y444
+.flags 2d
+.dest 1 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 ayuv guint8
+.temp 2 ay
+.temp 2 uv
+
+splitlw uv, ay, ayuv
+splitwb v, u, uv
+select1wb y, ay
+
+
+.function cogorc_convert_Y42B_YUY2
+.flags 2d
+.dest 4 yuy2 guint8
+.source 2 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.temp 2 uv
+
+mergebw uv, u, v
+x2 mergebw yuy2, y, uv
+
+
+.function cogorc_convert_Y42B_UYVY
+.flags 2d
+.dest 4 uyvy guint8
+.source 2 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.temp 2 uv
+
+mergebw uv, u, v
+x2 mergebw uyvy, uv, y
+
+
+.function cogorc_convert_Y42B_AYUV
+.flags 2d
+.dest 8 ayuv guint8
+.source 2 yy guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+.temp 4 uvuv
+.temp 4 ayay
+
+mergebw uv, u, v
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_convert_Y444_YUY2
+.flags 2d
+.dest 4 yuy2 guint8
+.source 2 y guint8
+.source 2 u guint8
+.source 2 v guint8
+.temp 2 uv
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 mergebw uvuv, u, v
+splitlw uv1, uv2, uvuv
+x2 avgub uv, uv1, uv2
+x2 mergebw yuy2, y, uv
+
+
+.function cogorc_convert_Y444_UYVY
+.flags 2d
+.dest 4 uyvy guint8
+.source 2 y guint8
+.source 2 u guint8
+.source 2 v guint8
+.temp 2 uv
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 mergebw uvuv, u, v
+splitlw uv1, uv2, uvuv
+x2 avgub uv, uv1, uv2
+x2 mergebw uyvy, uv, y
+
+
+.function cogorc_convert_Y444_AYUV
+.flags 2d
+.dest 4 ayuv guint8
+.source 1 yy guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+
+mergebw uv, u, v
+mergebw ay, c255, yy
+mergewl ayuv, ay, uv
+
+
+
+.function cogorc_convert_AYUV_ARGB
+.flags 2d
+.dest 4 argb guint8
+.source 4 ayuv guint8
+.temp 2 t1
+.temp 2 t2
+.temp 1 a
+.temp 1 y
+.temp 1 u
+.temp 1 v
+.temp 2 wy
+.temp 2 wu
+.temp 2 wv
+.temp 2 wr
+.temp 2 wg
+.temp 2 wb
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 4 x
+.const 1 c8 8
+
+x4 subb x, ayuv, 128
+splitlw t1, t2, x
+splitwb y, a, t2
+splitwb v, u, t1
+convsbw wy, y
+convsbw wu, u
+convsbw wv, v
+
+mullw t1, wy, 42
+shrsw t1, t1, c8
+addssw wy, wy, t1
+
+addssw wr, wy, wv
+mullw t1, wv, 103
+shrsw t1, t1, c8
+subssw wr, wr, t1
+addssw wr, wr, wv
+
+addssw wb, wy, wu
+addssw wb, wb, wu
+mullw t1, wu, 4
+shrsw t1, t1, c8
+addssw wb, wb, t1
+
+mullw t1, wu, 100
+shrsw t1, t1, c8
+subssw wg, wy, t1
+mullw t1, wv, 104
+shrsw t1, t1, c8
+subssw wg, wg, t1
+subssw wg, wg, t1
+
+convssswb r, wr
+convssswb g, wg
+convssswb b, wb
+
+mergebw t1, a, r
+mergebw t2, g, b
+mergewl x, t1, t2
+x4 addb argb, x, 128
+
+
+
+.function cogorc_convert_AYUV_BGRA
+.flags 2d
+.dest 4 argb guint8
+.source 4 ayuv guint8
+.temp 2 t1
+.temp 2 t2
+.temp 1 a
+.temp 1 y
+.temp 1 u
+.temp 1 v
+.temp 2 wy
+.temp 2 wu
+.temp 2 wv
+.temp 2 wr
+.temp 2 wg
+.temp 2 wb
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 4 x
+.const 1 c8 8
+
+x4 subb x, ayuv, 128
+splitlw t1, t2, x
+splitwb y, a, t2
+splitwb v, u, t1
+convsbw wy, y
+convsbw wu, u
+convsbw wv, v
+
+mullw t1, wy, 42
+shrsw t1, t1, c8
+addssw wy, wy, t1
+
+addssw wr, wy, wv
+mullw t1, wv, 103
+shrsw t1, t1, c8
+subssw wr, wr, t1
+addssw wr, wr, wv
+
+addssw wb, wy, wu
+addssw wb, wb, wu
+mullw t1, wu, 4
+shrsw t1, t1, c8
+addssw wb, wb, t1
+
+mullw t1, wu, 100
+shrsw t1, t1, c8
+subssw wg, wy, t1
+mullw t1, wv, 104
+shrsw t1, t1, c8
+subssw wg, wg, t1
+subssw wg, wg, t1
+
+convssswb r, wr
+convssswb g, wg
+convssswb b, wb
+
+mergebw t1, b, g
+mergebw t2, r, a
+mergewl x, t1, t2
+x4 addb argb, x, 128
+
+
+
+
+.function cogorc_convert_AYUV_ABGR
+.flags 2d
+.dest 4 argb guint8
+.source 4 ayuv guint8
+.temp 2 t1
+.temp 2 t2
+.temp 1 a
+.temp 1 y
+.temp 1 u
+.temp 1 v
+.temp 2 wy
+.temp 2 wu
+.temp 2 wv
+.temp 2 wr
+.temp 2 wg
+.temp 2 wb
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 4 x
+.const 1 c8 8
+
+x4 subb x, ayuv, 128
+splitlw t1, t2, x
+splitwb y, a, t2
+splitwb v, u, t1
+convsbw wy, y
+convsbw wu, u
+convsbw wv, v
+
+mullw t1, wy, 42
+shrsw t1, t1, c8
+addssw wy, wy, t1
+
+addssw wr, wy, wv
+mullw t1, wv, 103
+shrsw t1, t1, c8
+subssw wr, wr, t1
+addssw wr, wr, wv
+
+addssw wb, wy, wu
+addssw wb, wb, wu
+mullw t1, wu, 4
+shrsw t1, t1, c8
+addssw wb, wb, t1
+
+mullw t1, wu, 100
+shrsw t1, t1, c8
+subssw wg, wy, t1
+mullw t1, wv, 104
+shrsw t1, t1, c8
+subssw wg, wg, t1
+subssw wg, wg, t1
+
+convssswb r, wr
+convssswb g, wg
+convssswb b, wb
+
+mergebw t1, a, b
+mergebw t2, g, r
+mergewl x, t1, t2
+x4 addb argb, x, 128
+
+
+
+.function cogorc_convert_AYUV_RGBA
+.flags 2d
+.dest 4 argb guint8
+.source 4 ayuv guint8
+.temp 2 t1
+.temp 2 t2
+.temp 1 a
+.temp 1 y
+.temp 1 u
+.temp 1 v
+.temp 2 wy
+.temp 2 wu
+.temp 2 wv
+.temp 2 wr
+.temp 2 wg
+.temp 2 wb
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 4 x
+.const 1 c8 8
+
+x4 subb x, ayuv, 128
+splitlw t1, t2, x
+splitwb y, a, t2
+splitwb v, u, t1
+convsbw wy, y
+convsbw wu, u
+convsbw wv, v
+
+mullw t1, wy, 42
+shrsw t1, t1, c8
+addssw wy, wy, t1
+
+addssw wr, wy, wv
+mullw t1, wv, 103
+shrsw t1, t1, c8
+subssw wr, wr, t1
+addssw wr, wr, wv
+
+addssw wb, wy, wu
+addssw wb, wb, wu
+mullw t1, wu, 4
+shrsw t1, t1, c8
+addssw wb, wb, t1
+
+mullw t1, wu, 100
+shrsw t1, t1, c8
+subssw wg, wy, t1
+mullw t1, wv, 104
+shrsw t1, t1, c8
+subssw wg, wg, t1
+subssw wg, wg, t1
+
+convssswb r, wr
+convssswb g, wg
+convssswb b, wb
+
+mergebw t1, r, g
+mergebw t2, b, a
+mergewl x, t1, t2
+x4 addb argb, x, 128
+
+
+
+.function cogorc_convert_I420_BGRA
+.dest 4 argb guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.temp 2 t1
+.temp 2 t2
+.temp 1 t3
+.temp 2 wy
+.temp 2 wu
+.temp 2 wv
+.temp 2 wr
+.temp 2 wg
+.temp 2 wb
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 4 x
+.const 1 c8 8
+.const 1 c128 128
+
+subb t3, y, c128
+convsbw wy, t3
+loadupib t3, u
+subb t3, t3, c128
+convsbw wu, t3
+loadupib t3, v
+subb t3, t3, c128
+convsbw wv, t3
+
+mullw t1, wy, 42
+shrsw t1, t1, c8
+addssw wy, wy, t1
+
+addssw wr, wy, wv
+mullw t1, wv, 103
+shrsw t1, t1, c8
+subssw wr, wr, t1
+addssw wr, wr, wv
+
+addssw wb, wy, wu
+addssw wb, wb, wu
+mullw t1, wu, 4
+shrsw t1, t1, c8
+addssw wb, wb, t1
+
+mullw t1, wu, 100
+shrsw t1, t1, c8
+subssw wg, wy, t1
+mullw t1, wv, 104
+shrsw t1, t1, c8
+subssw wg, wg, t1
+subssw wg, wg, t1
+
+convssswb r, wr
+convssswb g, wg
+convssswb b, wb
+
+mergebw t1, b, g
+mergebw t2, r, 255
+mergewl x, t1, t2
+x4 addb argb, x, c128
+
+
+
+.function cogorc_convert_I420_BGRA_avg
+.dest 4 argb guint8
+.source 1 y guint8
+.source 1 u1 guint8
+.source 1 u2 guint8
+.source 1 v1 guint8
+.source 1 v2 guint8
+.temp 2 t1
+.temp 2 t2
+.temp 1 t3
+.temp 1 t4
+.temp 2 wy
+.temp 2 wu
+.temp 2 wv
+.temp 2 wr
+.temp 2 wg
+.temp 2 wb
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 4 x
+.const 1 c8 8
+.const 1 c128 128
+
+subb t3, y, c128
+convsbw wy, t3
+loadupib t3, u1
+loadupib t4, u2
+avgub t3, t3, t4
+subb t3, t3, c128
+convsbw wu, t3
+loadupib t3, v1
+loadupib t4, v2
+avgub t3, t3, t4
+subb t3, t3, c128
+convsbw wv, t3
+
+mullw t1, wy, 42
+shrsw t1, t1, c8
+addssw wy, wy, t1
+
+addssw wr, wy, wv
+mullw t1, wv, 103
+shrsw t1, t1, c8
+subssw wr, wr, t1
+addssw wr, wr, wv
+
+addssw wb, wy, wu
+addssw wb, wb, wu
+mullw t1, wu, 4
+shrsw t1, t1, c8
+addssw wb, wb, t1
+
+mullw t1, wu, 100
+shrsw t1, t1, c8
+subssw wg, wy, t1
+mullw t1, wv, 104
+shrsw t1, t1, c8
+subssw wg, wg, t1
+subssw wg, wg, t1
+
+convssswb r, wr
+convssswb g, wg
+convssswb b, wb
+
+mergebw t1, b, g
+mergebw t2, r, 255
+mergewl x, t1, t2
+x4 addb argb, x, c128
+
+
+
+.function cogorc_getline_I420
+.dest 4 d guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw uv, tu, tv
+mergebw ay, c255, y
+mergewl d, ay, uv
+
+.function cogorc_getline_YUV9
+.dest 8 d guint8
+.source 2 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 tuv
+.temp 4 ay
+.temp 4 uv
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw tuv, tu, tv
+mergewl uv, tuv, tuv
+x2 mergebw ay, c255, y
+x2 mergewl d, ay, uv
+
+.function cogorc_getline_YUY2
+.dest 8 ayuv guint8
+.source 4 yuy2 guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb uv, yy, yuy2
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_getline_UYVY
+.dest 8 ayuv guint8
+.source 4 uyvy guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb yy, uv, uyvy
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_getline_YVYU
+.dest 8 ayuv guint8
+.source 4 uyvy guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb uv, yy, uyvy
+swapw uv, uv
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_getline_Y42B
+.dest 8 ayuv guint8
+.source 2 yy guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+.temp 4 uvuv
+.temp 4 ayay
+
+mergebw uv, u, v
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_getline_Y444
+.dest 4 ayuv guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+
+mergebw uv, u, v
+mergebw ay, c255, y
+mergewl ayuv, ay, uv
+
+
+.function cogorc_getline_Y800
+.dest 4 ayuv guint8
+.source 1 y guint8
+.const 1 c255 255
+.const 2 c0x8080 0x8080
+.temp 2 ay
+
+mergebw ay, c255, y
+mergewl ayuv, ay, c0x8080
+
+.function cogorc_getline_Y16
+.dest 4 ayuv guint8
+.source 2 y guint8
+.const 1 c255 255
+.const 2 c0x8080 0x8080
+.temp 2 ay
+.temp 1 yb
+
+convhwb yb, y
+mergebw ay, c255, yb
+mergewl ayuv, ay, c0x8080
+
+.function cogorc_getline_BGRA
+.dest 4 argb guint8
+.source 4 bgra guint8
+
+swapl argb, bgra
+
+
+.function cogorc_getline_ABGR
+.dest 4 argb guint8
+.source 4 abgr guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 gr
+.temp 2 ab
+.temp 2 ar
+.temp 2 gb
+
+splitlw gr, ab, abgr
+splitwb r, g, gr
+splitwb b, a, ab
+mergebw ar, a, r
+mergebw gb, g, b
+mergewl argb, ar, gb
+
+
+.function cogorc_getline_RGBA
+.dest 4 argb guint8
+.source 4 rgba guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 rg
+.temp 2 ba
+.temp 2 ar
+.temp 2 gb
+
+splitlw ba, rg, rgba
+splitwb g, r, rg
+splitwb a, b, ba
+mergebw ar, a, r
+mergebw gb, g, b
+mergewl argb, ar, gb
+
+
+.function cogorc_getline_NV12
+.dest 8 d guint8
+.source 2 y guint8
+.source 2 uv guint8
+.const 1 c255 255
+.temp 4 ay
+.temp 4 uvuv
+
+mergewl uvuv, uv, uv
+x2 mergebw ay, c255, y
+x2 mergewl d, ay, uvuv
+
+
+.function cogorc_getline_NV21
+.dest 8 d guint8
+.source 2 y guint8
+.source 2 vu guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 4 ay
+.temp 4 uvuv
+
+swapw uv, vu
+mergewl uvuv, uv, uv
+x2 mergebw ay, c255, y
+x2 mergewl d, ay, uvuv
+
+.function cogorc_getline_A420
+.dest 4 d guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.source 1 a guint8
+.temp 2 uv
+.temp 2 ay
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw uv, tu, tv
+mergebw ay, a, y
+mergewl d, ay, uv
+
+.function cogorc_putline_I420
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uv
+.temp 2 uu
+.temp 2 vv
+.temp 1 t1
+.temp 1 t2
+
+x2 splitlw uv, ay, ayuv
+x2 select1wb y, ay
+x2 splitwb vv, uu, uv
+splitwb t1, t2, uu
+avgub u, t1, t2
+splitwb t1, t2, vv
+avgub v, t1, t2
+
+
+
+.function cogorc_putline_YUY2
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+x2 mergebw yuy2, yy, uv1
+
+
+.function cogorc_putline_YVYU
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+swapw uv1, uv1
+x2 mergebw yuy2, yy, uv1
+
+
+.function cogorc_putline_UYVY
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+x2 mergebw yuy2, uv1, yy
+
+
+
+.function cogorc_putline_Y42B
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 8 ayuv guint8
+.temp 4 ayay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+splitwb v, u, uv1
+x2 select1wb y, ayay
+
+
+.function cogorc_putline_Y444
+.dest 1 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 ayuv guint8
+.temp 2 ay
+.temp 2 uv
+
+splitlw uv, ay, ayuv
+splitwb v, u, uv
+select1wb y, ay
+
+
+.function cogorc_putline_Y800
+.dest 1 y guint8
+.source 4 ayuv guint8
+.temp 2 ay
+
+select0lw ay, ayuv
+select1wb y, ay
+
+.function cogorc_putline_Y16
+.dest 2 y guint8
+.source 4 ayuv guint8
+.temp 2 ay
+.temp 1 yb
+
+select0lw ay, ayuv
+select1wb yb, ay
+convubw ay, yb
+shlw y, ay, 8
+
+.function cogorc_putline_BGRA
+.dest 4 bgra guint8
+.source 4 argb guint8
+
+swapl bgra, argb
+
+
+.function cogorc_putline_ABGR
+.dest 4 abgr guint8
+.source 4 argb guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 gr
+.temp 2 ab
+.temp 2 ar
+.temp 2 gb
+
+splitlw gb, ar, argb
+splitwb b, g, gb
+splitwb r, a, ar
+mergebw ab, a, b
+mergebw gr, g, r
+mergewl abgr, ab, gr
+
+
+.function cogorc_putline_RGBA
+.dest 4 rgba guint8
+.source 4 argb guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 rg
+.temp 2 ba
+.temp 2 ar
+.temp 2 gb
+
+splitlw gb, ar, argb
+splitwb b, g, gb
+splitwb r, a, ar
+mergebw ba, b, a
+mergebw rg, r, g
+mergewl rgba, rg, ba
+
+
+.function cogorc_putline_NV12
+.dest 2 y guint8
+.dest 2 uv guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 splitlw uvuv, ay, ayuv
+x2 select1wb y, ay
+splitlw uv1, uv2, uvuv
+x2 avgub uv, uv1, uv2
+
+
+.function cogorc_putline_NV21
+.dest 2 y guint8
+.dest 2 vu guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+.temp 2 uv
+
+x2 splitlw uvuv, ay, ayuv
+x2 select1wb y, ay
+splitlw uv1, uv2, uvuv
+x2 avgub uv, uv1, uv2
+swapw vu, uv
+
+.function cogorc_putline_A420
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.dest 2 a guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uv
+.temp 2 uu
+.temp 2 vv
+.temp 1 t1
+.temp 1 t2
+
+x2 splitlw uv, ay, ayuv
+x2 select1wb y, ay
+x2 select0wb a, ay
+x2 splitwb vv, uu, uv
+splitwb t1, t2, uu
+avgub u, t1, t2
+splitwb t1, t2, vv
+avgub v, t1, t2
diff --git a/gst/videoconvert/videoconvert.c b/gst/videoconvert/videoconvert.c
new file mode 100644 (file)
index 0000000..690d4e0
--- /dev/null
@@ -0,0 +1,2386 @@
+/* GStreamer
+ * Copyright (C) 2010 David Schleef <ds@schleef.org>
+ * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "videoconvert.h"
+#include <glib.h>
+#include <string.h>
+#include "gstvideoconvertorc.h"
+
+
+static void videoconvert_convert_generic (VideoConvert * convert,
+    GstVideoFrame * dest, const GstVideoFrame * src);
+static void videoconvert_convert_lookup_fastpath (VideoConvert * convert);
+static void videoconvert_convert_lookup_getput (VideoConvert * convert);
+static void videoconvert_dither_none (VideoConvert * convert, int j);
+static void videoconvert_dither_verterr (VideoConvert * convert, int j);
+static void videoconvert_dither_halftone (VideoConvert * convert, int j);
+
+
+VideoConvert *
+videoconvert_convert_new (GstVideoFormat to_format, ColorSpaceColorSpec to_spec,
+    GstVideoFormat from_format, ColorSpaceColorSpec from_spec,
+    int width, int height)
+{
+  const GstVideoFormatInfo *to_info, *from_info;
+  VideoConvert *convert;
+  int i;
+
+  from_info = gst_video_format_get_info (from_format);
+  to_info = gst_video_format_get_info (to_format);
+
+  g_return_val_if_fail (!GST_VIDEO_FORMAT_INFO_IS_RGB (to_info)
+      || to_spec == COLOR_SPEC_RGB, NULL);
+  g_return_val_if_fail (!GST_VIDEO_FORMAT_INFO_IS_YUV (to_info)
+      || to_spec == COLOR_SPEC_YUV_BT709
+      || to_spec == COLOR_SPEC_YUV_BT470_6, NULL);
+  g_return_val_if_fail (GST_VIDEO_FORMAT_INFO_IS_RGB (to_info)
+      || GST_VIDEO_FORMAT_INFO_IS_YUV (to_info)
+      || (GST_VIDEO_FORMAT_INFO_IS_GRAY (to_info) &&
+          to_spec == COLOR_SPEC_GRAY), NULL);
+
+  g_return_val_if_fail (!GST_VIDEO_FORMAT_INFO_IS_RGB (from_info)
+      || from_spec == COLOR_SPEC_RGB, NULL);
+  g_return_val_if_fail (!GST_VIDEO_FORMAT_INFO_IS_YUV (from_info)
+      || from_spec == COLOR_SPEC_YUV_BT709
+      || from_spec == COLOR_SPEC_YUV_BT470_6, NULL);
+  g_return_val_if_fail (GST_VIDEO_FORMAT_INFO_IS_RGB (from_info)
+      || GST_VIDEO_FORMAT_INFO_IS_YUV (from_info)
+      || (GST_VIDEO_FORMAT_INFO_IS_GRAY (from_info) &&
+          from_spec == COLOR_SPEC_GRAY), NULL);
+
+  convert = g_malloc (sizeof (VideoConvert));
+  memset (convert, 0, sizeof (VideoConvert));
+
+  convert->to_format = to_format;
+  convert->to_spec = to_spec;
+  convert->from_format = from_format;
+  convert->from_spec = from_spec;
+  convert->height = height;
+  convert->width = width;
+  convert->convert = videoconvert_convert_generic;
+  convert->dither16 = videoconvert_dither_none;
+
+  if (to_info->depth[0] > 8 || from_info->depth[0] > 8) {
+    convert->use_16bit = TRUE;
+  } else {
+    convert->use_16bit = FALSE;
+  }
+
+  videoconvert_convert_lookup_fastpath (convert);
+  videoconvert_convert_lookup_getput (convert);
+
+  convert->tmpline = g_malloc (sizeof (guint8) * (width + 8) * 4);
+  convert->tmpline16 = g_malloc (sizeof (guint16) * (width + 8) * 4);
+  convert->errline = g_malloc (sizeof (guint16) * width * 4);
+
+  if (to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) {
+    /* build poor man's palette, taken from ffmpegcolorspace */
+    static const guint8 pal_value[6] = { 0x00, 0x33, 0x66, 0x99, 0xcc, 0xff };
+    guint32 *palette;
+    gint r, g, b;
+
+    convert->palette = palette = g_new (guint32, 256);
+    i = 0;
+    for (r = 0; r < 6; r++) {
+      for (g = 0; g < 6; g++) {
+        for (b = 0; b < 6; b++) {
+          palette[i++] =
+              (0xffU << 24) | (pal_value[r] << 16) | (pal_value[g] << 8) |
+              pal_value[b];
+        }
+      }
+    }
+    palette[i++] = 0;           /* 100% transparent, i == 6*6*6 */
+    while (i < 256)
+      palette[i++] = 0xff000000;
+  }
+
+  return convert;
+}
+
+void
+videoconvert_convert_free (VideoConvert * convert)
+{
+  g_free (convert->palette);
+  g_free (convert->tmpline);
+  g_free (convert->tmpline16);
+  g_free (convert->errline);
+
+  g_free (convert);
+}
+
+void
+videoconvert_convert_set_interlaced (VideoConvert * convert,
+    gboolean interlaced)
+{
+  convert->interlaced = interlaced;
+}
+
+void
+videoconvert_convert_set_dither (VideoConvert * convert, int type)
+{
+  switch (type) {
+    case 0:
+    default:
+      convert->dither16 = videoconvert_dither_none;
+      break;
+    case 1:
+      convert->dither16 = videoconvert_dither_verterr;
+      break;
+    case 2:
+      convert->dither16 = videoconvert_dither_halftone;
+      break;
+  }
+}
+
+void
+videoconvert_convert_set_palette (VideoConvert * convert,
+    const guint32 * palette)
+{
+  if (convert->palette == NULL) {
+    convert->palette = g_malloc (sizeof (guint32) * 256);
+  }
+  memcpy (convert->palette, palette, sizeof (guint32) * 256);
+}
+
+const guint32 *
+videoconvert_convert_get_palette (VideoConvert * convert)
+{
+  return convert->palette;
+}
+
+void
+videoconvert_convert_convert (VideoConvert * convert,
+    GstVideoFrame * dest, const GstVideoFrame * src)
+{
+  convert->convert (convert, dest, src);
+}
+
+/* Line conversion to AYUV */
+
+#define FRAME_GET_STRIDE(dir, comp) \
+  ((dir)->info.stride[comp])
+#define FRAME_GET_LINE(dir, comp, line) \
+  (((guint8*)(dir)->data[comp]) + FRAME_GET_STRIDE (dir, comp) * (line))
+
+static void
+getline_I420 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_I420 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j >> 1),
+      FRAME_GET_LINE (src, 2, j >> 1), convert->width);
+}
+
+static void
+putline_I420 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_I420 (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 1, j >> 1),
+      FRAME_GET_LINE (dest, 2, j >> 1), src, convert->width / 2);
+}
+
+static void
+getline_YV12 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_I420 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j >> 1),
+      FRAME_GET_LINE (src, 2, j >> 1), convert->width);
+}
+
+static void
+putline_YV12 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_I420 (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 1, j >> 1),
+      FRAME_GET_LINE (dest, 2, j >> 1), src, convert->width / 2);
+}
+
+static void
+getline_YUY2 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_YUY2 (dest, FRAME_GET_LINE (src, 0, j), convert->width / 2);
+}
+
+static void
+putline_YUY2 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_YUY2 (FRAME_GET_LINE (dest, 0, j), src, convert->width / 2);
+}
+
+static void
+getline_UYVY (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_UYVY (dest, FRAME_GET_LINE (src, 0, j), convert->width / 2);
+}
+
+static void
+putline_UYVY (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_UYVY (FRAME_GET_LINE (dest, 0, j), src, convert->width / 2);
+}
+
+static void
+getline_YVYU (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_YVYU (dest, FRAME_GET_LINE (src, 0, j), convert->width / 2);
+}
+
+static void
+putline_YVYU (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_YVYU (FRAME_GET_LINE (dest, 0, j), src, convert->width / 2);
+}
+
+static void
+getline_v308 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = srcline[i * 3 + 0];
+    dest[i * 4 + 2] = srcline[i * 3 + 1];
+    dest[i * 4 + 3] = srcline[i * 3 + 2];
+  }
+}
+
+static void
+putline_v308 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i * 3 + 0] = src[i * 4 + 1];
+    destline[i * 3 + 1] = src[i * 4 + 2];
+    destline[i * 3 + 2] = src[i * 4 + 3];
+  }
+}
+
+static void
+getline_AYUV (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  memcpy (dest, FRAME_GET_LINE (src, 0, j), convert->width * 4);
+}
+
+static void
+putline_AYUV (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  memcpy (FRAME_GET_LINE (dest, 0, j), src, convert->width * 4);
+}
+
+#if 0
+static void
+getline_v410 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = GST_READ_UINT16_LE (srcline + i * 8 + 0);
+    dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 8 + 2);
+    dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + i * 8 + 4);
+    dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + i * 8 + 6);
+  }
+}
+#endif
+
+static void
+getline_v210 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+
+  for (i = 0; i < convert->width; i += 6) {
+    guint32 a0, a1, a2, a3;
+    guint16 y0, y1, y2, y3, y4, y5;
+    guint16 u0, u2, u4;
+    guint16 v0, v2, v4;
+
+    a0 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 0);
+    a1 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 4);
+    a2 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 8);
+    a3 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 12);
+
+    u0 = ((a0 >> 0) & 0x3ff) >> 2;
+    y0 = ((a0 >> 10) & 0x3ff) >> 2;
+    v0 = ((a0 >> 20) & 0x3ff) >> 2;
+    y1 = ((a1 >> 0) & 0x3ff) >> 2;
+
+    u2 = ((a1 >> 10) & 0x3ff) >> 2;
+    y2 = ((a1 >> 20) & 0x3ff) >> 2;
+    v2 = ((a2 >> 0) & 0x3ff) >> 2;
+    y3 = ((a2 >> 10) & 0x3ff) >> 2;
+
+    u4 = ((a2 >> 20) & 0x3ff) >> 2;
+    y4 = ((a3 >> 0) & 0x3ff) >> 2;
+    v4 = ((a3 >> 10) & 0x3ff) >> 2;
+    y5 = ((a3 >> 20) & 0x3ff) >> 2;
+
+    dest[4 * (i + 0) + 0] = 0xff;
+    dest[4 * (i + 0) + 1] = y0;
+    dest[4 * (i + 0) + 2] = u0;
+    dest[4 * (i + 0) + 3] = v0;
+
+    dest[4 * (i + 1) + 0] = 0xff;
+    dest[4 * (i + 1) + 1] = y1;
+    dest[4 * (i + 1) + 2] = u0;
+    dest[4 * (i + 1) + 3] = v0;
+
+    dest[4 * (i + 2) + 0] = 0xff;
+    dest[4 * (i + 2) + 1] = y2;
+    dest[4 * (i + 2) + 2] = u2;
+    dest[4 * (i + 2) + 3] = v2;
+
+    dest[4 * (i + 3) + 0] = 0xff;
+    dest[4 * (i + 3) + 1] = y3;
+    dest[4 * (i + 3) + 2] = u2;
+    dest[4 * (i + 3) + 3] = v2;
+
+    dest[4 * (i + 4) + 0] = 0xff;
+    dest[4 * (i + 4) + 1] = y4;
+    dest[4 * (i + 4) + 2] = u4;
+    dest[4 * (i + 4) + 3] = v4;
+
+    dest[4 * (i + 5) + 0] = 0xff;
+    dest[4 * (i + 5) + 1] = y5;
+    dest[4 * (i + 5) + 2] = u4;
+    dest[4 * (i + 5) + 3] = v4;
+
+  }
+
+}
+
+static void
+putline_v210 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+
+  for (i = 0; i < convert->width + 5; i += 6) {
+    guint32 a0, a1, a2, a3;
+    guint16 y0, y1, y2, y3, y4, y5;
+    guint16 u0, u1, u2;
+    guint16 v0, v1, v2;
+
+    y0 = src[4 * (i + 0) + 1] << 2;
+    y1 = src[4 * (i + 1) + 1] << 2;
+    y2 = src[4 * (i + 2) + 1] << 2;
+    y3 = src[4 * (i + 3) + 1] << 2;
+    y4 = src[4 * (i + 4) + 1] << 2;
+    y5 = src[4 * (i + 5) + 1] << 2;
+
+    u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2]) << 1;
+    u1 = (src[4 * (i + 2) + 2] + src[4 * (i + 3) + 2]) << 1;
+    u2 = (src[4 * (i + 4) + 2] + src[4 * (i + 5) + 2]) << 1;
+
+    v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3]) << 1;
+    v1 = (src[4 * (i + 2) + 3] + src[4 * (i + 3) + 3]) << 1;
+    v2 = (src[4 * (i + 4) + 3] + src[4 * (i + 5) + 3]) << 1;
+
+    a0 = u0 | (y0 << 10) | (v0 << 20);
+    a1 = y1 | (u1 << 10) | (y2 << 20);
+    a2 = v1 | (y3 << 10) | (u2 << 20);
+    a3 = y4 | (v2 << 10) | (y5 << 20);
+
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 0, a0);
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 4, a1);
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 8, a2);
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 12, a3);
+  }
+}
+
+static void
+getline16_v210 (VideoConvert * convert, guint16 * dest,
+    const GstVideoFrame * src, int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+
+  for (i = 0; i < convert->width; i += 6) {
+    guint32 a0, a1, a2, a3;
+    guint16 y0, y1, y2, y3, y4, y5;
+    guint16 u0, u2, u4;
+    guint16 v0, v2, v4;
+
+    a0 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 0);
+    a1 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 4);
+    a2 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 8);
+    a3 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 12);
+
+    u0 = ((a0 >> 0) & 0x3ff) << 6;
+    y0 = ((a0 >> 10) & 0x3ff) << 6;
+    v0 = ((a0 >> 20) & 0x3ff) << 6;
+    y1 = ((a1 >> 0) & 0x3ff) << 6;
+
+    u2 = ((a1 >> 10) & 0x3ff) << 6;
+    y2 = ((a1 >> 20) & 0x3ff) << 6;
+    v2 = ((a2 >> 0) & 0x3ff) << 6;
+    y3 = ((a2 >> 10) & 0x3ff) << 6;
+
+    u4 = ((a2 >> 20) & 0x3ff) << 6;
+    y4 = ((a3 >> 0) & 0x3ff) << 6;
+    v4 = ((a3 >> 10) & 0x3ff) << 6;
+    y5 = ((a3 >> 20) & 0x3ff) << 6;
+
+    dest[4 * (i + 0) + 0] = 0xffff;
+    dest[4 * (i + 0) + 1] = y0;
+    dest[4 * (i + 0) + 2] = u0;
+    dest[4 * (i + 0) + 3] = v0;
+
+    dest[4 * (i + 1) + 0] = 0xffff;
+    dest[4 * (i + 1) + 1] = y1;
+    dest[4 * (i + 1) + 2] = u0;
+    dest[4 * (i + 1) + 3] = v0;
+
+    dest[4 * (i + 2) + 0] = 0xffff;
+    dest[4 * (i + 2) + 1] = y2;
+    dest[4 * (i + 2) + 2] = u2;
+    dest[4 * (i + 2) + 3] = v2;
+
+    dest[4 * (i + 3) + 0] = 0xffff;
+    dest[4 * (i + 3) + 1] = y3;
+    dest[4 * (i + 3) + 2] = u2;
+    dest[4 * (i + 3) + 3] = v2;
+
+    dest[4 * (i + 4) + 0] = 0xffff;
+    dest[4 * (i + 4) + 1] = y4;
+    dest[4 * (i + 4) + 2] = u4;
+    dest[4 * (i + 4) + 3] = v4;
+
+    dest[4 * (i + 5) + 0] = 0xffff;
+    dest[4 * (i + 5) + 1] = y5;
+    dest[4 * (i + 5) + 2] = u4;
+    dest[4 * (i + 5) + 3] = v4;
+
+  }
+}
+
+static void
+putline16_v210 (VideoConvert * convert, GstVideoFrame * dest,
+    const guint16 * src, int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+
+  for (i = 0; i < convert->width + 5; i += 6) {
+    guint32 a0, a1, a2, a3;
+    guint16 y0, y1, y2, y3, y4, y5;
+    guint16 u0, u1, u2;
+    guint16 v0, v1, v2;
+
+    y0 = src[4 * (i + 0) + 1] >> 6;
+    y1 = src[4 * (i + 1) + 1] >> 6;
+    y2 = src[4 * (i + 2) + 1] >> 6;
+    y3 = src[4 * (i + 3) + 1] >> 6;
+    y4 = src[4 * (i + 4) + 1] >> 6;
+    y5 = src[4 * (i + 5) + 1] >> 6;
+
+    u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2] + 1) >> 7;
+    u1 = (src[4 * (i + 2) + 2] + src[4 * (i + 3) + 2] + 1) >> 7;
+    u2 = (src[4 * (i + 4) + 2] + src[4 * (i + 5) + 2] + 1) >> 7;
+
+    v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3] + 1) >> 7;
+    v1 = (src[4 * (i + 2) + 3] + src[4 * (i + 3) + 3] + 1) >> 7;
+    v2 = (src[4 * (i + 4) + 3] + src[4 * (i + 5) + 3] + 1) >> 7;
+
+    a0 = u0 | (y0 << 10) | (v0 << 20);
+    a1 = y1 | (u1 << 10) | (y2 << 20);
+    a2 = v1 | (y3 << 10) | (u2 << 20);
+    a3 = y4 | (v2 << 10) | (y5 << 20);
+
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 0, a0);
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 4, a1);
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 8, a2);
+    GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 12, a3);
+  }
+}
+
+static void
+getline_v216 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 4 + 2) >> 8;
+    dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 0) >> 8;
+    dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 4) >> 8;
+  }
+}
+
+static void
+putline_v216 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width / 2; i++) {
+    GST_WRITE_UINT16_LE (destline + i * 8 + 0, src[(i * 2 + 0) * 4 + 2] << 8);
+    GST_WRITE_UINT16_LE (destline + i * 8 + 2, src[(i * 2 + 0) * 4 + 1] << 8);
+    GST_WRITE_UINT16_LE (destline + i * 8 + 4, src[(i * 2 + 1) * 4 + 3] << 8);
+    GST_WRITE_UINT16_LE (destline + i * 8 + 8, src[(i * 2 + 0) * 4 + 1] << 8);
+  }
+}
+
+static void
+getline16_v216 (VideoConvert * convert, guint16 * dest,
+    const GstVideoFrame * src, int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xffff;
+    dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 4 + 2);
+    dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 0);
+    dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 4);
+  }
+}
+
+static void
+putline16_v216 (VideoConvert * convert, GstVideoFrame * dest,
+    const guint16 * src, int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width / 2; i++) {
+    GST_WRITE_UINT16_LE (destline + i * 8 + 0, src[(i * 2 + 0) * 4 + 2]);
+    GST_WRITE_UINT16_LE (destline + i * 8 + 2, src[(i * 2 + 0) * 4 + 1]);
+    GST_WRITE_UINT16_LE (destline + i * 8 + 4, src[(i * 2 + 1) * 4 + 3]);
+    GST_WRITE_UINT16_LE (destline + i * 8 + 8, src[(i * 2 + 0) * 4 + 1]);
+  }
+}
+
+static void
+getline_Y41B (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_YUV9 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j), FRAME_GET_LINE (src, 2, j),
+      convert->width / 2);
+}
+
+static void
+putline_Y41B (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destlineY = FRAME_GET_LINE (dest, 0, j);
+  guint8 *destlineU = FRAME_GET_LINE (dest, 1, j);
+  guint8 *destlineV = FRAME_GET_LINE (dest, 2, j);
+
+  for (i = 0; i < convert->width - 3; i += 4) {
+    destlineY[i] = src[i * 4 + 1];
+    destlineY[i + 1] = src[i * 4 + 5];
+    destlineY[i + 2] = src[i * 4 + 9];
+    destlineY[i + 3] = src[i * 4 + 13];
+
+    destlineU[i >> 2] =
+        (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 + 14] +
+        2) >> 2;
+    destlineV[i >> 2] =
+        (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 + 15] +
+        2) >> 2;
+  }
+
+  if (i == convert->width - 3) {
+    destlineY[i] = src[i * 4 + 1];
+    destlineY[i + 1] = src[i * 4 + 5];
+    destlineY[i + 2] = src[i * 4 + 9];
+
+    destlineU[i >> 2] =
+        (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + 1) / 3;
+    destlineV[i >> 2] =
+        (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + 1) / 3;
+  } else if (i == convert->width - 2) {
+    destlineY[i] = src[i * 4 + 1];
+    destlineY[i + 1] = src[i * 4 + 5];
+
+    destlineU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1;
+    destlineV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1;
+  } else if (i == convert->width - 1) {
+    destlineY[i + 1] = src[i * 4 + 5];
+
+    destlineU[i >> 2] = src[i * 4 + 2];
+    destlineV[i >> 2] = src[i * 4 + 3];
+  }
+}
+
+static void
+getline_Y42B (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_Y42B (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j),
+      FRAME_GET_LINE (src, 2, j), convert->width / 2);
+}
+
+static void
+putline_Y42B (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_Y42B (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 1, j),
+      FRAME_GET_LINE (dest, 2, j), src, convert->width / 2);
+}
+
+static void
+getline_Y444 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_Y444 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j), FRAME_GET_LINE (src, 2, j), convert->width);
+}
+
+static void
+putline_Y444 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_Y444 (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 1, j),
+      FRAME_GET_LINE (dest, 2, j), src, convert->width);
+}
+
+static void
+getline_Y800 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_Y800 (dest, FRAME_GET_LINE (src, 0, j), convert->width);
+}
+
+static void
+putline_Y800 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_Y800 (FRAME_GET_LINE (dest, 0, j), src, convert->width);
+}
+
+static void
+getline_Y16 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_Y16 (dest, FRAME_GET_LINE (src, 0, j), convert->width);
+}
+
+static void
+putline_Y16 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_Y16 (FRAME_GET_LINE (dest, 0, j), src, convert->width);
+}
+
+static void
+getline_RGB16 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = ((srcline[i] >> 11) & 0x1f) << 3;
+    dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x3f) << 2;
+    dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
+  }
+}
+
+static void
+putline_RGB16 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i] =
+        ((src[i * 4 + 1] >> 3) << 11) | ((src[i * 4 +
+                2] >> 2) << 5) | (src[i * 4 + 3] >> 3);
+  }
+}
+
+static void
+getline_BGR16 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 3] = ((srcline[i] >> 11) & 0x1f) << 3;
+    dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x3f) << 2;
+    dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
+  }
+}
+
+static void
+putline_BGR16 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i] =
+        ((src[i * 4 + 3] >> 3) << 11) | ((src[i * 4 +
+                2] >> 2) << 5) | (src[i * 4 + 1] >> 3);
+  }
+}
+
+static void
+getline_RGB15 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = ((srcline[i] >> 10) & 0x1f) << 3;
+    dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
+    dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
+  }
+}
+
+static void
+putline_RGB15 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i] =
+        ((src[i * 4 + 1] >> 3) << 10) | ((src[i * 4 +
+                2] >> 3) << 5) | (src[i * 4 + 3] >> 3);
+  }
+}
+
+static void
+getline_BGR15 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 3] = ((srcline[i] >> 10) & 0x1f) << 3;
+    dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
+    dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
+  }
+}
+
+static void
+putline_BGR15 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i] =
+        ((src[i * 4 + 3] >> 3) << 10) | ((src[i * 4 +
+                2] >> 3) << 5) | (src[i * 4 + 1] >> 3);
+  }
+}
+
+static void
+getline_BGRA (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_BGRA (dest, FRAME_GET_LINE (src, 0, j), convert->width);
+}
+
+static void
+putline_BGRA (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_BGRA (FRAME_GET_LINE (dest, 0, j), src, convert->width);
+}
+
+static void
+getline_ABGR (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_ABGR (dest, FRAME_GET_LINE (src, 0, j), convert->width);
+}
+
+static void
+putline_ABGR (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_ABGR (FRAME_GET_LINE (dest, 0, j), src, convert->width);
+}
+
+static void
+getline_RGBA (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_RGBA (dest, FRAME_GET_LINE (src, 0, j), convert->width);
+}
+
+static void
+putline_RGBA (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_RGBA (FRAME_GET_LINE (dest, 0, j), src, convert->width);
+}
+
+static void
+getline_RGB (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = srcline[i * 3 + 0];
+    dest[i * 4 + 2] = srcline[i * 3 + 1];
+    dest[i * 4 + 3] = srcline[i * 3 + 2];
+  }
+}
+
+static void
+putline_RGB (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i * 3 + 0] = src[i * 4 + 1];
+    destline[i * 3 + 1] = src[i * 4 + 2];
+    destline[i * 3 + 2] = src[i * 4 + 3];
+  }
+}
+
+static void
+getline_BGR (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = srcline[i * 3 + 2];
+    dest[i * 4 + 2] = srcline[i * 3 + 1];
+    dest[i * 4 + 3] = srcline[i * 3 + 0];
+  }
+}
+
+static void
+putline_BGR (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i * 3 + 0] = src[i * 4 + 3];
+    destline[i * 3 + 1] = src[i * 4 + 2];
+    destline[i * 3 + 2] = src[i * 4 + 1];
+  }
+}
+
+static void
+getline_NV12 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_NV12 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j >> 1), convert->width / 2);
+}
+
+static void
+putline_NV12 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_NV12 (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 1, j >> 1), src, convert->width / 2);
+}
+
+static void
+getline_NV21 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_NV21 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 2, j >> 1), convert->width / 2);
+}
+
+static void
+putline_NV21 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_NV21 (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 2, j >> 1), src, convert->width / 2);
+}
+
+static void
+getline_UYVP (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i += 2) {
+    guint16 y0, y1;
+    guint16 u0;
+    guint16 v0;
+
+    u0 = (srcline[(i / 2) * 5 + 0] << 2) | (srcline[(i / 2) * 5 + 1] >> 6);
+    y0 = ((srcline[(i / 2) * 5 + 1] & 0x3f) << 4) | (srcline[(i / 2) * 5 +
+            2] >> 4);
+    v0 = ((srcline[(i / 2) * 5 + 2] & 0x0f) << 6) | (srcline[(i / 2) * 5 +
+            3] >> 2);
+    y1 = ((srcline[(i / 2) * 5 + 3] & 0x03) << 8) | srcline[(i / 2) * 5 + 4];
+
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = y0 >> 2;
+    dest[i * 4 + 2] = u0 >> 2;
+    dest[i * 4 + 3] = v0 >> 2;
+    dest[i * 4 + 4] = 0xff;
+    dest[i * 4 + 5] = y1 >> 2;
+    dest[i * 4 + 6] = u0 >> 2;
+    dest[i * 4 + 7] = v0 >> 2;
+  }
+}
+
+static void
+putline_UYVP (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i += 2) {
+    guint16 y0, y1;
+    guint16 u0;
+    guint16 v0;
+
+    y0 = src[4 * (i + 0) + 1];
+    y1 = src[4 * (i + 1) + 1];
+    u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2] + 1) >> 1;
+    v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3] + 1) >> 1;
+
+    destline[(i / 2) * 5 + 0] = u0;
+    destline[(i / 2) * 5 + 1] = y0 >> 2;
+    destline[(i / 2) * 5 + 2] = (y0 << 6) | (v0 >> 4);
+    destline[(i / 2) * 5 + 3] = (v0 << 4) | (y1 >> 2);
+    destline[(i / 2) * 5 + 4] = (y1 << 2);
+  }
+}
+
+static void
+getline_A420 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_A420 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j >> 1),
+      FRAME_GET_LINE (src, 2, j >> 1),
+      FRAME_GET_LINE (src, 3, j), convert->width);
+}
+
+static void
+putline_A420 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  cogorc_putline_A420 (FRAME_GET_LINE (dest, 0, j),
+      FRAME_GET_LINE (dest, 1, j >> 1),
+      FRAME_GET_LINE (dest, 2, j >> 1),
+      FRAME_GET_LINE (dest, 3, j), src, convert->width / 2);
+}
+
+static void
+getline_RGB8P (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    guint32 v = convert->palette[srcline[i]];
+    dest[i * 4 + 0] = (v >> 24) & 0xff;
+    dest[i * 4 + 1] = (v >> 16) & 0xff;
+    dest[i * 4 + 2] = (v >> 8) & 0xff;
+    dest[i * 4 + 3] = (v) & 0xff;
+  }
+}
+
+static void
+putline_RGB8P (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  /* Use our poor man's palette, taken from ffmpegcolorspace too */
+  for (i = 0; i < convert->width; i++) {
+    /* crude approximation for alpha ! */
+    if (src[i * 4 + 0] < 0x80)
+      destline[i] = 6 * 6 * 6;
+    else
+      destline[i] =
+          ((((src[i * 4 + 1]) / 47) % 6) * 6 * 6 + (((src[i * 4 +
+                          2]) / 47) % 6) * 6 + (((src[i * 4 + 3]) / 47) % 6));
+  }
+}
+
+
+static void
+getline_YUV9 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  cogorc_getline_YUV9 (dest,
+      FRAME_GET_LINE (src, 0, j),
+      FRAME_GET_LINE (src, 1, j >> 2),
+      FRAME_GET_LINE (src, 2, j >> 2), convert->width / 2);
+}
+
+static void
+putline_YUV9 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destY = FRAME_GET_LINE (dest, 0, j);
+  guint8 *destU = FRAME_GET_LINE (dest, 1, j >> 2);
+  guint8 *destV = FRAME_GET_LINE (dest, 2, j >> 2);
+
+  for (i = 0; i < convert->width - 3; i += 4) {
+    destY[i] = src[i * 4 + 1];
+    destY[i + 1] = src[i * 4 + 5];
+    destY[i + 2] = src[i * 4 + 9];
+    destY[i + 3] = src[i * 4 + 13];
+    if (j % 4 == 0) {
+      destU[i >> 2] =
+          (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 +
+              14]) >> 2;
+      destV[i >> 2] =
+          (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 +
+              15]) >> 2;
+    }
+  }
+
+  if (i == convert->width - 3) {
+    destY[i] = src[i * 4 + 1];
+    destY[i + 1] = src[i * 4 + 5];
+    destY[i + 2] = src[i * 4 + 9];
+    if (j % 4 == 0) {
+      destU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10]) / 3;
+      destV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11]) / 3;
+    }
+  } else if (i == convert->width - 2) {
+    destY[i] = src[i * 4 + 1];
+    destY[i + 1] = src[i * 4 + 5];
+    if (j % 4 == 0) {
+      destU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6]) >> 1;
+      destV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7]) >> 1;
+    }
+  } else if (i == convert->width - 1) {
+    destY[i] = src[i * 4 + 1];
+    destU[i >> 2] = src[i * 4 + 2];
+    destV[i >> 2] = src[i * 4 + 3];
+  }
+}
+
+static void
+getline_IYU1 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+
+  for (i = 0; i < convert->width - 3; i += 4) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 4] = 0xff;
+    dest[i * 4 + 8] = 0xff;
+    dest[i * 4 + 12] = 0xff;
+    dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+    dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
+    dest[i * 4 + 9] = srcline[(i >> 2) * 6 + 4];
+    dest[i * 4 + 13] = srcline[(i >> 2) * 6 + 5];
+    dest[i * 4 + 2] = dest[i * 4 + 6] = dest[i * 4 + 10] = dest[i * 4 + 14] =
+        srcline[(i >> 2) * 6 + 0];
+    dest[i * 4 + 3] = dest[i * 4 + 7] = dest[i * 4 + 11] = dest[i * 4 + 15] =
+        srcline[(i >> 2) * 6 + 3];
+  }
+
+  if (i == convert->width - 3) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 4] = 0xff;
+    dest[i * 4 + 8] = 0xff;
+    dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+    dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
+    dest[i * 4 + 9] = srcline[(i >> 2) * 6 + 4];
+    dest[i * 4 + 2] = dest[i * 4 + 6] = dest[i * 4 + 10] =
+        srcline[(i >> 2) * 6 + 0];
+    dest[i * 4 + 3] = dest[i * 4 + 7] = dest[i * 4 + 11] =
+        srcline[(i >> 2) * 6 + 3];
+  } else if (i == convert->width - 2) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 4] = 0xff;
+    dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+    dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
+    dest[i * 4 + 2] = dest[i * 4 + 6] = srcline[(i >> 2) * 6 + 0];
+    dest[i * 4 + 3] = dest[i * 4 + 7] = srcline[(i >> 2) * 6 + 3];
+  } else if (i == convert->width - 1) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+    dest[i * 4 + 2] = srcline[(i >> 2) * 6 + 0];
+    dest[i * 4 + 3] = srcline[(i >> 2) * 6 + 3];
+  }
+}
+
+static void
+putline_IYU1 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+
+  for (i = 0; i < convert->width - 3; i += 4) {
+    destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
+    destline[(i >> 2) * 6 + 2] = src[i * 4 + 5];
+    destline[(i >> 2) * 6 + 4] = src[i * 4 + 9];
+    destline[(i >> 2) * 6 + 5] = src[i * 4 + 13];
+    destline[(i >> 2) * 6 + 0] =
+        (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 +
+            14]) >> 2;
+    destline[(i >> 2) * 6 + 3] =
+        (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 +
+            15]) >> 2;
+  }
+
+  if (i == convert->width - 3) {
+    destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
+    destline[(i >> 2) * 6 + 2] = src[i * 4 + 5];
+    destline[(i >> 2) * 6 + 4] = src[i * 4 + 9];
+    destline[(i >> 2) * 6 + 0] =
+        (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10]) / 3;
+    destline[(i >> 2) * 6 + 3] =
+        (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11]) / 3;
+  } else if (i == convert->width - 2) {
+    destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
+    destline[(i >> 2) * 6 + 2] = src[i * 4 + 5];
+    destline[(i >> 2) * 6 + 0] = (src[i * 4 + 2] + src[i * 4 + 6]) >> 1;
+    destline[(i >> 2) * 6 + 3] = (src[i * 4 + 3] + src[i * 4 + 7]) >> 1;
+  } else if (i == convert->width - 1) {
+    destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
+    destline[(i >> 2) * 6 + 0] = src[i * 4 + 2];
+    destline[(i >> 2) * 6 + 3] = src[i * 4 + 3];
+  }
+}
+
+static void
+getline_AY64 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width * 4; i++) {
+    dest[i] = srcline[i] >> 8;
+  }
+}
+
+static void
+putline_AY64 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width * 4; i++) {
+    destline[i] = src[i] << 8;
+  }
+}
+
+static void
+getline16_AY64 (VideoConvert * convert, guint16 * dest,
+    const GstVideoFrame * src, int j)
+{
+  memcpy (dest, FRAME_GET_LINE (src, 0, j), convert->width * 8);
+}
+
+static void
+putline16_AY64 (VideoConvert * convert, GstVideoFrame * dest,
+    const guint16 * src, int j)
+{
+  memcpy (FRAME_GET_LINE (dest, 0, j), src, convert->width * 8);
+}
+
+static void
+getline_r210 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
+    int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    guint8 x;
+    dest[i * 4 + 0] = 0xff;
+    x = GST_READ_UINT32_BE (srcline + i * 4);
+    dest[i * 4 + 1] = (x >> 22) & 0xff;
+    dest[i * 4 + 2] = (x >> 12) & 0xff;
+    dest[i * 4 + 3] = (x >> 2) & 0xff;
+  }
+}
+
+static void
+putline_r210 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width / 2; i++) {
+    guint32 x = 0;
+    x |= src[i * 4 + 1] << 22;
+    x |= (src[i * 4 + 1] & 0xc0) << 14;
+    x |= src[i * 4 + 2] << 12;
+    x |= (src[i * 4 + 2] & 0xc0) << 10;
+    x |= src[i * 4 + 3] << 2;
+    x |= (src[i * 4 + 3] & 0xc0) >> 6;
+    GST_WRITE_UINT32_BE (destline + i * 4, x);
+  }
+}
+
+static void
+getline16_r210 (VideoConvert * convert, guint16 * dest,
+    const GstVideoFrame * src, int j)
+{
+  int i;
+  const guint8 *srcline = FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    guint32 x;
+    dest[i * 4 + 0] = 0xffff;
+    x = GST_READ_UINT32_BE (srcline + i * 4);
+    dest[i * 4 + 1] = ((x >> 14) & 0xffc0) | (x >> 24);
+    dest[i * 4 + 2] = ((x >> 4) & 0xffc0) | ((x >> 14) & 0x3f);
+    dest[i * 4 + 3] = ((x << 6) & 0xffc0) | ((x >> 4) & 0x3f);
+  }
+}
+
+static void
+putline16_r210 (VideoConvert * convert, GstVideoFrame * dest,
+    const guint16 * src, int j)
+{
+  int i;
+  guint8 *destline = FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width / 2; i++) {
+    guint32 x = 0;
+    x |= (src[i * 4 + 1] & 0xffc0) << 14;
+    x |= (src[i * 4 + 2] & 0xffc0) << 4;
+    x |= (src[i * 4 + 3] & 0xffc0) >> 6;
+    GST_WRITE_UINT32_BE (destline + i * 4, x);
+  }
+}
+
+static void
+getline16_convert (VideoConvert * convert, guint16 * dest,
+    const GstVideoFrame * src, int j)
+{
+  int i;
+  convert->getline (convert, convert->tmpline, src, j);
+  for (i = 0; i < convert->width * 4; i++) {
+    dest[i] = convert->tmpline[i] << 8;
+  }
+}
+
+static void
+putline16_convert (VideoConvert * convert, GstVideoFrame * dest,
+    const guint16 * src, int j)
+{
+  int i;
+  for (i = 0; i < convert->width * 4; i++) {
+    convert->tmpline[i] = src[i] >> 8;
+  }
+  convert->putline (convert, dest, convert->tmpline, j);
+}
+
+typedef struct
+{
+  GstVideoFormat format;
+  void (*getline) (VideoConvert * convert, guint8 * dest,
+      const GstVideoFrame * src, int j);
+  void (*putline) (VideoConvert * convert, GstVideoFrame * dest,
+      const guint8 * src, int j);
+  void (*getline16) (VideoConvert * convert, guint16 * dest,
+      const GstVideoFrame * src, int j);
+  void (*putline16) (VideoConvert * convert, GstVideoFrame * dest,
+      const guint16 * src, int j);
+} VideoLine;
+static const VideoLine lines[] = {
+  {GST_VIDEO_FORMAT_I420, getline_I420, putline_I420},
+  {GST_VIDEO_FORMAT_YV12, getline_YV12, putline_YV12},
+  {GST_VIDEO_FORMAT_YUY2, getline_YUY2, putline_YUY2},
+  {GST_VIDEO_FORMAT_UYVY, getline_UYVY, putline_UYVY},
+  {GST_VIDEO_FORMAT_AYUV, getline_AYUV, putline_AYUV},
+  {GST_VIDEO_FORMAT_RGBx, getline_RGBA, putline_RGBA},
+  {GST_VIDEO_FORMAT_BGRx, getline_BGRA, putline_BGRA},
+  {GST_VIDEO_FORMAT_xRGB, getline_AYUV, putline_AYUV},
+  {GST_VIDEO_FORMAT_xBGR, getline_ABGR, putline_ABGR},
+  {GST_VIDEO_FORMAT_RGBA, getline_RGBA, putline_RGBA},
+  {GST_VIDEO_FORMAT_BGRA, getline_BGRA, putline_BGRA},
+  {GST_VIDEO_FORMAT_ARGB, getline_AYUV, putline_AYUV},
+  {GST_VIDEO_FORMAT_ABGR, getline_ABGR, putline_ABGR},
+  {GST_VIDEO_FORMAT_RGB, getline_RGB, putline_RGB},
+  {GST_VIDEO_FORMAT_BGR, getline_BGR, putline_BGR},
+  {GST_VIDEO_FORMAT_Y41B, getline_Y41B, putline_Y41B},
+  {GST_VIDEO_FORMAT_Y42B, getline_Y42B, putline_Y42B},
+  {GST_VIDEO_FORMAT_YVYU, getline_YVYU, putline_YVYU},
+  {GST_VIDEO_FORMAT_Y444, getline_Y444, putline_Y444},
+  {GST_VIDEO_FORMAT_v210, getline_v210, putline_v210,
+      getline16_v210, putline16_v210},
+  {GST_VIDEO_FORMAT_v216, getline_v216, putline_v216,
+      getline16_v216, putline16_v216},
+  {GST_VIDEO_FORMAT_NV12, getline_NV12, putline_NV12},
+  {GST_VIDEO_FORMAT_NV21, getline_NV21, putline_NV21},
+  //{GST_VIDEO_FORMAT_GRAY8, getline_GRAY8, putline_GRAY8},
+  //{GST_VIDEO_FORMAT_GRAY16_BE, getline_GRAY16_BE, putline_GRAY16_BE},
+  //{GST_VIDEO_FORMAT_GRAY16_LE, getline_GRAY16_LE, putline_GRAY16_LE},
+  {GST_VIDEO_FORMAT_v308, getline_v308, putline_v308},
+  {GST_VIDEO_FORMAT_Y800, getline_Y800, putline_Y800},
+  {GST_VIDEO_FORMAT_Y16, getline_Y16, putline_Y16},
+  {GST_VIDEO_FORMAT_RGB16, getline_RGB16, putline_RGB16},
+  {GST_VIDEO_FORMAT_BGR16, getline_BGR16, putline_BGR16},
+  {GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15},
+  {GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
+  {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP},
+  {GST_VIDEO_FORMAT_A420, getline_A420, putline_A420}
+  , {GST_VIDEO_FORMAT_RGB8_PALETTED, getline_RGB8P, putline_RGB8P},
+  {GST_VIDEO_FORMAT_YUV9, getline_YUV9, putline_YUV9},
+  {GST_VIDEO_FORMAT_YVU9, getline_YUV9, putline_YUV9},  /* alias */
+  {GST_VIDEO_FORMAT_IYU1, getline_IYU1, putline_IYU1},
+  {GST_VIDEO_FORMAT_ARGB64, getline_AY64, putline_AY64, getline16_AY64,
+      putline16_AY64},
+  {GST_VIDEO_FORMAT_AYUV64, getline_AY64, putline_AY64, getline16_AY64,
+      putline16_AY64},
+  {GST_VIDEO_FORMAT_r210, getline_r210, putline_r210, getline16_r210,
+      putline16_r210}
+};
+
+static void
+matrix_rgb_to_yuv_bt470_6 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint8 *tmpline = convert->tmpline;
+
+  for (i = 0; i < convert->width; i++) {
+    r = tmpline[i * 4 + 1];
+    g = tmpline[i * 4 + 2];
+    b = tmpline[i * 4 + 3];
+
+    y = (66 * r + 129 * g + 25 * b + 4096) >> 8;
+    u = (-38 * r - 74 * g + 112 * b + 32768) >> 8;
+    v = (112 * r - 94 * g - 18 * b + 32768) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (y, 0, 255);
+    tmpline[i * 4 + 2] = CLAMP (u, 0, 255);
+    tmpline[i * 4 + 3] = CLAMP (v, 0, 255);
+  }
+}
+
+static void
+matrix_rgb_to_yuv_bt709 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint8 *tmpline = convert->tmpline;
+
+  for (i = 0; i < convert->width; i++) {
+    r = tmpline[i * 4 + 1];
+    g = tmpline[i * 4 + 2];
+    b = tmpline[i * 4 + 3];
+
+    y = (47 * r + 157 * g + 16 * b + 4096) >> 8;
+    u = (-26 * r - 87 * g + 112 * b + 32768) >> 8;
+    v = (112 * r - 102 * g - 10 * b + 32768) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (y, 0, 255);
+    tmpline[i * 4 + 2] = CLAMP (u, 0, 255);
+    tmpline[i * 4 + 3] = CLAMP (v, 0, 255);
+  }
+}
+
+static void
+matrix_yuv_bt470_6_to_rgb (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint8 *tmpline = convert->tmpline;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (298 * y + 409 * v - 57068) >> 8;
+    g = (298 * y - 100 * u - 208 * v + 34707) >> 8;
+    b = (298 * y + 516 * u - 70870) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 255);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 255);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 255);
+  }
+}
+
+static void
+matrix_yuv_bt709_to_rgb (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint8 *tmpline = convert->tmpline;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (298 * y + 459 * v - 63514) >> 8;
+    g = (298 * y - 55 * u - 136 * v + 19681) >> 8;
+    b = (298 * y + 541 * u - 73988) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 255);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 255);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 255);
+  }
+}
+
+static void
+matrix_yuv_bt709_to_yuv_bt470_6 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint8 *tmpline = convert->tmpline;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (256 * y + 25 * u + 49 * v - 9536) >> 8;
+    g = (253 * u - 28 * v + 3958) >> 8;
+    b = (-19 * u + 252 * v + 2918) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 255);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 255);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 255);
+  }
+}
+
+static void
+matrix_yuv_bt470_6_to_yuv_bt709 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint8 *tmpline = convert->tmpline;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (256 * y - 30 * u - 53 * v + 10600) >> 8;
+    g = (261 * u + 29 * v - 4367) >> 8;
+    b = (19 * u + 262 * v - 3289) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 255);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 255);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 255);
+  }
+}
+
+static void
+matrix_identity (VideoConvert * convert)
+{
+  /* do nothing */
+}
+
+static void
+matrix16_rgb_to_yuv_bt470_6 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint16 *tmpline = convert->tmpline16;
+
+  for (i = 0; i < convert->width; i++) {
+    r = tmpline[i * 4 + 1];
+    g = tmpline[i * 4 + 2];
+    b = tmpline[i * 4 + 3];
+
+    y = (66 * r + 129 * g + 25 * b + 4096 * 256) >> 8;
+    u = (-38 * r - 74 * g + 112 * b + 32768 * 256) >> 8;
+    v = (112 * r - 94 * g - 18 * b + 32768 * 256) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (y, 0, 65535);
+    tmpline[i * 4 + 2] = CLAMP (u, 0, 65535);
+    tmpline[i * 4 + 3] = CLAMP (v, 0, 65535);
+  }
+}
+
+static void
+matrix16_rgb_to_yuv_bt709 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint16 *tmpline = convert->tmpline16;
+
+  for (i = 0; i < convert->width; i++) {
+    r = tmpline[i * 4 + 1];
+    g = tmpline[i * 4 + 2];
+    b = tmpline[i * 4 + 3];
+
+    y = (47 * r + 157 * g + 16 * b + 4096 * 256) >> 8;
+    u = (-26 * r - 87 * g + 112 * b + 32768 * 256) >> 8;
+    v = (112 * r - 102 * g - 10 * b + 32768 * 256) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (y, 0, 65535);
+    tmpline[i * 4 + 2] = CLAMP (u, 0, 65535);
+    tmpline[i * 4 + 3] = CLAMP (v, 0, 65535);
+  }
+}
+
+static void
+matrix16_yuv_bt470_6_to_rgb (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint16 *tmpline = convert->tmpline16;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (298 * y + 409 * v - 57068 * 256) >> 8;
+    g = (298 * y - 100 * u - 208 * v + 34707 * 256) >> 8;
+    b = (298 * y + 516 * u - 70870 * 256) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 65535);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 65535);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 65535);
+  }
+}
+
+static void
+matrix16_yuv_bt709_to_rgb (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint16 *tmpline = convert->tmpline16;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (298 * y + 459 * v - 63514 * 256) >> 8;
+    g = (298 * y - 55 * u - 136 * v + 19681 * 256) >> 8;
+    b = (298 * y + 541 * u - 73988 * 256) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 65535);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 65535);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 65535);
+  }
+}
+
+static void
+matrix16_yuv_bt709_to_yuv_bt470_6 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint16 *tmpline = convert->tmpline16;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (256 * y + 25 * u + 49 * v - 9536 * 256) >> 8;
+    g = (253 * u - 28 * v + 3958 * 256) >> 8;
+    b = (-19 * u + 252 * v + 2918 * 256) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 65535);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 65535);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 65535);
+  }
+}
+
+static void
+matrix16_yuv_bt470_6_to_yuv_bt709 (VideoConvert * convert)
+{
+  int i;
+  int r, g, b;
+  int y, u, v;
+  guint16 *tmpline = convert->tmpline16;
+
+  for (i = 0; i < convert->width; i++) {
+    y = tmpline[i * 4 + 1];
+    u = tmpline[i * 4 + 2];
+    v = tmpline[i * 4 + 3];
+
+    r = (256 * y - 30 * u - 53 * v + 10600 * 256) >> 8;
+    g = (261 * u + 29 * v - 4367 * 256) >> 8;
+    b = (19 * u + 262 * v - 3289 * 256) >> 8;
+
+    tmpline[i * 4 + 1] = CLAMP (r, 0, 65535);
+    tmpline[i * 4 + 2] = CLAMP (g, 0, 65535);
+    tmpline[i * 4 + 3] = CLAMP (b, 0, 65535);
+  }
+}
+
+static void
+matrix16_identity (VideoConvert * convert)
+{
+  /* do nothing */
+}
+
+
+
+static void
+videoconvert_convert_lookup_getput (VideoConvert * convert)
+{
+  int i;
+
+  convert->getline = NULL;
+  convert->getline16 = NULL;
+  for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) {
+    if (lines[i].format == convert->from_format) {
+      convert->getline = lines[i].getline;
+      convert->getline16 = lines[i].getline16;
+      break;
+    }
+  }
+  convert->putline = NULL;
+  convert->putline16 = NULL;
+  for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) {
+    if (lines[i].format == convert->to_format) {
+      convert->putline = lines[i].putline;
+      convert->putline16 = lines[i].putline16;
+      break;
+    }
+  }
+  GST_DEBUG ("get %p put %p", convert->getline, convert->putline);
+
+  if (convert->getline16 == NULL) {
+    convert->getline16 = getline16_convert;
+  }
+  if (convert->putline16 == NULL) {
+    convert->putline16 = putline16_convert;
+  }
+
+  if (convert->from_spec == convert->to_spec) {
+    convert->matrix = matrix_identity;
+    convert->matrix16 = matrix16_identity;
+  } else if (convert->from_spec == COLOR_SPEC_RGB
+      && convert->to_spec == COLOR_SPEC_YUV_BT470_6) {
+    convert->matrix = matrix_rgb_to_yuv_bt470_6;
+    convert->matrix16 = matrix16_rgb_to_yuv_bt470_6;
+  } else if (convert->from_spec == COLOR_SPEC_RGB
+      && convert->to_spec == COLOR_SPEC_YUV_BT709) {
+    convert->matrix = matrix_rgb_to_yuv_bt709;
+    convert->matrix16 = matrix16_rgb_to_yuv_bt709;
+  } else if (convert->from_spec == COLOR_SPEC_YUV_BT470_6
+      && convert->to_spec == COLOR_SPEC_RGB) {
+    convert->matrix = matrix_yuv_bt470_6_to_rgb;
+    convert->matrix16 = matrix16_yuv_bt470_6_to_rgb;
+  } else if (convert->from_spec == COLOR_SPEC_YUV_BT709
+      && convert->to_spec == COLOR_SPEC_RGB) {
+    convert->matrix = matrix_yuv_bt709_to_rgb;
+    convert->matrix16 = matrix16_yuv_bt709_to_rgb;
+  } else if (convert->from_spec == COLOR_SPEC_YUV_BT709
+      && convert->to_spec == COLOR_SPEC_YUV_BT470_6) {
+    convert->matrix = matrix_yuv_bt709_to_yuv_bt470_6;
+    convert->matrix16 = matrix16_yuv_bt709_to_yuv_bt470_6;
+  } else if (convert->from_spec == COLOR_SPEC_YUV_BT470_6
+      && convert->to_spec == COLOR_SPEC_YUV_BT709) {
+    convert->matrix = matrix_yuv_bt470_6_to_yuv_bt709;
+    convert->matrix16 = matrix16_yuv_bt470_6_to_yuv_bt709;
+  }
+}
+
+static void
+videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int j;
+
+  if (convert->getline == NULL) {
+    GST_ERROR ("no getline");
+    return;
+  }
+
+  if (convert->putline == NULL) {
+    GST_ERROR ("no putline");
+    return;
+  }
+
+  if (convert->use_16bit) {
+    for (j = 0; j < convert->height; j++) {
+      convert->getline16 (convert, convert->tmpline16, src, j);
+      convert->matrix16 (convert);
+      convert->dither16 (convert, j);
+      convert->putline16 (convert, dest, convert->tmpline16, j);
+    }
+  } else {
+    for (j = 0; j < convert->height; j++) {
+      convert->getline (convert, convert->tmpline, src, j);
+      convert->matrix (convert);
+      convert->putline (convert, dest, convert->tmpline, j);
+    }
+  }
+}
+
+static void
+videoconvert_dither_none (VideoConvert * convert, int j)
+{
+}
+
+static void
+videoconvert_dither_verterr (VideoConvert * convert, int j)
+{
+  int i;
+  guint16 *tmpline = convert->tmpline16;
+  guint16 *errline = convert->errline;
+
+  for (i = 0; i < 4 * convert->width; i++) {
+    tmpline[i] += errline[i];
+    errline[i] = tmpline[i] & 0xff;
+  }
+}
+
+static void
+videoconvert_dither_halftone (VideoConvert * convert, int j)
+{
+  int i;
+  guint16 *tmpline = convert->tmpline16;
+  static guint16 halftone[8][8] = {
+    {0, 128, 32, 160, 8, 136, 40, 168},
+    {192, 64, 224, 96, 200, 72, 232, 104},
+    {48, 176, 16, 144, 56, 184, 24, 152},
+    {240, 112, 208, 80, 248, 120, 216, 88},
+    {12, 240, 44, 172, 4, 132, 36, 164},
+    {204, 76, 236, 108, 196, 68, 228, 100},
+    {60, 188, 28, 156, 52, 180, 20, 148},
+    {252, 142, 220, 92, 244, 116, 212, 84}
+  };
+
+  for (i = 0; i < convert->width * 4; i++) {
+    tmpline[i] += halftone[(i >> 2) & 7][j & 7];
+  }
+}
+
+/* Fast paths */
+
+static void
+convert_I420_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int i;
+
+  for (i = 0; i < convert->height; i += 2) {
+    cogorc_convert_I420_YUY2 (FRAME_GET_LINE (dest, 0, i),
+        FRAME_GET_LINE (dest, 0, i + 1),
+        FRAME_GET_LINE (src, 0, i),
+        FRAME_GET_LINE (src, 0, i + 1),
+        FRAME_GET_LINE (src, 1, i >> 1),
+        FRAME_GET_LINE (src, 2, i >> 1), (convert->width + 1) / 2);
+  }
+}
+
+static void
+convert_I420_UYVY (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int i;
+
+  for (i = 0; i < convert->height; i += 2) {
+    cogorc_convert_I420_UYVY (FRAME_GET_LINE (dest, 0, i),
+        FRAME_GET_LINE (dest, 0, i + 1),
+        FRAME_GET_LINE (src, 0, i),
+        FRAME_GET_LINE (src, 0, i + 1),
+        FRAME_GET_LINE (src, 1, i >> 1),
+        FRAME_GET_LINE (src, 2, i >> 1), (convert->width + 1) / 2);
+  }
+}
+
+static void
+convert_I420_AYUV (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int i;
+
+  for (i = 0; i < convert->height; i += 2) {
+    cogorc_convert_I420_AYUV (FRAME_GET_LINE (dest, 0, i),
+        FRAME_GET_LINE (dest, 0, i + 1),
+        FRAME_GET_LINE (src, 0, i),
+        FRAME_GET_LINE (src, 0, i + 1),
+        FRAME_GET_LINE (src, 1, i >> 1),
+        FRAME_GET_LINE (src, 2, i >> 1), convert->width);
+  }
+}
+
+static void
+convert_I420_Y42B (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), FRAME_GET_STRIDE (dest, 0),
+      FRAME_GET_LINE (src, 0, 0), FRAME_GET_STRIDE (src, 0),
+      convert->width, convert->height);
+
+  cogorc_planar_chroma_420_422 (FRAME_GET_LINE (dest, 1, 0),
+      2 * FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 1, 1),
+      2 * FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), (convert->width + 1) / 2, convert->height / 2);
+
+  cogorc_planar_chroma_420_422 (FRAME_GET_LINE (dest, 2, 0),
+      2 * FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (dest, 2, 1),
+      2 * FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height / 2);
+}
+
+static void
+convert_I420_Y444 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), FRAME_GET_STRIDE (dest, 0),
+      FRAME_GET_LINE (src, 0, 0), FRAME_GET_STRIDE (src, 0),
+      convert->width, convert->height);
+
+  cogorc_planar_chroma_420_444 (FRAME_GET_LINE (dest, 1, 0),
+      2 * FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 1, 1),
+      2 * FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), (convert->width + 1) / 2,
+      (convert->height + 1) / 2);
+
+  cogorc_planar_chroma_420_444 (FRAME_GET_LINE (dest, 2, 0),
+      2 * FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (dest, 2, 1),
+      2 * FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2,
+      (convert->height + 1) / 2);
+}
+
+static void
+convert_YUY2_I420 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int i;
+
+  for (i = 0; i < convert->height; i += 2) {
+    cogorc_convert_YUY2_I420 (FRAME_GET_LINE (dest, 0, i),
+        FRAME_GET_LINE (dest, 0, i + 1),
+        FRAME_GET_LINE (dest, 1, i >> 1),
+        FRAME_GET_LINE (dest, 2, i >> 1),
+        FRAME_GET_LINE (src, 0, i),
+        FRAME_GET_LINE (src, 0, i + 1), (convert->width + 1) / 2);
+  }
+}
+
+static void
+convert_YUY2_AYUV (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_YUY2_AYUV (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_YUY2_Y42B (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_YUY2_Y42B (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_YUY2_Y444 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_YUY2_Y444 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+
+static void
+convert_UYVY_I420 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int i;
+
+  for (i = 0; i < convert->height; i += 2) {
+    cogorc_convert_UYVY_I420 (FRAME_GET_LINE (dest, 0, i),
+        FRAME_GET_LINE (dest, 0, i + 1),
+        FRAME_GET_LINE (dest, 1, i >> 1),
+        FRAME_GET_LINE (dest, 2, i >> 1),
+        FRAME_GET_LINE (src, 0, i),
+        FRAME_GET_LINE (src, 0, i + 1), (convert->width + 1) / 2);
+  }
+}
+
+static void
+convert_UYVY_AYUV (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_UYVY_AYUV (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_UYVY_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_UYVY_YUY2 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_UYVY_Y42B (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_UYVY_Y42B (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_UYVY_Y444 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_UYVY_Y444 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_AYUV_I420 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_I420 (FRAME_GET_LINE (dest, 0, 0),
+      2 * FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 0, 1),
+      2 * FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      2 * FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 0, 1),
+      2 * FRAME_GET_STRIDE (src, 0), convert->width / 2, convert->height / 2);
+}
+
+static void
+convert_AYUV_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_YUY2 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width / 2, convert->height);
+}
+
+static void
+convert_AYUV_UYVY (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_UYVY (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width / 2, convert->height);
+}
+
+static void
+convert_AYUV_Y42B (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_Y42B (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_AYUV_Y444 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_Y444 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width, convert->height);
+}
+
+static void
+convert_Y42B_I420 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), FRAME_GET_STRIDE (dest, 0),
+      FRAME_GET_LINE (src, 0, 0), FRAME_GET_STRIDE (src, 0),
+      convert->width, convert->height);
+
+  cogorc_planar_chroma_422_420 (FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (src, 1, 0),
+      2 * FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 1, 1),
+      2 * FRAME_GET_STRIDE (src, 1), (convert->width + 1) / 2,
+      (convert->height + 1) / 2);
+
+  cogorc_planar_chroma_422_420 (FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 2, 0),
+      2 * FRAME_GET_STRIDE (src, 2), FRAME_GET_LINE (src, 2, 1),
+      2 * FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2,
+      (convert->height + 1) / 2);
+}
+
+static void
+convert_Y42B_Y444 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), FRAME_GET_STRIDE (dest, 0),
+      FRAME_GET_LINE (src, 0, 0), FRAME_GET_STRIDE (src, 0),
+      convert->width, convert->height);
+
+  cogorc_planar_chroma_422_444 (FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), (convert->width + 1) / 2, convert->height);
+
+  cogorc_planar_chroma_422_444 (FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_Y42B_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_Y42B_YUY2 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_Y42B_UYVY (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_Y42B_UYVY (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_Y42B_AYUV (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_Y42B_AYUV (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width) / 2, convert->height);
+}
+
+static void
+convert_Y444_I420 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), FRAME_GET_STRIDE (dest, 0),
+      FRAME_GET_LINE (src, 0, 0), FRAME_GET_STRIDE (src, 0),
+      convert->width, convert->height);
+
+  cogorc_planar_chroma_444_420 (FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (src, 1, 0),
+      2 * FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 1, 1),
+      2 * FRAME_GET_STRIDE (src, 1), (convert->width + 1) / 2,
+      (convert->height + 1) / 2);
+
+  cogorc_planar_chroma_444_420 (FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 2, 0),
+      2 * FRAME_GET_STRIDE (src, 2), FRAME_GET_LINE (src, 2, 1),
+      2 * FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2,
+      (convert->height + 1) / 2);
+}
+
+static void
+convert_Y444_Y42B (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), FRAME_GET_STRIDE (dest, 0),
+      FRAME_GET_LINE (src, 0, 0), FRAME_GET_STRIDE (src, 0),
+      convert->width, convert->height);
+
+  cogorc_planar_chroma_444_422 (FRAME_GET_LINE (dest, 1, 0),
+      FRAME_GET_STRIDE (dest, 1), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), (convert->width + 1) / 2, convert->height);
+
+  cogorc_planar_chroma_444_422 (FRAME_GET_LINE (dest, 2, 0),
+      FRAME_GET_STRIDE (dest, 2), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_Y444_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_Y444_YUY2 (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_Y444_UYVY (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_Y444_UYVY (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), (convert->width + 1) / 2, convert->height);
+}
+
+static void
+convert_Y444_AYUV (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_Y444_AYUV (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), FRAME_GET_LINE (src, 1, 0),
+      FRAME_GET_STRIDE (src, 1), FRAME_GET_LINE (src, 2, 0),
+      FRAME_GET_STRIDE (src, 2), convert->width, convert->height);
+}
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+static void
+convert_AYUV_ARGB (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_ARGB (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width, convert->height);
+}
+
+static void
+convert_AYUV_BGRA (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_BGRA (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width, convert->height);
+}
+
+static void
+convert_AYUV_ABGR (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_ABGR (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width, convert->height);
+}
+
+static void
+convert_AYUV_RGBA (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  cogorc_convert_AYUV_RGBA (FRAME_GET_LINE (dest, 0, 0),
+      FRAME_GET_STRIDE (dest, 0), FRAME_GET_LINE (src, 0, 0),
+      FRAME_GET_STRIDE (src, 0), convert->width, convert->height);
+}
+
+static void
+convert_I420_BGRA (VideoConvert * convert, GstVideoFrame * dest,
+    const GstVideoFrame * src)
+{
+  int i;
+  int quality = 0;
+
+  if (quality > 3) {
+    for (i = 0; i < convert->height; i++) {
+      if (i & 1) {
+        cogorc_convert_I420_BGRA_avg (FRAME_GET_LINE (dest, 0, i),
+            FRAME_GET_LINE (src, 0, i),
+            FRAME_GET_LINE (src, 1, i >> 1),
+            FRAME_GET_LINE (src, 1, (i >> 1) + 1),
+            FRAME_GET_LINE (src, 2, i >> 1),
+            FRAME_GET_LINE (src, 2, (i >> 1) + 1), convert->width);
+      } else {
+        cogorc_convert_I420_BGRA (FRAME_GET_LINE (dest, 0, i),
+            FRAME_GET_LINE (src, 0, i),
+            FRAME_GET_LINE (src, 1, i >> 1),
+            FRAME_GET_LINE (src, 2, i >> 1), convert->width);
+      }
+    }
+  } else {
+    for (i = 0; i < convert->height; i++) {
+      cogorc_convert_I420_BGRA (FRAME_GET_LINE (dest, 0, i),
+          FRAME_GET_LINE (src, 0, i),
+          FRAME_GET_LINE (src, 1, i >> 1),
+          FRAME_GET_LINE (src, 2, i >> 1), convert->width);
+    }
+  }
+}
+#endif
+
+
+
+/* Fast paths */
+
+typedef struct
+{
+  GstVideoFormat from_format;
+  ColorSpaceColorSpec from_spec;
+  GstVideoFormat to_format;
+  ColorSpaceColorSpec to_spec;
+  gboolean keeps_color_spec;
+  void (*convert) (VideoConvert * convert, GstVideoFrame * dest,
+      const GstVideoFrame * src);
+} VideoTransform;
+static const VideoTransform transforms[] = {
+  {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2,
+      COLOR_SPEC_NONE, TRUE, convert_I420_YUY2},
+  {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY,
+      COLOR_SPEC_NONE, TRUE, convert_I420_UYVY},
+  {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV,
+      COLOR_SPEC_NONE, TRUE, convert_I420_AYUV},
+  {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B,
+      COLOR_SPEC_NONE, TRUE, convert_I420_Y42B},
+  {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444,
+      COLOR_SPEC_NONE, TRUE, convert_I420_Y444},
+
+  {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420,
+      COLOR_SPEC_NONE, TRUE, convert_YUY2_I420},
+  {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, TRUE, convert_UYVY_YUY2},    /* alias */
+  {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV,
+      COLOR_SPEC_NONE, TRUE, convert_YUY2_AYUV},
+  {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B,
+      COLOR_SPEC_NONE, TRUE, convert_YUY2_Y42B},
+  {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444,
+      COLOR_SPEC_NONE, TRUE, convert_YUY2_Y444},
+
+  {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420,
+      COLOR_SPEC_NONE, TRUE, convert_UYVY_I420},
+  {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2,
+      COLOR_SPEC_NONE, TRUE, convert_UYVY_YUY2},
+  {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV,
+      COLOR_SPEC_NONE, TRUE, convert_UYVY_AYUV},
+  {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B,
+      COLOR_SPEC_NONE, TRUE, convert_UYVY_Y42B},
+  {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444,
+      COLOR_SPEC_NONE, TRUE, convert_UYVY_Y444},
+
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420,
+      COLOR_SPEC_NONE, TRUE, convert_AYUV_I420},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2,
+      COLOR_SPEC_NONE, TRUE, convert_AYUV_YUY2},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY,
+      COLOR_SPEC_NONE, TRUE, convert_AYUV_UYVY},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B,
+      COLOR_SPEC_NONE, TRUE, convert_AYUV_Y42B},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444,
+      COLOR_SPEC_NONE, TRUE, convert_AYUV_Y444},
+
+  {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420,
+      COLOR_SPEC_NONE, TRUE, convert_Y42B_I420},
+  {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2,
+      COLOR_SPEC_NONE, TRUE, convert_Y42B_YUY2},
+  {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY,
+      COLOR_SPEC_NONE, TRUE, convert_Y42B_UYVY},
+  {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV,
+      COLOR_SPEC_NONE, TRUE, convert_Y42B_AYUV},
+  {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444,
+      COLOR_SPEC_NONE, TRUE, convert_Y42B_Y444},
+
+  {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420,
+      COLOR_SPEC_NONE, TRUE, convert_Y444_I420},
+  {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2,
+      COLOR_SPEC_NONE, TRUE, convert_Y444_YUY2},
+  {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY,
+      COLOR_SPEC_NONE, TRUE, convert_Y444_UYVY},
+  {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV,
+      COLOR_SPEC_NONE, TRUE, convert_Y444_AYUV},
+  {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B,
+      COLOR_SPEC_NONE, TRUE, convert_Y444_Y42B},
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_ARGB,
+      COLOR_SPEC_RGB, FALSE, convert_AYUV_ARGB},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_BGRA,
+      COLOR_SPEC_RGB, FALSE, convert_AYUV_BGRA},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_xRGB, COLOR_SPEC_RGB, FALSE, convert_AYUV_ARGB},     /* alias */
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_BGRx, COLOR_SPEC_RGB, FALSE, convert_AYUV_BGRA},     /* alias */
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_ABGR,
+      COLOR_SPEC_RGB, FALSE, convert_AYUV_ABGR},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_RGBA,
+      COLOR_SPEC_RGB, FALSE, convert_AYUV_RGBA},
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_xBGR, COLOR_SPEC_RGB, FALSE, convert_AYUV_ABGR},     /* alias */
+  {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_RGBx, COLOR_SPEC_RGB, FALSE, convert_AYUV_RGBA},     /* alias */
+
+  {GST_VIDEO_FORMAT_I420, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_BGRA,
+      COLOR_SPEC_RGB, FALSE, convert_I420_BGRA},
+#endif
+};
+
+static void
+videoconvert_convert_lookup_fastpath (VideoConvert * convert)
+{
+  int i;
+
+  for (i = 0; i < sizeof (transforms) / sizeof (transforms[0]); i++) {
+    if (transforms[i].to_format == convert->to_format &&
+        transforms[i].from_format == convert->from_format &&
+        (transforms[i].keeps_color_spec ||
+            (transforms[i].from_spec == convert->from_spec &&
+                transforms[i].to_spec == convert->to_spec))) {
+      convert->convert = transforms[i].convert;
+      return;
+    }
+  }
+}
diff --git a/gst/videoconvert/videoconvert.h b/gst/videoconvert/videoconvert.h
new file mode 100644 (file)
index 0000000..8d946ab
--- /dev/null
@@ -0,0 +1,91 @@
+/* Video conversion functions
+ * Copyright (C) 2010 David Schleef <ds@schleef.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __COLORSPACE_H__
+#define __COLORSPACE_H__
+
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+typedef struct _VideoConvert VideoConvert;
+
+typedef enum {
+  COLOR_SPEC_NONE = 0,
+  COLOR_SPEC_RGB,
+  COLOR_SPEC_GRAY,
+  COLOR_SPEC_YUV_BT470_6,
+  COLOR_SPEC_YUV_BT709
+} ColorSpaceColorSpec;
+
+typedef enum {
+  DITHER_NONE,
+  DITHER_VERTERR,
+  DITHER_HALFTONE
+} ColorSpaceDitherMethod;
+
+struct _VideoConvert {
+  gint width, height;
+  gboolean interlaced;
+  gboolean use_16bit;
+  gboolean dither;
+
+  GstVideoFormat from_format;
+  ColorSpaceColorSpec from_spec;
+  GstVideoFormat to_format;
+  ColorSpaceColorSpec to_spec;
+  guint32 *palette;
+
+  guint8 *tmpline;
+  guint16 *tmpline16;
+  guint16 *errline;
+
+  void (*convert) (VideoConvert *convert, GstVideoFrame *dest, const GstVideoFrame *src);
+  void (*getline) (VideoConvert *convert, guint8 *dest, const GstVideoFrame *src, int j);
+  void (*putline) (VideoConvert *convert, GstVideoFrame *dest, const guint8 *src, int j);
+  void (*matrix) (VideoConvert *convert);
+
+  void (*getline16) (VideoConvert *convert, guint16 *dest, const GstVideoFrame *src, int j);
+  void (*putline16) (VideoConvert *convert, GstVideoFrame *dest, const guint16 *src, int j);
+  void (*matrix16) (VideoConvert *convert);
+  void (*dither16) (VideoConvert *convert, int j);
+};
+
+VideoConvert *   videoconvert_convert_new            (GstVideoFormat to_format,
+                                                      ColorSpaceColorSpec from_spec,
+                                                      GstVideoFormat from_format,
+                                                      ColorSpaceColorSpec to_spec,
+                                                      int width, int height);
+void             videoconvert_convert_free           (VideoConvert * convert);
+
+void             videoconvert_convert_set_dither     (VideoConvert * convert, int type);
+void             videoconvert_convert_set_interlaced (VideoConvert *convert,
+                                                      gboolean interlaced);
+
+void             videoconvert_convert_set_palette    (VideoConvert *convert,
+                                                      const guint32 *palette);
+const guint32 *  videoconvert_convert_get_palette    (VideoConvert *convert);
+
+void             videoconvert_convert_convert        (VideoConvert * convert,
+                                                      GstVideoFrame *dest, const GstVideoFrame *src);
+
+
+G_END_DECLS
+
+#endif /* __GST_COLORSPACE_H__ */
similarity index 79%
rename from gst/ffmpegcolorspace/ffmpegcolorspace.vcproj
rename to gst/videoconvert/videoconvert.vcproj
index fc5e7c6..f6ca6ce 100644 (file)
@@ -2,8 +2,8 @@
 <VisualStudioProject
        ProjectType="Visual C++"
        Version="7.10"
-       Name="ffmpegcolorspace"
-       ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678B1}"
+       Name="colorspace"
+       ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678AB}"
        Keyword="Win32Proj">
        <Platforms>
                <Platform
@@ -20,7 +20,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ffmpegcolorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;colorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
-                               OutputFile="$(OutDir)/gstffmpegcolorspace.dll"
+                               OutputFile="$(OutDir)/gstcolorspace.dll"
                                LinkIncremental="2"
                                AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
                                ModuleDefinitionFile=""
                                GenerateDebugInformation="TRUE"
-                               ProgramDatabaseFile="$(OutDir)/ffmpegcolorspace.pdb"
+                               ProgramDatabaseFile="$(OutDir)/colorspace.pdb"
                                SubSystem="2"
                                OptimizeReferences="2"
-                               ImportLibrary="$(OutDir)/gstffmpegcolorspace.lib"
+                               ImportLibrary="$(OutDir)/gstcolorspace.lib"
                                TargetMachine="1"/>
                        <Tool
                                Name="VCMIDLTool"/>
@@ -74,7 +74,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
-                               PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;ffmpegcolorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
+                               PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;colorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
@@ -85,7 +85,7 @@
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
-                               OutputFile="$(OutDir)/gstffmpegcolorspace.dll"
+                               OutputFile="$(OutDir)/gstcolorspace.dll"
                                LinkIncremental="1"
                                AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
                                ModuleDefinitionFile=""
@@ -93,7 +93,7 @@
                                SubSystem="2"
                                OptimizeReferences="2"
                                EnableCOMDATFolding="2"
-                               ImportLibrary="$(OutDir)/gstffmpegcolorspace.lib"
+                               ImportLibrary="$(OutDir)/gstcolorspace.lib"
                                TargetMachine="1"/>
                        <Tool
                                Name="VCMIDLTool"/>
                        Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
                        <File
-                               RelativePath=".\gstffmpegcolorspace.c">
+                               RelativePath=".\gstcolorspace.c">
                        </File>
                        <File
-                               RelativePath=".\gstffmpeg.c">
-                       </File>
-                       <File
-                               RelativePath=".\gstffmpegcodecmap.c">
-                       </File>
-                       <File
-                               RelativePath=".\dsputil.c">
-                       </File>
-                       <File
-                               RelativePath=".\mem.c">
-                       </File>
-                       <File
-                               RelativePath=".\utils.c">
-                       </File>
-                       <File
-                               RelativePath=".\imgconvert.c">
+                               RelativePath=".\yuv2rgb.c">
                        </File>
                </Filter>
                <Filter
                        Filter="h;hpp;hxx;hm;inl;inc;xsd"
                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
                        <File
-                               RelativePath=".\gstffmpegcodecmap.h">
-                       </File>
-                       <File
-                               RelativePath=".\imgconvert_template.h">
-                       </File>
-                       <File
-                               RelativePath=".\common.h">
-                       </File>
-                       <File
-                               RelativePath=".\dsputil.h">
-                       </File>
-                       <File
-                               RelativePath=".\mmx.h">
+                               RelativePath=".\gstcolorspace.h">
                        </File>
                        <File
-                               RelativePath=".\avcodec.h">
+                               RelativePath=".\yuv2rgb.h">
                        </File>
                </Filter>
                <Filter
index 8045b12..a0b3701 100644 (file)
  * <refsect2>
  * <title>Example pipelines</title>
  * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videorate ! video/x-raw-yuv,framerate=15/1 ! xvimagesink
+ * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videorate ! video/x-raw,framerate=15/1 ! xvimagesink
  * ]| Decode an Ogg/Theora file and adjust the framerate to 15 fps before playing.
  * To create the test Ogg/Theora file refer to the documentation of theoraenc.
  * |[
- * gst-launch -v v4lsrc ! videorate ! video/x-raw-yuv,framerate=25/2 ! theoraenc ! oggmux ! filesink location=v4l.ogg
+ * gst-launch -v v4l2src ! videorate ! video/x-raw,framerate=25/2 ! theoraenc ! oggmux ! filesink location=recording.ogg
  * ]| Capture video from a V4L device, and adjust the stream to 12.5 fps before
  * encoding to Ogg/Theora.
  * </refsect2>
@@ -108,16 +108,14 @@ static GstStaticPadTemplate gst_video_rate_src_template =
     GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv;"
-        "video/x-raw-rgb;" "video/x-raw-gray;" "image/jpeg;" "image/png")
+    GST_STATIC_CAPS ("video/x-raw;" "image/jpeg;" "image/png")
     );
 
 static GstStaticPadTemplate gst_video_rate_sink_template =
     GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv;"
-        "video/x-raw-rgb;" "video/x-raw-gray;" "image/jpeg;" "image/png")
+    GST_STATIC_CAPS ("video/x-raw;" "image/jpeg;" "image/png")
     );
 
 static void gst_video_rate_swap_prev (GstVideoRate * videorate,
@@ -139,23 +137,8 @@ static GstStateChangeReturn gst_video_rate_change_state (GstElement * element,
 static GParamSpec *pspec_drop = NULL;
 static GParamSpec *pspec_duplicate = NULL;
 
-GST_BOILERPLATE (GstVideoRate, gst_video_rate, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_video_rate_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Video rate adjuster", "Filter/Effect/Video",
-      "Drops/duplicates/adjusts timestamps on video frames to make a perfect stream",
-      "Wim Taymans <wim@fluendo.com>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_video_rate_sink_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_video_rate_src_template));
-}
+#define gst_video_rate_parent_class parent_class
+G_DEFINE_TYPE (GstVideoRate, gst_video_rate, GST_TYPE_ELEMENT);
 
 static void
 gst_video_rate_class_init (GstVideoRateClass * klass)
@@ -203,6 +186,16 @@ gst_video_rate_class_init (GstVideoRateClass * klass)
           "Don't produce buffers before the first one we receive",
           DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (element_class,
+      "Video rate adjuster", "Filter/Effect/Video",
+      "Drops/duplicates/adjusts timestamps on video frames to make a perfect stream",
+      "Wim Taymans <wim@fluendo.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_video_rate_sink_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_video_rate_src_template));
+
   /**
    * GstVideoRate:drop-only:
    *
@@ -236,16 +229,17 @@ gst_video_rate_class_init (GstVideoRateClass * klass)
 /* return the caps that can be used on out_pad given in_caps on in_pad */
 static gboolean
 gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
-    GstPad * out_pad, GstCaps ** out_caps)
+    GstPad * out_pad, GstCaps ** out_caps, GstCaps * filter)
 {
-  GstCaps *intersect;
-  const GstCaps *in_templ;
+  GstCaps *intersect, *in_templ;
   gint i;
   GSList *extra_structures = NULL;
   GSList *iter;
 
   in_templ = gst_pad_get_pad_template_caps (in_pad);
-  intersect = gst_caps_intersect (in_caps, in_templ);
+  intersect =
+      gst_caps_intersect_full (in_caps, in_templ, GST_CAPS_INTERSECT_FIRST);
+  gst_caps_unref (in_templ);
 
   /* all possible framerates are allowed */
   for (i = 0; i < gst_caps_get_size (intersect); i++) {
@@ -269,13 +263,21 @@ gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
   }
   g_slist_free (extra_structures);
 
+  if (filter) {
+    GstCaps *tmp;
+
+    tmp = gst_caps_intersect_full (filter, intersect, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (intersect);
+    intersect = tmp;
+  }
+
   *out_caps = intersect;
 
   return TRUE;
 }
 
 static GstCaps *
-gst_video_rate_getcaps (GstPad * pad)
+gst_video_rate_getcaps (GstPad * pad, GstCaps * filter)
 {
   GstVideoRate *videorate;
   GstPad *otherpad;
@@ -287,132 +289,148 @@ gst_video_rate_getcaps (GstPad * pad)
       videorate->srcpad;
 
   /* we can do what the peer can */
-  caps = gst_pad_peer_get_caps (otherpad);
+  caps = gst_pad_peer_get_caps (otherpad, filter);
   if (caps) {
-    GstCaps *transform;
+    GstCaps *transform, *intersect;
 
-    gst_video_rate_transformcaps (otherpad, caps, pad, &transform);
-    gst_caps_unref (caps);
-    caps = transform;
+    gst_video_rate_transformcaps (otherpad, caps, pad, &transform, filter);
+
+    /* Now prefer the downstream caps if possible */
+    intersect =
+        gst_caps_intersect_full (caps, transform, GST_CAPS_INTERSECT_FIRST);
+    if (!gst_caps_is_empty (intersect)) {
+      gst_caps_append (intersect, transform);
+      gst_caps_unref (caps);
+      caps = intersect;
+    } else {
+      gst_caps_unref (intersect);
+      caps = transform;
+    }
   } else {
     /* no peer, our padtemplate is enough then */
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+    caps = gst_pad_get_pad_template_caps (pad);
+    if (filter) {
+      GstCaps *intersection;
+      intersection =
+          gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+      gst_caps_unref (caps);
+      caps = intersection;
+    }
   }
 
   return caps;
 }
 
 static gboolean
-gst_video_rate_setcaps (GstPad * pad, GstCaps * caps)
+gst_video_rate_set_src_caps (GstVideoRate * videorate, GstCaps * caps)
 {
-  GstVideoRate *videorate;
   GstStructure *structure;
-  gboolean ret = TRUE;
-  GstPad *otherpad, *opeer;
   gint rate_numerator, rate_denominator;
 
-  videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
-
-  GST_DEBUG_OBJECT (pad, "setcaps called %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (videorate, "src caps %" GST_PTR_FORMAT, caps);
 
   structure = gst_caps_get_structure (caps, 0);
   if (!gst_structure_get_fraction (structure, "framerate",
           &rate_numerator, &rate_denominator))
     goto no_framerate;
 
-  if (pad == videorate->srcpad) {
-    /* out_frame_count is scaled by the frame rate caps when calculating next_ts.
-     * when the frame rate caps change, we must update base_ts and reset
-     * out_frame_count */
-    if (videorate->to_rate_numerator) {
-      videorate->base_ts +=
-          gst_util_uint64_scale (videorate->out_frame_count,
-          videorate->to_rate_denominator * GST_SECOND,
-          videorate->to_rate_numerator);
-    }
-    videorate->out_frame_count = 0;
-    videorate->to_rate_numerator = rate_numerator;
-    videorate->to_rate_denominator = rate_denominator;
-    videorate->wanted_diff = gst_util_uint64_scale_int (GST_SECOND,
-        rate_denominator, rate_numerator);
-    otherpad = videorate->sinkpad;
-  } else {
-    videorate->from_rate_numerator = rate_numerator;
-    videorate->from_rate_denominator = rate_denominator;
-    otherpad = videorate->srcpad;
+  /* out_frame_count is scaled by the frame rate caps when calculating next_ts.
+   * when the frame rate caps change, we must update base_ts and reset
+   * out_frame_count */
+  if (videorate->to_rate_numerator) {
+    videorate->base_ts +=
+        gst_util_uint64_scale (videorate->out_frame_count,
+        videorate->to_rate_denominator * GST_SECOND,
+        videorate->to_rate_numerator);
   }
+  videorate->out_frame_count = 0;
+  videorate->to_rate_numerator = rate_numerator;
+  videorate->to_rate_denominator = rate_denominator;
+  videorate->wanted_diff = gst_util_uint64_scale_int (GST_SECOND,
+      rate_denominator, rate_numerator);
 
-  /* now try to find something for the peer */
-  opeer = gst_pad_get_peer (otherpad);
-  if (opeer) {
-    if (gst_pad_accept_caps (opeer, caps)) {
-      /* the peer accepts the caps as they are */
-      gst_pad_set_caps (otherpad, caps);
+  gst_pad_push_event (videorate->srcpad, gst_event_new_caps (caps));
 
-      ret = TRUE;
-    } else {
-      GstCaps *peercaps;
-      GstCaps *transform = NULL;
+  return TRUE;
 
-      ret = FALSE;
+  /* ERRORS */
+no_framerate:
+  {
+    GST_DEBUG_OBJECT (videorate, "no framerate specified");
+    return FALSE;
+  }
+}
 
-      /* see how we can transform the input caps */
-      if (!gst_video_rate_transformcaps (pad, caps, otherpad, &transform))
-        goto no_transform;
+static gboolean
+gst_video_rate_set_sink_caps (GstVideoRate * videorate, GstCaps * caps)
+{
+  GstStructure *structure;
+  gboolean ret = TRUE;
+  gint rate_numerator, rate_denominator;
 
-      /* see what the peer can do */
-      peercaps = gst_pad_get_caps (opeer);
+  GST_DEBUG_OBJECT (videorate, "sink caps %" GST_PTR_FORMAT, caps);
 
-      GST_DEBUG_OBJECT (opeer, "icaps %" GST_PTR_FORMAT, peercaps);
-      GST_DEBUG_OBJECT (videorate, "transform %" GST_PTR_FORMAT, transform);
+  structure = gst_caps_get_structure (caps, 0);
+  if (!gst_structure_get_fraction (structure, "framerate",
+          &rate_numerator, &rate_denominator))
+    goto no_framerate;
 
-      /* filter against our possibilities */
-      caps = gst_caps_intersect (peercaps, transform);
-      gst_caps_unref (peercaps);
-      gst_caps_unref (transform);
+  videorate->from_rate_numerator = rate_numerator;
+  videorate->from_rate_denominator = rate_denominator;
 
-      GST_DEBUG_OBJECT (videorate, "intersect %" GST_PTR_FORMAT, caps);
+  /* now try to find something for the peer */
+  if (gst_pad_peer_accept_caps (videorate->srcpad, caps)) {
+    /* the peer accepts the caps as they are */
+    ret = gst_video_rate_set_src_caps (videorate, caps);
+  } else {
+    GstCaps *transform = NULL;
 
-      /* could turn up empty, due to e.g. colorspace etc */
-      if (gst_caps_get_size (caps) == 0) {
-        gst_caps_unref (caps);
-        goto no_transform;
-      }
+    ret = FALSE;
 
-      /* take first possibility */
-      gst_caps_truncate (caps);
-      structure = gst_caps_get_structure (caps, 0);
+    /* see how we can transform the input caps */
+    if (!gst_video_rate_transformcaps (videorate->sinkpad, caps,
+            videorate->srcpad, &transform, NULL))
+      goto no_transform;
 
-      /* and fixate */
-      gst_structure_fixate_field_nearest_fraction (structure, "framerate",
-          rate_numerator, rate_denominator);
+    GST_DEBUG_OBJECT (videorate, "transform %" GST_PTR_FORMAT, transform);
 
-      gst_structure_get_fraction (structure, "framerate",
-          &rate_numerator, &rate_denominator);
+    /* see what the peer can do */
+    caps = gst_pad_peer_get_caps (videorate->srcpad, transform);
 
-      if (otherpad == videorate->srcpad) {
-        videorate->to_rate_numerator = rate_numerator;
-        videorate->to_rate_denominator = rate_denominator;
-      } else {
-        videorate->from_rate_numerator = rate_numerator;
-        videorate->from_rate_denominator = rate_denominator;
-      }
+    GST_DEBUG_OBJECT (videorate, "icaps %" GST_PTR_FORMAT, caps);
 
-      if (gst_structure_has_field (structure, "interlaced"))
-        gst_structure_fixate_field_boolean (structure, "interlaced", FALSE);
-      if (gst_structure_has_field (structure, "color-matrix"))
-        gst_structure_fixate_field_string (structure, "color-matrix", "sdtv");
-      if (gst_structure_has_field (structure, "chroma-site"))
-        gst_structure_fixate_field_string (structure, "chroma-site", "mpeg2");
-      if (gst_structure_has_field (structure, "pixel-aspect-ratio"))
-        gst_structure_fixate_field_nearest_fraction (structure,
-            "pixel-aspect-ratio", 1, 1);
-
-      gst_pad_set_caps (otherpad, caps);
+    /* could turn up empty, due to e.g. colorspace etc */
+    if (gst_caps_get_size (caps) == 0) {
       gst_caps_unref (caps);
-      ret = TRUE;
+      goto no_transform;
     }
-    gst_object_unref (opeer);
+
+    /* take first possibility */
+    caps = gst_caps_make_writable (caps);
+    gst_caps_truncate (caps);
+    structure = gst_caps_get_structure (caps, 0);
+
+    /* and fixate */
+    gst_structure_fixate_field_nearest_fraction (structure, "framerate",
+        rate_numerator, rate_denominator);
+    gst_structure_get_fraction (structure, "framerate",
+        &rate_numerator, &rate_denominator);
+
+    videorate->to_rate_numerator = rate_numerator;
+    videorate->to_rate_denominator = rate_denominator;
+
+    if (gst_structure_has_field (structure, "interlaced"))
+      gst_structure_fixate_field_boolean (structure, "interlaced", FALSE);
+    if (gst_structure_has_field (structure, "color-matrix"))
+      gst_structure_fixate_field_string (structure, "color-matrix", "sdtv");
+    if (gst_structure_has_field (structure, "chroma-site"))
+      gst_structure_fixate_field_string (structure, "chroma-site", "mpeg2");
+    if (gst_structure_has_field (structure, "pixel-aspect-ratio"))
+      gst_structure_fixate_field_nearest_fraction (structure,
+          "pixel-aspect-ratio", 1, 1);
+
+    ret = gst_video_rate_set_src_caps (videorate, caps);
+    gst_caps_unref (caps);
   }
 done:
   /* After a setcaps, our caps may have changed. In that case, we can't use
@@ -420,7 +438,6 @@ done:
   GST_DEBUG_OBJECT (videorate, "swapping old buffers");
   gst_video_rate_swap_prev (videorate, NULL, GST_CLOCK_TIME_NONE);
 
-  gst_object_unref (videorate);
   return ret;
 
 no_framerate:
@@ -457,7 +474,7 @@ gst_video_rate_reset (GstVideoRate * videorate)
 }
 
 static void
-gst_video_rate_init (GstVideoRate * videorate, GstVideoRateClass * klass)
+gst_video_rate_init (GstVideoRate * videorate)
 {
   videorate->sinkpad =
       gst_pad_new_from_static_template (&gst_video_rate_sink_template, "sink");
@@ -467,8 +484,6 @@ gst_video_rate_init (GstVideoRate * videorate, GstVideoRateClass * klass)
       GST_DEBUG_FUNCPTR (gst_video_rate_chain));
   gst_pad_set_getcaps_function (videorate->sinkpad,
       GST_DEBUG_FUNCPTR (gst_video_rate_getcaps));
-  gst_pad_set_setcaps_function (videorate->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_video_rate_setcaps));
   gst_element_add_pad (GST_ELEMENT (videorate), videorate->sinkpad);
 
   videorate->srcpad =
@@ -477,8 +492,6 @@ gst_video_rate_init (GstVideoRate * videorate, GstVideoRateClass * klass)
       GST_DEBUG_FUNCPTR (gst_video_rate_query));
   gst_pad_set_getcaps_function (videorate->srcpad,
       GST_DEBUG_FUNCPTR (gst_video_rate_getcaps));
-  gst_pad_set_setcaps_function (videorate->srcpad,
-      GST_DEBUG_FUNCPTR (gst_video_rate_setcaps));
   gst_element_add_pad (GST_ELEMENT (videorate), videorate->srcpad);
 
   gst_video_rate_reset (videorate);
@@ -505,8 +518,7 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate)
     goto eos_before_buffers;
 
   /* make sure we can write to the metadata */
-  outbuf = gst_buffer_make_metadata_writable
-      (gst_buffer_ref (videorate->prevbuf));
+  outbuf = gst_buffer_make_writable (gst_buffer_ref (videorate->prevbuf));
 
   GST_BUFFER_OFFSET (outbuf) = videorate->out;
   GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
@@ -530,7 +542,7 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate)
   if (videorate->to_rate_numerator) {
     /* interpolate next expected timestamp in the segment */
     videorate->next_ts =
-        videorate->segment.accum + videorate->segment.start +
+        videorate->segment.base + videorate->segment.start +
         videorate->base_ts + gst_util_uint64_scale (videorate->out_frame_count,
         videorate->to_rate_denominator * GST_SECOND,
         videorate->to_rate_numerator);
@@ -540,9 +552,8 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate)
   /* We do not need to update time in VFR (variable frame rate) mode */
   if (!videorate->drop_only) {
     /* adapt for looping, bring back to time in current segment. */
-    GST_BUFFER_TIMESTAMP (outbuf) = push_ts - videorate->segment.accum;
+    GST_BUFFER_TIMESTAMP (outbuf) = push_ts - videorate->segment.base;
   }
-  gst_buffer_set_caps (outbuf, GST_PAD_CAPS (videorate->srcpad));
 
   GST_LOG_OBJECT (videorate,
       "old is best, dup, pushing buffer outgoing ts %" GST_TIME_FORMAT,
@@ -601,23 +612,30 @@ gst_video_rate_event (GstPad * pad, GstEvent * event)
   videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      ret = gst_video_rate_set_sink_caps (videorate, caps);
+      gst_event_unref (event);
+
+      /* don't forward */
+      goto done;
+    }
+    case GST_EVENT_SEGMENT:
     {
-      gint64 start, stop, time;
-      gdouble rate, arate;
-      gboolean update;
-      GstFormat format;
+      const GstSegment *segment;
 
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
-          &start, &stop, &time);
+      gst_event_parse_segment (event, &segment);
 
-      if (format != GST_FORMAT_TIME)
+      if (segment->format != GST_FORMAT_TIME)
         goto format_error;
 
       GST_DEBUG_OBJECT (videorate, "handle NEWSEGMENT");
 
       /* close up the previous segment, if appropriate */
-      if (!update && videorate->prevbuf) {
+      if (videorate->prevbuf) {
         gint count = 0;
         GstFlowReturn res;
 
@@ -627,7 +645,7 @@ gst_video_rate_event (GstPad * pad, GstEvent * event)
          * regardless, prevent going loopy in strange cases */
         while (res == GST_FLOW_OK && count <= MAGIC_LIMIT &&
             ((GST_CLOCK_TIME_IS_VALID (videorate->segment.stop) &&
-                    videorate->next_ts - videorate->segment.accum
+                    videorate->next_ts - videorate->segment.base
                     < videorate->segment.stop)
                 || count < 1)) {
           res = gst_video_rate_flush_prev (videorate, count > 0);
@@ -650,8 +668,7 @@ gst_video_rate_event (GstPad * pad, GstEvent * event)
       }
 
       /* We just want to update the accumulated stream_time  */
-      gst_segment_set_newsegment_full (&videorate->segment, update, rate, arate,
-          format, start, stop, time);
+      gst_segment_copy_into (segment, &videorate->segment);
 
       GST_DEBUG_OBJECT (videorate, "updated segment: %" GST_SEGMENT_FORMAT,
           &videorate->segment);
@@ -669,7 +686,7 @@ gst_video_rate_event (GstPad * pad, GstEvent * event)
          * or only send out the stored buffer if there is no specific stop.
          * regardless, prevent going loopy in strange cases */
         while (res == GST_FLOW_OK && count <= MAGIC_LIMIT &&
-            ((videorate->next_ts - videorate->segment.accum <
+            ((videorate->next_ts - videorate->segment.base <
                     videorate->segment.stop)
                 || count < 1)) {
           res = gst_video_rate_flush_prev (videorate, count > 0);
@@ -683,7 +700,7 @@ gst_video_rate_event (GstPad * pad, GstEvent * event)
               videorate->next_ts + GST_BUFFER_DURATION (videorate->prevbuf);
 
           while (res == GST_FLOW_OK && count <= MAGIC_LIMIT &&
-              ((videorate->next_ts - videorate->segment.accum < end_ts)
+              ((videorate->next_ts - videorate->segment.base < end_ts)
                   || count < 1)) {
             res = gst_video_rate_flush_prev (videorate, count > 0);
             count++;
@@ -909,7 +926,7 @@ gst_video_rate_chain (GstPad * pad, GstBuffer * buffer)
 
   /* the input time is the time in the segment + all previously accumulated
    * segments */
-  intime = in_ts + videorate->segment.accum;
+  intime = in_ts + videorate->segment.base;
 
   /* we need to have two buffers to compare */
   if (videorate->prevbuf == NULL) {
@@ -923,8 +940,7 @@ gst_video_rate_chain (GstPad * pad, GstBuffer * buffer)
         videorate->base_ts = in_ts - videorate->segment.start;
         videorate->out_frame_count = 0;
       } else {
-        videorate->next_ts =
-            videorate->segment.start + videorate->segment.accum;
+        videorate->next_ts = videorate->segment.start + videorate->segment.base;
       }
     }
   } else {
@@ -1132,7 +1148,7 @@ gst_video_rate_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = parent_class->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
index b941ed0..06e4681 100644 (file)
@@ -20,7 +20,7 @@
 
 /**
  * SECTION:element-videoscale
- * @see_also: videorate, ffmpegcolorspace
+ * @see_also: videorate, videoconvert
  *
  * This element resizes video frames. By default the element will try to
  * negotiate to the same size on the source and sinkpad so that no scaling
  * <refsect2>
  * <title>Example pipelines</title>
  * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink
+ * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoconvert ! videoscale ! ximagesink
  * ]| Decode an Ogg/Theora and display the video using ximagesink. Since
  * ximagesink cannot perform scaling, the video scaling will be performed by
  * videoscale when you resize the video window.
  * To create the test Ogg/Theora file refer to the documentation of theoraenc.
  * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw-yuv, width=50 ! xvimagesink
+ * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw, width=50 ! xvimagesink
  * ]| Decode an Ogg/Theora and display the video using xvimagesink with a width
  * of 50.
  * </refsect2>
@@ -76,7 +76,8 @@
 
 #include <math.h>
 
-#include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideopool.h>
 
 #include "gstvideoscale.h"
 #include "gstvideoscaleorc.h"
@@ -101,37 +102,14 @@ enum
 #undef GST_VIDEO_SIZE_RANGE
 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, 32767]"
 
+#define GST_VIDEO_FORMATS "{ \"I420\", \"YV12\", \"YUY2\", \"UYVY\", \"AYUV\", \"RGBx\", " \
+    "\"BGRx\", \"xRGB\", \"xBGR\", \"RGBA\", \"BGRA\", \"ARGB\", \"ABGR\", \"RGB\", " \
+    "\"BGR\", \"Y41B\", \"Y42B\", \"YVYU\", \"Y444\", \"GRAY8\", \"GRAY16_BE\", \"GRAY16_LE\", " \
+    "\"v308\", \"Y800\", \"Y16\", \"RGB16\", \"RGB15\", \"ARGB64\", \"AYUV64\" } "
+
+
 static GstStaticCaps gst_video_scale_format_caps[] = {
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_ABGR),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBx),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_xBGR),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y444")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("v308")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_BGR),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y42B")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YUY2")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YVYU")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("UYVY")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YV12")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y41B")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_16),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_15),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_GRAY16 ("BYTE_ORDER")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y16 ")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_GRAY8),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y800")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y8  ")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("GREY")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AY64")),
-  GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB_64)
+  GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS))
 };
 
 #define GST_TYPE_VIDEO_SCALE_METHOD (gst_video_scale_method_get_type())
@@ -180,14 +158,14 @@ static GstPadTemplate *
 gst_video_scale_src_template_factory (void)
 {
   return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
-      gst_caps_ref (gst_video_scale_get_capslist ()));
+      gst_video_scale_get_capslist ());
 }
 
 static GstPadTemplate *
 gst_video_scale_sink_template_factory (void)
 {
   return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
-      gst_caps_ref (gst_video_scale_get_capslist ()));
+      gst_video_scale_get_capslist ());
 }
 
 
@@ -197,11 +175,13 @@ static gboolean gst_video_scale_src_event (GstBaseTransform * trans,
 
 /* base transform vmethods */
 static GstCaps *gst_video_scale_transform_caps (GstBaseTransform * trans,
-    GstPadDirection direction, GstCaps * caps);
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter);
 static gboolean gst_video_scale_set_caps (GstBaseTransform * trans,
     GstCaps * in, GstCaps * out);
 static gboolean gst_video_scale_get_unit_size (GstBaseTransform * trans,
-    GstCaps * caps, guint * size);
+    GstCaps * caps, gsize * size);
+static gboolean gst_video_scale_setup_allocation (GstBaseTransform * trans,
+    GstQuery * query);
 static GstFlowReturn gst_video_scale_transform (GstBaseTransform * trans,
     GstBuffer * in, GstBuffer * out);
 static void gst_video_scale_fixate_caps (GstBaseTransform * base,
@@ -212,28 +192,14 @@ static void gst_video_scale_set_property (GObject * object, guint prop_id,
 static void gst_video_scale_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-GST_BOILERPLATE (GstVideoScale, gst_video_scale, GstVideoFilter,
-    GST_TYPE_VIDEO_FILTER);
-
-static void
-gst_video_scale_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Video scaler", "Filter/Converter/Video/Scaler",
-      "Resizes video", "Wim Taymans <wim.taymans@chello.be>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_video_scale_sink_template_factory ());
-  gst_element_class_add_pad_template (element_class,
-      gst_video_scale_src_template_factory ());
-}
+#define gst_video_scale_parent_class parent_class
+G_DEFINE_TYPE (GstVideoScale, gst_video_scale, GST_TYPE_VIDEO_FILTER);
 
 static void
 gst_video_scale_class_init (GstVideoScaleClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *element_class = (GstElementClass *) klass;
   GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
 
   gobject_class->finalize = (GObjectFinalizeFunc) gst_video_scale_finalize;
@@ -251,18 +217,29 @@ gst_video_scale_class_init (GstVideoScaleClass * klass)
           DEFAULT_PROP_ADD_BORDERS,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (element_class,
+      "Video scaler", "Filter/Converter/Video/Scaler",
+      "Resizes video", "Wim Taymans <wim.taymans@chello.be>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_video_scale_sink_template_factory ());
+  gst_element_class_add_pad_template (element_class,
+      gst_video_scale_src_template_factory ());
+
   trans_class->transform_caps =
       GST_DEBUG_FUNCPTR (gst_video_scale_transform_caps);
   trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_scale_set_caps);
   trans_class->get_unit_size =
       GST_DEBUG_FUNCPTR (gst_video_scale_get_unit_size);
+  trans_class->setup_allocation =
+      GST_DEBUG_FUNCPTR (gst_video_scale_setup_allocation);
   trans_class->transform = GST_DEBUG_FUNCPTR (gst_video_scale_transform);
   trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_scale_fixate_caps);
   trans_class->src_event = GST_DEBUG_FUNCPTR (gst_video_scale_src_event);
 }
 
 static void
-gst_video_scale_init (GstVideoScale * videoscale, GstVideoScaleClass * klass)
+gst_video_scale_init (GstVideoScale * videoscale)
 {
   videoscale->tmp_buf = NULL;
   videoscale->method = DEFAULT_PROP_METHOD;
@@ -327,72 +304,96 @@ gst_video_scale_get_property (GObject * object, guint prop_id, GValue * value,
 
 static GstCaps *
 gst_video_scale_transform_caps (GstBaseTransform * trans,
-    GstPadDirection direction, GstCaps * caps)
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
 {
   GstCaps *ret;
   GstStructure *structure;
-
-  /* this function is always called with a simple caps */
-  g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL);
+  gint i, n;
 
   GST_DEBUG_OBJECT (trans,
       "Transforming caps %" GST_PTR_FORMAT " in direction %s", caps,
       (direction == GST_PAD_SINK) ? "sink" : "src");
 
-  ret = gst_caps_copy (caps);
-  structure = gst_structure_copy (gst_caps_get_structure (ret, 0));
+  ret = gst_caps_new_empty ();
+  n = gst_caps_get_size (caps);
+  for (i = 0; i < n; i++) {
+    structure = gst_caps_get_structure (caps, i);
+
+    /* If this is already expressed by the existing caps
+     * skip this structure */
+    if (i > 0 && gst_caps_is_subset_structure (ret, structure))
+      continue;
+
+    structure = gst_structure_copy (structure);
+    gst_structure_set (structure,
+        "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+        "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+
+    /* if pixel aspect ratio, make a range of it */
+    if (gst_structure_has_field (structure, "pixel-aspect-ratio")) {
+      gst_structure_set (structure, "pixel-aspect-ratio",
+          GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1, NULL);
+    }
+    gst_caps_append_structure (ret, structure);
+  }
 
-  gst_structure_set (structure,
-      "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-      "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+  if (filter) {
+    GstCaps *intersection;
 
-  /* if pixel aspect ratio, make a range of it */
-  if (gst_structure_has_field (structure, "pixel-aspect-ratio")) {
-    gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE,
-        1, G_MAXINT, G_MAXINT, 1, NULL);
+    intersection =
+        gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (ret);
+    ret = intersection;
   }
-  gst_caps_append_structure (ret, structure);
 
   GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
 
   return ret;
 }
 
+
+static gboolean
+gst_video_scale_setup_allocation (GstBaseTransform * trans, GstQuery * query)
+{
+  GstBufferPool *pool = NULL;
+  guint size, min, max, prefix, alignment;
+
+  gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
+      &alignment, &pool);
+
+  if (pool) {
+    GstStructure *config;
+
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_add_option (config,
+        GST_BUFFER_POOL_OPTION_META_VIDEO);
+    gst_buffer_pool_set_config (pool, config);
+  }
+  return TRUE;
+}
+
 static gboolean
 gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
 {
   GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
   gboolean ret;
+  GstVideoInfo in_info, out_info;
   gint from_dar_n, from_dar_d, to_dar_n, to_dar_d;
-  gint from_par_n, from_par_d, to_par_n, to_par_d;
-
-  ret =
-      gst_video_format_parse_caps (in, &videoscale->format,
-      &videoscale->from_width, &videoscale->from_height);
-  ret &=
-      gst_video_format_parse_caps (out, NULL, &videoscale->to_width,
-      &videoscale->to_height);
-  if (!ret)
-    goto done;
 
-  videoscale->src_size = gst_video_format_get_size (videoscale->format,
-      videoscale->from_width, videoscale->from_height);
-  videoscale->dest_size = gst_video_format_get_size (videoscale->format,
-      videoscale->to_width, videoscale->to_height);
-
-  if (!gst_video_parse_caps_pixel_aspect_ratio (in, &from_par_n, &from_par_d))
-    from_par_n = from_par_d = 1;
-  if (!gst_video_parse_caps_pixel_aspect_ratio (out, &to_par_n, &to_par_d))
-    to_par_n = to_par_d = 1;
+  ret = gst_video_info_from_caps (&in_info, in);
+  ret &= gst_video_info_from_caps (&out_info, out);
+  if (!ret)
+    goto invalid_formats;
 
-  if (!gst_util_fraction_multiply (videoscale->from_width,
-          videoscale->from_height, from_par_n, from_par_d, &from_dar_n,
+  if (!gst_util_fraction_multiply (in_info.width,
+          in_info.height, out_info.par_n, out_info.par_d, &from_dar_n,
           &from_dar_d)) {
     from_dar_n = from_dar_d = -1;
   }
 
-  if (!gst_util_fraction_multiply (videoscale->to_width,
-          videoscale->to_height, to_par_n, to_par_d, &to_dar_n, &to_dar_d)) {
+  if (!gst_util_fraction_multiply (out_info.width,
+          out_info.height, out_info.par_n, out_info.par_d, &to_dar_n,
+          &to_dar_d)) {
     to_dar_n = to_dar_d = -1;
   }
 
@@ -402,17 +403,17 @@ gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
       gint n, d, to_h, to_w;
 
       if (from_dar_n != -1 && from_dar_d != -1
-          && gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_n,
-              to_par_d, &n, &d)) {
-        to_h = gst_util_uint64_scale_int (videoscale->to_width, d, n);
-        if (to_h <= videoscale->to_height) {
-          videoscale->borders_h = videoscale->to_height - to_h;
+          && gst_util_fraction_multiply (from_dar_n, from_dar_d, out_info.par_n,
+              out_info.par_d, &n, &d)) {
+        to_h = gst_util_uint64_scale_int (out_info.width, d, n);
+        if (to_h <= out_info.height) {
+          videoscale->borders_h = out_info.height - to_h;
           videoscale->borders_w = 0;
         } else {
-          to_w = gst_util_uint64_scale_int (videoscale->to_height, n, d);
-          g_assert (to_w <= videoscale->to_width);
+          to_w = gst_util_uint64_scale_int (out_info.height, n, d);
+          g_assert (to_w <= out_info.width);
           videoscale->borders_h = 0;
-          videoscale->borders_w = videoscale->to_width - to_w;
+          videoscale->borders_w = out_info.width - to_w;
         }
       } else {
         GST_WARNING_OBJECT (videoscale, "Can't calculate borders");
@@ -424,34 +425,42 @@ gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
 
   if (videoscale->tmp_buf)
     g_free (videoscale->tmp_buf);
-  videoscale->tmp_buf = g_malloc (videoscale->to_width * 8 * 4);
+  videoscale->tmp_buf = g_malloc (out_info.width * 8 * 4);
 
   gst_base_transform_set_passthrough (trans,
-      (videoscale->from_width == videoscale->to_width
-          && videoscale->from_height == videoscale->to_height));
+      (in_info.width == out_info.width && in_info.height == out_info.height));
 
-  GST_DEBUG_OBJECT (videoscale, "from=%dx%d (par=%d/%d dar=%d/%d), size %d "
-      "-> to=%dx%d (par=%d/%d dar=%d/%d borders=%d:%d), size %d",
-      videoscale->from_width, videoscale->from_height, from_par_n, from_par_d,
-      from_dar_n, from_dar_d, videoscale->src_size, videoscale->to_width,
-      videoscale->to_height, to_par_n, to_par_d, to_dar_n, to_dar_d,
-      videoscale->borders_w, videoscale->borders_h, videoscale->dest_size);
+  GST_DEBUG_OBJECT (videoscale, "from=%dx%d (par=%d/%d dar=%d/%d), size %"
+      G_GSIZE_FORMAT " -> to=%dx%d (par=%d/%d dar=%d/%d borders=%d:%d), "
+      "size %" G_GSIZE_FORMAT,
+      in_info.width, in_info.height, out_info.par_n, out_info.par_d,
+      from_dar_n, from_dar_d, in_info.size, out_info.width,
+      out_info.height, out_info.par_n, out_info.par_d, to_dar_n, to_dar_d,
+      videoscale->borders_w, videoscale->borders_h, out_info.size);
 
-done:
-  return ret;
+  videoscale->from_info = in_info;
+  videoscale->to_info = out_info;
+
+  return TRUE;
+
+  /* ERRORS */
+invalid_formats:
+  {
+    GST_DEBUG_OBJECT (videoscale, "could not parse formats");
+    return FALSE;
+  }
 }
 
 static gboolean
 gst_video_scale_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
-    guint * size)
+    gsize * size)
 {
-  GstVideoFormat format;
-  gint width, height;
+  GstVideoInfo info;
 
-  if (!gst_video_format_parse_caps (caps, &format, &width, &height))
+  if (!gst_video_info_from_caps (&info, caps))
     return FALSE;
 
-  *size = gst_video_format_get_size (format, width, height);
+  *size = info.size;
 
   return TRUE;
 }
@@ -891,20 +900,22 @@ done:
 }
 
 static void
-gst_video_scale_setup_vs_image (VSImage * image, GstVideoFormat format,
-    gint component, gint width, gint height, gint b_w, gint b_h, uint8_t * data)
+gst_video_scale_setup_vs_image (VSImage * image, GstVideoFrame * frame,
+    gint component, gint b_w, gint b_h)
 {
-  image->real_width =
-      gst_video_format_get_component_width (format, component, width);
-  image->real_height =
-      gst_video_format_get_component_height (format, component, height);
-  image->width =
-      gst_video_format_get_component_width (format, component, MAX (1,
-          width - b_w));
-  image->height =
-      gst_video_format_get_component_height (format, component, MAX (1,
-          height - b_h));
-  image->stride = gst_video_format_get_row_stride (format, component, width);
+  GstVideoFormat format;
+  gint width, height;
+
+  format = GST_VIDEO_FRAME_FORMAT (frame);
+  width = GST_VIDEO_FRAME_WIDTH (frame);
+  height = GST_VIDEO_FRAME_HEIGHT (frame);
+
+  image->real_width = GST_VIDEO_FRAME_COMP_WIDTH (frame, component);
+  image->real_height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, component);
+  image->width = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (frame->info.finfo,
+      component, MAX (1, width - b_w));
+  image->height = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (frame->info.finfo,
+      component, MAX (1, height - b_h));
 
   image->border_top = (image->real_height - image->height) / 2;
   image->border_bottom = image->real_height - image->height - image->border_top;
@@ -923,21 +934,12 @@ gst_video_scale_setup_vs_image (VSImage * image, GstVideoFormat format,
     image->border_right = image->real_width - image->width - image->border_left;
   }
 
-  if (format == GST_VIDEO_FORMAT_I420
-      || format == GST_VIDEO_FORMAT_YV12
-      || format == GST_VIDEO_FORMAT_Y444
-      || format == GST_VIDEO_FORMAT_Y42B || format == GST_VIDEO_FORMAT_Y41B) {
-    image->real_pixels = data + gst_video_format_get_component_offset (format,
-        component, width, height);
-  } else {
-    g_assert (component == 0);
-    image->real_pixels = data;
-  }
+  image->real_pixels = frame->data[component];
+  image->stride = frame->info.stride[component];
 
   image->pixels =
       image->real_pixels + image->border_top * image->stride +
-      image->border_left * gst_video_format_get_pixel_stride (format,
-      component);
+      image->border_left * GST_VIDEO_FRAME_COMP_PSTRIDE (frame, component);
 }
 
 static const guint8 *
@@ -1007,56 +1009,41 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
 {
   GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
   GstFlowReturn ret = GST_FLOW_OK;
-  VSImage dest = { NULL, };
-  VSImage src = { NULL, };
-  VSImage dest_u = { NULL, };
-  VSImage dest_v = { NULL, };
-  VSImage src_u = { NULL, };
-  VSImage src_v = { NULL, };
+  GstVideoFrame in_frame, out_frame;
+  VSImage dest[4] = { {NULL,}, };
+  VSImage src[4] = { {NULL,}, };
   gint method;
-  const guint8 *black = _get_black_for_format (videoscale->format);
+  const guint8 *black;
   gboolean add_borders;
+  GstVideoFormat format;
+  gint i;
 
   GST_OBJECT_LOCK (videoscale);
   method = videoscale->method;
   add_borders = videoscale->add_borders;
   GST_OBJECT_UNLOCK (videoscale);
 
-  if (videoscale->from_width == 1) {
+  format = GST_VIDEO_INFO_FORMAT (&videoscale->from_info);
+  black = _get_black_for_format (format);
+
+  if (videoscale->from_info.width == 1) {
     method = GST_VIDEO_SCALE_NEAREST;
   }
   if (method == GST_VIDEO_SCALE_4TAP &&
-      (videoscale->from_width < 4 || videoscale->from_height < 4)) {
+      (videoscale->from_info.width < 4 || videoscale->from_info.height < 4)) {
     method = GST_VIDEO_SCALE_BILINEAR;
   }
 
-  gst_video_scale_setup_vs_image (&src, videoscale->format, 0,
-      videoscale->from_width, videoscale->from_height, 0, 0,
-      GST_BUFFER_DATA (in));
-  gst_video_scale_setup_vs_image (&dest, videoscale->format, 0,
-      videoscale->to_width, videoscale->to_height, videoscale->borders_w,
-      videoscale->borders_h, GST_BUFFER_DATA (out));
-
-  if (videoscale->format == GST_VIDEO_FORMAT_I420
-      || videoscale->format == GST_VIDEO_FORMAT_YV12
-      || videoscale->format == GST_VIDEO_FORMAT_Y444
-      || videoscale->format == GST_VIDEO_FORMAT_Y42B
-      || videoscale->format == GST_VIDEO_FORMAT_Y41B) {
-    gst_video_scale_setup_vs_image (&src_u, videoscale->format, 1,
-        videoscale->from_width, videoscale->from_height, 0, 0,
-        GST_BUFFER_DATA (in));
-    gst_video_scale_setup_vs_image (&src_v, videoscale->format, 2,
-        videoscale->from_width, videoscale->from_height, 0, 0,
-        GST_BUFFER_DATA (in));
-    gst_video_scale_setup_vs_image (&dest_u, videoscale->format, 1,
-        videoscale->to_width, videoscale->to_height, videoscale->borders_w,
-        videoscale->borders_h, GST_BUFFER_DATA (out));
-    gst_video_scale_setup_vs_image (&dest_v, videoscale->format, 2,
-        videoscale->to_width, videoscale->to_height, videoscale->borders_w,
-        videoscale->borders_h, GST_BUFFER_DATA (out));
+  gst_video_frame_map (&in_frame, &videoscale->from_info, in, GST_MAP_READ);
+  gst_video_frame_map (&out_frame, &videoscale->to_info, out, GST_MAP_WRITE);
+
+  for (i = 0; i < GST_VIDEO_FRAME_N_PLANES (&in_frame); i++) {
+    gst_video_scale_setup_vs_image (&src[i], &in_frame, i, 0, 0);
+    gst_video_scale_setup_vs_image (&dest[i], &out_frame, i,
+        videoscale->borders_w, videoscale->borders_h);
   }
 
-  switch (videoscale->format) {
+  switch (format) {
     case GST_VIDEO_FORMAT_RGBx:
     case GST_VIDEO_FORMAT_xRGB:
     case GST_VIDEO_FORMAT_BGRx:
@@ -1067,16 +1054,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_ABGR:
     case GST_VIDEO_FORMAT_AYUV:
       if (add_borders)
-        vs_fill_borders_RGBA (&dest, black);
+        vs_fill_borders_RGBA (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_RGBA (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_RGBA (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_RGBA (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_RGBA (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_RGBA (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_RGBA (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1085,16 +1072,17 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_ARGB64:
     case GST_VIDEO_FORMAT_AYUV64:
       if (add_borders)
-        vs_fill_borders_AYUV64 (&dest, black);
+        vs_fill_borders_AYUV64 (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_AYUV64 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_AYUV64 (&dest[0], &src[0],
+              videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_AYUV64 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_AYUV64 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_AYUV64 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_AYUV64 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1104,16 +1092,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_BGR:
     case GST_VIDEO_FORMAT_v308:
       if (add_borders)
-        vs_fill_borders_RGB (&dest, black);
+        vs_fill_borders_RGB (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_RGB (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_RGB (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_RGB (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_RGB (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_RGB (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_RGB (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1122,16 +1110,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_YUY2:
     case GST_VIDEO_FORMAT_YVYU:
       if (add_borders)
-        vs_fill_borders_YUYV (&dest, black);
+        vs_fill_borders_YUYV (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_YUYV (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_YUYV (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_YUYV (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_YUYV (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_YUYV (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_YUYV (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1139,16 +1127,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
       break;
     case GST_VIDEO_FORMAT_UYVY:
       if (add_borders)
-        vs_fill_borders_UYVY (&dest, black);
+        vs_fill_borders_UYVY (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_UYVY (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_UYVY (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_UYVY (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_UYVY (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_UYVY (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_UYVY (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1157,16 +1145,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_Y800:
     case GST_VIDEO_FORMAT_GRAY8:
       if (add_borders)
-        vs_fill_borders_Y (&dest, black);
+        vs_fill_borders_Y (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_Y (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_Y (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_Y (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_Y (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_Y (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_Y (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1176,16 +1164,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_GRAY16_BE:
     case GST_VIDEO_FORMAT_Y16:
       if (add_borders)
-        vs_fill_borders_Y16 (&dest, 0);
+        vs_fill_borders_Y16 (&dest[0], 0);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_Y16 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_Y16 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_Y16 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_Y16 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_Y16 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_Y16 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1197,25 +1185,25 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
     case GST_VIDEO_FORMAT_Y42B:
     case GST_VIDEO_FORMAT_Y41B:
       if (add_borders) {
-        vs_fill_borders_Y (&dest, black);
-        vs_fill_borders_Y (&dest_u, black + 1);
-        vs_fill_borders_Y (&dest_v, black + 2);
+        vs_fill_borders_Y (&dest[0], black);
+        vs_fill_borders_Y (&dest[1], black + 1);
+        vs_fill_borders_Y (&dest[2], black + 2);
       }
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_Y (&dest, &src, videoscale->tmp_buf);
-          vs_image_scale_nearest_Y (&dest_u, &src_u, videoscale->tmp_buf);
-          vs_image_scale_nearest_Y (&dest_v, &src_v, videoscale->tmp_buf);
+          vs_image_scale_nearest_Y (&dest[0], &src[0], videoscale->tmp_buf);
+          vs_image_scale_nearest_Y (&dest[1], &src[1], videoscale->tmp_buf);
+          vs_image_scale_nearest_Y (&dest[2], &src[2], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_Y (&dest, &src, videoscale->tmp_buf);
-          vs_image_scale_linear_Y (&dest_u, &src_u, videoscale->tmp_buf);
-          vs_image_scale_linear_Y (&dest_v, &src_v, videoscale->tmp_buf);
+          vs_image_scale_linear_Y (&dest[0], &src[0], videoscale->tmp_buf);
+          vs_image_scale_linear_Y (&dest[1], &src[1], videoscale->tmp_buf);
+          vs_image_scale_linear_Y (&dest[2], &src[2], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_Y (&dest, &src, videoscale->tmp_buf);
-          vs_image_scale_4tap_Y (&dest_u, &src_u, videoscale->tmp_buf);
-          vs_image_scale_4tap_Y (&dest_v, &src_v, videoscale->tmp_buf);
+          vs_image_scale_4tap_Y (&dest[0], &src[0], videoscale->tmp_buf);
+          vs_image_scale_4tap_Y (&dest[1], &src[1], videoscale->tmp_buf);
+          vs_image_scale_4tap_Y (&dest[2], &src[2], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1223,16 +1211,17 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
       break;
     case GST_VIDEO_FORMAT_RGB16:
       if (add_borders)
-        vs_fill_borders_RGB565 (&dest, black);
+        vs_fill_borders_RGB565 (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_RGB565 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_RGB565 (&dest[0], &src[0],
+              videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_RGB565 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_RGB565 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_RGB565 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_RGB565 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1240,16 +1229,17 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
       break;
     case GST_VIDEO_FORMAT_RGB15:
       if (add_borders)
-        vs_fill_borders_RGB555 (&dest, black);
+        vs_fill_borders_RGB555 (&dest[0], black);
       switch (method) {
         case GST_VIDEO_SCALE_NEAREST:
-          vs_image_scale_nearest_RGB555 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_nearest_RGB555 (&dest[0], &src[0],
+              videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_BILINEAR:
-          vs_image_scale_linear_RGB555 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_linear_RGB555 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         case GST_VIDEO_SCALE_4TAP:
-          vs_image_scale_4tap_RGB555 (&dest, &src, videoscale->tmp_buf);
+          vs_image_scale_4tap_RGB555 (&dest[0], &src[0], videoscale->tmp_buf);
           break;
         default:
           goto unknown_mode;
@@ -1259,8 +1249,12 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
       goto unsupported;
   }
 
-  GST_LOG_OBJECT (videoscale, "pushing buffer of %d bytes",
-      GST_BUFFER_SIZE (out));
+  GST_LOG_OBJECT (videoscale, "pushing buffer of %" G_GSIZE_FORMAT " bytes",
+      gst_buffer_get_size (out));
+
+done:
+  gst_video_frame_unmap (&out_frame);
+  gst_video_frame_unmap (&in_frame);
 
   return ret;
 
@@ -1268,15 +1262,16 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
 unsupported:
   {
     GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
-        ("Unsupported format %d for scaling method %d",
-            videoscale->format, method));
-    return GST_FLOW_ERROR;
+        ("Unsupported format %d for scaling method %d", format, method));
+    ret = GST_FLOW_ERROR;
+    goto done;
   }
 unknown_mode:
   {
     GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
         ("Unknown scaling method %d", videoscale->method));
-    return GST_FLOW_ERROR;
+    ret = GST_FLOW_ERROR;
+    goto done;
   }
 }
 
@@ -1299,11 +1294,12 @@ gst_video_scale_src_event (GstBaseTransform * trans, GstEvent * event)
       structure = (GstStructure *) gst_event_get_structure (event);
       if (gst_structure_get_double (structure, "pointer_x", &a)) {
         gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
-            a * videoscale->from_width / videoscale->to_width, NULL);
+            a * videoscale->from_info.width / videoscale->to_info.width, NULL);
       }
       if (gst_structure_get_double (structure, "pointer_y", &a)) {
         gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
-            a * videoscale->from_height / videoscale->to_height, NULL);
+            a * videoscale->from_info.height / videoscale->to_info.height,
+            NULL);
       }
       break;
     default:
index a09d769..af8adab 100644 (file)
@@ -71,13 +71,8 @@ struct _GstVideoScale {
   gboolean add_borders;
 
   /* negotiated stuff */
-  GstVideoFormat format;
-  gint to_width;
-  gint to_height;
-  gint from_width;
-  gint from_height;
-  guint src_size;
-  guint dest_size;
+  GstVideoInfo from_info;
+  GstVideoInfo to_info;
 
   gint borders_h;
   gint borders_w;
index 814899f..cbfda81 100644 (file)
@@ -8,9 +8,11 @@ libgstvideotestsrc_la_SOURCES = \
                        videotestsrc.c
 nodist_libgstvideotestsrc_la_SOURCES = $(ORC_NODIST_SOURCES)
 
-libgstvideotestsrc_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
+libgstvideotestsrc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
 libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideotestsrc_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
+libgstvideotestsrc_la_LIBADD =         \
+       $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
+       $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
 libgstvideotestsrc_la_LIBTOOLFLAGS = --tag=disable-static
 
 noinst_HEADERS = gstvideotestsrc.h videotestsrc.h
index 227e0a9..f473f94 100644 (file)
@@ -49,7 +49,6 @@ GST_DEBUG_CATEGORY_STATIC (video_test_src_debug);
 #define DEFAULT_PATTERN            GST_VIDEO_TEST_SRC_SMPTE
 #define DEFAULT_TIMESTAMP_OFFSET   0
 #define DEFAULT_IS_LIVE            FALSE
-#define DEFAULT_PEER_ALLOC         TRUE
 #define DEFAULT_COLOR_SPEC         GST_VIDEO_TEST_SRC_BT601
 #define DEFAULT_FOREGROUND_COLOR   0xffffffff
 #define DEFAULT_BACKGROUND_COLOR   0xff000000
@@ -61,7 +60,6 @@ enum
   PROP_PATTERN,
   PROP_TIMESTAMP_OFFSET,
   PROP_IS_LIVE,
-  PROP_PEER_ALLOC,
   PROP_COLOR_SPEC,
   PROP_K0,
   PROP_KX,
@@ -82,9 +80,8 @@ enum
 };
 
 
-GST_BOILERPLATE (GstVideoTestSrc, gst_video_test_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC);
-
+#define gst_video_test_src_parent_class parent_class
+G_DEFINE_TYPE (GstVideoTestSrc, gst_video_test_src, GST_TYPE_PUSH_SRC);
 
 static void gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
     int pattern_type);
@@ -93,9 +90,10 @@ static void gst_video_test_src_set_property (GObject * object, guint prop_id,
 static void gst_video_test_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static GstCaps *gst_video_test_src_getcaps (GstBaseSrc * bsrc);
+static GstCaps *gst_video_test_src_getcaps (GstBaseSrc * bsrc,
+    GstCaps * filter);
 static gboolean gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
-static void gst_video_test_src_src_fixate (GstPad * pad, GstCaps * caps);
+static void gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
 
 static gboolean gst_video_test_src_is_seekable (GstBaseSrc * psrc);
 static gboolean gst_video_test_src_do_seek (GstBaseSrc * bsrc,
@@ -104,9 +102,12 @@ static gboolean gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query);
 
 static void gst_video_test_src_get_times (GstBaseSrc * basesrc,
     GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
-static GstFlowReturn gst_video_test_src_create (GstPushSrc * psrc,
-    GstBuffer ** buffer);
+static gboolean gst_video_test_src_setup_allocation (GstBaseSrc * bsrc,
+    GstQuery * query);
+static GstFlowReturn gst_video_test_src_fill (GstPushSrc * psrc,
+    GstBuffer * buffer);
 static gboolean gst_video_test_src_start (GstBaseSrc * basesrc);
+static gboolean gst_video_test_src_stop (GstBaseSrc * basesrc);
 
 #define GST_TYPE_VIDEO_TEST_SRC_PATTERN (gst_video_test_src_pattern_get_type ())
 static GType
@@ -165,27 +166,16 @@ gst_video_test_src_color_spec_get_type (void)
 }
 
 static void
-gst_video_test_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Video test source", "Source/Video",
-      "Creates a test video stream", "David A. Schleef <ds@schleef.org>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
-          gst_video_test_src_getcaps (NULL)));
-}
-
-static void
 gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
   GstBaseSrcClass *gstbasesrc_class;
   GstPushSrcClass *gstpushsrc_class;
+  GstCaps *templ_caps;
 
   gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
   gstpushsrc_class = (GstPushSrcClass *) klass;
 
@@ -204,10 +194,6 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
       g_param_spec_boolean ("is-live", "Is Live",
           "Whether to act as a live source", DEFAULT_IS_LIVE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_PEER_ALLOC,
-      g_param_spec_boolean ("peer-alloc", "Peer Alloc",
-          "Ask the peer to allocate an output buffer", DEFAULT_PEER_ALLOC,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_COLOR_SPEC,
       g_param_spec_enum ("colorspec", "Color Specification",
           "Generate video in the given color specification (Deprecated: "
@@ -303,24 +289,32 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
           G_MININT32, G_MAXINT32, DEFAULT_HORIZONTAL_SPEED,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "Video test source", "Source/Video",
+      "Creates a test video stream", "David A. Schleef <ds@schleef.org>");
+
+  templ_caps = gst_video_test_src_getcaps (NULL, NULL);
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps));
+  gst_caps_unref (templ_caps);
+
   gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
   gstbasesrc_class->set_caps = gst_video_test_src_setcaps;
+  gstbasesrc_class->fixate = gst_video_test_src_src_fixate;
   gstbasesrc_class->is_seekable = gst_video_test_src_is_seekable;
   gstbasesrc_class->do_seek = gst_video_test_src_do_seek;
   gstbasesrc_class->query = gst_video_test_src_query;
   gstbasesrc_class->get_times = gst_video_test_src_get_times;
   gstbasesrc_class->start = gst_video_test_src_start;
+  gstbasesrc_class->stop = gst_video_test_src_stop;
+  gstbasesrc_class->setup_allocation = gst_video_test_src_setup_allocation;
 
-  gstpushsrc_class->create = gst_video_test_src_create;
+  gstpushsrc_class->fill = gst_video_test_src_fill;
 }
 
 static void
-gst_video_test_src_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class)
+gst_video_test_src_init (GstVideoTestSrc * src)
 {
-  GstPad *pad = GST_BASE_SRC_PAD (src);
-
-  gst_pad_set_fixatecaps_function (pad, gst_video_test_src_src_fixate);
-
   gst_video_test_src_set_pattern (src, DEFAULT_PATTERN);
 
   src->timestamp_offset = DEFAULT_TIMESTAMP_OFFSET;
@@ -331,11 +325,10 @@ gst_video_test_src_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class)
   /* we operate in time */
   gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
   gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
-  src->peer_alloc = DEFAULT_PEER_ALLOC;
 }
 
 static void
-gst_video_test_src_src_fixate (GstPad * pad, GstCaps * caps)
+gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 {
   GstStructure *structure;
 
@@ -354,6 +347,8 @@ gst_video_test_src_src_fixate (GstPad * pad, GstCaps * caps)
 
   if (gst_structure_has_field (structure, "interlaced"))
     gst_structure_fixate_field_boolean (structure, "interlaced", FALSE);
+
+  GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 }
 
 static void
@@ -449,9 +444,6 @@ gst_video_test_src_set_property (GObject * object, guint prop_id,
     case PROP_IS_LIVE:
       gst_base_src_set_live (GST_BASE_SRC (src), g_value_get_boolean (value));
       break;
-    case PROP_PEER_ALLOC:
-      src->peer_alloc = g_value_get_boolean (value);
-      break;
     case PROP_COLOR_SPEC:
       break;
     case PROP_K0:
@@ -519,9 +511,6 @@ gst_video_test_src_get_property (GObject * object, guint prop_id,
     case PROP_IS_LIVE:
       g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (src)));
       break;
-    case PROP_PEER_ALLOC:
-      g_value_set_boolean (value, src->peer_alloc);
-      break;
     case PROP_COLOR_SPEC:
       break;
     case PROP_K0:
@@ -575,9 +564,26 @@ gst_video_test_src_get_property (GObject * object, guint prop_id,
   }
 }
 
+static GstVideoTestSrcColorSpec
+to_color_spec (const gchar * csp)
+{
+  if (csp) {
+    if (strcmp (csp, "sdtv") == 0) {
+      return GST_VIDEO_TEST_SRC_BT601;
+    } else if (strcmp (csp, "hdtv") == 0) {
+      return GST_VIDEO_TEST_SRC_BT709;
+    } else {
+      GST_DEBUG ("unknown color-matrix");
+      return GST_VIDEO_TEST_SRC_UNKNOWN;
+    }
+  } else {
+    return GST_VIDEO_TEST_SRC_BT601;
+  }
+}
+
 /* threadsafe because this gets called as the plugin is loaded */
 static GstCaps *
-gst_video_test_src_getcaps (GstBaseSrc * bsrc)
+gst_video_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
 {
   static GstCaps *capslist = NULL;
 
@@ -587,8 +593,8 @@ gst_video_test_src_getcaps (GstBaseSrc * bsrc)
     int i;
 
     caps = gst_caps_new_empty ();
-    for (i = 0; i < n_fourccs; i++) {
-      structure = paint_get_structure (fourcc_list + i);
+    for (i = 0; i < n_formats; i++) {
+      structure = paint_get_structure (format_list + i);
       gst_structure_set (structure,
           "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
@@ -599,61 +605,40 @@ gst_video_test_src_getcaps (GstBaseSrc * bsrc)
     capslist = caps;
   }
 
-  return gst_caps_copy (capslist);
+  if (filter)
+    return gst_caps_intersect_full (filter, capslist, GST_CAPS_INTERSECT_FIRST);
+  else
+    return gst_caps_ref (capslist);
 }
 
 static gboolean
 gst_video_test_src_parse_caps (const GstCaps * caps,
-    gint * width, gint * height, gint * rate_numerator, gint * rate_denominator,
-    struct fourcc_list_struct **fourcc, GstVideoTestSrcColorSpec * color_spec)
+    gint * width, gint * height, gint * fps_n, gint * fps_d,
+    const gchar ** color_matrix)
 {
   const GstStructure *structure;
   GstPadLinkReturn ret;
   const GValue *framerate;
-  const char *csp;
 
   GST_DEBUG ("parsing caps");
 
-  if (gst_caps_get_size (caps) < 1)
-    return FALSE;
-
   structure = gst_caps_get_structure (caps, 0);
 
-  if (!(*fourcc = paintinfo_find_by_structure (structure)))
-    goto unknown_format;
-
   ret = gst_structure_get_int (structure, "width", width);
   ret &= gst_structure_get_int (structure, "height", height);
   framerate = gst_structure_get_value (structure, "framerate");
 
   if (framerate) {
-    *rate_numerator = gst_value_get_fraction_numerator (framerate);
-    *rate_denominator = gst_value_get_fraction_denominator (framerate);
+    *fps_n = gst_value_get_fraction_numerator (framerate);
+    *fps_d = gst_value_get_fraction_denominator (framerate);
   } else
     goto no_framerate;
 
-  csp = gst_structure_get_string (structure, "color-matrix");
-  if (csp) {
-    if (strcmp (csp, "sdtv") == 0) {
-      *color_spec = GST_VIDEO_TEST_SRC_BT601;
-    } else if (strcmp (csp, "hdtv") == 0) {
-      *color_spec = GST_VIDEO_TEST_SRC_BT709;
-    } else {
-      GST_DEBUG ("unknown color-matrix");
-      return FALSE;
-    }
-  } else {
-    *color_spec = GST_VIDEO_TEST_SRC_BT601;
-  }
+  *color_matrix = gst_structure_get_string (structure, "color-matrix");
 
   return ret;
 
   /* ERRORS */
-unknown_format:
-  {
-    GST_DEBUG ("videotestsrc format not found");
-    return FALSE;
-  }
 no_framerate:
   {
     GST_DEBUG ("videotestsrc no framerate given");
@@ -662,33 +647,90 @@ no_framerate:
 }
 
 static gboolean
+gst_video_test_src_setup_allocation (GstBaseSrc * bsrc, GstQuery * query)
+{
+  GstVideoTestSrc *videotestsrc;
+  GstBufferPool *pool;
+  guint size, min, max, prefix, alignment;
+
+  videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
+
+  gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
+      &alignment, &pool);
+  /* adjust size */
+  size = MAX (size, videotestsrc->info.size);
+
+  if (pool) {
+    GstStructure *config;
+
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_add_option (config,
+        GST_BUFFER_POOL_OPTION_META_VIDEO);
+    gst_buffer_pool_set_config (pool, config);
+  }
+  gst_query_set_allocation_params (query, size, min, max, prefix,
+      alignment, pool);
+
+  return TRUE;
+}
+
+static gboolean
 gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
 {
-  gboolean res;
-  gint width, height, rate_denominator, rate_numerator;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  const GstStructure *structure;
   GstVideoTestSrc *videotestsrc;
-  GstVideoTestSrcColorSpec color_spec;
+  GstVideoInfo info;
 
   videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
 
-  res = gst_video_test_src_parse_caps (caps, &width, &height,
-      &rate_numerator, &rate_denominator, &fourcc, &color_spec);
-  if (res) {
-    /* looks ok here */
-    videotestsrc->fourcc = fourcc;
-    videotestsrc->width = width;
-    videotestsrc->height = height;
-    videotestsrc->rate_numerator = rate_numerator;
-    videotestsrc->rate_denominator = rate_denominator;
-    videotestsrc->bpp = videotestsrc->fourcc->bitspp;
-    videotestsrc->color_spec = color_spec;
-
-    GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
-        videotestsrc->width, videotestsrc->height,
-        videotestsrc->rate_numerator, videotestsrc->rate_denominator);
+  structure = gst_caps_get_structure (caps, 0);
+
+  if (gst_structure_has_name (structure, "video/x-raw")) {
+    /* we can use the parsing code */
+    if (!gst_video_info_from_caps (&info, caps))
+      goto parse_failed;
+
+  } else if (gst_structure_has_name (structure, "video/x-raw-bayer")) {
+    if (!gst_video_test_src_parse_caps (caps, &info.width, &info.height,
+            &info.fps_n, &info.fps_d, &info.color_matrix))
+      goto parse_failed;
+
+    info.size =
+        gst_video_test_src_get_size (videotestsrc, info.width, info.height);
+  }
+
+  if (!(format = paintinfo_find_by_structure (structure)))
+    goto unknown_format;
+
+  /* looks ok here */
+  videotestsrc->color_spec = to_color_spec (info.color_matrix);
+  videotestsrc->format = format;
+  videotestsrc->info = info;
+
+  GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
+      info.width, info.height, info.fps_n, info.fps_d);
+
+  g_free (videotestsrc->tmpline);
+  g_free (videotestsrc->tmpline2);
+  g_free (videotestsrc->tmpline_u8);
+  videotestsrc->tmpline_u8 = g_malloc (info.width + 8);
+  videotestsrc->tmpline = g_malloc ((info.width + 8) * 4);
+  videotestsrc->tmpline2 = g_malloc ((info.width + 8) * 4);
+
+  return TRUE;
+
+  /* ERRORS */
+parse_failed:
+  {
+    GST_DEBUG_OBJECT (bsrc, "failed to parse caps");
+    return FALSE;
+  }
+unknown_format:
+  {
+    GST_DEBUG ("videotestsrc format not found");
+    return FALSE;
   }
-  return res;
 }
 
 static gboolean
@@ -706,61 +748,17 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
       gint64 src_val, dest_val;
 
       gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
-      if (src_fmt == dest_fmt) {
-        dest_val = src_val;
-        goto done;
-      }
-
-      switch (src_fmt) {
-        case GST_FORMAT_DEFAULT:
-          switch (dest_fmt) {
-            case GST_FORMAT_TIME:
-              /* frames to time */
-              if (src->rate_numerator) {
-                dest_val = gst_util_uint64_scale (src_val,
-                    src->rate_denominator * GST_SECOND, src->rate_numerator);
-              } else {
-                dest_val = 0;
-              }
-              break;
-            default:
-              goto error;
-          }
-          break;
-        case GST_FORMAT_TIME:
-          switch (dest_fmt) {
-            case GST_FORMAT_DEFAULT:
-              /* time to frames */
-              if (src->rate_numerator) {
-                dest_val = gst_util_uint64_scale (src_val,
-                    src->rate_numerator, src->rate_denominator * GST_SECOND);
-              } else {
-                dest_val = 0;
-              }
-              break;
-            default:
-              goto error;
-          }
-          break;
-        default:
-          goto error;
-      }
-    done:
+      res =
+          gst_video_info_convert (&src->info, src_fmt, src_val, dest_fmt,
+          &dest_val);
       gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
-      res = TRUE;
       break;
     }
     default:
       res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
+      break;
   }
   return res;
-
-  /* ERROR */
-error:
-  {
-    GST_DEBUG_OBJECT (src, "query failed");
-    return FALSE;
-  }
 }
 
 static void
@@ -789,30 +787,30 @@ gst_video_test_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
 static gboolean
 gst_video_test_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
 {
-  GstClockTime time;
+  GstClockTime position;
   GstVideoTestSrc *src;
 
   src = GST_VIDEO_TEST_SRC (bsrc);
 
   segment->time = segment->start;
-  time = segment->last_stop;
+  position = segment->position;
 
-  /* now move to the time indicated */
-  if (src->rate_numerator) {
-    src->n_frames = gst_util_uint64_scale (time,
-        src->rate_numerator, src->rate_denominator * GST_SECOND);
+  /* now move to the position indicated */
+  if (src->info.fps_n) {
+    src->n_frames = gst_util_uint64_scale (position,
+        src->info.fps_n, src->info.fps_d * GST_SECOND);
   } else {
     src->n_frames = 0;
   }
-  if (src->rate_numerator) {
+  if (src->info.fps_n) {
     src->running_time = gst_util_uint64_scale (src->n_frames,
-        src->rate_denominator * GST_SECOND, src->rate_numerator);
+        src->info.fps_d * GST_SECOND, src->info.fps_n);
   } else {
     /* FIXME : Not sure what to set here */
     src->running_time = 0;
   }
 
-  g_assert (src->running_time <= time);
+  g_assert (src->running_time <= position);
 
   return TRUE;
 }
@@ -825,85 +823,47 @@ gst_video_test_src_is_seekable (GstBaseSrc * psrc)
 }
 
 static GstFlowReturn
-gst_video_test_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
+gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
 {
   GstVideoTestSrc *src;
-  gulong newsize, size;
-  GstBuffer *outbuf = NULL;
-  GstFlowReturn res;
   GstClockTime next_time;
+  GstVideoFrame frame;
 
   src = GST_VIDEO_TEST_SRC (psrc);
 
-  if (G_UNLIKELY (src->fourcc == NULL))
+  if (G_UNLIKELY (src->format == NULL))
     goto not_negotiated;
 
   /* 0 framerate and we are at the second frame, eos */
-  if (G_UNLIKELY (src->rate_numerator == 0 && src->n_frames == 1))
+  if (G_UNLIKELY (src->info.fps_n == 0 && src->n_frames == 1))
     goto eos;
 
-  newsize = gst_video_test_src_get_size (src, src->width, src->height);
-
-  g_return_val_if_fail (newsize > 0, GST_FLOW_ERROR);
-
   GST_LOG_OBJECT (src,
-      "creating buffer of %lu bytes with %dx%d image for frame %d", newsize,
-      src->width, src->height, (gint) src->n_frames);
-
-  if (src->peer_alloc) {
-    res =
-        gst_pad_alloc_buffer_and_set_caps (GST_BASE_SRC_PAD (psrc),
-        GST_BUFFER_OFFSET_NONE, newsize, GST_PAD_CAPS (GST_BASE_SRC_PAD (psrc)),
-        &outbuf);
-    if (res != GST_FLOW_OK)
-      goto no_buffer;
-
-    /* the buffer could have renegotiated, we need to discard any buffers of the
-     * wrong size. */
-    size = GST_BUFFER_SIZE (outbuf);
-    newsize = gst_video_test_src_get_size (src, src->width, src->height);
-
-    if (size != newsize) {
-      gst_buffer_unref (outbuf);
-      outbuf = NULL;
-    }
-  }
+      "creating buffer from pool for frame %d", (gint) src->n_frames);
 
-  if (outbuf == NULL) {
-    outbuf = gst_buffer_new_and_alloc (newsize);
-    gst_buffer_set_caps (outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (psrc)));
-  }
-
-  memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
-  src->tmpline_u8 = g_malloc (src->width + 8);
-  src->tmpline = g_malloc ((src->width + 8) * 4);
-  src->tmpline2 = g_malloc ((src->width + 8) * 4);
+  if (!gst_video_frame_map (&frame, &src->info, buffer, GST_MAP_WRITE))
+    goto invalid_frame;
 
-  src->make_image (src, (void *) GST_BUFFER_DATA (outbuf),
-      src->width, src->height);
+  src->make_image (src, &frame);
 
-  g_free (src->tmpline);
-  g_free (src->tmpline2);
-  g_free (src->tmpline_u8);
+  gst_video_frame_unmap (&frame);
 
-  GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;
-  GST_BUFFER_OFFSET (outbuf) = src->n_frames;
+  GST_BUFFER_TIMESTAMP (buffer) = src->timestamp_offset + src->running_time;
+  GST_BUFFER_OFFSET (buffer) = src->n_frames;
   src->n_frames++;
-  GST_BUFFER_OFFSET_END (outbuf) = src->n_frames;
-  if (src->rate_numerator) {
+  GST_BUFFER_OFFSET_END (buffer) = src->n_frames;
+  if (src->info.fps_n) {
     next_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND,
-        src->rate_denominator, src->rate_numerator);
-    GST_BUFFER_DURATION (outbuf) = next_time - src->running_time;
+        src->info.fps_d, src->info.fps_n);
+    GST_BUFFER_DURATION (buffer) = next_time - src->running_time;
   } else {
     next_time = src->timestamp_offset;
     /* NONE means forever */
-    GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
+    GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
   }
 
   src->running_time = next_time;
 
-  *buffer = outbuf;
-
   return GST_FLOW_OK;
 
 not_negotiated:
@@ -917,11 +877,10 @@ eos:
     GST_DEBUG_OBJECT (src, "eos: 0 framerate, frame %d", (gint) src->n_frames);
     return GST_FLOW_UNEXPECTED;
   }
-no_buffer:
+invalid_frame:
   {
-    GST_DEBUG_OBJECT (src, "could not allocate buffer, reason %s",
-        gst_flow_get_name (res));
-    return res;
+    GST_DEBUG_OBJECT (src, "invalid frame");
+    return GST_FLOW_OK;
   }
 }
 
@@ -937,6 +896,21 @@ gst_video_test_src_start (GstBaseSrc * basesrc)
 }
 
 static gboolean
+gst_video_test_src_stop (GstBaseSrc * basesrc)
+{
+  GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (basesrc);
+
+  g_free (src->tmpline);
+  src->tmpline = NULL;
+  g_free (src->tmpline2);
+  src->tmpline2 = NULL;
+  g_free (src->tmpline_u8);
+  src->tmpline_u8 = NULL;
+
+  return TRUE;
+}
+
+static gboolean
 plugin_init (GstPlugin * plugin)
 {
   gst_videotestsrc_orc_init ();
index ae63281..31673f8 100644 (file)
@@ -24,6 +24,9 @@
 #include <gst/gst.h>
 #include <gst/base/gstpushsrc.h>
 
+#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideopool.h>
+
 G_BEGIN_DECLS
 
 #define GST_TYPE_VIDEO_TEST_SRC \
@@ -111,6 +114,7 @@ typedef enum {
  * The color specification to use.
  */
 typedef enum {
+  GST_VIDEO_TEST_SRC_UNKNOWN,
   GST_VIDEO_TEST_SRC_BT601,
   GST_VIDEO_TEST_SRC_BT709
 } GstVideoTestSrcColorSpec;
@@ -135,19 +139,15 @@ struct _GstVideoTestSrc {
   GstVideoTestSrcColorSpec color_spec;
 
   /* video state */
+  GstVideoInfo info;
+
   char *format_name;
-  gint width;
-  gint height;
-  struct fourcc_list_struct *fourcc;
-  gint bpp;
-  gint rate_numerator;
-  gint rate_denominator;
+  struct format_list_struct *format;
 
   /* private */
   gint64 timestamp_offset;              /* base offset */
   GstClockTime running_time;            /* total running time */
   gint64 n_frames;                      /* total frames sent */
-  gboolean peer_alloc;
 
   /* zoneplate */
   gint k0;
@@ -171,7 +171,7 @@ struct _GstVideoTestSrc {
   gint horizontal_offset;
   gint horizontal_speed;
 
-  void (*make_image) (GstVideoTestSrc *v, unsigned char *dest, int w, int h);
+  void (*make_image) (GstVideoTestSrc *v, GstVideoFrame *frame);
 
   /* temporary AYUV/ARGB scanline */
   guint8 *tmpline_u8;
index ecc83f8..be5dd46 100644 (file)
@@ -125,50 +125,50 @@ static const struct vts_color_struct vts_colors_bt601_ycbcr_75[] = {
 };
 
 
-static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_UYVY (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVYU (paintinfo * p, unsigned char *dest);
+static void paint_setup_I420 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YV12 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YUY2 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_UYVY (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YVYU (paintinfo * p, GstVideoFrame * frame);
 #ifdef disabled
-static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest);
+static void paint_setup_IYU2 (paintinfo * p, GstVideoFrame * frame);
 #endif
-static void paint_setup_Y41B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y42B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y444 (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y800 (paintinfo * p, unsigned char *dest);
-static void paint_setup_AYUV (paintinfo * p, unsigned char *dest);
-static void paint_setup_v308 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV21 (paintinfo * p, unsigned char *dest);
+static void paint_setup_Y41B (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_Y42B (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_Y444 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_Y800 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_AYUV (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_v308 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_NV12 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_NV21 (paintinfo * p, GstVideoFrame * frame);
 #ifdef disabled
-static void paint_setup_v410 (paintinfo * p, unsigned char *dest);
+static void paint_setup_v410 (paintinfo * p, GstVideoFrame * frame);
 #endif
-static void paint_setup_v216 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v210 (paintinfo * p, unsigned char *dest);
-static void paint_setup_UYVP (paintinfo * p, unsigned char *dest);
-static void paint_setup_AY64 (paintinfo * p, unsigned char *dest);
-
-static void paint_setup_YUV9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVU9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ARGB8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ABGR8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGBA8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGRA8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGB888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGR888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGB565 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ARGB64 (paintinfo * p, unsigned char *dest);
-
-static void paint_setup_bayer_bggr (paintinfo * p, unsigned char *dest);
-static void paint_setup_bayer_rggb (paintinfo * p, unsigned char *dest);
-static void paint_setup_bayer_gbrg (paintinfo * p, unsigned char *dest);
-static void paint_setup_bayer_grbg (paintinfo * p, unsigned char *dest);
+static void paint_setup_v216 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_v210 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_UYVP (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_AY64 (paintinfo * p, GstVideoFrame * frame);
+
+static void paint_setup_YUV9 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YVU9 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_ARGB8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_ABGR8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGBA8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_BGRA8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_xRGB8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_xBGR8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGBx8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_BGRx8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGB888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_BGR888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGB565 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_xRGB1555 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_ARGB64 (paintinfo * p, GstVideoFrame * frame);
+
+static void paint_setup_bayer_bggr (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_bayer_rggb (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_bayer_gbrg (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_bayer_grbg (paintinfo * p, GstVideoFrame * frame);
 
 static void convert_hline_I420 (paintinfo * p, int y);
 static void convert_hline_NV12 (paintinfo * p, int y);
@@ -201,12 +201,12 @@ static void convert_hline_xRGB1555 (paintinfo * p, int y);
 
 static void convert_hline_bayer (paintinfo * p, int y);
 
-static void paint_setup_GRAY8 (paintinfo * p, unsigned char *dest);
-static void paint_setup_GRAY16 (paintinfo * p, unsigned char *dest);
+static void paint_setup_GRAY8 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_GRAY16 (paintinfo * p, GstVideoFrame * frame);
 static void convert_hline_GRAY8 (paintinfo * p, int y);
 static void convert_hline_GRAY16 (paintinfo * p, int y);
 
-struct fourcc_list_struct fourcc_list[] = {
+struct format_list_struct format_list[] = {
 /* packed */
   {VTS_YUV, "YUY2", "YUY2", 16, paint_setup_YUY2, convert_hline_YUY2},
   {VTS_YUV, "UYVY", "UYVY", 16, paint_setup_UYVY, convert_hline_YUY2},
@@ -255,43 +255,49 @@ struct fourcc_list_struct fourcc_list[] = {
 
   /* Not exactly YUV but it's the same as above */
   {VTS_GRAY, "GRAY8", "GRAY8", 8, paint_setup_GRAY8, convert_hline_GRAY8},
-  {VTS_GRAY, "GRAY16", "GRAY16", 16, paint_setup_GRAY16, convert_hline_GRAY16},
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+  {VTS_GRAY, "GRAY16_LE", "GRAY16", 16, paint_setup_GRAY16,
+      convert_hline_GRAY16},
+#else
+  {VTS_GRAY, "GRAY16_BE", "GRAY16", 16, paint_setup_GRAY16,
+      convert_hline_GRAY16},
+#endif
 
-  {VTS_RGB, "RGB ", "xRGB8888", 32, paint_setup_xRGB8888, convert_hline_str4,
+  {VTS_RGB, "xRGB", "xRGB8888", 32, paint_setup_xRGB8888, convert_hline_str4,
         24,
       0x00ff0000, 0x0000ff00, 0x000000ff},
-  {VTS_RGB, "RGB ", "xBGR8888", 32, paint_setup_xBGR8888, convert_hline_str4,
+  {VTS_RGB, "xBGR", "xBGR8888", 32, paint_setup_xBGR8888, convert_hline_str4,
         24,
       0x000000ff, 0x0000ff00, 0x00ff0000},
-  {VTS_RGB, "RGB ", "RGBx8888", 32, paint_setup_RGBx8888, convert_hline_str4,
+  {VTS_RGB, "RGBx", "RGBx8888", 32, paint_setup_RGBx8888, convert_hline_str4,
         24,
       0xff000000, 0x00ff0000, 0x0000ff00},
-  {VTS_RGB, "RGB ", "BGRx8888", 32, paint_setup_BGRx8888, convert_hline_str4,
+  {VTS_RGB, "BGRx", "BGRx8888", 32, paint_setup_BGRx8888, convert_hline_str4,
         24,
       0x0000ff00, 0x00ff0000, 0xff000000},
-  {VTS_RGB, "RGB ", "ARGB8888", 32, paint_setup_ARGB8888, convert_hline_astr4,
+  {VTS_RGB, "ARGB", "ARGB8888", 32, paint_setup_ARGB8888, convert_hline_astr4,
         32,
       0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
-  {VTS_RGB, "RGB ", "ABGR8888", 32, paint_setup_ABGR8888, convert_hline_astr4,
+  {VTS_RGB, "ABGR", "ABGR8888", 32, paint_setup_ABGR8888, convert_hline_astr4,
         32,
       0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000},
-  {VTS_RGB, "RGB ", "RGBA8888", 32, paint_setup_RGBA8888, convert_hline_astr4,
+  {VTS_RGB, "RGBA", "RGBA8888", 32, paint_setup_RGBA8888, convert_hline_astr4,
         32,
       0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff},
-  {VTS_RGB, "RGB ", "BGRA8888", 32, paint_setup_BGRA8888, convert_hline_astr4,
+  {VTS_RGB, "BGRA", "BGRA8888", 32, paint_setup_BGRA8888, convert_hline_astr4,
         32,
       0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff},
-  {VTS_RGB, "RGB ", "RGB888", 24, paint_setup_RGB888, convert_hline_str3, 24,
+  {VTS_RGB, "RGB", "RGB888", 24, paint_setup_RGB888, convert_hline_str3, 24,
       0x00ff0000, 0x0000ff00, 0x000000ff},
-  {VTS_RGB, "RGB ", "BGR888", 24, paint_setup_BGR888, convert_hline_str3, 24,
+  {VTS_RGB, "BGR", "BGR888", 24, paint_setup_BGR888, convert_hline_str3, 24,
       0x000000ff, 0x0000ff00, 0x00ff0000},
-  {VTS_RGB, "RGB ", "RGB565", 16, paint_setup_RGB565, convert_hline_RGB565, 16,
+  {VTS_RGB, "RGB16", "RGB565", 16, paint_setup_RGB565, convert_hline_RGB565, 16,
       0x0000f800, 0x000007e0, 0x0000001f},
-  {VTS_RGB, "RGB ", "xRGB1555", 16, paint_setup_xRGB1555,
+  {VTS_RGB, "RGB15", "xRGB1555", 16, paint_setup_xRGB1555,
         convert_hline_xRGB1555,
         15,
       0x00007c00, 0x000003e0, 0x0000001f},
-  {VTS_RGB, "RGB ", "ARGB8888", 64, paint_setup_ARGB64, convert_hline_astr8,
+  {VTS_RGB, "ARGB64", "ARGB8888", 64, paint_setup_ARGB64, convert_hline_astr8,
         64,
       0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
 
@@ -301,84 +307,28 @@ struct fourcc_list_struct fourcc_list[] = {
   {VTS_BAYER, "gbrg", "Bayer", 8, paint_setup_bayer_gbrg, convert_hline_bayer}
 };
 
-int n_fourccs = G_N_ELEMENTS (fourcc_list);
+int n_formats = G_N_ELEMENTS (format_list);
 
-struct fourcc_list_struct *
+struct format_list_struct *
 paintinfo_find_by_structure (const GstStructure * structure)
 {
   int i;
   const char *media_type = gst_structure_get_name (structure);
-  int ret;
 
   g_return_val_if_fail (structure, NULL);
 
-  if (strcmp (media_type, "video/x-raw-gray") == 0) {
-    gint bpp, depth, endianness = 0;
-
-    ret = gst_structure_get_int (structure, "bpp", &bpp) &&
-        gst_structure_get_int (structure, "depth", &depth);
-    if (!ret || bpp != depth || (depth != 8 && depth != 16))
-      return NULL;
-
-    ret = gst_structure_get_int (structure, "endianness", &endianness);
-    if ((!ret || endianness != G_BYTE_ORDER) && bpp == 16)
-      return NULL;
-
-    for (i = 0; i < n_fourccs; i++) {
-      if (fourcc_list[i].type == VTS_GRAY && fourcc_list[i].bitspp == bpp) {
-        return fourcc_list + i;
-      }
-    }
-  } else if (strcmp (media_type, "video/x-raw-yuv") == 0) {
-    const char *s;
-    int fourcc;
-    guint32 format;
-
-    ret = gst_structure_get_fourcc (structure, "format", &format);
-    if (!ret)
-      return NULL;
-    for (i = 0; i < n_fourccs; i++) {
-      s = fourcc_list[i].fourcc;
-      /* g_print("testing %" GST_FOURCC_FORMAT " and %s\n", GST_FOURCC_ARGS(format), s); */
-      fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
-      if (fourcc_list[i].type == VTS_YUV && fourcc == format) {
-        return fourcc_list + i;
-      }
-    }
-  } else if (strcmp (media_type, "video/x-raw-rgb") == 0) {
-    int red_mask;
-    int green_mask;
-    int blue_mask;
-    int alpha_mask;
-    int depth;
-    int bpp;
-
-    ret = gst_structure_get_int (structure, "red_mask", &red_mask);
-    ret &= gst_structure_get_int (structure, "green_mask", &green_mask);
-    ret &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
-    ret &= gst_structure_get_int (structure, "depth", &depth);
-    ret &= gst_structure_get_int (structure, "bpp", &bpp);
-
-    if (depth == 32) {
-      ret &= gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
-      ret &= (alpha_mask != 0);
-    } else {
-      alpha_mask = 0;
-    }
+  if (strcmp (media_type, "video/x-raw") == 0) {
+    const gchar *format;
 
-    if (!ret) {
+    format = gst_structure_get_string (structure, "format");
+    if (!format) {
       GST_WARNING ("incomplete caps structure: %" GST_PTR_FORMAT, structure);
       return NULL;
     }
 
-    for (i = 0; i < n_fourccs; i++) {
-      if (fourcc_list[i].type == VTS_RGB &&
-          fourcc_list[i].red_mask == red_mask &&
-          fourcc_list[i].green_mask == green_mask &&
-          fourcc_list[i].blue_mask == blue_mask &&
-          (alpha_mask == 0 || fourcc_list[i].alpha_mask == alpha_mask) &&
-          fourcc_list[i].depth == depth && fourcc_list[i].bitspp == bpp) {
-        return fourcc_list + i;
+    for (i = 0; i < n_formats; i++) {
+      if (g_str_equal (format, format_list[i].format)) {
+        return format_list + i;
       }
     }
     return NULL;
@@ -391,10 +341,10 @@ paintinfo_find_by_structure (const GstStructure * structure)
       return NULL;
     }
 
-    for (i = 0; i < n_fourccs; i++) {
-      if (fourcc_list[i].type == VTS_BAYER &&
-          g_str_equal (format, fourcc_list[i].fourcc)) {
-        return fourcc_list + i;
+    for (i = 0; i < n_formats; i++) {
+      if (format_list[i].type == VTS_BAYER &&
+          g_str_equal (format, format_list[i].format)) {
+        return format_list + i;
       }
     }
     return NULL;
@@ -405,37 +355,27 @@ paintinfo_find_by_structure (const GstStructure * structure)
   return NULL;
 }
 
-struct fourcc_list_struct *
-paintrect_find_fourcc (int find_fourcc)
+struct format_list_struct *
+paintrect_find_format (const gchar * find_format)
 {
   int i;
 
-  for (i = 0; i < n_fourccs; i++) {
-    const char *s;
-    int fourcc;
-
-    s = fourcc_list[i].fourcc;
-    fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
-    if (find_fourcc == fourcc) {
-      /* If YUV format, it's good */
-      if (!fourcc_list[i].type == VTS_YUV) {
-        return fourcc_list + i;
-      }
-
-      return fourcc_list + i;
+  for (i = 0; i < n_formats; i++) {
+    if (g_str_equal (find_format, format_list[i].format)) {
+      return format_list + i;
     }
   }
   return NULL;
 }
 
-struct fourcc_list_struct *
+struct format_list_struct *
 paintrect_find_name (const char *name)
 {
   int i;
 
-  for (i = 0; i < n_fourccs; i++) {
-    if (strcmp (name, fourcc_list[i].name) == 0) {
-      return fourcc_list + i;
+  for (i = 0; i < n_formats; i++) {
+    if (g_str_equal (name, format_list[i].name)) {
+      return format_list + i;
     }
   }
   return NULL;
@@ -443,54 +383,27 @@ paintrect_find_name (const char *name)
 
 
 GstStructure *
-paint_get_structure (struct fourcc_list_struct * format)
+paint_get_structure (struct format_list_struct * format)
 {
   GstStructure *structure = NULL;
-  unsigned int fourcc;
-  int endianness;
 
   g_return_val_if_fail (format, NULL);
 
-  fourcc =
-      GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2],
-      format->fourcc[3]);
-
   switch (format->type) {
     case VTS_RGB:
-      if (format->bitspp == 16) {
-        endianness = G_BYTE_ORDER;
-      } else {
-        endianness = G_BIG_ENDIAN;
-      }
-      structure = gst_structure_new ("video/x-raw-rgb",
-          "bpp", G_TYPE_INT, format->bitspp,
-          "endianness", G_TYPE_INT, endianness,
-          "depth", G_TYPE_INT, format->depth,
-          "red_mask", G_TYPE_INT, format->red_mask,
-          "green_mask", G_TYPE_INT, format->green_mask,
-          "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
-      if (format->depth == 32 && format->alpha_mask > 0) {
-        gst_structure_set (structure, "alpha_mask", G_TYPE_INT,
-            format->alpha_mask, NULL);
-      }
-      break;
     case VTS_GRAY:
-      structure = gst_structure_new ("video/x-raw-gray",
-          "bpp", G_TYPE_INT, format->bitspp, "depth", G_TYPE_INT,
-          format->bitspp, NULL);
-      if (format->bitspp == 16)
-        gst_structure_set (structure, "endianness", G_TYPE_INT, G_BYTE_ORDER,
-            NULL);
+      structure = gst_structure_new ("video/x-raw",
+          "format", G_TYPE_STRING, format->format, NULL);
       break;
     case VTS_YUV:
     {
       GValue value_list = { 0 };
       GValue value = { 0 };
 
-      structure = gst_structure_new ("video/x-raw-yuv",
-          "format", GST_TYPE_FOURCC, fourcc, NULL);
+      structure = gst_structure_new ("video/x-raw",
+          "format", G_TYPE_STRING, format->format, NULL);
 
-      if (fourcc != GST_STR_FOURCC ("Y800")) {
+      if (strcmp (format->format, "Y800") != 0) {
         g_value_init (&value_list, GST_TYPE_LIST);
 
         g_value_init (&value, G_TYPE_STRING);
@@ -503,10 +416,10 @@ paint_get_structure (struct fourcc_list_struct * format)
         gst_structure_set_value (structure, "color-matrix", &value_list);
         g_value_reset (&value_list);
 
-        if (fourcc != GST_STR_FOURCC ("AYUV") &&
-            fourcc != GST_STR_FOURCC ("v308") &&
-            fourcc != GST_STR_FOURCC ("v410") &&
-            fourcc != GST_STR_FOURCC ("Y444")) {
+        if (strcmp (format->format, "AYUV") &&
+            strcmp (format->format, "v308") &&
+            strcmp (format->format, "v410") &&
+            strcmp (format->format, "Y444")) {
           g_value_set_static_string (&value, "mpeg2");
           gst_value_list_append_value (&value_list, &value);
 
@@ -521,7 +434,7 @@ paint_get_structure (struct fourcc_list_struct * format)
       break;
     case VTS_BAYER:
       structure = gst_structure_new ("video/x-raw-bayer",
-          "format", G_TYPE_STRING, format->fourcc, NULL);
+          "format", G_TYPE_STRING, format->format, NULL);
       break;
     default:
       g_assert_not_reached ();
@@ -531,23 +444,23 @@ paint_get_structure (struct fourcc_list_struct * format)
 }
 
 /* returns the size in bytes for one video frame of the given dimensions
- * given the fourcc in GstVideoTestSrc */
+ * given the format in GstVideoTestSrc */
 int
 gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h)
 {
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
 
   p->width = w;
   p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return 0;
 
-  fourcc->paint_setup (p, NULL);
+  format->paint_setup (p, NULL);
 
-  return (unsigned long) p->endptr;
+  return p->size;
 }
 
 #define SCALEBITS 10
@@ -603,8 +516,8 @@ videotestsrc_setup_paintinfo (GstVideoTestSrc * v, paintinfo * p, int w, int h)
   p->width = w;
   p->height = h;
 
-  p->convert_tmpline = v->fourcc->convert_hline;
-  if (v->fourcc->type == VTS_RGB || v->fourcc->type == VTS_BAYER) {
+  p->convert_tmpline = v->format->convert_hline;
+  if (v->format->type == VTS_RGB || v->format->type == VTS_BAYER) {
     p->paint_tmpline = paint_tmpline_ARGB;
   } else {
     p->paint_tmpline = paint_tmpline_AYUV;
@@ -703,7 +616,7 @@ videotestsrc_blend_line (GstVideoTestSrc * v, guint8 * dest, guint8 * src,
     struct vts_color_struct *a, struct vts_color_struct *b, int n)
 {
   int i;
-  if (v->fourcc->type == VTS_RGB || v->fourcc->type == VTS_BAYER) {
+  if (v->format->type == VTS_RGB || v->format->type == VTS_BAYER) {
     for (i = 0; i < n; i++) {
       dest[i * 4 + 0] = BLEND (a->A, b->A, src[i]);
       dest[i * 4 + 1] = BLEND (a->R, b->R, src[i]);
@@ -722,22 +635,22 @@ videotestsrc_blend_line (GstVideoTestSrc * v, guint8 * dest, guint8 * src,
 }
 
 void
-gst_video_test_src_smpte (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h)
+gst_video_test_src_smpte (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int y1, y2;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
-  videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  videotestsrc_setup_paintinfo (v, p, frame->info.width, frame->info.height);
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   y1 = 2 * h / 3;
   y2 = h * 0.75;
@@ -828,14 +741,14 @@ gst_video_test_src_smpte (GstVideoTestSrc * v, unsigned char *dest, int w,
 }
 
 void
-gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h)
+gst_video_test_src_smpte75 (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
   if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
@@ -843,11 +756,11 @@ gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w,
   } else {
     p->colors = vts_colors_bt709_ycbcr_75;
   }
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   /* color bars */
   for (j = 0; j < h; j++) {
@@ -863,21 +776,21 @@ gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w,
 }
 
 void
-gst_video_test_src_smpte100 (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h)
+gst_video_test_src_smpte100 (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   /* color bars */
   for (j = 0; j < h; j++) {
@@ -893,19 +806,20 @@ gst_video_test_src_smpte100 (GstVideoTestSrc * v, unsigned char *dest, int w,
 }
 
 void
-gst_video_test_src_bar (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+gst_video_test_src_bar (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (j = 0; j < h; j++) {
     /* use fixed size for now */
@@ -920,21 +834,22 @@ gst_video_test_src_bar (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
 }
 
 void
-gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+gst_video_test_src_snow (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
   struct vts_color_struct color;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   color = p->colors[COLOR_BLACK];
   p->color = &color;
@@ -951,20 +866,21 @@ gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
 }
 
 static void
-gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h, int color_index)
+gst_video_test_src_unicolor (GstVideoTestSrc * v, GstVideoFrame * frame,
+    int color_index)
 {
   int i;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   p->color = p->colors + color_index;
   if (color_index == COLOR_BLACK) {
@@ -981,51 +897,51 @@ gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w,
 }
 
 void
-gst_video_test_src_black (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_black (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLACK);
+  gst_video_test_src_unicolor (v, frame, COLOR_BLACK);
 }
 
 void
-gst_video_test_src_white (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_white (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_WHITE);
+  gst_video_test_src_unicolor (v, frame, COLOR_WHITE);
 }
 
 void
-gst_video_test_src_red (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_red (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_RED);
+  gst_video_test_src_unicolor (v, frame, COLOR_RED);
 }
 
 void
-gst_video_test_src_green (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_green (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_GREEN);
+  gst_video_test_src_unicolor (v, frame, COLOR_GREEN);
 }
 
 void
-gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_blue (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE);
+  gst_video_test_src_unicolor (v, frame, COLOR_BLUE);
 }
 
 void
-gst_video_test_src_blink (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h)
+gst_video_test_src_blink (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
 
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   if (v->n_frames & 1) {
     p->color = &p->foreground_color;
@@ -1040,21 +956,21 @@ gst_video_test_src_blink (GstVideoTestSrc * v, unsigned char *dest, int w,
 }
 
 void
-gst_video_test_src_solid (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h)
+gst_video_test_src_solid (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
 
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   p->color = &p->foreground_color;
 
@@ -1065,20 +981,21 @@ gst_video_test_src_solid (GstVideoTestSrc * v, unsigned char *dest, int w,
 }
 
 void
-gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers1 (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int x, y;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
 
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (y = 0; y < h; y++) {
     for (x = 0; x < w; x++) {
@@ -1094,19 +1011,20 @@ gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h)
 }
 
 void
-gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers2 (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int x, y;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (y = 0; y < h; y++) {
     for (x = 0; x < w; x += 2) {
@@ -1124,19 +1042,20 @@ gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h)
 }
 
 void
-gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers4 (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int x, y;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (y = 0; y < h; y++) {
     for (x = 0; x < w; x += 4) {
@@ -1154,19 +1073,20 @@ gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h)
 }
 
 void
-gst_video_test_src_checkers8 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers8 (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int x, y;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (y = 0; y < h; y++) {
     for (x = 0; x < w; x += 8) {
@@ -1220,16 +1140,16 @@ static const guint8 sine_table[256] = {
 
 
 void
-gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest,
-    int w, int h)
+gst_video_test_src_zoneplate (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
   struct vts_color_struct color;
   int t = v->n_frames;
+  int w = frame->info.width, h = frame->info.height;
   int xreset = -(w / 2) - v->xoffset;   /* starting values for x^2 and y^2, centering the ellipse */
   int yreset = -(h / 2) - v->yoffset;
 
@@ -1248,11 +1168,11 @@ gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest,
   int scale_kx2 = 0xffff / w;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   color = p->colors[COLOR_BLACK];
   p->color = &color;
@@ -1341,16 +1261,16 @@ gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest,
 }
 
 void
-gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, unsigned char *dest,
-    int w, int h)
+gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
   struct vts_color_struct color;
   int t = v->n_frames;
+  int w = frame->info.width, h = frame->info.height;
 
   int xreset = -(w / 2) - v->xoffset;   /* starting values for x^2 and y^2, centering the ellipse */
   int yreset = -(h / 2) - v->yoffset;
@@ -1370,11 +1290,11 @@ gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, unsigned char *dest,
   int scale_kx2 = 0xffff / w;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   color = p->colors[COLOR_BLACK];
   p->color = &color;
@@ -1441,24 +1361,24 @@ gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, unsigned char *dest,
 
 #undef SCALE_AMPLITUDE
 void
-gst_video_test_src_circular (GstVideoTestSrc * v, unsigned char *dest,
-    int w, int h)
+gst_video_test_src_circular (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   int j;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
   double freq[8];
+  int w = frame->info.width, h = frame->info.height;
 
   int d;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (i = 1; i < 8; i++) {
     freq[i] = 200 * pow (2.0, -(i - 1) / 4.0);
@@ -1487,21 +1407,22 @@ gst_video_test_src_circular (GstVideoTestSrc * v, unsigned char *dest,
 }
 
 void
-gst_video_test_src_gamut (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_gamut (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int x, y;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
   struct vts_color_struct yuv_primary;
   struct vts_color_struct yuv_secondary;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   for (y = 0; y < h; y++) {
     int region = (y * 4) / h;
@@ -1544,22 +1465,23 @@ gst_video_test_src_gamut (GstVideoTestSrc * v, guchar * dest, int w, int h)
 }
 
 void
-gst_video_test_src_ball (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+gst_video_test_src_ball (GstVideoTestSrc * v, GstVideoFrame * frame)
 {
   int i;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  struct format_list_struct *format;
   int t = v->n_frames;
   double x, y;
   int radius = 20;
+  int w = frame->info.width, h = frame->info.height;
 
   videotestsrc_setup_paintinfo (v, p, w, h);
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
+  format = v->format;
+  if (format == NULL)
     return;
 
-  fourcc->paint_setup (p, dest);
+  format->paint_setup (p, frame);
 
   x = radius + (0.5 + 0.5 * sin (2 * G_PI * t / 200)) * (w - 2 * radius);
   y = radius + (0.5 + 0.5 * sin (2 * G_PI * sqrt (2) * t / 200)) * (h -
@@ -1638,39 +1560,39 @@ paint_tmpline_AYUV (paintinfo * p, int x, int w)
 
 
 static void
-paint_setup_I420 (paintinfo * p, unsigned char *dest)
+paint_setup_I420 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
-  p->ustride = GST_ROUND_UP_8 (p->width) / 2;
-  p->vp = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
-  p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
-  p->endptr = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_NV12 (paintinfo * p, unsigned char *dest)
+paint_setup_NV12 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
   p->vp = p->up + 1;
-  p->ustride = p->ystride;
-  p->vstride = p->ystride;
-  p->endptr = p->up + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
+  p->vstride = p->ustride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_NV21 (paintinfo * p, unsigned char *dest)
+paint_setup_NV21 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
   p->up = p->vp + 1;
-  p->ustride = p->ystride;
-  p->vstride = p->ystride;
-  p->endptr = p->vp + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
+  p->ustride = p->vstride;
+  p->size = frame->info.size;
 }
 
 static void
@@ -1729,137 +1651,146 @@ convert_hline_NV21 (paintinfo * p, int y)
 
 
 static void
-paint_setup_YV12 (paintinfo * p, unsigned char *dest)
+paint_setup_YV12 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
-  p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
-  p->up = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
-  p->ustride = GST_ROUND_UP_8 (p->ystride) / 2;
-  p->endptr = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_v308 (paintinfo * p, unsigned char *dest)
+paint_setup_v308 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->up = dest + 1;
-  p->vp = dest + 2;
-  p->ystride = GST_ROUND_UP_4 (p->width * 3);
-  p->ustride = GST_ROUND_UP_4 (p->width * 3);
-  p->vstride = GST_ROUND_UP_4 (p->width * 3);
-  p->endptr = dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->yp + 1;
+  p->vp = p->yp + 2;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_AYUV (paintinfo * p, unsigned char *dest)
+paint_setup_AYUV (paintinfo * p, GstVideoFrame * frame)
 {
-  p->ap = dest;
-  p->yp = dest + 1;
-  p->up = dest + 2;
-  p->vp = dest + 3;
-  p->ystride = p->width * 4;
-  p->ustride = p->width * 4;
-  p->vstride = p->width * 4;
-  p->endptr = dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap + 1;
+  p->up = p->ap + 2;
+  p->vp = p->ap + 3;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 #ifdef disabled
 static void
-paint_setup_v410 (paintinfo * p, unsigned char *dest)
+paint_setup_v410 (paintinfo * p, GstVideoFrame * frame)
 {
   p->yp = dest + 0;
   p->up = dest + 0;
   p->vp = dest + 0;
   p->ystride = p->width * 4;
   p->endptr = dest + p->ystride * p->height;
+  p->size = frame->info.size;
 }
 #endif
 
 static void
-paint_setup_v216 (paintinfo * p, unsigned char *dest)
+paint_setup_v216 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->ap = dest;
-  p->yp = dest + 2;
-  p->up = dest + 0;
-  p->vp = dest + 4;
-  p->ystride = p->width * 4;
-  p->ustride = p->width * 4;
-  p->vstride = p->width * 4;
-  p->endptr = dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap + 2;
+  p->up = p->ap + 0;
+  p->vp = p->ap + 4;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_v210 (paintinfo * p, unsigned char *dest)
+paint_setup_v210 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->ap = dest;
-  p->yp = dest + 0;
-  p->up = dest + 0;
-  p->vp = dest + 0;
-  p->ystride = ((p->width + 47) / 48) * 128;    /* no, really. */
-  p->endptr = dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap;
+  p->up = p->ap;
+  p->vp = p->ap;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_UYVP (paintinfo * p, unsigned char *dest)
+paint_setup_UYVP (paintinfo * p, GstVideoFrame * frame)
 {
-  p->ap = dest;
-  p->yp = dest + 0;
-  p->up = dest + 0;
-  p->vp = dest + 0;
-  p->ystride = GST_ROUND_UP_4 ((p->width * 2 * 5 + 3) / 4);
-  GST_ERROR ("stride %d", p->ystride);
-  p->endptr = dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap;
+  p->up = p->ap;
+  p->vp = p->ap;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
+paint_setup_YUY2 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->up = dest + 1;
-  p->vp = dest + 3;
-  p->ystride = GST_ROUND_UP_2 (p->width) * 2;
-  p->ustride = GST_ROUND_UP_2 (p->width) * 2;
-  p->vstride = GST_ROUND_UP_2 (p->width) * 2;
-  p->endptr = dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->yp + 1;
+  p->vp = p->yp + 3;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_UYVY (paintinfo * p, unsigned char *dest)
+paint_setup_UYVY (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 1;
-  p->up = dest;
-  p->vp = dest + 2;
-  p->ystride = GST_ROUND_UP_2 (p->width) * 2;
-  p->ustride = GST_ROUND_UP_2 (p->width) * 2;
-  p->vstride = GST_ROUND_UP_2 (p->width) * 2;
-  p->endptr = dest + p->ystride * p->height;
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->up + 1;
+  p->vp = p->up + 2;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_YVYU (paintinfo * p, unsigned char *dest)
+paint_setup_YVYU (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->up = dest + 3;
-  p->vp = dest + 1;
-  p->ystride = GST_ROUND_UP_2 (p->width) * 2;
-  p->ustride = GST_ROUND_UP_2 (p->width) * 2;
-  p->vstride = GST_ROUND_UP_2 (p->width) * 2;
-  p->endptr = dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->yp + 3;
+  p->vp = p->yp + 1;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_AY64 (paintinfo * p, unsigned char *dest)
+paint_setup_AY64 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->ap = dest;
-  p->yp = dest + 2;
-  p->up = dest + 4;
-  p->vp = dest + 6;
-  p->ystride = p->width * 8;
-  p->ustride = p->width * 8;
-  p->vstride = p->width * 8;
-  p->endptr = dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap + 2;
+  p->up = p->ap + 4;
+  p->vp = p->ap + 6;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
@@ -2043,14 +1974,16 @@ convert_hline_AY64 (paintinfo * p, int y)
 
 #ifdef disabled
 static void
-paint_setup_IYU2 (paintinfo * p, unsigned char *dest)
+paint_setup_IYU2 (paintinfo * p, GstVideoFrame * frame)
 {
   /* untested */
-  p->yp = dest + 1;
-  p->up = dest + 0;
-  p->vp = dest + 2;
-  p->ystride = GST_ROUND_UP_4 (p->width * 3);
-  p->endptr = dest + p->ystride * p->height;
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->up + 1;
+  p->vp = p->up + 2;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
@@ -2071,15 +2004,15 @@ convert_hline_IYU2 (paintinfo * p, int y)
 #endif
 
 static void
-paint_setup_Y41B (paintinfo * p, unsigned char *dest)
+paint_setup_Y41B (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * p->height;
-  p->ustride = GST_ROUND_UP_16 (p->width) / 4;
-  p->vp = p->up + p->ustride * p->height;
-  p->vstride = GST_ROUND_UP_16 (p->width) / 4;
-  p->endptr = p->vp + p->vstride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
@@ -2103,15 +2036,15 @@ convert_hline_Y41B (paintinfo * p, int y)
 }
 
 static void
-paint_setup_Y42B (paintinfo * p, unsigned char *dest)
+paint_setup_Y42B (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * p->height;
-  p->ustride = GST_ROUND_UP_8 (p->width) / 2;
-  p->vp = p->up + p->ustride * p->height;
-  p->vstride = GST_ROUND_UP_8 (p->width) / 2;
-  p->endptr = p->vp + p->vstride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
@@ -2133,15 +2066,15 @@ convert_hline_Y42B (paintinfo * p, int y)
 }
 
 static void
-paint_setup_Y444 (paintinfo * p, unsigned char *dest)
+paint_setup_Y444 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->ustride = GST_ROUND_UP_4 (p->width);
-  p->vstride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * p->height;
-  p->vp = p->up + p->ystride * p->height;
-  p->endptr = p->vp + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
@@ -2161,12 +2094,12 @@ convert_hline_Y444 (paintinfo * p, int y)
 }
 
 static void
-paint_setup_Y800 (paintinfo * p, unsigned char *dest)
+paint_setup_Y800 (paintinfo * p, GstVideoFrame * frame)
 {
   /* untested */
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->endptr = dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->size = frame->info.size;
 }
 
 static void
@@ -2182,32 +2115,27 @@ convert_hline_Y800 (paintinfo * p, int y)
 }
 
 static void
-paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
+paint_setup_YVU9 (paintinfo * p, GstVideoFrame * frame)
 {
-  int h = GST_ROUND_UP_4 (p->height);
-
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->vp = p->yp + p->ystride * h;
-  p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
-  p->up = p->vp + p->vstride * h / 4;
-  p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
-  p->endptr = p->up + p->ustride * h / 4;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
+paint_setup_YUV9 (paintinfo * p, GstVideoFrame * frame)
 {
-  /* untested */
-  int h = GST_ROUND_UP_4 (p->height);
-
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * h;
-  p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
-  p->vp = p->up + p->ustride * h / 4;
-  p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
-  p->endptr = p->vp + p->vstride * h / 4;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
+  p->vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
+  p->size = frame->info.size;
 }
 
 static void
@@ -2231,116 +2159,121 @@ convert_hline_YUV9 (paintinfo * p, int y)
 }
 
 static void
-paint_setup_ARGB8888 (paintinfo * p, unsigned char *dest)
+paint_setup_ARGB8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  paint_setup_xRGB8888 (p, dest);
+  paint_setup_xRGB8888 (p, frame);
 }
 
 static void
-paint_setup_ABGR8888 (paintinfo * p, unsigned char *dest)
+paint_setup_ABGR8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  paint_setup_xBGR8888 (p, dest);
+  paint_setup_xBGR8888 (p, frame);
 }
 
 static void
-paint_setup_RGBA8888 (paintinfo * p, unsigned char *dest)
+paint_setup_RGBA8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  paint_setup_RGBx8888 (p, dest);
+  paint_setup_RGBx8888 (p, frame);
 }
 
 static void
-paint_setup_BGRA8888 (paintinfo * p, unsigned char *dest)
+paint_setup_BGRA8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  paint_setup_BGRx8888 (p, dest);
+  paint_setup_BGRx8888 (p, frame);
 }
 
 static void
-paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest)
+paint_setup_xRGB8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 1;
-  p->up = dest + 2;
-  p->vp = dest + 3;
-  p->ap = dest;
-  p->ystride = p->width * 4;
-  p->ustride = p->width * 4;
-  p->vstride = p->width * 4;
-  p->endptr = p->dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap + 1;
+  p->up = p->ap + 2;
+  p->vp = p->ap + 3;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest)
+paint_setup_xBGR8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 3;
-  p->up = dest + 2;
-  p->vp = dest + 1;
-  p->ap = dest;
-  p->ystride = p->width * 4;
-  p->ustride = p->width * 4;
-  p->vstride = p->width * 4;
-  p->endptr = p->dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap + 3;
+  p->up = p->ap + 2;
+  p->vp = p->ap + 1;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest)
+paint_setup_RGBx8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 0;
-  p->up = dest + 1;
-  p->vp = dest + 2;
-  p->ap = dest + 3;
-  p->ystride = p->width * 4;
-  p->ustride = p->width * 4;
-  p->vstride = p->width * 4;
-  p->endptr = p->dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->yp + 1;
+  p->vp = p->yp + 2;
+  p->ap = p->yp + 3;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest)
+paint_setup_BGRx8888 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 2;
-  p->up = dest + 1;
-  p->vp = dest + 0;
-  p->ap = dest + 3;
-  p->ystride = p->width * 4;
-  p->ustride = p->width * 4;
-  p->vstride = p->width * 4;
-  p->endptr = p->dest + p->ystride * p->height;
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->vp + 1;
+  p->yp = p->vp + 2;
+  p->ap = p->vp + 3;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_RGB888 (paintinfo * p, unsigned char *dest)
+paint_setup_RGB888 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 0;
-  p->up = dest + 1;
-  p->vp = dest + 2;
-  p->ystride = GST_ROUND_UP_4 (p->width * 3);
-  p->ustride = GST_ROUND_UP_4 (p->width * 3);
-  p->vstride = GST_ROUND_UP_4 (p->width * 3);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->yp + 1;
+  p->vp = p->yp + 2;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_BGR888 (paintinfo * p, unsigned char *dest)
+paint_setup_BGR888 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 2;
-  p->up = dest + 1;
-  p->vp = dest + 0;
-  p->ystride = GST_ROUND_UP_4 (p->width * 3);
-  p->ustride = GST_ROUND_UP_4 (p->width * 3);
-  p->vstride = GST_ROUND_UP_4 (p->width * 3);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->vp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->up = p->vp + 1;
+  p->yp = p->vp + 2;
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
-paint_setup_ARGB64 (paintinfo * p, unsigned char *dest)
+paint_setup_ARGB64 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest + 2;
-  p->up = dest + 4;
-  p->vp = dest + 6;
-  p->ap = dest;
-  p->ystride = p->width * 8;
-  p->ustride = p->width * 8;
-  p->vstride = p->width * 8;
-  p->endptr = p->dest + p->ystride * p->height;
+  p->ap = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->yp = p->ap + 2;
+  p->up = p->ap + 4;
+  p->yp = p->ap + 6;
+  p->astride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ystride = p->astride;
+  p->ustride = p->astride;
+  p->vstride = p->astride;
+  p->size = frame->info.size;
 }
 
 static void
@@ -2414,13 +2347,13 @@ convert_hline_str3 (paintinfo * p, int y)
 }
 
 static void
-paint_setup_RGB565 (paintinfo * p, unsigned char *dest)
+paint_setup_RGB565 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width * 2);
-  p->ustride = GST_ROUND_UP_4 (p->width * 2);
-  p->vstride = GST_ROUND_UP_4 (p->width * 2);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 static void
@@ -2460,60 +2393,60 @@ convert_hline_xRGB1555 (paintinfo * p, int y)
 }
 
 static void
-paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest)
+paint_setup_xRGB1555 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width * 2);
-  p->ustride = GST_ROUND_UP_4 (p->width * 2);
-  p->vstride = GST_ROUND_UP_4 (p->width * 2);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->ustride = p->ystride;
+  p->vstride = p->ystride;
+  p->size = frame->info.size;
 }
 
 
 static void
-paint_setup_bayer_bggr (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_bggr (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
   p->ystride = GST_ROUND_UP_4 (p->width);
   p->ustride = GST_ROUND_UP_4 (p->width);
   p->vstride = GST_ROUND_UP_4 (p->width);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->size = p->ystride * p->height;
   p->bayer_x_invert = 0;
   p->bayer_y_invert = 0;
 }
 
 static void
-paint_setup_bayer_rggb (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_rggb (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
   p->ystride = GST_ROUND_UP_4 (p->width);
   p->ustride = GST_ROUND_UP_4 (p->width);
   p->vstride = GST_ROUND_UP_4 (p->width);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->size = p->ystride * p->height;
   p->bayer_x_invert = 1;
   p->bayer_y_invert = 1;
 }
 
 static void
-paint_setup_bayer_grbg (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_grbg (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
   p->ystride = GST_ROUND_UP_4 (p->width);
   p->ustride = GST_ROUND_UP_4 (p->width);
   p->vstride = GST_ROUND_UP_4 (p->width);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->size = p->ystride * p->height;
   p->bayer_x_invert = 0;
   p->bayer_y_invert = 1;
 }
 
 static void
-paint_setup_bayer_gbrg (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_gbrg (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
   p->ystride = GST_ROUND_UP_4 (p->width);
   p->ustride = GST_ROUND_UP_4 (p->width);
   p->vstride = GST_ROUND_UP_4 (p->width);
-  p->endptr = p->dest + p->ystride * p->height;
+  p->size = p->ystride * p->height;
   p->bayer_x_invert = 1;
   p->bayer_y_invert = 0;
 }
@@ -2547,11 +2480,11 @@ convert_hline_bayer (paintinfo * p, int y)
 }
 
 static void
-paint_setup_GRAY8 (paintinfo * p, unsigned char *dest)
+paint_setup_GRAY8 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->endptr = dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->size = frame->info.size;
 }
 
 static void
@@ -2568,11 +2501,11 @@ convert_hline_GRAY8 (paintinfo * p, int y)
 }
 
 static void
-paint_setup_GRAY16 (paintinfo * p, unsigned char *dest)
+paint_setup_GRAY16 (paintinfo * p, GstVideoFrame * frame)
 {
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width * 2);
-  p->endptr = dest + p->ystride * p->height;
+  p->yp = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+  p->ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+  p->size = frame->info.size;
 }
 
 static void
index b93b704..ee1f4f2 100644 (file)
@@ -46,14 +46,11 @@ struct vts_color_struct {
 typedef struct paintinfo_struct paintinfo;
 struct paintinfo_struct
 {
-  unsigned char *dest;          /* pointer to first byte of video data */
-  unsigned char *yp, *up, *vp;  /* pointers to first byte of each component
-                                 * for both packed/planar YUV and RGB */
-  unsigned char *ap;            /* pointer to first byte of alpha component */
-  unsigned char *endptr;        /* pointer to byte beyond last video data */
-  int ystride;
-  int ustride;
-  int vstride;
+  unsigned char *ap, *yp, *up, *vp; /* pointers to first byte of each component
+                                     * for both packed/planar YUV and RGB */
+  int astride, ystride, ustride, vstride;
+
+  int size;                     /* size of a frame */
   int width;
   int height;
   const struct vts_color_struct *colors;
@@ -75,13 +72,13 @@ struct paintinfo_struct
   struct vts_color_struct background_color;
 };
 
-struct fourcc_list_struct
+struct format_list_struct
 {
   int type;
-  const char *fourcc;
+  const char *format;
   const char *name;
   int bitspp;
-  void (*paint_setup) (paintinfo * p, unsigned char *dest);
+  void (*paint_setup) (paintinfo * p, GstVideoFrame *frame);
   void (*convert_hline) (paintinfo * p, int y);
   int depth;
   unsigned int red_mask;
@@ -90,59 +87,39 @@ struct fourcc_list_struct
   unsigned int alpha_mask;
 };
 
-struct fourcc_list_struct *
-        paintrect_find_fourcc           (int find_fourcc);
-struct fourcc_list_struct *
+struct format_list_struct *
+        paintrect_find_format           (const gchar *find_format);
+struct format_list_struct *
         paintrect_find_name             (const char *name);
-struct fourcc_list_struct *
+struct format_list_struct *
         paintinfo_find_by_structure     (const GstStructure *structure);
 GstStructure *
-        paint_get_structure             (struct fourcc_list_struct *format);
+        paint_get_structure             (struct format_list_struct *format);
+
 int     gst_video_test_src_get_size     (GstVideoTestSrc * v, int w, int h);
-void    gst_video_test_src_smpte        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_smpte75      (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_snow         (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_black        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_white        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_red          (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_green        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_blue         (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_solid        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_blink        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_checkers1    (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_checkers2    (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_checkers4    (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_checkers8    (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_circular     (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_zoneplate    (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_gamut        (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_chromazoneplate (GstVideoTestSrc * v,
-                                            unsigned char *dest, int w, int h);
-void    gst_video_test_src_ball         (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_smpte100     (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-void    gst_video_test_src_bar          (GstVideoTestSrc * v,
-                                         unsigned char *dest, int w, int h);
-
-extern struct fourcc_list_struct fourcc_list[];
-extern int n_fourccs;
+void    gst_video_test_src_smpte        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_smpte75      (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_snow         (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_black        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_white        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_red          (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_green        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_blue         (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_solid        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_blink        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_checkers1    (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_checkers2    (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_checkers4    (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_checkers8    (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_circular     (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_zoneplate    (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_gamut        (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_ball         (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_smpte100     (GstVideoTestSrc * v, GstVideoFrame *frame);
+void    gst_video_test_src_bar          (GstVideoTestSrc * v, GstVideoFrame *frame);
+
+extern struct format_list_struct format_list[];
+extern int n_formats;
 
 #endif
index 1f40f62..3e792f5 100644 (file)
@@ -104,70 +104,21 @@ enum
   PROP_VOLUME
 };
 
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
 #define ALLOWED_CAPS \
-        "audio/x-raw-float, " \
-        "rate = (int) [ 1, MAX ], " \
-        "channels = (int) [ 1, MAX ], " \
-        "endianness = (int) BYTE_ORDER, " \
-        "width = (int) {32, 64}; " \
-        "audio/x-raw-int, " \
-        "channels = (int) [ 1, MAX ], " \
-        "rate = (int) [ 1,  MAX ], " \
-        "endianness = (int) BYTE_ORDER, " \
-        "width = (int) 8, " \
-        "depth = (int) 8, " \
-        "signed = (bool) TRUE; " \
-        "audio/x-raw-int, " \
-        "channels = (int) [ 1, MAX ], " \
-        "rate = (int) [ 1,  MAX ], " \
-        "endianness = (int) BYTE_ORDER, " \
-        "width = (int) 16, " \
-        "depth = (int) 16, " \
-        "signed = (bool) TRUE; " \
-        "audio/x-raw-int, " \
-        "channels = (int) [ 1, MAX ], " \
-        "rate = (int) [ 1,  MAX ], " \
-        "endianness = (int) BYTE_ORDER, " \
-        "width = (int) 24, " \
-        "depth = (int) 24, " \
-        "signed = (bool) TRUE; " \
-        "audio/x-raw-int, " \
-        "channels = (int) [ 1, MAX ], " \
-        "rate = (int) [ 1,  MAX ], " \
-        "endianness = (int) BYTE_ORDER, " \
-        "width = (int) 32, " \
-       "depth = (int) 32, " \
-       "signed = (bool) TRUE"
-
-static void gst_volume_interface_init (GstImplementsInterfaceClass * klass);
-static void gst_volume_mixer_init (GstMixerClass * iface);
+    GST_AUDIO_CAPS_MAKE ("{ F32_LE, F64_LE, S8, S16_LE, S24_3LE, S32_LE }")
+#else
+#define ALLOWED_CAPS \
+    GST_AUDIO_CAPS_MAKE ("{ F32_BE, F64_BE, S8, S16_BE, S24_3BE, S32_BE }")
+#endif
 
-#define _init_interfaces(type)                                          \
-  {                                                                     \
-    static const GInterfaceInfo voliface_info = {                       \
-      (GInterfaceInitFunc) gst_volume_interface_init,                   \
-      NULL,                                                             \
-      NULL                                                              \
-    };                                                                  \
-    static const GInterfaceInfo volmixer_info = {                       \
-      (GInterfaceInitFunc) gst_volume_mixer_init,                       \
-      NULL,                                                             \
-      NULL                                                              \
-    };                                                                  \
-    static const GInterfaceInfo svol_info = {                           \
-      NULL,                                                             \
-      NULL,                                                             \
-      NULL                                                              \
-    };                                                                  \
-                                                                        \
-    g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,   \
-        &voliface_info);                                                \
-    g_type_add_interface_static (type, GST_TYPE_MIXER, &volmixer_info); \
-    g_type_add_interface_static (type, GST_TYPE_STREAM_VOLUME, &svol_info); \
-  }
+static void gst_volume_mixer_init (GstMixerClass * iface);
 
-GST_BOILERPLATE_FULL (GstVolume, gst_volume, GstAudioFilter,
-    GST_TYPE_AUDIO_FILTER, _init_interfaces);
+#define gst_volume_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstVolume, gst_volume,
+    GST_TYPE_AUDIO_FILTER,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_MIXER, gst_volume_mixer_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
 
 static void volume_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -180,7 +131,7 @@ static GstFlowReturn volume_transform_ip (GstBaseTransform * base,
     GstBuffer * outbuf);
 static gboolean volume_stop (GstBaseTransform * base);
 static gboolean volume_setup (GstAudioFilter * filter,
-    GstRingBufferSpec * format);
+    const GstAudioInfo * info);
 
 static void volume_process_double (GstVolume * self, gpointer bytes,
     guint n_bytes);
@@ -221,68 +172,61 @@ static void volume_process_controlled_int8_clamp (GstVolume * self,
 static gboolean
 volume_choose_func (GstVolume * self)
 {
+  GstAudioFilter *filter = GST_AUDIO_FILTER (self);
+  GstAudioFormat format;
+
   self->process = NULL;
   self->process_controlled = NULL;
 
-  if (GST_AUDIO_FILTER (self)->format.caps == NULL)
+  format = GST_AUDIO_FORMAT_INFO_FORMAT (filter->info.finfo);
+
+  if (format == GST_AUDIO_FORMAT_UNKNOWN)
     return FALSE;
 
-  switch (GST_AUDIO_FILTER (self)->format.type) {
-    case GST_BUFTYPE_LINEAR:
-      switch (GST_AUDIO_FILTER (self)->format.width) {
-        case 32:
-          /* only clamp if the gain is greater than 1.0
-           */
-          if (self->current_vol_i32 > VOLUME_UNITY_INT32) {
-            self->process = volume_process_int32_clamp;
-          } else {
-            self->process = volume_process_int32;
-          }
-          self->process_controlled = volume_process_controlled_int32_clamp;
-          break;
-        case 24:
-          /* only clamp if the gain is greater than 1.0
-           */
-          if (self->current_vol_i24 > VOLUME_UNITY_INT24) {
-            self->process = volume_process_int24_clamp;
-          } else {
-            self->process = volume_process_int24;
-          }
-          self->process_controlled = volume_process_controlled_int24_clamp;
-          break;
-        case 16:
-          /* only clamp if the gain is greater than 1.0
-           */
-          if (self->current_vol_i16 > VOLUME_UNITY_INT16) {
-            self->process = volume_process_int16_clamp;
-          } else {
-            self->process = volume_process_int16;
-          }
-          self->process_controlled = volume_process_controlled_int16_clamp;
-          break;
-        case 8:
-          /* only clamp if the gain is greater than 1.0
-           */
-          if (self->current_vol_i8 > VOLUME_UNITY_INT8) {
-            self->process = volume_process_int8_clamp;
-          } else {
-            self->process = volume_process_int8;
-          }
-          self->process_controlled = volume_process_controlled_int8_clamp;
-          break;
+  switch (format) {
+    case GST_AUDIO_FORMAT_S32:
+      /* only clamp if the gain is greater than 1.0 */
+      if (self->current_vol_i32 > VOLUME_UNITY_INT32) {
+        self->process = volume_process_int32_clamp;
+      } else {
+        self->process = volume_process_int32;
+      }
+      self->process_controlled = volume_process_controlled_int32_clamp;
+      break;
+    case GST_AUDIO_FORMAT_S24_3:
+      /* only clamp if the gain is greater than 1.0 */
+      if (self->current_vol_i24 > VOLUME_UNITY_INT24) {
+        self->process = volume_process_int24_clamp;
+      } else {
+        self->process = volume_process_int24;
+      }
+      self->process_controlled = volume_process_controlled_int24_clamp;
+      break;
+    case GST_AUDIO_FORMAT_S16:
+      /* only clamp if the gain is greater than 1.0 */
+      if (self->current_vol_i16 > VOLUME_UNITY_INT16) {
+        self->process = volume_process_int16_clamp;
+      } else {
+        self->process = volume_process_int16;
       }
+      self->process_controlled = volume_process_controlled_int16_clamp;
       break;
-    case GST_BUFTYPE_FLOAT:
-      switch (GST_AUDIO_FILTER (self)->format.width) {
-        case 32:
-          self->process = volume_process_float;
-          self->process_controlled = volume_process_controlled_float;
-          break;
-        case 64:
-          self->process = volume_process_double;
-          self->process_controlled = volume_process_controlled_double;
-          break;
+    case GST_AUDIO_FORMAT_S8:
+      /* only clamp if the gain is greater than 1.0 */
+      if (self->current_vol_i8 > VOLUME_UNITY_INT8) {
+        self->process = volume_process_int8_clamp;
+      } else {
+        self->process = volume_process_int8;
       }
+      self->process_controlled = volume_process_controlled_int8_clamp;
+      break;
+    case GST_AUDIO_FORMAT_F32:
+      self->process = volume_process_float;
+      self->process_controlled = volume_process_controlled_float;
+      break;
+    case GST_AUDIO_FORMAT_F64:
+      self->process = volume_process_double;
+      self->process_controlled = volume_process_controlled_double;
       break;
     default:
       break;
@@ -340,18 +284,6 @@ volume_update_volume (GstVolume * self, gfloat volume, gboolean mute)
 
 /* Mixer interface */
 
-static gboolean
-gst_volume_interface_supported (GstImplementsInterface * iface, GType type)
-{
-  return (type == GST_TYPE_MIXER || type == GST_TYPE_STREAM_VOLUME);
-}
-
-static void
-gst_volume_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = gst_volume_interface_supported;
-}
-
 static const GList *
 gst_volume_list_tracks (GstMixer * mixer)
 {
@@ -432,29 +364,16 @@ gst_volume_dispose (GObject * object)
 }
 
 static void
-gst_volume_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-  GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS (g_class);
-  GstCaps *caps;
-
-  gst_element_class_set_details_simple (element_class, "Volume",
-      "Filter/Effect/Audio",
-      "Set volume on audio/raw streams", "Andy Wingo <wingo@pobox.com>");
-
-  caps = gst_caps_from_string (ALLOWED_CAPS);
-  gst_audio_filter_class_add_pad_templates (filter_class, caps);
-  gst_caps_unref (caps);
-}
-
-static void
 gst_volume_class_init (GstVolumeClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *element_class;
   GstBaseTransformClass *trans_class;
   GstAudioFilterClass *filter_class;
+  GstCaps *caps;
 
   gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
   trans_class = (GstBaseTransformClass *) klass;
   filter_class = (GstAudioFilterClass *) (klass);
 
@@ -472,6 +391,14 @@ gst_volume_class_init (GstVolumeClass * klass)
           0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME,
           G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (element_class, "Volume",
+      "Filter/Effect/Audio",
+      "Set volume on audio/raw streams", "Andy Wingo <wingo@pobox.com>");
+
+  caps = gst_caps_from_string (ALLOWED_CAPS);
+  gst_audio_filter_class_add_pad_templates (filter_class, caps);
+  gst_caps_unref (caps);
+
   trans_class->before_transform = GST_DEBUG_FUNCPTR (volume_before_transform);
   trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip);
   trans_class->stop = GST_DEBUG_FUNCPTR (volume_stop);
@@ -479,7 +406,7 @@ gst_volume_class_init (GstVolumeClass * klass)
 }
 
 static void
-gst_volume_init (GstVolume * self, GstVolumeClass * g_class)
+gst_volume_init (GstVolume * self)
 {
   GstMixerTrack *track = NULL;
 
@@ -795,7 +722,7 @@ volume_process_controlled_int8_clamp (GstVolume * self, gpointer bytes,
 
 /* get notified of caps and plug in the correct process function */
 static gboolean
-volume_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
+volume_setup (GstAudioFilter * filter, const GstAudioInfo * info)
 {
   gboolean res;
   GstVolume *self = GST_VOLUME (filter);
@@ -872,9 +799,10 @@ volume_before_transform (GstBaseTransform * base, GstBuffer * buffer)
 static GstFlowReturn
 volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
 {
+  GstAudioFilter *filter = GST_AUDIO_FILTER_CAST (base);
   GstVolume *self = GST_VOLUME (base);
   guint8 *data;
-  guint size;
+  gsize size;
   GstControlSource *mute_csource, *volume_csource;
 
   if (G_UNLIKELY (!self->negotiated))
@@ -885,15 +813,15 @@ volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
       GST_BUFFER_FLAG_IS_SET (outbuf, GST_BUFFER_FLAG_GAP))
     return GST_FLOW_OK;
 
-  data = GST_BUFFER_DATA (outbuf);
-  size = GST_BUFFER_SIZE (outbuf);
+  data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READWRITE);
 
   mute_csource = gst_object_get_control_source (G_OBJECT (self), "mute");
   volume_csource = gst_object_get_control_source (G_OBJECT (self), "volume");
+
   if (mute_csource || (volume_csource && !self->current_mute)) {
-    gint rate = GST_AUDIO_FILTER_CAST (self)->format.rate;
-    gint width = GST_AUDIO_FILTER_CAST (self)->format.width / 8;
-    gint channels = GST_AUDIO_FILTER_CAST (self)->format.channels;
+    gint rate = GST_AUDIO_INFO_RATE (&filter->info);
+    gint width = GST_AUDIO_FORMAT_INFO_WIDTH (filter->info.finfo) / 8;
+    gint channels = GST_AUDIO_INFO_CHANNELS (&filter->info);
     guint nsamples = size / (width * channels);
     GstClockTime interval = gst_util_uint64_scale_int (1, GST_SECOND, rate);
     GstClockTime ts = GST_BUFFER_TIMESTAMP (outbuf);
@@ -956,6 +884,7 @@ volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
   } else if (self->current_volume != 1.0) {
     self->process (self, data, size);
   }
+  gst_buffer_unmap (outbuf, data, size);
 
   return GST_FLOW_OK;
 
@@ -975,6 +904,7 @@ controller_failure:
 
     GST_ELEMENT_ERROR (self, CORE, FAILED,
         ("Failed to get values from controller"), (NULL));
+    gst_buffer_unmap (outbuf, data, size);
     return GST_FLOW_ERROR;
   }
 }
index 8e987cc..c512a1a 100644 (file)
@@ -1 +1 @@
-af az bg ca cs da de el en_GB es eu fi fr gl hu id it ja lt lv nb nl or pl pt_BR ro ru sk sl sq sr sv tr uk vi zh_CN
+af az bg ca cs da de el en_GB es eo eu fi fr gl hu id it ja lt lv nb nl or pl pt_BR ro ru sk sl sq sr sv tr uk vi zh_CN
index d8aa8cc..6b19ec3 100644 (file)
@@ -2,14 +2,10 @@ ext/alsa/gstalsamixertrack.c
 ext/alsa/gstalsasink.c
 ext/alsa/gstalsasrc.c
 ext/cdparanoia/gstcdparanoiasrc.c
-ext/gnomevfs/gstgnomevfssrc.c
-ext/gnomevfs/gstgnomevfssink.c
 ext/ogg/gstoggdemux.c
-gst/playback/gstdecodebin.c
 gst/playback/gstdecodebin2.c
-gst/playback/gstplaybasebin.c
-gst/playback/gstplaybin.c
 gst/playback/gstplaysink.c
+gst/playback/gstsubtitleoverlay.c
 gst/playback/gsturidecodebin.c
 gst/tcp/gsttcp.c
 gst/tcp/gsttcpclientsink.c
@@ -20,4 +16,3 @@ gst-libs/gst/tag/tags.c
 gst-libs/gst/cdda/gstcddabasesrc.c
 gst-libs/gst/pbutils/descriptions.c
 gst-libs/gst/pbutils/missing-plugins.c
-sys/v4l/v4l_calls.c
index d679ad2..01df45a 100644 (file)
--- a/po/af.po
+++ b/po/af.po
@@ -104,22 +104,6 @@ msgstr "Kon nie vfs-lêer \"%s\" toemaak nie."
 msgid "Could not read CD."
 msgstr "Kon nie skryf na toestel \"%s\" nie."
 
-#, fuzzy, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Kon nie vfs-lêer \"%s\" oopmaak vir skryf nie."
-
-#, fuzzy
-msgid "No filename given"
-msgstr "Geen lêernaam gespesifiseer."
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Kon nie vfs-lêer \"%s\" toemaak nie."
-
-#, fuzzy, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Fout tydens toemaak van lêer \"%s\"."
-
 msgid "Internal data stream error."
 msgstr ""
 
@@ -127,60 +111,17 @@ msgstr ""
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 
-msgid "This appears to be a text file"
-msgstr ""
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "Kon nie skryf na lêer \"%s\" nie."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-
-msgid "No URI specified to play from."
-msgstr ""
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr ""
-
-msgid "RTSP streams cannot be played yet."
-msgstr ""
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr ""
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-#, fuzzy
-msgid "This is not a media file"
-msgstr "Toestel \"%s\" is nie 'n vasleggingtoestel nie."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
+msgid "This appears to be a text file"
 msgstr ""
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -230,25 +171,27 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
+msgid "No URI specified to play from."
 msgstr ""
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
+msgid "Invalid URI \"%s\"."
 msgstr ""
 
-#, fuzzy, c-format
-msgid "Error while sending data to \"%s:%d\"."
-msgstr "Fout tydens toemaak van lêer \"%s\"."
+msgid "This stream type cannot be played yet."
+msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Source element is invalid."
 msgstr ""
 
+#, fuzzy, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "Fout tydens toemaak van lêer \"%s\"."
+
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr ""
@@ -597,20 +540,37 @@ msgstr ""
 msgid "Plugin or element of unknown type"
 msgstr ""
 
-msgid "No device specified."
-msgstr "Geen toestel gespesifiseer"
+#, fuzzy
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Kon nie vfs-lêer \"%s\" oopmaak vir skryf nie."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Toestel \"%s\" bestaan nie."
+#, fuzzy
+#~ msgid "No filename given"
+#~ msgstr "Geen lêernaam gespesifiseer."
 
-#, fuzzy, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "OSS-toestel \"%s\" is reeds in gebruik deur 'n ander program."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Kon nie vfs-lêer \"%s\" toemaak nie."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Kon nie toestel \"%s\" oopmaak vir lees en skryf nie."
+#, fuzzy
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Fout tydens toemaak van lêer \"%s\"."
+
+#, fuzzy
+#~ msgid "This is not a media file"
+#~ msgstr "Toestel \"%s\" is nie 'n vasleggingtoestel nie."
+
+#~ msgid "No device specified."
+#~ msgstr "Geen toestel gespesifiseer"
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Toestel \"%s\" bestaan nie."
+
+#, fuzzy
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "OSS-toestel \"%s\" is reeds in gebruik deur 'n ander program."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Kon nie toestel \"%s\" oopmaak vir lees en skryf nie."
 
 #, fuzzy
 #~ msgid "Could not create \"typefind\" element."
index 01902ff..1481cbb 100644 (file)
--- a/po/az.po
+++ b/po/az.po
@@ -105,22 +105,6 @@ msgstr "\"%s\" vfs faylı bağlana bilmədi."
 msgid "Could not read CD."
 msgstr "\"%s\" avadanlığına yazıla bilmədi."
 
-#, fuzzy, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "\"%s\" vfs faylı yazma üçün açıla bilmədi."
-
-#, fuzzy
-msgid "No filename given"
-msgstr "Fayl adı verilməyib."
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "\"%s\" vfs faylı bağlana bilmədi."
-
-#, fuzzy, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "\"%s\" faylı bağlana bilmədi."
-
 msgid "Internal data stream error."
 msgstr ""
 
@@ -128,60 +112,17 @@ msgstr ""
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 
-msgid "This appears to be a text file"
-msgstr ""
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "\"%s\" faylına yazıla bilmədi."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-
-msgid "No URI specified to play from."
-msgstr ""
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr ""
-
-msgid "RTSP streams cannot be played yet."
-msgstr ""
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr ""
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-#, fuzzy
-msgid "This is not a media file"
-msgstr "\"%s\" avadanlığı capture avadanlığı deyil."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
+msgid "This appears to be a text file"
 msgstr ""
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -231,25 +172,27 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
+msgid "No URI specified to play from."
 msgstr ""
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
+msgid "Invalid URI \"%s\"."
 msgstr ""
 
-#, fuzzy, c-format
-msgid "Error while sending data to \"%s:%d\"."
-msgstr "\"%s\" faylı bağlana bilmədi."
+msgid "This stream type cannot be played yet."
+msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Source element is invalid."
 msgstr ""
 
+#, fuzzy, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "\"%s\" faylı bağlana bilmədi."
+
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr ""
@@ -598,20 +541,37 @@ msgstr ""
 msgid "Plugin or element of unknown type"
 msgstr ""
 
-msgid "No device specified."
-msgstr "Avadanlıq bildirilməyib."
+#, fuzzy
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "\"%s\" vfs faylı yazma üçün açıla bilmədi."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "\"%s\" avadanlığı mövcud deyil."
+#, fuzzy
+#~ msgid "No filename given"
+#~ msgstr "Fayl adı verilməyib."
 
-#, fuzzy, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "\"%s\" OSS avadanlığı başqa bir proqram tərəfindən istifadədədir."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "\"%s\" vfs faylı bağlana bilmədi."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "\"%s\" avadanlığı oxuma və yazma üçün açıla bilmədi."
+#, fuzzy
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "\"%s\" faylı bağlana bilmədi."
+
+#, fuzzy
+#~ msgid "This is not a media file"
+#~ msgstr "\"%s\" avadanlığı capture avadanlığı deyil."
+
+#~ msgid "No device specified."
+#~ msgstr "Avadanlıq bildirilməyib."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "\"%s\" avadanlığı mövcud deyil."
+
+#, fuzzy
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "\"%s\" OSS avadanlığı başqa bir proqram tərəfindən istifadədədir."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "\"%s\" avadanlığı oxuma və yazma üçün açıla bilmədi."
 
 #, fuzzy
 #~ msgid "Could not create \"typefind\" element."
index 0a2ceb2..cff8d1c 100644 (file)
--- a/po/bg.po
+++ b/po/bg.po
@@ -100,22 +100,6 @@ msgstr "По CD-то не може да се търси."
 msgid "Could not read CD."
 msgstr "CD-то не може да бъде прочетено."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr ""
-"Файлът „%s“ от виртуалната файлова система не може да се отвори за запис: %s."
-
-msgid "No filename given"
-msgstr "Не е дадено име на файл"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Файлът „%s“ от виртуалната файлова система не може да се затвори."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Грешка при запис във файла „%s“."
-
 msgid "Internal data stream error."
 msgstr "Вътрешна грешка на потока от данни."
 
@@ -125,65 +109,16 @@ msgstr ""
 "За да пуснете този поток, се нуждаете от приставка за %s. Такава не е "
 "инсталирана."
 
-msgid "This appears to be a text file"
-msgstr "Това изглежда е текстов файл"
-
 msgid "Could not determine type of stream"
 msgstr "Видът на потока не може да бъде определен"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Грешен адрес за субтитри „%s“, субтитрите са изключени."
-
-msgid "No URI specified to play from."
-msgstr "Не е указан адрес за пускане."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Грешен адрес „%s“."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Потоци с RTSP все още не се поддържат."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Не може да се създаде елемент „decodebin“."
-
-msgid "Source element is invalid."
-msgstr "Елементът-източник е грешен."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Бе засечен единствено поток със субтитри. Или сте заредили файл със "
-"субтитри, или някакъв друг вид текстов файл, или просто видът на "
-"мултимедийния файл не е разпознат."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Липсва декодер за обработката на този файл. Ще трябва да инсталирате "
-"необходимите приставки."
-
-msgid "This is not a media file"
-msgstr "Това не е медиен файл"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Открит е поток със субтитри, липсва видео поток."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr ""
-"Едновременно липсват елементите-приемници „autovideosink“ и „xvimagesink“."
+msgid "This appears to be a text file"
+msgstr "Това изглежда е текстов файл"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Елементът „%s“ липсва — проверете инсталацията на GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-"Едновременно липсват елементите-приемници „autoaudiosink“ и „alsasink“."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Едновременно липсват елементите-приемници „autovideosink“ и „%s“."
@@ -233,6 +168,13 @@ msgstr "Текстов файл не може да се изпълни без в
 msgid "No decoder available for type '%s'."
 msgstr "Липсва декодер за вида „%s“."
 
+msgid "No URI specified to play from."
+msgstr "Не е указан адрес за пускане."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Грешен адрес „%s“."
+
 msgid "This stream type cannot be played yet."
 msgstr "Потоци от този тип все още не могат да бъдат изпълнявани."
 
@@ -240,19 +182,14 @@ msgstr "Потоци от този тип все още не могат да б
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Обработката на адреси „%s“ не е реализирана."
 
+msgid "Source element is invalid."
+msgstr "Елементът-източник е грешен."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Грешка при запис във файла „%s:%d“."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Грешка при запис на заглавните данни gdp във файла „%s:%d“."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Грешка при изпращането на натоварените по gtp данни към „%s:%d“."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Връзката към %s:%d е отказана."
 
@@ -600,17 +537,73 @@ msgstr "Непознат елемент-кодер"
 msgid "Plugin or element of unknown type"
 msgstr "Приставка или елемент от непознат вид"
 
-msgid "No device specified."
-msgstr "Не е указано устройство."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr ""
+#~ "Файлът „%s“ от виртуалната файлова система не може да се отвори за запис: "
+#~ "%s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Устройството „%s“ не съществува."
+#~ msgid "No filename given"
+#~ msgstr "Не е дадено име на файл"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Устройството „%s“ вече се използва."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Файлът „%s“ от виртуалната файлова система не може да се затвори."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Устройството „%s“ не може да се отвори за четене и запис."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Грешка при запис във файла „%s“."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Грешен адрес за субтитри „%s“, субтитрите са изключени."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Потоци с RTSP все още не се поддържат."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Не може да се създаде елемент „decodebin“."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Бе засечен единствено поток със субтитри. Или сте заредили файл със "
+#~ "субтитри, или някакъв друг вид текстов файл, или просто видът на "
+#~ "мултимедийния файл не е разпознат."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Липсва декодер за обработката на този файл. Ще трябва да инсталирате "
+#~ "необходимите приставки."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Това не е медиен файл"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Открит е поток със субтитри, липсва видео поток."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr ""
+#~ "Едновременно липсват елементите-приемници „autovideosink“ и „xvimagesink“."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr ""
+#~ "Едновременно липсват елементите-приемници „autoaudiosink“ и „alsasink“."
+
+#~ msgid "No device specified."
+#~ msgstr "Не е указано устройство."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Устройството „%s“ не съществува."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Устройството „%s“ вече се използва."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Устройството „%s“ не може да се отвори за четене и запис."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Грешка при запис на заглавните данни gdp във файла „%s:%d“."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Грешка при изпращането на натоварените по gtp данни към „%s:%d“."
index fbcd690..b750782 100644 (file)
--- a/po/ca.po
+++ b/po/ca.po
@@ -99,21 +99,6 @@ msgstr "No s'ha pogut cercar el CD."
 msgid "Could not read CD."
 msgstr "No s'ha pogut llegir el CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "No s'ha pogut obrir el fitxer vfs «%s» per a l'escriptura: %s."
-
-msgid "No filename given"
-msgstr "No s'ha donat cap nom de fitxer"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "No s'ha pogut tancar el fitxer vfs «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "S'ha produït un error en escriure al fitxer «%s»."
-
 msgid "Internal data stream error."
 msgstr "S'ha produït un error intern de flux de dades."
 
@@ -123,63 +108,16 @@ msgstr ""
 "Es requereix un connector %s per a reproduir aquest flux, però no és "
 "instaŀlat."
 
-msgid "This appears to be a text file"
-msgstr "Açò sembla ser un fitxer de text"
-
 msgid "Could not determine type of stream"
 msgstr "No s'ha pogut determinar el tipus de flux"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "L'URI de subtítols «%s» és invàlida, s'inhabiliten els subtítols."
-
-msgid "No URI specified to play from."
-msgstr "No s'ha especificat cap URL des d'on reproduir."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "L'URI «%s» és invàlid."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Encara no es poden reproduir els fluxes RTSP."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "No s'ha pogut crear l'element «decodebin»."
-
-msgid "Source element is invalid."
-msgstr "L'element font és invàlid."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Només s'ha detectat un flux de subtítols. O bé esteu carregant un fitxer de "
-"subtítols o qualsevol altre tipus de fitxer de text, o no s'ha reconegut el "
-"fitxer de medi."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"No teniu un decodificador instaŀlat per a gestionar aquest fitxer. És "
-"possible que necessiteu instaŀlar els connectors necessaris."
-
-msgid "This is not a media file"
-msgstr "Aquest no és un fitxer de medi"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "S'ha detectat un flux de subtítols, però no un flux de vídeo."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Manquen l'element autovideosink i el xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Açò sembla ser un fitxer de text"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Manca l'element «%s» - comproveu la vostra instaŀlació del GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Manquen l'element autoaudiosink i l'alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Manquen els elements autovideosink i %s."
@@ -229,6 +167,13 @@ msgstr "No es pot reproduir un fitxer de text sense vídeo o visualitzacions."
 msgid "No decoder available for type '%s'."
 msgstr "No hi ha un decodificador disponible per al tipus «%s»."
 
+msgid "No URI specified to play from."
+msgstr "No s'ha especificat cap URL des d'on reproduir."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "L'URI «%s» és invàlid."
+
 msgid "This stream type cannot be played yet."
 msgstr "Encara no es pot reproduir aquest tipus de flux."
 
@@ -236,20 +181,14 @@ msgstr "Encara no es pot reproduir aquest tipus de flux."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "No hi ha cap gestor d'URI implementat per a «%s»."
 
+msgid "Source element is invalid."
+msgstr "L'element font és invàlid."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "S'ha produït un error en enviar dades a «%s:%d»."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "S'ha produït un error en enviar dades de la capçalera gdp a «%s:%d»."
-
-# Payload -> càrrega en molts àmbits. jm
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "S'ha produït un error en enviar la càrrega de dades de gdp a «%s:%d»."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "S'ha refusat la connexió amb %s:%d."
 
@@ -597,20 +536,75 @@ msgstr "L'element codificador és desconegut"
 msgid "Plugin or element of unknown type"
 msgstr "El connector o element és de tipus desconegut"
 
-msgid "No device specified."
-msgstr "No s'ha especificat un dispositiu."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "No s'ha pogut obrir el fitxer vfs «%s» per a l'escriptura: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "El dispositiu «%s» no existeix."
+#~ msgid "No filename given"
+#~ msgstr "No s'ha donat cap nom de fitxer"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "El dispositiu «%s» ja és en ús."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "No s'ha pogut tancar el fitxer vfs «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "No s'ha pogut obrir el dispositiu «%s» per a llegir i escriure."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "S'ha produït un error en escriure al fitxer «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "L'URI de subtítols «%s» és invàlida, s'inhabiliten els subtítols."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Encara no es poden reproduir els fluxes RTSP."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "No s'ha pogut crear l'element «decodebin»."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Només s'ha detectat un flux de subtítols. O bé esteu carregant un fitxer "
+#~ "de subtítols o qualsevol altre tipus de fitxer de text, o no s'ha "
+#~ "reconegut el fitxer de medi."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "No teniu un decodificador instaŀlat per a gestionar aquest fitxer. És "
+#~ "possible que necessiteu instaŀlar els connectors necessaris."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Aquest no és un fitxer de medi"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "S'ha detectat un flux de subtítols, però no un flux de vídeo."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Manquen l'element autovideosink i el xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Manquen l'element autoaudiosink i l'alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "No s'ha especificat un dispositiu."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "El dispositiu «%s» no existeix."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "El dispositiu «%s» ja és en ús."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "No s'ha pogut obrir el dispositiu «%s» per a llegir i escriure."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr ""
+#~ "S'ha produït un error en enviar dades de la capçalera gdp a «%s:%d»."
+
+# Payload -> càrrega en molts àmbits. jm
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr ""
+#~ "S'ha produït un error en enviar la càrrega de dades de gdp a «%s:%d»."
 
 #~ msgid "discid"
 #~ msgstr "id del disc"
index c73fd9d..af37d42 100644 (file)
--- a/po/cs.po
+++ b/po/cs.po
@@ -1,12 +1,12 @@
 # Czech translations of gst-plugins-base.
-# Copyright (C) 2007, 2008, 2009, 2010 the author(s) of gst-plugins-base.
+# Copyright (C) 2007, 2008, 2009, 2010, 2011 the author(s) of gst-plugins-base.
 # Copyright (C) 2004 Miloslav Trmac <mitr@volny.cz>.
 # This file is put in the public domain.
 # Miloslav Trmac <mitr@volny.cz>, 2004.
-# Petr Kovar <pknbe@volny.cz>, 2007, 2008, 2009, 2010.
+# Petr Kovar <pknbe@volny.cz>, 2007, 2008, 2009, 2010, 2011.
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-base-0.10.30.3\n"
+"Project-Id-Version: gst-plugins-base-0.10.32.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
 "POT-Creation-Date: 2011-08-20 12:18+0100\n"
 "PO-Revision-Date: 2010-10-31 10:51+0100\n"
@@ -17,7 +17,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Generator: Lokalize 1.1\n"
+"X-Generator: Lokalize 1.2\n"
 
 msgid "Master"
 msgstr "Master"
@@ -101,21 +101,6 @@ msgstr "Nezdařilo se nalézt CD."
 msgid "Could not read CD."
 msgstr "Nezdařilo se přečíst CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nezdařilo se otevření souboru vfs \"%s\" k zápisu: %s."
-
-msgid "No filename given"
-msgstr "Nezadán název souboru"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nezdařilo se zavření souboru vfs \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Chyba při zápisu do souboru \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Vnitřní chyba datového proudu."
 
@@ -125,63 +110,16 @@ msgstr ""
 "Zásuvný modul %s je vyžadován k přehrání tohoto proudu, ale není "
 "nainstalován."
 
-msgid "This appears to be a text file"
-msgstr "Zdá se, že se jedná o textový soubor"
-
 msgid "Could not determine type of stream"
 msgstr "Nezdařilo se určit typ proudu"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Neplatné URI titulků \"%s\", titulky vypnuty."
-
-msgid "No URI specified to play from."
-msgstr "Nezadáno žádné URI, ze kterého se má přehrávat."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Neplatné URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Proudy RTSP zatím nemohou být přehrávány."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nezdařilo se vytvoření prvku \"decodebin\"."
-
-msgid "Source element is invalid."
-msgstr "Zdrojový prvek je neplatný."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Byl rozpoznán pouze proud titulků. Buď je nahráván pouze soubor titulků nebo "
-"nějaký jiný typ textového soubor, popřípadě nebyl rozpoznán multimediální "
-"soubor."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"K obsluze tohoto souboru není nainstalován dekodér. Patrně bude nutné "
-"nainstalovat nezbytné zásuvné moduly."
-
-msgid "This is not a media file"
-msgstr "Toto není multimediální soubor"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Byl rozpoznán proud titulků, ale nikoliv obrazový proud."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Schází jak prvek autovideosink, tak xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Zdá se, že se jedná o textový soubor"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Schází prvek \"%s\" - zkontrolujte prosím instalaci systému GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Schází jak prvek autoaudiosink, tak alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Schází jak prvek autovideosink, tak %s."
@@ -231,6 +169,13 @@ msgstr "Textový soubor nelze přehrát bez videa nebo vizualizací."
 msgid "No decoder available for type '%s'."
 msgstr "K typu \"%s\" není dostupný dekodér."
 
+msgid "No URI specified to play from."
+msgstr "Nezadáno žádné URI, ze kterého se má přehrávat."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Neplatné URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Tento typ proudu zatím nemůže být přehrán."
 
@@ -238,19 +183,14 @@ msgstr "Tento typ proudu zatím nemůže být přehrán."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "U \"%s\" není prováděna obsluha URI."
 
+msgid "Source element is invalid."
+msgstr "Zdrojový prvek je neplatný."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Chyba při odesílání dat na \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Chyba při odesílání dat záhlaví gdp na \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Chyba při odesílání zátěžových dat gdp na \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Spojení s %s:%d bylo odmítnuto."
 
@@ -332,13 +272,11 @@ msgstr "režim expozice záznamu"
 msgid "The exposure mode used when capturing an image"
 msgstr "Režim expozice při záznamu obrazu"
 
-#, fuzzy
 msgid "capturing exposure compensation"
-msgstr "režim expozice záznamu"
+msgstr "kompenzace expozice záznamu"
 
-#, fuzzy
 msgid "The exposure compensation used when capturing an image"
-msgstr "Režim expozice při záznamu obrazu"
+msgstr "Kompenzace expozice při záznamu obrazu"
 
 msgid "capturing scene capture type"
 msgstr "typ zachycení scény záznamu"
@@ -603,17 +541,69 @@ msgstr "Neznámý kodérový prvek"
 msgid "Plugin or element of unknown type"
 msgstr "Zásuvný modul nebo prvek neznámého typu"
 
-msgid "No device specified."
-msgstr "Nezadáno zařízení."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nezdařilo se otevření souboru vfs \"%s\" k zápisu: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Zařízení \"%s\" neexistuje."
+#~ msgid "No filename given"
+#~ msgstr "Nezadán název souboru"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Zařízení \"%s\" je již používáno."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nezdařilo se zavření souboru vfs \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Zařízení \"%s\" se nezdařilo otevřít ke čtení a k zápisu."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Chyba při zápisu do souboru \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Neplatné URI titulků \"%s\", titulky vypnuty."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Proudy RTSP zatím nemohou být přehrávány."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nezdařilo se vytvoření prvku \"decodebin\"."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Byl rozpoznán pouze proud titulků. Buď je nahráván pouze soubor titulků "
+#~ "nebo nějaký jiný typ textového soubor, popřípadě nebyl rozpoznán "
+#~ "multimediální soubor."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "K obsluze tohoto souboru není nainstalován dekodér. Patrně bude nutné "
+#~ "nainstalovat nezbytné zásuvné moduly."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Toto není multimediální soubor"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Byl rozpoznán proud titulků, ale nikoliv obrazový proud."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Schází jak prvek autovideosink, tak xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Schází jak prvek autoaudiosink, tak alsasink."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Chyba při odesílání dat záhlaví gdp na \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Chyba při odesílání zátěžových dat gdp na \"%s:%d\"."
+
+#~ msgid "No device specified."
+#~ msgstr "Nezadáno zařízení."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Zařízení \"%s\" neexistuje."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Zařízení \"%s\" je již používáno."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Zařízení \"%s\" se nezdařilo otevřít ke čtení a k zápisu."
index c0425fa..cfd07a5 100644 (file)
--- a/po/da.po
+++ b/po/da.po
@@ -123,21 +123,6 @@ msgstr "Kunne ikke søge på cd."
 msgid "Could not read CD."
 msgstr "Kunne ikke læse cd."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Kunne ikke åbne vfs-filen \"%s\" til skrivning: %s."
-
-msgid "No filename given"
-msgstr "Intet filnavn angivet"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Kunne ikke lukke vfs-filen \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Fejl ved skrivning til filen \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Intern datastrømsfejl."
 
@@ -147,63 +132,16 @@ msgstr ""
 "Et %s plugin er nødvendigt ved afspilning af denne sekvens, men ikke "
 "installeret."
 
-msgid "This appears to be a text file"
-msgstr "Denne fremstår som en tekstfil"
-
 msgid "Could not determine type of stream"
 msgstr "Kunne ikke afgøre strømtypen"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Defekt undertekst URI \"%s\", undertekster deaktiveret."
-
-msgid "No URI specified to play from."
-msgstr "Ingen angivet URI til afspilning."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Ugyldig URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP sekvenser kan endnu ikke afspilles."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Kunne ikke danne et \"decodebin\" element."
-
-msgid "Source element is invalid."
-msgstr "Kildeelement er ugyldigt."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Der blev kun fundet en undertekst-sekvens. Enten forsøger du at indlæse en "
-"undertekst-fil eller en anden type tekstfil, eller media-filen blev ikke "
-"genkendt."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Du har ingen dekoder installeret, der kan håndtere denne fil. Du er nødt til "
-"at installere de nødvendige plugins."
-
-msgid "This is not a media file"
-msgstr "Dette er ikke en media-fil"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "En undertekst-sekvens blev fundet, men ingen video-sekvens."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Både autovideosink og xvimagesink elementerne mangler."
+msgid "This appears to be a text file"
+msgstr "Denne fremstår som en tekstfil"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "'%s' elementet mangler - check din GStreamer installation."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Både autoaudiosink og alsasink elementerne mangler."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Både autovideosink og %s elementer mangler."
@@ -253,6 +191,13 @@ msgstr "Kan ikke afspille en tekstfil uden video eller visualiseringer."
 msgid "No decoder available for type '%s'."
 msgstr "Ingen dekoder tilgængelig for type '%s'."
 
+msgid "No URI specified to play from."
+msgstr "Ingen angivet URI til afspilning."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Ugyldig URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Denne type lydstrøm kan ikke afspilles endnu."
 
@@ -261,20 +206,14 @@ msgstr "Denne type lydstrøm kan ikke afspilles endnu."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Ingen URI-håndtering er implementeret for \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Kildeelement er ugyldigt."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Der opstod en fejl under data-overførsel til \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr ""
-"Der opstod en fejl under overførsel af gdp-overskriftsdata til \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Der opstod en fejl under overførsel af gdp-pakkeindhold til \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Opkobling til %s:%d afvist."
 
@@ -639,17 +578,71 @@ msgstr "Ukendt indkodeelement"
 msgid "Plugin or element of unknown type"
 msgstr "Plugin eller element af ukendt type"
 
-msgid "No device specified."
-msgstr "Ingen enhed angivet."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Kunne ikke åbne vfs-filen \"%s\" til skrivning: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Enheden \"%s\" eksisterer ikke."
+#~ msgid "No filename given"
+#~ msgstr "Intet filnavn angivet"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Enheden \"%s\" er allerede i brug."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Kunne ikke lukke vfs-filen \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Kunne ikke tilgå enheden \"%s\"."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Fejl ved skrivning til filen \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Defekt undertekst URI \"%s\", undertekster deaktiveret."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP sekvenser kan endnu ikke afspilles."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Kunne ikke danne et \"decodebin\" element."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Der blev kun fundet en undertekst-sekvens. Enten forsøger du at indlæse "
+#~ "en undertekst-fil eller en anden type tekstfil, eller media-filen blev "
+#~ "ikke genkendt."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Du har ingen dekoder installeret, der kan håndtere denne fil. Du er nødt "
+#~ "til at installere de nødvendige plugins."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Dette er ikke en media-fil"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "En undertekst-sekvens blev fundet, men ingen video-sekvens."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Både autovideosink og xvimagesink elementerne mangler."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Både autoaudiosink og alsasink elementerne mangler."
+
+#~ msgid "No device specified."
+#~ msgstr "Ingen enhed angivet."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Enheden \"%s\" eksisterer ikke."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Enheden \"%s\" er allerede i brug."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Kunne ikke tilgå enheden \"%s\"."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr ""
+#~ "Der opstod en fejl under overførsel af gdp-overskriftsdata til \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr ""
+#~ "Der opstod en fejl under overførsel af gdp-pakkeindhold til \"%s:%d\"."
index 18ccfbd..2abf19a 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -101,21 +101,6 @@ msgstr "Suchvorgang auf der CD ist fehlgeschlagen."
 msgid "Could not read CD."
 msgstr "CD konnte nicht gelesen werden."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "VFS-Datei »%s« konnte nicht zum Schreiben geöffnet werden: %s."
-
-msgid "No filename given"
-msgstr "Kein Dateiname angegeben"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "VFS-Datei »%s« konnte nicht geschlossen werden."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Fehler beim Schreiben in die Datei »%s«."
-
 msgid "Internal data stream error."
 msgstr "Interner Fehler im Datenstrom."
 
@@ -125,64 +110,17 @@ msgstr ""
 "Ein Plugin »%s« wird zum Abspielen dieses Datenstroms benötigt, ist aber "
 "nicht installiert."
 
-msgid "This appears to be a text file"
-msgstr "Dies scheint eine Textdatei zu sein"
-
 msgid "Could not determine type of stream"
 msgstr "Der Typ des Datenstroms konnte nicht bestimmt werden"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Ungültige Untertitel-URI »%s«, Untertitel werden deaktiviert."
-
-msgid "No URI specified to play from."
-msgstr "Keine Adresse (URI) zum Abspielen angegeben."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Ungültige Adresse (URI) »%s«."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP-Datenströme können noch nicht abgespielt werden."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Das Element »decodebin« konnte nicht erstellt werden."
-
-msgid "Source element is invalid."
-msgstr "Das Quellelement ist ungültig."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Es wurde nur ein Datenstrom mit Untertiteln erkannt. Entweder laden Sie eine "
-"Datei mit Untertiteln oder eine andere Art Textdatei oder die Mediendatei "
-"wurde nicht erkannt."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Sie haben keinen Decoder für den Umgang mit dieser Datei installiert. Sie "
-"sollten die erforderlichen Plugins installieren."
-
-msgid "This is not a media file"
-msgstr "Dies ist keine Mediendatei"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Ein Datenstrom mit Untertiteln wurde erkannt, aber kein Videostrom."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Beide Elemente »autovideosink« und »xvimagesink« fehlen."
+msgid "This appears to be a text file"
+msgstr "Dies scheint eine Textdatei zu sein"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 "Das Element »%s« fehlt - überprüfen Sie Ihre Installation von GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Beide Elemente »autoaudiosink« und »alsasink« fehlen."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Beide Elemente »autovideosink« und »%s« fehlen."
@@ -234,6 +172,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Für den Typ »%s« ist kein Decoder vorhanden."
 
+msgid "No URI specified to play from."
+msgstr "Keine Adresse (URI) zum Abspielen angegeben."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Ungültige Adresse (URI) »%s«."
+
 msgid "This stream type cannot be played yet."
 msgstr "Dieser Datenstrom kann noch nicht abgespielt werden."
 
@@ -241,19 +186,14 @@ msgstr "Dieser Datenstrom kann noch nicht abgespielt werden."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Es ist kein URI-Handler für »%s« implementiert."
 
+msgid "Source element is invalid."
+msgstr "Das Quellelement ist ungültig."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Fehler beim Senden der Daten nach »%s:%d«."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Fehler beim Senden der GDP-Kopfdaten nach »%s:%d«."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Fehler beim Senden der GDP-Nutzdaten nach »%s:%d«."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Verbindung nach %s:%d wurde verweigert."
 
@@ -607,20 +547,73 @@ msgstr "Unbekanntes Encoder-Element"
 msgid "Plugin or element of unknown type"
 msgstr "Plugin oder Element unbekannten Typs"
 
-msgid "No device specified."
-msgstr "Kein Gerät angegeben."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "VFS-Datei »%s« konnte nicht zum Schreiben geöffnet werden: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Das Gerät »%s« existiert nicht."
+#~ msgid "No filename given"
+#~ msgstr "Kein Dateiname angegeben"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Das Gerät »%s« wird bereits verwendet."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "VFS-Datei »%s« konnte nicht geschlossen werden."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Das Gerät »%s« konnte nicht zum Lesen und Schreiben geöffnet werden."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Fehler beim Schreiben in die Datei »%s«."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Ungültige Untertitel-URI »%s«, Untertitel werden deaktiviert."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP-Datenströme können noch nicht abgespielt werden."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Das Element »decodebin« konnte nicht erstellt werden."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Es wurde nur ein Datenstrom mit Untertiteln erkannt. Entweder laden Sie "
+#~ "eine Datei mit Untertiteln oder eine andere Art Textdatei oder die "
+#~ "Mediendatei wurde nicht erkannt."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Sie haben keinen Decoder für den Umgang mit dieser Datei installiert. Sie "
+#~ "sollten die erforderlichen Plugins installieren."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Dies ist keine Mediendatei"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Ein Datenstrom mit Untertiteln wurde erkannt, aber kein Videostrom."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Beide Elemente »autovideosink« und »xvimagesink« fehlen."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Beide Elemente »autoaudiosink« und »alsasink« fehlen."
+
+#~ msgid "No device specified."
+#~ msgstr "Kein Gerät angegeben."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Das Gerät »%s« existiert nicht."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Das Gerät »%s« wird bereits verwendet."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr ""
+#~ "Das Gerät »%s« konnte nicht zum Lesen und Schreiben geöffnet werden."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Fehler beim Senden der GDP-Kopfdaten nach »%s:%d«."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Fehler beim Senden der GDP-Nutzdaten nach »%s:%d«."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr ""
index c542fdf..88b105b 100644 (file)
--- a/po/el.po
+++ b/po/el.po
@@ -102,21 +102,6 @@ msgstr "Αδυναμία αναζήτησης CD."
 msgid "Could not read CD."
 msgstr "Αδυναμία ανάγνωσης CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Αδυναμία ανοίγματος αρχείου vfs «%s» για εγγραφή: %s."
-
-msgid "No filename given"
-msgstr "Δεν δόθηκε όνομα αρχείου"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Αδυναμία κλεισίματος αρχείου vfs «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Σφάλμα κατά την εγγραφή στο αρχείο «%s»."
-
 msgid "Internal data stream error."
 msgstr "Σφάλμα εσωτερικής ροής δεδομένων."
 
@@ -126,62 +111,16 @@ msgstr ""
 "Απαιτείται μια πρόσθετη λειτουργία %s για την αναπαραγωγή αυτής της ροής, "
 "αλλά δεν έχει εγκατασταθεί."
 
-msgid "This appears to be a text file"
-msgstr "Αυτό φαίνεται να είναι αρχείο κειμένου"
-
 msgid "Could not determine type of stream"
 msgstr "Αδυναμία προσδιορισμού τύπου ροής"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Μη έγκυρο URI υποτίτλων «%s», υπότιτλοι απενεργοποιήθηκαν."
-
-msgid "No URI specified to play from."
-msgstr "Δεν ορίσθηκε URI από το οποίο θα γίνει αναπαραγωγή."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Μη έγκυρο URI «%s»."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Ροές RTSP δεν μπορούν να αναπαραχθούν ακόμα."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Αδυναμία δημιουργία στοιχείου «decodebin»."
-
-msgid "Source element is invalid."
-msgstr "Το στοιχείο προέλευσης δεν είναι έγκυρο."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Ανιχνεύθηκε μόνο μια ροή υποτίτλων. Είτε φορτώνετε ένα αρχείο υποτίτλων ή "
-"κάποιο άλλο τύπο αρχείου κειμένου, ή το αρχείο πολυμέσων δεν αναγνωρίσθηκε."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Δεν έχετε εγκατεστημένο αποκωδικοποιητή για να χειριστεί αυτό το αρχείο. "
-"Μπορεί να χρειάζεται να εγκαταστήσετε τις απαραίτητες πρόσθετες λειτουργίες."
-
-msgid "This is not a media file"
-msgstr "Αυτό δεν είναι αρχείο πολυμέσων"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Ανιχνεύθηκε ροή υποτίτλων αλλά όχι ροή βίντεο."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Λείπουν και τα δύο στοιχεία autovideosink και xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Αυτό φαίνεται να είναι αρχείο κειμένου"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Λείπει το στοιχείο '%s' - ελέγξτε την εγκατάσταση του GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Λείπουν και τα δύο στοιχεία autoaudiosink και alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Λείπουν και τα δύο στοιχεία autoaudiosink και %s."
@@ -231,6 +170,13 @@ msgstr "Αδυναμία αναπαραγωγής αρχείου κειμένο
 msgid "No decoder available for type '%s'."
 msgstr "Δεν υπάρχει διαθέσιμος αποκωδικοποιητής για τον τύπο '%s'."
 
+msgid "No URI specified to play from."
+msgstr "Δεν ορίσθηκε URI από το οποίο θα γίνει αναπαραγωγή."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Μη έγκυρο URI «%s»."
+
 msgid "This stream type cannot be played yet."
 msgstr "Αυτός ο τύπος ροής δεν μπορεί να αναπαραχθεί ακόμη."
 
@@ -238,19 +184,14 @@ msgstr "Αυτός ο τύπος ροής δεν μπορεί να αναπαρ
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Δεν έχει υλοποιηθεί χειριστής URI για «%s»."
 
+msgid "Source element is invalid."
+msgstr "Το στοιχείο προέλευσης δεν είναι έγκυρο."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Σφάλμα κατά την αποστολή δεδομένων σε «%s:%d»."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Σφάλμα κατά την αποστολή δεδομένων κεφαλίδας gdp σε «%s:%d»."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Σφάλμα κατά την αποστολή δεδομένων φόρτου gdp σε «%s:%d»."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Άρνηση σύνδεσης σε %s:%d."
 
@@ -615,17 +556,70 @@ msgstr "Άγνωστο στοιχείο κωδικοποιητή"
 msgid "Plugin or element of unknown type"
 msgstr "Πρόσθετη λειτουργία ή στοιχείο άγνωστου τύπου"
 
-msgid "No device specified."
-msgstr "Δεν ορίσθηκε συσκευή."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Αδυναμία ανοίγματος αρχείου vfs «%s» για εγγραφή: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Η συσκευή «%s» δεν υπάρχει."
+#~ msgid "No filename given"
+#~ msgstr "Δεν δόθηκε όνομα αρχείου"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Η συσκευή «%s» χρησιμοποιείται ήδη."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Αδυναμία κλεισίματος αρχείου vfs «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Αδυναμία ανοίγματος συσκευής «%s» για ανάγνωση και εγγραφή."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Σφάλμα κατά την εγγραφή στο αρχείο «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Μη έγκυρο URI υποτίτλων «%s», υπότιτλοι απενεργοποιήθηκαν."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Ροές RTSP δεν μπορούν να αναπαραχθούν ακόμα."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Αδυναμία δημιουργία στοιχείου «decodebin»."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Ανιχνεύθηκε μόνο μια ροή υποτίτλων. Είτε φορτώνετε ένα αρχείο υποτίτλων ή "
+#~ "κάποιο άλλο τύπο αρχείου κειμένου, ή το αρχείο πολυμέσων δεν "
+#~ "αναγνωρίσθηκε."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Δεν έχετε εγκατεστημένο αποκωδικοποιητή για να χειριστεί αυτό το αρχείο. "
+#~ "Μπορεί να χρειάζεται να εγκαταστήσετε τις απαραίτητες πρόσθετες "
+#~ "λειτουργίες."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Αυτό δεν είναι αρχείο πολυμέσων"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Ανιχνεύθηκε ροή υποτίτλων αλλά όχι ροή βίντεο."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Λείπουν και τα δύο στοιχεία autovideosink και xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Λείπουν και τα δύο στοιχεία autoaudiosink και alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Δεν ορίσθηκε συσκευή."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Η συσκευή «%s» δεν υπάρχει."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Η συσκευή «%s» χρησιμοποιείται ήδη."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Αδυναμία ανοίγματος συσκευής «%s» για ανάγνωση και εγγραφή."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Σφάλμα κατά την αποστολή δεδομένων κεφαλίδας gdp σε «%s:%d»."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Σφάλμα κατά την αποστολή δεδομένων φόρτου gdp σε «%s:%d»."
index 2526c86..8aed5f9 100644 (file)
@@ -103,21 +103,6 @@ msgstr "Could not close vfs file \"%s\"."
 msgid "Could not read CD."
 msgstr "Could not write to device \"%s\"."
 
-#, fuzzy, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Could not open vfs file \"%s\" for writing."
-
-msgid "No filename given"
-msgstr "No filename given"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Could not close vfs file \"%s\"."
-
-#, fuzzy, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Error closing file \"%s\"."
-
 msgid "Internal data stream error."
 msgstr ""
 
@@ -125,60 +110,17 @@ msgstr ""
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 
-msgid "This appears to be a text file"
-msgstr ""
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "Could not write to file \"%s\"."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-
-msgid "No URI specified to play from."
-msgstr ""
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr ""
-
-msgid "RTSP streams cannot be played yet."
-msgstr ""
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr ""
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-#, fuzzy
-msgid "This is not a media file"
-msgstr "Device \"%s\" is not a capture device."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
+msgid "This appears to be a text file"
 msgstr ""
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -228,25 +170,27 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
+msgid "No URI specified to play from."
 msgstr ""
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
+msgid "Invalid URI \"%s\"."
 msgstr ""
 
-#, fuzzy, c-format
-msgid "Error while sending data to \"%s:%d\"."
-msgstr "Error closing file \"%s\"."
+msgid "This stream type cannot be played yet."
+msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Source element is invalid."
 msgstr ""
 
+#, fuzzy, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "Error closing file \"%s\"."
+
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr ""
@@ -595,20 +539,36 @@ msgstr ""
 msgid "Plugin or element of unknown type"
 msgstr ""
 
-msgid "No device specified."
-msgstr "No device specified."
+#, fuzzy
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Could not open vfs file \"%s\" for writing."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Device \"%s\" does not exist."
+#~ msgid "No filename given"
+#~ msgstr "No filename given"
 
-#, fuzzy, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "OSS device \"%s\" is already in use by another program."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Could not close vfs file \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Could not open device \"%s\" for reading and writing."
+#, fuzzy
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Error closing file \"%s\"."
+
+#, fuzzy
+#~ msgid "This is not a media file"
+#~ msgstr "Device \"%s\" is not a capture device."
+
+#~ msgid "No device specified."
+#~ msgstr "No device specified."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Device \"%s\" does not exist."
+
+#, fuzzy
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "OSS device \"%s\" is already in use by another program."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Could not open device \"%s\" for reading and writing."
 
 #, fuzzy
 #~ msgid "Could not create \"typefind\" element."
diff --git a/po/eo.po b/po/eo.po
new file mode 100644 (file)
index 0000000..2df6136
--- /dev/null
+++ b/po/eo.po
@@ -0,0 +1,538 @@
+# Esperanto translation for gst-plugins-base.
+# Copyright (C) 2011 Free Software Foundation, Inc.
+# This file is distributed under the same license as the gst-plugins-base package.
+# Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>, 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: gst-plugins-base 0.10.32.2\n"
+"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
+"POT-Creation-Date: 2011-08-22 12:54+0200\n"
+"PO-Revision-Date: 2011-06-04 21:11+0100\n"
+"Last-Translator: Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>\n"
+"Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net>\n"
+"Language: eo\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgid "Master"
+msgstr "Ĉefa regilo"
+
+msgid "Bass"
+msgstr "Baso"
+
+msgid "Treble"
+msgstr ""
+
+msgid "PCM"
+msgstr ""
+
+msgid "Synth"
+msgstr "Sintezilo"
+
+msgid "Line-in"
+msgstr ""
+
+msgid "CD"
+msgstr "KD"
+
+msgid "Microphone"
+msgstr "Mikrofono"
+
+msgid "PC Speaker"
+msgstr "Komputila laŭtparolilo"
+
+msgid "Playback"
+msgstr "Reproduktado"
+
+msgid "Capture"
+msgstr "Kapti"
+
+msgid "Could not open device for playback in mono mode."
+msgstr "Ne eblis malfermi aparaton por reproduktado per unukanala reĝimo."
+
+msgid "Could not open device for playback in stereo mode."
+msgstr "Ne eblis malfermi aparaton por reproduktado per dukanala reĝimo."
+
+#, c-format
+msgid "Could not open device for playback in %d-channel mode."
+msgstr "Ne eblis malfermi la aparaton por reproduktado per %d-kanala reĝimo."
+
+msgid ""
+"Could not open audio device for playback. Device is being used by another "
+"application."
+msgstr ""
+"Ne eblis malfermi la sonaparaton por reproduktado. Ĝi estas uzate de alia "
+"aplikaĵo."
+
+msgid "Could not open audio device for playback."
+msgstr "Ne eblis malfermi la sonaparaton por reproduktado."
+
+msgid "Could not open device for recording in mono mode."
+msgstr "Ne eblis malfermi la aparaton por registrado per unukanala reĝimo."
+
+msgid "Could not open device for recording in stereo mode."
+msgstr "Ne eblis malfermi la aparaton por registrado per dukanala reĝimo."
+
+#, c-format
+msgid "Could not open device for recording in %d-channel mode"
+msgstr "Ne eblis malfermi la aparaton por registrado per %d-kanala reĝimo."
+
+msgid ""
+"Could not open audio device for recording. Device is being used by another "
+"application."
+msgstr ""
+"Ne eblis malfermi la aparaton por registrado. Ĝi estas uzate de alia "
+"aplikaĵo."
+
+msgid "Could not open audio device for recording."
+msgstr "Ne eblis malfermi sonaparaton por registrado."
+
+msgid "Could not open CD device for reading."
+msgstr "Ne eblis malfermi KD-aparaton por legado."
+
+msgid "Could not seek CD."
+msgstr "Ne eblis traserĉi la KD-n."
+
+msgid "Could not read CD."
+msgstr "Ne eblis legi la KD-n."
+
+msgid "Internal data stream error."
+msgstr "Interna datumflu-eraro."
+
+#, c-format
+msgid "A %s plugin is required to play this stream, but not installed."
+msgstr "%s-kromprogramo bezonatas, sed tia ne estas instalite."
+
+msgid "Could not determine type of stream"
+msgstr "Ne eblis rekoni la tipon de la fluo"
+
+msgid "This appears to be a text file"
+msgstr "Tio ŝajnas esti tekstdosiero"
+
+#, c-format
+msgid "Missing element '%s' - check your GStreamer installation."
+msgstr ""
+
+#, c-format
+msgid "Both autovideosink and %s elements are missing."
+msgstr ""
+
+msgid "The autovideosink element is missing."
+msgstr ""
+
+#, c-format
+msgid "Configured videosink %s is not working."
+msgstr ""
+
+#, c-format
+msgid "Both autovideosink and %s elements are not working."
+msgstr ""
+
+msgid "The autovideosink element is not working."
+msgstr ""
+
+msgid "Custom text sink element is not usable."
+msgstr ""
+
+msgid "No volume control found"
+msgstr "Ne trovis laŭtec-regilon"
+
+#, c-format
+msgid "Both autoaudiosink and %s elements are missing."
+msgstr ""
+
+msgid "The autoaudiosink element is missing."
+msgstr ""
+
+#, c-format
+msgid "Configured audiosink %s is not working."
+msgstr ""
+
+#, c-format
+msgid "Both autoaudiosink and %s elements are not working."
+msgstr ""
+
+msgid "The autoaudiosink element is not working."
+msgstr ""
+
+msgid "Can't play a text file without video or visualizations."
+msgstr ""
+
+#, c-format
+msgid "No decoder available for type '%s'."
+msgstr ""
+
+msgid "No URI specified to play from."
+msgstr ""
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Nevalida URI \"%s\"."
+
+msgid "This stream type cannot be played yet."
+msgstr ""
+
+#, c-format
+msgid "No URI handler implemented for \"%s\"."
+msgstr ""
+
+msgid "Source element is invalid."
+msgstr "Font-elemento estas nevalide."
+
+#, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "Eraro dum sendado de datumoj al \"%s:%d\"."
+
+#, c-format
+msgid "Connection to %s:%d refused."
+msgstr ""
+
+msgid "Can't record audio fast enough"
+msgstr "Ne eblas registri la sonon sufiĉe rapide"
+
+msgid "Failed to read tag: not enough data"
+msgstr ""
+
+msgid "track ID"
+msgstr ""
+
+msgid "MusicBrainz track ID"
+msgstr ""
+
+msgid "artist ID"
+msgstr ""
+
+msgid "MusicBrainz artist ID"
+msgstr ""
+
+msgid "album ID"
+msgstr "album-ID"
+
+msgid "MusicBrainz album ID"
+msgstr ""
+
+msgid "album artist ID"
+msgstr ""
+
+msgid "MusicBrainz album artist ID"
+msgstr ""
+
+msgid "track TRM ID"
+msgstr ""
+
+msgid "MusicBrainz TRM ID"
+msgstr ""
+
+msgid "capturing shutter speed"
+msgstr ""
+
+msgid "Shutter speed used when capturing an image, in seconds"
+msgstr ""
+
+msgid "capturing focal ratio"
+msgstr ""
+
+msgid "Focal ratio (f-number) used when capturing the image"
+msgstr ""
+
+msgid "capturing focal length"
+msgstr ""
+
+msgid "Focal length of the lens used capturing the image, in mm"
+msgstr ""
+
+msgid "capturing digital zoom ratio"
+msgstr ""
+
+msgid "Digital zoom ratio used when capturing an image"
+msgstr ""
+
+msgid "capturing iso speed"
+msgstr ""
+
+msgid "The ISO speed used when capturing an image"
+msgstr ""
+
+msgid "capturing exposure program"
+msgstr ""
+
+msgid "The exposure program used when capturing an image"
+msgstr ""
+
+msgid "capturing exposure mode"
+msgstr ""
+
+msgid "The exposure mode used when capturing an image"
+msgstr ""
+
+msgid "capturing exposure compensation"
+msgstr ""
+
+msgid "The exposure compensation used when capturing an image"
+msgstr ""
+
+msgid "capturing scene capture type"
+msgstr ""
+
+msgid "The scene capture mode used when capturing an image"
+msgstr ""
+
+msgid "capturing gain adjustment"
+msgstr ""
+
+msgid "The overall gain adjustment applied on an image"
+msgstr ""
+
+msgid "capturing white balance"
+msgstr ""
+
+msgid "The white balance mode set when capturing an image"
+msgstr ""
+
+msgid "capturing contrast"
+msgstr ""
+
+msgid "The direction of contrast processing applied when capturing an image"
+msgstr ""
+
+msgid "capturing saturation"
+msgstr ""
+
+msgid "The direction of saturation processing applied when capturing an image"
+msgstr ""
+
+msgid "capturing sharpness"
+msgstr ""
+
+msgid "The direction of sharpness processing applied when capturing an image"
+msgstr ""
+
+msgid "capturing flash fired"
+msgstr ""
+
+msgid "If the flash fired while capturing an image"
+msgstr ""
+
+msgid "capturing flash mode"
+msgstr ""
+
+msgid "The selected flash mode while capturing an image"
+msgstr ""
+
+msgid "capturing metering mode"
+msgstr ""
+
+msgid ""
+"The metering mode used while determining exposure for capturing an image"
+msgstr ""
+
+msgid "capturing source"
+msgstr ""
+
+msgid "The source or type of device used for the capture"
+msgstr ""
+
+msgid "image horizontal ppi"
+msgstr ""
+
+msgid "Media (image/video) intended horizontal pixel density in ppi"
+msgstr ""
+
+msgid "image vertical ppi"
+msgstr ""
+
+msgid "Media (image/video) intended vertical pixel density in ppi"
+msgstr ""
+
+msgid "ID3v2 frame"
+msgstr ""
+
+msgid "unparsed id3v2 tag frame"
+msgstr ""
+
+msgid "This CD has no audio tracks"
+msgstr ""
+
+msgid "ID3 tag"
+msgstr ""
+
+msgid "APE tag"
+msgstr ""
+
+msgid "ICY internet radio"
+msgstr ""
+
+msgid "Apple Lossless Audio (ALAC)"
+msgstr ""
+
+msgid "Free Lossless Audio Codec (FLAC)"
+msgstr ""
+
+msgid "Lossless True Audio (TTA)"
+msgstr ""
+
+msgid "Windows Media Speech"
+msgstr ""
+
+msgid "CYUV Lossless"
+msgstr ""
+
+msgid "FFMpeg v1"
+msgstr "FFMpeg v1"
+
+msgid "Lossless MSZH"
+msgstr ""
+
+msgid "Run-length encoding"
+msgstr ""
+
+msgid "Sami subtitle format"
+msgstr ""
+
+msgid "TMPlayer subtitle format"
+msgstr ""
+
+msgid "Kate subtitle format"
+msgstr ""
+
+msgid "Uncompressed video"
+msgstr ""
+
+msgid "Uncompressed gray"
+msgstr ""
+
+#, c-format
+msgid "Uncompressed %s YUV %s"
+msgstr ""
+
+#, c-format
+msgid "Uncompressed %s%d-bit %s"
+msgstr ""
+
+#, c-format
+msgid "DivX MPEG-4 Version %d"
+msgstr "\"DivX MPEG-4\"-versio %d"
+
+msgid "Uncompressed audio"
+msgstr ""
+
+#, c-format
+msgid "Raw %d-bit %s audio"
+msgstr ""
+
+msgid "Audio CD source"
+msgstr "Son-KD-fonto"
+
+msgid "DVD source"
+msgstr "DVD-fonto"
+
+msgid "Real Time Streaming Protocol (RTSP) source"
+msgstr ""
+
+msgid "Microsoft Media Server (MMS) protocol source"
+msgstr ""
+
+#, c-format
+msgid "%s protocol source"
+msgstr "%s protokolfonto"
+
+#, c-format
+msgid "%s video RTP depayloader"
+msgstr ""
+
+#, c-format
+msgid "%s audio RTP depayloader"
+msgstr ""
+
+#, c-format
+msgid "%s RTP depayloader"
+msgstr ""
+
+#, c-format
+msgid "%s demuxer"
+msgstr ""
+
+#, c-format
+msgid "%s decoder"
+msgstr ""
+
+#, c-format
+msgid "%s video RTP payloader"
+msgstr ""
+
+#, c-format
+msgid "%s audio RTP payloader"
+msgstr ""
+
+#, c-format
+msgid "%s RTP payloader"
+msgstr ""
+
+#, c-format
+msgid "%s muxer"
+msgstr ""
+
+#, c-format
+msgid "%s encoder"
+msgstr ""
+
+#, c-format
+msgid "GStreamer element %s"
+msgstr ""
+
+msgid "Unknown source element"
+msgstr "Nekonata fontelemento"
+
+msgid "Unknown sink element"
+msgstr ""
+
+msgid "Unknown element"
+msgstr "Nekonata elemento"
+
+msgid "Unknown decoder element"
+msgstr ""
+
+msgid "Unknown encoder element"
+msgstr ""
+
+msgid "Plugin or element of unknown type"
+msgstr ""
+
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Ne eblis malfermi la vfs-dosieron \"%s\" por skribado: %s."
+
+#~ msgid "No filename given"
+#~ msgstr "Ne donis dosiernomon"
+
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Ne eblis fermi vfs-dosieron \"%s\"."
+
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Eraro dum skribo al dosiero \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Nevalida subtekst-adreso \"%s\", subtekstoj estos elŝaltate."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Ankoraŭ ne eblas ludi RTSP-fluojn."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Ne eblis krei \"decodebin\"-elementon."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Tio ne estas aŭdvidaĵa dosiero"
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Ambaŭ elementoj \"autovideosink\" kaj \"xvimagesink\" mankas."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Aparato \"%s\" ne ekzistas."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Aparato \"%s\" jam estas uzata."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Ne eblis malfermi aparaton  \"%s\" por legado aŭ skribado."
index a35eec9..a3e7a9e 100644 (file)
--- a/po/es.po
+++ b/po/es.po
@@ -99,21 +99,6 @@ msgstr "No se pudo buscar en el CD."
 msgid "Could not read CD."
 msgstr "No se pudo leer del D."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "No se pudo abrir el archivo VFS «%s» para escribir: %s."
-
-msgid "No filename given"
-msgstr "No se dio un nombre de archivo"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "No se pudo cerrar el archivo VFS «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Error al escribir al archivo «%s»."
-
 msgid "Internal data stream error."
 msgstr "Error interno de flujo de datos."
 
@@ -123,63 +108,16 @@ msgstr ""
 "Se requiere un complemento de %s para reproducir este medio, pero no está "
 "instalado."
 
-msgid "This appears to be a text file"
-msgstr "Esto parece ser un archivo de texto"
-
 msgid "Could not determine type of stream"
 msgstr "No se pudo determinar el tipo de flujo"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "URI de subtítulos «%s» no válida, se desactivaron los subtítulos."
-
-msgid "No URI specified to play from."
-msgstr "No se especificó una URI para reproducir."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "El URI «%s» no es válido."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Aún no se pueden reproducir los medios RTSP."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "No se pudo crear el elemento «decodebin»."
-
-msgid "Source element is invalid."
-msgstr "El elemento fuente no es válido."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Sólo se detecto un flujo de subtítulos. O bien está cargando un archivo de "
-"subtítulos o algún otro tipo de archivo de texto o el archivo multimedia no "
-"se pudo reconocer."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"No tiene un decodificador instalado para manejar este archivo. Debe instalar "
-"los complementos necesarios."
-
-msgid "This is not a media file"
-msgstr "Este no es un archivo multimedia"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Se detectó un flujo de subtítulos, pero no un flujo de vídeo."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Tanto el elemento autovideosink como xvimagesink faltan."
+msgid "This appears to be a text file"
+msgstr "Esto parece ser un archivo de texto"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Falta el elemento «%s»; compruebe su instalación de GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Tanto el elemento autoaudiosink como alsasink faltan."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Tanto el elemento autovideosink como %s faltan."
@@ -230,6 +168,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "No hay un decodificador disponible para el tipo «%s»."
 
+msgid "No URI specified to play from."
+msgstr "No se especificó una URI para reproducir."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "El URI «%s» no es válido."
+
 msgid "This stream type cannot be played yet."
 msgstr "Este tipo de flujo no se puede reproducir aún."
 
@@ -237,19 +182,14 @@ msgstr "Este tipo de flujo no se puede reproducir aún."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "No existe un manejador URI implementado para «%s»."
 
+msgid "Source element is invalid."
+msgstr "El elemento fuente no es válido."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Error al enviar los datos a «%s:%d»."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Error al enviar los datos de la cabecera gdp a «%s:%d»."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Error al enviar la carga de datos de gdp a «%s:%d»."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Se rechazó la conexión con %s:%d."
 
@@ -600,20 +540,72 @@ msgstr "Elemento codificador desconocido"
 msgid "Plugin or element of unknown type"
 msgstr "Complemento o elemento de tipo desconocido"
 
-msgid "No device specified."
-msgstr "No se especificó un dispositivo."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "No se pudo abrir el archivo VFS «%s» para escribir: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "El dispositivo «%s» no existe."
+#~ msgid "No filename given"
+#~ msgstr "No se dio un nombre de archivo"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "El dispositivo «%s» ya se está usando."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "No se pudo cerrar el archivo VFS «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "No se pudo abrir el dispositivo «%s» para su lectura y escritura."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Error al escribir al archivo «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "URI de subtítulos «%s» no válida, se desactivaron los subtítulos."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Aún no se pueden reproducir los medios RTSP."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "No se pudo crear el elemento «decodebin»."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Sólo se detecto un flujo de subtítulos. O bien está cargando un archivo "
+#~ "de subtítulos o algún otro tipo de archivo de texto o el archivo "
+#~ "multimedia no se pudo reconocer."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "No tiene un decodificador instalado para manejar este archivo. Debe "
+#~ "instalar los complementos necesarios."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Este no es un archivo multimedia"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Se detectó un flujo de subtítulos, pero no un flujo de vídeo."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Tanto el elemento autovideosink como xvimagesink faltan."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Tanto el elemento autoaudiosink como alsasink faltan."
+
+#~ msgid "No device specified."
+#~ msgstr "No se especificó un dispositivo."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "El dispositivo «%s» no existe."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "El dispositivo «%s» ya se está usando."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "No se pudo abrir el dispositivo «%s» para su lectura y escritura."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Error al enviar los datos de la cabecera gdp a «%s:%d»."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Error al enviar la carga de datos de gdp a «%s:%d»."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr "No se pueden mostrar a la vez subtítulos de texto y subimágenes."
index 97d1632..507f9ec 100644 (file)
--- a/po/eu.po
+++ b/po/eu.po
@@ -101,21 +101,6 @@ msgstr "Ezin izan da CDan bilatu."
 msgid "Could not read CD."
 msgstr "Ezin izan da CDa irakurri."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Ezin izan da \"%s\" vfs fitxategia ireki idazteko: %s."
-
-msgid "No filename given"
-msgstr "Ez da fitxategi-izenik eman"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Ezin izan da itxi \"%s\" vfs fitxategia."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Errorea gertatu da \"%s\" fitxategian idaztean."
-
 msgid "Internal data stream error."
 msgstr "Datu-korrontearen barne-errorea."
 
@@ -124,64 +109,16 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "%s plugina behar da korronte hori erreproduzitzeko, baina ez dago instalatua."
 
-msgid "This appears to be a text file"
-msgstr "Testu-fitxategia dela dirudi"
-
 msgid "Could not determine type of stream"
 msgstr "Ezin izan da korronte mota zehaztu"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-"Azpitituluen \"%s\" URIa ez da baliozkoa. Azpitituluak desgaitu egin dira."
-
-msgid "No URI specified to play from."
-msgstr "Ez da URIrik zehaztu irakurtzeko."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "\"%s\" URI baliogabea."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Oraindik ezin dira erreproduzitu RTSP korronteak."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Ezin izan da sortu \"decodebin\" elementua."
-
-msgid "Source element is invalid."
-msgstr "Iturburuko elementua baliogabea da."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Azpitituluen korrontea soilik detektatu da. Azpitituluen fitxategi bat edo "
-"beste testu-fitxategi bat ari zara kargatzen, edo multimedia-fitxategi hori "
-"ez da onartzen."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Ez da instalatu fitxategi hori maneiatzeko deskodetzailerik  Litekeena da "
-"beharrezko pluginak instalatu behar izatea."
-
-msgid "This is not a media file"
-msgstr "Hori ez da multimedia-fitxategi bat"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Azpitituluen korrontea detektatu da, baina ez bideoarena."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Autovideosink eta xvimagesink elementuak, biak, falta dira."
+msgid "This appears to be a text file"
+msgstr "Testu-fitxategia dela dirudi"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "'%s' elementua falta da. Begiratu GStreamer ondo instalatua dagoen."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Autoaudiosink eta alsasink elementuak, biak, falta dira."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Autovideosink eta %s elementuak, biak, falta dira."
@@ -233,6 +170,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Ez dago deskodetzaile erabilgarririk '%s' motarentzat."
 
+msgid "No URI specified to play from."
+msgstr "Ez da URIrik zehaztu irakurtzeko."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "\"%s\" URI baliogabea."
+
 msgid "This stream type cannot be played yet."
 msgstr "Oraindik ezin da erreproduzitu korronte mota hori."
 
@@ -240,21 +184,14 @@ msgstr "Oraindik ezin da erreproduzitu korronte mota hori."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Ez da URI maneiatzailerik ezarri \"%s\"(r)entzat."
 
+msgid "Source element is invalid."
+msgstr "Iturburuko elementua baliogabea da."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Errorea gertatu da datuak \"%s:%d\"(e)ra bidaltzean."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Errorea gertatu da gdp goiburuaren datuak \"%s:%d\"(e)ra bidaltzean."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr ""
-"Errorea gertatu da gdp karga erabilgarriaren datuak \"%s:%d\"(e)ra "
-"bidaltzean."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "%s:%d(e)ra konektatzea ukatu da."
 
@@ -602,17 +539,73 @@ msgstr "Kodetzailearen elementu ezezaguna"
 msgid "Plugin or element of unknown type"
 msgstr "Mota ezezaguneko plugina edo elementua"
 
-msgid "No device specified."
-msgstr "Ez da gailurik zehaztu."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Ezin izan da \"%s\" vfs fitxategia ireki idazteko: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "\"%s\" gailua ez dago."
+#~ msgid "No filename given"
+#~ msgstr "Ez da fitxategi-izenik eman"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "\"%s\" gailua erabiltzen ari dira."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Ezin izan da itxi \"%s\" vfs fitxategia."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Ezin izan da \"%s\" gailua ireki irakurtzeko eta idazteko."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Errorea gertatu da \"%s\" fitxategian idaztean."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr ""
+#~ "Azpitituluen \"%s\" URIa ez da baliozkoa. Azpitituluak desgaitu egin dira."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Oraindik ezin dira erreproduzitu RTSP korronteak."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Ezin izan da sortu \"decodebin\" elementua."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Azpitituluen korrontea soilik detektatu da. Azpitituluen fitxategi bat "
+#~ "edo beste testu-fitxategi bat ari zara kargatzen, edo multimedia-"
+#~ "fitxategi hori ez da onartzen."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Ez da instalatu fitxategi hori maneiatzeko deskodetzailerik  Litekeena da "
+#~ "beharrezko pluginak instalatu behar izatea."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Hori ez da multimedia-fitxategi bat"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Azpitituluen korrontea detektatu da, baina ez bideoarena."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Autovideosink eta xvimagesink elementuak, biak, falta dira."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Autoaudiosink eta alsasink elementuak, biak, falta dira."
+
+#~ msgid "No device specified."
+#~ msgstr "Ez da gailurik zehaztu."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "\"%s\" gailua ez dago."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "\"%s\" gailua erabiltzen ari dira."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Ezin izan da \"%s\" gailua ireki irakurtzeko eta idazteko."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr ""
+#~ "Errorea gertatu da gdp goiburuaren datuak \"%s:%d\"(e)ra bidaltzean."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr ""
+#~ "Errorea gertatu da gdp karga erabilgarriaren datuak \"%s:%d\"(e)ra "
+#~ "bidaltzean."
index 0e35ce2..03254eb 100644 (file)
--- a/po/fi.po
+++ b/po/fi.po
@@ -103,21 +103,6 @@ msgstr "CD-levyllä ei voitu siirtyä."
 msgid "Could not read CD."
 msgstr "CD-levyä ei voitu lukea."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "VFS-tiedostoa \"%s\" ei voi avata kirjoitettavaksi: %s."
-
-msgid "No filename given"
-msgstr "Tiedostonimeä ei annettu"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "VFS-tiedostoa \"%s\" ei voitu sulkea."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Virhe kirjoitettaessa tiedostoon \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Sisäisen tietovirran virhe."
 
@@ -126,62 +111,16 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "Virran toistamiseen tarvitaan %s-liitännäinen, mutta se ei ole asennettu."
 
-msgid "This appears to be a text file"
-msgstr "Tämä näyttää olevan tekstitiedosto"
-
 msgid "Could not determine type of stream"
 msgstr "Virran tyyppiä ei voitu määrittää"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Virheellinen tekstitysten URI \"%s\", tekstitys ei ole käytössä."
-
-msgid "No URI specified to play from."
-msgstr "URIa, josta soitetaan, ei annettu."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Virheellinen URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP-virtoja ei voi vielä soittaa."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Elementtiä \"decodebin\" ei voitu luoda."
-
-msgid "Source element is invalid."
-msgstr "Lähde-elementti on virheellinen."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Havaittiin vain tekstitysvirta. Joko yrität ladata tekstitystiedostoa tai "
-"muuta tekstitiedostoa, tai mediatiedostoa ei voitu tunnistaa."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Tämän tiedoston käsittelyyn ei ole asennettu purkajaa. Voi olla, että sinun "
-"täytyy asentaa tarvittavia liitännäisiä."
-
-msgid "This is not a media file"
-msgstr "Tämä ei ole mediatiedosto"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Havaittiin tekstitysvirta, mutta ei videovirtaa."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Sekä autovideosink- ja xvimagesink-elementit puuttuvat."
+msgid "This appears to be a text file"
+msgstr "Tämä näyttää olevan tekstitiedosto"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Puuttuva elementti \"%s\" - tarkista GStreamer-asennuksesi."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Sekä autoaudiosink- että alsasink-elementit puuttuvat."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Sekä autovideosink- ja %s-elementit puuttuvat."
@@ -231,6 +170,13 @@ msgstr "Ei voida toistaa tekstitiedosta ilman videota tai visualisointia."
 msgid "No decoder available for type '%s'."
 msgstr "Purkajaa tyypille \"%s\" ei ole saatavilla."
 
+msgid "No URI specified to play from."
+msgstr "URIa, josta soitetaan, ei annettu."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Virheellinen URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Tätä virtatyyppiä ei voi vielä soittaa."
 
@@ -238,19 +184,14 @@ msgstr "Tätä virtatyyppiä ei voi vielä soittaa."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Protokollalle \"%s\" ei ole määritelty URI-käsittelijää."
 
+msgid "Source element is invalid."
+msgstr "Lähde-elementti on virheellinen."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Virhe lähetettäessä tietoa kohteeseen \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Virhe lähetettäessä gdp-otsaketietoja kohteeseen \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Virhe lähetettäessä gdp-sisältöä kohteeseen \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Yhteys kohteeseen %s:%d estettiin."
 
@@ -600,20 +541,71 @@ msgstr "Tuntematon kodekkielementti"
 msgid "Plugin or element of unknown type"
 msgstr "Liitännäisen tai elementin tyyppi on tuntematon"
 
-msgid "No device specified."
-msgstr "Laitetta ei ole määritelty."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "VFS-tiedostoa \"%s\" ei voi avata kirjoitettavaksi: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Laitetta \"%s\" ei ole olemassa."
+#~ msgid "No filename given"
+#~ msgstr "Tiedostonimeä ei annettu"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Laite \"%s\" on jo käytössä."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "VFS-tiedostoa \"%s\" ei voitu sulkea."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Laitetta \"%s\" ei voi avata luettavaksi ja kirjoitettavaksi."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Virhe kirjoitettaessa tiedostoon \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Virheellinen tekstitysten URI \"%s\", tekstitys ei ole käytössä."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP-virtoja ei voi vielä soittaa."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Elementtiä \"decodebin\" ei voitu luoda."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Havaittiin vain tekstitysvirta. Joko yrität ladata tekstitystiedostoa tai "
+#~ "muuta tekstitiedostoa, tai mediatiedostoa ei voitu tunnistaa."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Tämän tiedoston käsittelyyn ei ole asennettu purkajaa. Voi olla, että "
+#~ "sinun täytyy asentaa tarvittavia liitännäisiä."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Tämä ei ole mediatiedosto"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Havaittiin tekstitysvirta, mutta ei videovirtaa."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Sekä autovideosink- ja xvimagesink-elementit puuttuvat."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Sekä autoaudiosink- että alsasink-elementit puuttuvat."
+
+#~ msgid "No device specified."
+#~ msgstr "Laitetta ei ole määritelty."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Laitetta \"%s\" ei ole olemassa."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Laite \"%s\" on jo käytössä."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Laitetta \"%s\" ei voi avata luettavaksi ja kirjoitettavaksi."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Virhe lähetettäessä gdp-otsaketietoja kohteeseen \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Virhe lähetettäessä gdp-sisältöä kohteeseen \"%s:%d\"."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr "Ei voida toistaa sekä tekstitystä että alikuvaa."
index 50865f9..8f2b0a2 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -106,21 +106,6 @@ msgstr "Impossible de se positionner sur le CD."
 msgid "Could not read CD."
 msgstr "Impossible de lire le CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Impossible d'ouvrir le fichier vfs « %s » en écriture : %s."
-
-msgid "No filename given"
-msgstr "Aucun nom de fichier indiqué"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Impossible de fermer le fichier vfs « %s »."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Erreur lors de l'écriture dans le fichier « %s »."
-
 msgid "Internal data stream error."
 msgstr "Erreur interne de flux de données."
 
@@ -129,63 +114,16 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "Un greffon %s est requis pour lire ce flux, mais il n'est pas installé."
 
-msgid "This appears to be a text file"
-msgstr "Ce fichier semble être un fichier texte"
-
 msgid "Could not determine type of stream"
 msgstr "Impossible de déterminer le type de flux"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "URI de sous-titres « %s » non valide, les sous-titres sont désactivés."
-
-msgid "No URI specified to play from."
-msgstr "Aucun URI source indiqué pour la lecture."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "URI « %s » non valide."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Il n'est pas encore possible de lire les flux RTSP."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Impossible de créer un élément « decodebin »."
-
-msgid "Source element is invalid."
-msgstr "Élément source non valide."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Seul un flux de sous-titres a été détecté. Soit vous essayez d'ouvrir un "
-"fichier de sous-titres ou un autre type de fichier texte, soit le fichier "
-"multimédia n'a pas été reconnu."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Aucun décodeur n'est installé pour gérer ce fichier. Vous devriez "
-"probablement installer des greffons supplémentaires."
-
-msgid "This is not a media file"
-msgstr "Ceci n'est pas un fichier multimédia"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Un flux de sous-titres a été détecté, mais pas de flux vidéo."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Les éléments autovideosink et xvimagesink sont tous deux manquants."
+msgid "This appears to be a text file"
+msgstr "Ce fichier semble être un fichier texte"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Élément « %s » manquant, contrôlez votre installation de GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Les éléments autoaudiosink et alsasink sont tous deux manquants."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Les éléments autovideosink et %s sont tous deux manquants."
@@ -235,6 +173,13 @@ msgstr "Impossible de lire un fichier texte sans vidéo ou visualisation."
 msgid "No decoder available for type '%s'."
 msgstr "Aucun décodeur n'est disponible pour le type « %s »."
 
+msgid "No URI specified to play from."
+msgstr "Aucun URI source indiqué pour la lecture."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "URI « %s » non valide."
+
 msgid "This stream type cannot be played yet."
 msgstr "Ce type de flux ne peut pas encore être lu."
 
@@ -242,19 +187,14 @@ msgstr "Ce type de flux ne peut pas encore être lu."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Aucun gestionnaire d'URI implémenté pour « %s »."
 
+msgid "Source element is invalid."
+msgstr "Élément source non valide."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Erreur lors de l'envoi de données vers « %s:%d »."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Erreur lors de l'envoi de données d'en-tête gdp vers « %s:%d »."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Erreur lors de l'envoi de données de charge utile gdp vers « %s:%d »."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Connexion refusée vers %s:%d."
 
@@ -617,17 +557,71 @@ msgstr "Élément codeur inconnu"
 msgid "Plugin or element of unknown type"
 msgstr "Greffon ou élément de type inconnu"
 
-msgid "No device specified."
-msgstr "Aucun périphérique indiqué."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Impossible d'ouvrir le fichier vfs « %s » en écriture : %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Le périphérique « %s » n'existe pas."
+#~ msgid "No filename given"
+#~ msgstr "Aucun nom de fichier indiqué"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Le périphérique « %s » est déjà en cours d'utilisation."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Impossible de fermer le fichier vfs « %s »."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Impossible d'ouvrir le périphérique « %s » en lecture et écriture."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Erreur lors de l'écriture dans le fichier « %s »."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr ""
+#~ "URI de sous-titres « %s » non valide, les sous-titres sont désactivés."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Il n'est pas encore possible de lire les flux RTSP."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Impossible de créer un élément « decodebin »."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Seul un flux de sous-titres a été détecté. Soit vous essayez d'ouvrir un "
+#~ "fichier de sous-titres ou un autre type de fichier texte, soit le fichier "
+#~ "multimédia n'a pas été reconnu."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Aucun décodeur n'est installé pour gérer ce fichier. Vous devriez "
+#~ "probablement installer des greffons supplémentaires."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Ceci n'est pas un fichier multimédia"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Un flux de sous-titres a été détecté, mais pas de flux vidéo."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Les éléments autovideosink et xvimagesink sont tous deux manquants."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Les éléments autoaudiosink et alsasink sont tous deux manquants."
+
+#~ msgid "No device specified."
+#~ msgstr "Aucun périphérique indiqué."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Le périphérique « %s » n'existe pas."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Le périphérique « %s » est déjà en cours d'utilisation."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Impossible d'ouvrir le périphérique « %s » en lecture et écriture."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Erreur lors de l'envoi de données d'en-tête gdp vers « %s:%d »."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr ""
+#~ "Erreur lors de l'envoi de données de charge utile gdp vers « %s:%d »."
index 0f8e512..35f3ada 100644 (file)
--- a/po/gl.po
+++ b/po/gl.po
@@ -101,21 +101,6 @@ msgstr "Non foi posíbel buscar no CD."
 msgid "Could not read CD."
 msgstr "Non foi posíbel ler o CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Non foi posíbel abrir o ficheiro vfs «%s» para escribir: %s."
-
-msgid "No filename given"
-msgstr "Non se forneceu un nome de ficheiro"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Non foi posíbel pechar o ficheiro vfs «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Produciuse un erro ao escribir no ficheiro «%s»."
-
 msgid "Internal data stream error."
 msgstr "Produciuse un erro no fluxo de datos internos."
 
@@ -124,63 +109,16 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "Precísase un engadido %s que non está instalado para reproducir este fluxo."
 
-msgid "This appears to be a text file"
-msgstr "Isto parece ser un ficheiro de texto"
-
 msgid "Could not determine type of stream"
 msgstr "Non foi posíbel determinar o tipo de fluxo."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "O URI dos subtítulos «%s» é incorrecto, desactiváronse os subtítulos."
-
-msgid "No URI specified to play from."
-msgstr "Non se especificou un URI para reproducir."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "O URI «%s» é incorrecto."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Aínda non é posíbel reproducir os fluxos RTSP."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Non foi posíbel crear o elemento \"decodebin\" ."
-
-msgid "Source element is invalid."
-msgstr "O elemento fonte é incorrecto."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Só se detectou un fluxo de subtítulos. Ou ben está cargando un ficheiro de "
-"subtítulos ou calquera outro ficheiro de texto ou quizais o ficheiro "
-"multimedia non foi recoñecido."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Non ten instalado un decodificador para manexar este ficheiro. É posíbel que "
-"precise instalar os engadidos necesarios. "
-
-msgid "This is not a media file"
-msgstr "Este non é un ficheiro multimedia"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Detectouse un fluxo de subtítulos pero non de vídeo."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Faltan os elementos autovideosink e xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Isto parece ser un ficheiro de texto"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Falta o elemento «%s» - comprobe a instalación do GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Faltan os elementos autoaudiosink e alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Faltan os elementos autivideosink e %s."
@@ -231,6 +169,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Non hai dispoñíbel ningún decodificador para o tipo «%s»."
 
+msgid "No URI specified to play from."
+msgstr "Non se especificou un URI para reproducir."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "O URI «%s» é incorrecto."
+
 msgid "This stream type cannot be played yet."
 msgstr "Aínda non é posíbel reproducir este tipo de fluxo."
 
@@ -238,19 +183,14 @@ msgstr "Aínda non é posíbel reproducir este tipo de fluxo."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Non hai implementado un manexador de URIs para «%s»."
 
+msgid "Source element is invalid."
+msgstr "O elemento fonte é incorrecto."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Produciuse un erro mentres se enviaban datos a \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Produciuse un erro ao enviar os datos da cabeceira gdp a  \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Produciuse un erro ao enviar a carga de datos de gdp a «%s:%d»."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Rexeitouse a conexión a %s:%d."
 
@@ -601,18 +541,72 @@ msgstr "O elemento codificador é descoñecido"
 msgid "Plugin or element of unknown type"
 msgstr "Engadido ou elemento de tipo descoñecido"
 
-msgid "No device specified."
-msgstr "Non se especificou un dispositivo."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Non foi posíbel abrir o ficheiro vfs «%s» para escribir: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "O dispositivo «%s» non existe."
+#~ msgid "No filename given"
+#~ msgstr "Non se forneceu un nome de ficheiro"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "O dispositivo «%s» xa está en uso."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Non foi posíbel pechar o ficheiro vfs «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr ""
-"Non foi posíbel abrir o dispositivo «%s» para a súa lectura e escritura."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Produciuse un erro ao escribir no ficheiro «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr ""
+#~ "O URI dos subtítulos «%s» é incorrecto, desactiváronse os subtítulos."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Aínda non é posíbel reproducir os fluxos RTSP."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Non foi posíbel crear o elemento \"decodebin\" ."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Só se detectou un fluxo de subtítulos. Ou ben está cargando un ficheiro "
+#~ "de subtítulos ou calquera outro ficheiro de texto ou quizais o ficheiro "
+#~ "multimedia non foi recoñecido."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Non ten instalado un decodificador para manexar este ficheiro. É posíbel "
+#~ "que precise instalar os engadidos necesarios. "
+
+#~ msgid "This is not a media file"
+#~ msgstr "Este non é un ficheiro multimedia"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Detectouse un fluxo de subtítulos pero non de vídeo."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Faltan os elementos autovideosink e xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Faltan os elementos autoaudiosink e alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Non se especificou un dispositivo."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "O dispositivo «%s» non existe."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "O dispositivo «%s» xa está en uso."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr ""
+#~ "Non foi posíbel abrir o dispositivo «%s» para a súa lectura e escritura."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr ""
+#~ "Produciuse un erro ao enviar os datos da cabeceira gdp a  \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Produciuse un erro ao enviar a carga de datos de gdp a «%s:%d»."
index 29b6ccf..2d7808a 100644 (file)
--- a/po/hu.po
+++ b/po/hu.po
@@ -102,21 +102,6 @@ msgstr "Nem kereshető a CD."
 msgid "Could not read CD."
 msgstr "Nem olvasható a CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nem lehet írásra megnyitni a(z) „%s” vfs-fájlt: %s."
-
-msgid "No filename given"
-msgstr "Nincs fájlnév megadva"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nem lehet bezárni a(z) „%s” vfs-fájlt."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Hiba a(z) „%s” fájl írása közben."
-
 msgid "Internal data stream error."
 msgstr "Belső adatfolyam-hiba."
 
@@ -126,62 +111,16 @@ msgstr ""
 "Az adatfolyam lejátszásához egy %s bővítmény szükséges, de az nincs "
 "telepítve."
 
-msgid "This appears to be a text file"
-msgstr "Ez egy szövegfájlnak tűnik"
-
 msgid "Could not determine type of stream"
 msgstr "Nem határozható meg az adatfolyam típusa"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Érvénytelen felirat URI: „%s”, a feliratok letiltva."
-
-msgid "No URI specified to play from."
-msgstr "Nincs megadva URI a lejátszáshoz."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Érvénytelen URI: „%s”."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Az RTSP adatfolyamok még nem játszhatók le."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nem hozható létre „decodebin” elem"
-
-msgid "Source element is invalid."
-msgstr "A forráselem érvénytelen."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Csak egy feliratfolyam észlelhető. Vagy egy feliratfájlt vagy más "
-"szövegfájlt tölt be, vagy a médiafájl nem ismerhető fel."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Nincs telepítve a fájl kezeléséhez szükséges dekódoló. Lehetséges, hogy "
-"telepítenie kell a szükséges bővítményeket."
-
-msgid "This is not a media file"
-msgstr "Ez nem egy médiafájl"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Egy feliratfolyam felismerve, de nincs videofolyam."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Mind az autovideosink, mind az xvimagesink elemek hiányoznak."
+msgid "This appears to be a text file"
+msgstr "Ez egy szövegfájlnak tűnik"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "A(z) „%s” elem hiányzik - ellenőrizze a Gstreamer telepítését."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Az autoaudiosink és az alsasink elem is hiányzik."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Az autovideosink és a(z) %s elem is hiányzik."
@@ -231,6 +170,13 @@ msgstr "A szövegfájl nem játszható le videó vagy vizualizációk nélkül."
 msgid "No decoder available for type '%s'."
 msgstr "Nem érhető el dekódoló a(z) „%s” típushoz."
 
+msgid "No URI specified to play from."
+msgstr "Nincs megadva URI a lejátszáshoz."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Érvénytelen URI: „%s”."
+
 msgid "This stream type cannot be played yet."
 msgstr "Ez az adatfolyamtípus még nem játszható le."
 
@@ -238,19 +184,14 @@ msgstr "Ez az adatfolyamtípus még nem játszható le."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nincs URI kezelő megvalósítva a következőhöz: „%s”."
 
+msgid "Source element is invalid."
+msgstr "A forráselem érvénytelen."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Hiba adatok küldése során a következőnek: „%s:%d”."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Hiba a gdp fejlécadatok küldésekor a következőnek: „%s:%d”."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Hiba a gdp küldeményadatok elküldésekor a következőnek: „%s:%d”."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "A kapcsolat visszautasítva a következőhöz: %s:%d."
 
@@ -600,17 +541,68 @@ msgstr "Ismeretlen kódolóelem"
 msgid "Plugin or element of unknown type"
 msgstr "Ismeretlen típusú bővítmény vagy elem"
 
-msgid "No device specified."
-msgstr "Nincs megadva eszköz."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nem lehet írásra megnyitni a(z) „%s” vfs-fájlt: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Az eszköz („%s”) nem létezik."
+#~ msgid "No filename given"
+#~ msgstr "Nincs fájlnév megadva"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Az eszköz („%s”) már használatban van."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nem lehet bezárni a(z) „%s” vfs-fájlt."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Nem lehet olvasásra és írásra megnyitni az eszközt („%s”)."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Hiba a(z) „%s” fájl írása közben."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Érvénytelen felirat URI: „%s”, a feliratok letiltva."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Az RTSP adatfolyamok még nem játszhatók le."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nem hozható létre „decodebin” elem"
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Csak egy feliratfolyam észlelhető. Vagy egy feliratfájlt vagy más "
+#~ "szövegfájlt tölt be, vagy a médiafájl nem ismerhető fel."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Nincs telepítve a fájl kezeléséhez szükséges dekódoló. Lehetséges, hogy "
+#~ "telepítenie kell a szükséges bővítményeket."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Ez nem egy médiafájl"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Egy feliratfolyam felismerve, de nincs videofolyam."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Mind az autovideosink, mind az xvimagesink elemek hiányoznak."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Az autoaudiosink és az alsasink elem is hiányzik."
+
+#~ msgid "No device specified."
+#~ msgstr "Nincs megadva eszköz."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Az eszköz („%s”) nem létezik."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Az eszköz („%s”) már használatban van."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Nem lehet olvasásra és írásra megnyitni az eszközt („%s”)."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Hiba a gdp fejlécadatok küldésekor a következőnek: „%s:%d”."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Hiba a gdp küldeményadatok elküldésekor a következőnek: „%s:%d”."
index 98fc9a6..b2168f6 100644 (file)
--- a/po/id.po
+++ b/po/id.po
@@ -97,21 +97,6 @@ msgstr "Tak dapat mencari CD."
 msgid "Could not read CD."
 msgstr "Tak dapat membaca CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Tak dapat membuka berkas vfs \"%s\" untuk ditulis: %s."
-
-msgid "No filename given"
-msgstr "Tak ada nama berkas yang diberikan"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Tak dapat menutup berkas vfs \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Galat ketika menulis ke berkas \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Galat arus data internal."
 
@@ -119,62 +104,16 @@ msgstr "Galat arus data internal."
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "Plugin %s dibutuhkan untuk memutar arus ini, tapi tidak diinstal."
 
-msgid "This appears to be a text file"
-msgstr "Ini kelihatannya merupakan berkas teks"
-
 msgid "Could not determine type of stream"
 msgstr "Tak dapat menentukan tipe arus"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "URI subjudul \"%s\" tidak sah, subjudul dinonaktifkan."
-
-msgid "No URI specified to play from."
-msgstr "Tak ada URI yang ditentukan untuk diputar."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "URI \"%s\" tidak sah."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Arus RTSP belum dapat dimainkan."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Tak dapat membuat elemen \"decodebin\""
-
-msgid "Source element is invalid."
-msgstr "Elemen sumber tidak sah."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Hanya arus subjudul yang terdeteksi. Mungkin anda memuat berkas subjudul "
-"atau tipe lain dari berkas teks, atau berkas media yang tidak dikenal."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Anda tidak memiliki pengawasandi terinstal untuk menangani berkas ini. Anda "
-"mungkin harus menginstal plugin yang diperlukan."
-
-msgid "This is not a media file"
-msgstr "Ini bukan berkas media"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Arus subjudul terdeteksi, tapi bukan arus video."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Baik elemen autovideosink maupun xvimagesink hilang."
+msgid "This appears to be a text file"
+msgstr "Ini kelihatannya merupakan berkas teks"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Elemen '%s' hilang - cek instalasi GStreamer anda."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Baik elemen autoaudiosink maupun alsasink hilang."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Baik elemen autovideosink maupun %s hilang."
@@ -224,6 +163,13 @@ msgstr "Tak dapat memutar berkas teks tanpa video atau visualisasi."
 msgid "No decoder available for type '%s'."
 msgstr "Tak ada pengawasandi yang tersedia untuk tipe '%s'."
 
+msgid "No URI specified to play from."
+msgstr "Tak ada URI yang ditentukan untuk diputar."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "URI \"%s\" tidak sah."
+
 msgid "This stream type cannot be played yet."
 msgstr "Tipe arus ini belum dapat dimainkan."
 
@@ -231,19 +177,14 @@ msgstr "Tipe arus ini belum dapat dimainkan."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Tak ada penanganan URI yang diimplementasikan untuk \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Elemen sumber tidak sah."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Galat ketika mengirim data ke \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Galat ketika mengirim data tajuk gdp ke \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Galat ketika mengirim data pemuat gdp ke \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Koneksi ke %s:%d ditolak."
 
@@ -591,20 +532,71 @@ msgstr "Elemen penyandi tak diketahui"
 msgid "Plugin or element of unknown type"
 msgstr "Plugin atau elemen dari tipe yang tak diketahui"
 
-msgid "No device specified."
-msgstr "Tak ada divais yang ditentukan."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Tak dapat membuka berkas vfs \"%s\" untuk ditulis: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Divais \"%s\" tak ada."
+#~ msgid "No filename given"
+#~ msgstr "Tak ada nama berkas yang diberikan"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Divais \"%s\" telah digunakan."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Tak dapat menutup berkas vfs \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Tak dapat membuka divaus \"%s\" untuk dibaca dan ditulis."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Galat ketika menulis ke berkas \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "URI subjudul \"%s\" tidak sah, subjudul dinonaktifkan."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Arus RTSP belum dapat dimainkan."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Tak dapat membuat elemen \"decodebin\""
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Hanya arus subjudul yang terdeteksi. Mungkin anda memuat berkas subjudul "
+#~ "atau tipe lain dari berkas teks, atau berkas media yang tidak dikenal."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Anda tidak memiliki pengawasandi terinstal untuk menangani berkas ini. "
+#~ "Anda mungkin harus menginstal plugin yang diperlukan."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Ini bukan berkas media"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Arus subjudul terdeteksi, tapi bukan arus video."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Baik elemen autovideosink maupun xvimagesink hilang."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Baik elemen autoaudiosink maupun alsasink hilang."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Galat ketika mengirim data tajuk gdp ke \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Galat ketika mengirim data pemuat gdp ke \"%s:%d\"."
+
+#~ msgid "No device specified."
+#~ msgstr "Tak ada divais yang ditentukan."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Divais \"%s\" tak ada."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Divais \"%s\" telah digunakan."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Tak dapat membuka divaus \"%s\" untuk dibaca dan ditulis."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr "Tak dapat menampilkan baik teks subjudul dan subgambar."
index dbef8e4..c96e29f 100644 (file)
--- a/po/it.po
+++ b/po/it.po
@@ -101,21 +101,6 @@ msgstr "Impossibile effettuare il posizionamento nel CD."
 msgid "Could not read CD."
 msgstr "Impossibile leggere il CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Impossibile aprire il file vfs «%s» in scrittura: %s."
-
-msgid "No filename given"
-msgstr "Nessun nome di file fornito"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Impossibile chiudere il file vfs «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Errore durante la scrittura sul file «%s»."
-
 msgid "Internal data stream error."
 msgstr "Errore interno nel flusso di dati."
 
@@ -125,56 +110,11 @@ msgstr ""
 "Per riprodurre questo stream è richiesto un plugin %s, che però non risulta "
 "installato. "
 
-msgid "This appears to be a text file"
-msgstr "Questo sembra essere un file di testo"
-
 msgid "Could not determine type of stream"
 msgstr "Impossibile determinare il tipo di stream"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "URI dei sottotitoli «%s» non valido, sottotitoli disabilitati."
-
-msgid "No URI specified to play from."
-msgstr "Non è stato specificato alcun URI da cui riprodurre."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "URI «%s» non valido."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Non è ancora possibile riprodurre gli stream RTSP."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Impossibile creare l'elemento «decodebin»."
-
-msgid "Source element is invalid."
-msgstr "L'elemento sorgente non è valido."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"È stato rilevato unicamente uno stream di sottotitoli. Ciò significa che si "
-"sta caricando un file di sottotitoli o un altro tipo di file di testo, "
-"oppure che il file multimediale non è stato riconosciuto."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Non risulta installato alcun decoder in grado di gestire questo file. "
-"Potrebbe essere necessario installare gli opportuni plugin."
-
-msgid "This is not a media file"
-msgstr "Questo non è un file multimediale"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "È stato rilevato uno stream di sottotitoli, ma nessuno stream video."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr ""
-"Risultano mancanti entrambi gli elementi «autovideosink» e «xvimagesink»."
+msgid "This appears to be a text file"
+msgstr "Questo sembra essere un file di testo"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
@@ -182,9 +122,6 @@ msgstr ""
 "Risulta mancante l'elemento «%s» - verificare la propria installazione di "
 "GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Risultano mancanti entrambi gli elementi «autoaudiosink» e «alsasink»."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Risultano mancanti entrambi gli elementi «autovideosink» e «%s»."
@@ -234,6 +171,13 @@ msgstr "Impossibile riprodurre un file di testo senza video o visualizzazioni."
 msgid "No decoder available for type '%s'."
 msgstr "Nessun decoder disponibile per il tipo «%s»."
 
+msgid "No URI specified to play from."
+msgstr "Non è stato specificato alcun URI da cui riprodurre."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "URI «%s» non valido."
+
 msgid "This stream type cannot be played yet."
 msgstr "Non è ancora possibile riprodurre questo tipo di stream."
 
@@ -241,19 +185,14 @@ msgstr "Non è ancora possibile riprodurre questo tipo di stream."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nessun gestore di URI implementato per «%s»."
 
+msgid "Source element is invalid."
+msgstr "L'elemento sorgente non è valido."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Errore durante l'invio dei dati a \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Errore durante l'invio di dati header gdp a \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Errore durante l'invio di dati payload gdp a \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Connessione a %s:%d rifiutata."
 
@@ -619,17 +558,72 @@ msgstr "Elemento di codifica sconosciuto"
 msgid "Plugin or element of unknown type"
 msgstr "Plugin o elemento di tipo sconosciuto"
 
-msgid "No device specified."
-msgstr "Nessun device specificato."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Impossibile aprire il file vfs «%s» in scrittura: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Il device «%s» non esiste."
+#~ msgid "No filename given"
+#~ msgstr "Nessun nome di file fornito"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Il device «%s» è già in uso."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Impossibile chiudere il file vfs «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Impossibile aprire il device «%s» in lettura e scrittura."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Errore durante la scrittura sul file «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "URI dei sottotitoli «%s» non valido, sottotitoli disabilitati."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Non è ancora possibile riprodurre gli stream RTSP."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Impossibile creare l'elemento «decodebin»."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "È stato rilevato unicamente uno stream di sottotitoli. Ciò significa che "
+#~ "si sta caricando un file di sottotitoli o un altro tipo di file di testo, "
+#~ "oppure che il file multimediale non è stato riconosciuto."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Non risulta installato alcun decoder in grado di gestire questo file. "
+#~ "Potrebbe essere necessario installare gli opportuni plugin."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Questo non è un file multimediale"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr ""
+#~ "È stato rilevato uno stream di sottotitoli, ma nessuno stream video."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr ""
+#~ "Risultano mancanti entrambi gli elementi «autovideosink» e «xvimagesink»."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr ""
+#~ "Risultano mancanti entrambi gli elementi «autoaudiosink» e «alsasink»."
+
+#~ msgid "No device specified."
+#~ msgstr "Nessun device specificato."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Il device «%s» non esiste."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Il device «%s» è già in uso."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Impossibile aprire il device «%s» in lettura e scrittura."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Errore durante l'invio di dati header gdp a \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Errore durante l'invio di dati payload gdp a \"%s:%d\"."
index bbef9dd..4606b92 100644 (file)
--- a/po/ja.po
+++ b/po/ja.po
@@ -99,21 +99,6 @@ msgstr "CDをシークすることができませんでした"
 msgid "Could not read CD."
 msgstr "CD を読むことができませんでした"
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "書き込み用に vfs ファイル \"%s\" を開くことができませんでした: %s"
-
-msgid "No filename given"
-msgstr "ファイル名が与えられていません"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "vfs ファイル \"%s\" をクローズできませんでした"
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "ファイル \"%s\" の書き込み中にエラーが発生しました"
-
 msgid "Internal data stream error."
 msgstr "内部データストリームエラー"
 
@@ -123,54 +108,11 @@ msgstr ""
 "%s プラグインはこのストリームを再生するのに必要ですが、インストールされていま"
 "せん"
 
-msgid "This appears to be a text file"
-msgstr "これはテキストファイルのようです"
-
 msgid "Could not determine type of stream"
 msgstr "ストリームの種類を判別できませんでした"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "不正な字幕 URI \"%s\"。字幕を無効にします。"
-
-msgid "No URI specified to play from."
-msgstr "再生するURIが指定されていません"
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "不正な URI \"%s\""
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP ストリームをまだ再生できません"
-
-msgid "Could not create \"decodebin\" element."
-msgstr "\"decodebin\" エレメントを作成できません。"
-
-msgid "Source element is invalid."
-msgstr "ソースエレメントが不正です。"
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"字幕ストリームのみを認識しました。字幕ファイルかテキストファイルをロード中"
-"か、メディアファイルが認識されないのかどちらかです。"
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"このファイルを扱うことができるデコーダがインストールされていません。必要なプ"
-"ラグインをインストールする必要があるかもしれません"
-
-msgid "This is not a media file"
-msgstr "これはメディアファイルではありません"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "字幕のストリームを認識しましたが、動画ストリームがありません"
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "autovideosinkとxvimagesinkエレメントの両方が見つかりません。"
+msgid "This appears to be a text file"
+msgstr "これはテキストファイルのようです"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
@@ -178,9 +120,6 @@ msgstr ""
 "エレメント '%s' が見つかりません - GStreamer のインストールが失敗している可能"
 "性があります"
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "autovideosinkとalsasinkエレメントの両方が見つかりません。"
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "autovideosinkと%sエレメントの両方が見つかりません。"
@@ -230,6 +169,13 @@ msgstr "ビデオまたは視覚化なしでテキストファイルを再生で
 msgid "No decoder available for type '%s'."
 msgstr "タイプ '%s' 用のデコーダーが利用可能ではありません。"
 
+msgid "No URI specified to play from."
+msgstr "再生するURIが指定されていません"
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "不正な URI \"%s\""
+
 msgid "This stream type cannot be played yet."
 msgstr "このストリームタイプをまだ再生することはできません"
 
@@ -237,19 +183,14 @@ msgstr "このストリームタイプをまだ再生することはできませ
 msgid "No URI handler implemented for \"%s\"."
 msgstr "\"%s\" 用の URI ハンドラの実装はありません"
 
+msgid "Source element is invalid."
+msgstr "ソースエレメントが不正です。"
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "データを \"%s:%d\" へ送信中にエラーが発生しました"
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "gdp ヘッダデータを \"%s:%d\" へ送信中にエラーが発生しました"
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "gdp ペイロードデータを \"%s:%d\" へ送信中にエラーが発生しました"
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "%s:%d への接続が拒否されました"
 
@@ -599,20 +540,72 @@ msgstr "不明なエンコーダーエレメント"
 msgid "Plugin or element of unknown type"
 msgstr "不明な種類のプラグインまたはエレメント"
 
-msgid "No device specified."
-msgstr "デバイスが指定されていません。"
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "書き込み用に vfs ファイル \"%s\" を開くことができませんでした: %s"
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "デバイス \"%s\" は存在しません。"
+#~ msgid "No filename given"
+#~ msgstr "ファイル名が与えられていません"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "デバイス \"%s\" は既に使われています。"
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "vfs ファイル \"%s\" をクローズできませんでした"
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "読み込み用と書き込み用にデバイス \"%s\" を開くことができませんでした。"
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "ファイル \"%s\" の書き込み中にエラーが発生しました"
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "不正な字幕 URI \"%s\"。字幕を無効にします。"
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP ストリームをまだ再生できません"
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "\"decodebin\" エレメントを作成できません。"
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "字幕ストリームのみを認識しました。字幕ファイルかテキストファイルをロード中"
+#~ "か、メディアファイルが認識されないのかどちらかです。"
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "このファイルを扱うことができるデコーダがインストールされていません。必要な"
+#~ "プラグインをインストールする必要があるかもしれません"
+
+#~ msgid "This is not a media file"
+#~ msgstr "これはメディアファイルではありません"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "字幕のストリームを認識しましたが、動画ストリームがありません"
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "autovideosinkとxvimagesinkエレメントの両方が見つかりません。"
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "autovideosinkとalsasinkエレメントの両方が見つかりません。"
+
+#~ msgid "No device specified."
+#~ msgstr "デバイスが指定されていません。"
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "デバイス \"%s\" は存在しません。"
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "デバイス \"%s\" は既に使われています。"
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr ""
+#~ "読み込み用と書き込み用にデバイス \"%s\" を開くことができませんでした。"
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "gdp ヘッダデータを \"%s:%d\" へ送信中にエラーが発生しました"
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "gdp ペイロードデータを \"%s:%d\" へ送信中にエラーが発生しました"
 
 #~ msgid "No file name specified."
 #~ msgstr "ファイル名が指定されていません"
index d37745e..c9ff4ca 100644 (file)
--- a/po/lt.po
+++ b/po/lt.po
@@ -101,21 +101,6 @@ msgstr "Nepavyko pakeisti pozicijos CD."
 msgid "Could not read CD."
 msgstr "Nepavyko perskaityti CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nepavyko atverti vfs failo „%s“ rašymui: %s."
-
-msgid "No filename given"
-msgstr "Nenurodytas failo vardas"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nepavyko užverti vfs failo „%s“."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Klaida rašant į failą „%s“."
-
 msgid "Internal data stream error."
 msgstr "Vidinė duomenų srauto klaida."
 
@@ -123,63 +108,17 @@ msgstr "Vidinė duomenų srauto klaida."
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "Šiam srautui groti reikalingas %s įskiepis, bet jis nėra įdiegtas."
 
-msgid "This appears to be a text file"
-msgstr "Atrodo, kad šis failas tekstinis"
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "Nepavyko sukurti „decodebin“ elemento."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Netaisyklingas titrų URI „%s“, titrai išjungti."
-
-msgid "No URI specified to play from."
-msgstr "Nenurodytas URI, iš kurio groti."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Netaisyklingas URI „%s“."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP srautai dar negali būti rodomi."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nepavyko sukurti „decodebin“ elemento."
-
-msgid "Source element is invalid."
-msgstr "Šaltinio elementas nekorektiškas."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Rastas tik subtitrų srautas. Arba bandote įkelti subtitrų failą ar kitokį "
-"tekstinį failą, arba failas nebuvo teisingai atpažintas."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Neturite dekoderio, reikalingo šiam failui rodyti. Gali prireikti įdiegti "
-"reikalingus įskiepius."
-
-msgid "This is not a media file"
-msgstr "Tai nėra medijos failas"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Rastas titrų srautas, bet be video srauto."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Trūksta ir autovideosink, ir xvimagesink elementų."
+msgid "This appears to be a text file"
+msgstr "Atrodo, kad šis failas tekstinis"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Trūksta elemento „%s“ - patikrinkite GStreamer įdiegimą."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Trūksta ir autoaudiosink, ir alsasink elementų."
-
 #, fuzzy, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Trūksta ir autovideosink, ir xvimagesink elementų."
@@ -233,6 +172,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Tipui „%s“ dekoderių nerasta."
 
+msgid "No URI specified to play from."
+msgstr "Nenurodytas URI, iš kurio groti."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Netaisyklingas URI „%s“."
+
 msgid "This stream type cannot be played yet."
 msgstr "Šis srautas dar negali būti rodomas."
 
@@ -240,19 +186,14 @@ msgstr "Šis srautas dar negali būti rodomas."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nėra URI valdyklės „%s“."
 
+msgid "Source element is invalid."
+msgstr "Šaltinio elementas nekorektiškas."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Klaida siunčiant duomenis į „%s:%d“."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Klaida siunčiant gdp antraštės duomenis į \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Klaida siunčiant gdp duomenis į „%s:%d“."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Prisijungimas prie %s:%d atmestas."
 
@@ -601,20 +542,71 @@ msgstr "Nežinomas kodavimo elementas"
 msgid "Plugin or element of unknown type"
 msgstr "Nežinomo tipo įskiepis ar elementas"
 
-msgid "No device specified."
-msgstr "Nenurodytas įrenginys."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nepavyko atverti vfs failo „%s“ rašymui: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Įrenginys „%s“ neegzistuoja."
+#~ msgid "No filename given"
+#~ msgstr "Nenurodytas failo vardas"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Įrenginys „%s“ jau naudojamas."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nepavyko užverti vfs failo „%s“."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Nepavyko atverti įrenginio „%s“ skaitymui ir rašymui."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Klaida rašant į failą „%s“."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Netaisyklingas titrų URI „%s“, titrai išjungti."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP srautai dar negali būti rodomi."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nepavyko sukurti „decodebin“ elemento."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Rastas tik subtitrų srautas. Arba bandote įkelti subtitrų failą ar kitokį "
+#~ "tekstinį failą, arba failas nebuvo teisingai atpažintas."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Neturite dekoderio, reikalingo šiam failui rodyti. Gali prireikti įdiegti "
+#~ "reikalingus įskiepius."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Tai nėra medijos failas"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Rastas titrų srautas, bet be video srauto."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Trūksta ir autovideosink, ir xvimagesink elementų."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Trūksta ir autoaudiosink, ir alsasink elementų."
+
+#~ msgid "No device specified."
+#~ msgstr "Nenurodytas įrenginys."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Įrenginys „%s“ neegzistuoja."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Įrenginys „%s“ jau naudojamas."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Nepavyko atverti įrenginio „%s“ skaitymui ir rašymui."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Klaida siunčiant gdp antraštės duomenis į \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Klaida siunčiant gdp duomenis į „%s:%d“."
 
 #~ msgid "Could not create \"decodebin2\" element."
 #~ msgstr "Nepavyko sukurti „decodebin2“ elemento."
index bfcb218..b915939 100644 (file)
--- a/po/lv.po
+++ b/po/lv.po
@@ -103,21 +103,6 @@ msgstr "Nevarēja meklēt pa CD."
 msgid "Could not read CD."
 msgstr "Nevarēja nolasīt CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nevarēja atvērt vfs failu \"%s\" rakstīšanai: %s."
-
-msgid "No filename given"
-msgstr "Nav norādīts faila nosaukums"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nevarēja aizvērt vfs failu \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Kļūda rakstot failā \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Iekšējās datu plūsmas kļūda."
 
@@ -126,62 +111,16 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "Nepieciešamas %s spraudnis, lai atskaņotu šo plūsmu, bet tas nav instalēts."
 
-msgid "This appears to be a text file"
-msgstr "Tiek atpazīts kā teksta fails"
-
 msgid "Could not determine type of stream"
 msgstr "Nevarēja noteikts straumes tipu"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Nederīgs subtitru URI \"%s\", subtitri izslēgti."
-
-msgid "No URI specified to play from."
-msgstr "Nav norādīts neviens URI, no kā varētu spēlēt. "
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Nederīgs URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP plūsmas pagaidām nevar tikt atskaņotas."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nevarēja izveidot \"decodebin\" elementu."
-
-msgid "Source element is invalid."
-msgstr "Avota elements ir nederīgs."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Tika pamanīta tikai subtitru plūsma. Vai nu jūs ielādējat subtitru failu vai "
-"cita veida teksta failu, vai arī mediju fails netika atpazīts."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Jums nav instalēta atkodētāja, lai apietos ar šo failu. Jums iespējams "
-"vajadzētu instalēt nepieciešamos spraudņus."
-
-msgid "This is not a media file"
-msgstr "Šis nav mediju fails"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Tika pamanīta subtitru plūsma, bet ne video plūsma."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Trūkst gan autovideosink, gan xvimagesink elementi."
+msgid "This appears to be a text file"
+msgstr "Tiek atpazīts kā teksta fails"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Trūkst elements \"%s\" - pārbaudiet savu GStreamer instalāciju."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Trūkst gan autoaudiosink, gan alsasink elementi."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Trūkst gan autovideosink, gan %s elementi."
@@ -231,6 +170,13 @@ msgstr "Nevar atskaņot teksta failu bez video vai vizualizācijas."
 msgid "No decoder available for type '%s'."
 msgstr "Nav pieejams neviens atkodētājs failu veidam \"%s\"."
 
+msgid "No URI specified to play from."
+msgstr "Nav norādīts neviens URI, no kā varētu spēlēt. "
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Nederīgs URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Šī plūsma pagaidām nevar tikt atskaņota."
 
@@ -238,19 +184,14 @@ msgstr "Šī plūsma pagaidām nevar tikt atskaņota."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nav izstrādāts neviens URI apstrādātājs priekš \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Avota elements ir nederīgs."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Radās kļūda nosūtot datus uz \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Radās kļūda nosūtot gdb galvenas datus uz \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Kļūda sūtot gdp iekrāvēja datus uz \"%s:%d\""
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Savienojums ar %s:%d noraidīts."
 
@@ -598,20 +539,71 @@ msgstr "Nezināms kodētāja elements"
 msgid "Plugin or element of unknown type"
 msgstr "Nezināma veida spraudnis vai elements"
 
-msgid "No device specified."
-msgstr "Nav norādīta ierīce."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nevarēja atvērt vfs failu \"%s\" rakstīšanai: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Ierīce \"%s\" neeksistē."
+#~ msgid "No filename given"
+#~ msgstr "Nav norādīts faila nosaukums"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Ierīce \"%s\" jau tiek izmantota."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nevarēja aizvērt vfs failu \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Nevarēja atvērt ierīci \"%s\" lasīšanai vai rakstīšanai."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Kļūda rakstot failā \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Nederīgs subtitru URI \"%s\", subtitri izslēgti."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP plūsmas pagaidām nevar tikt atskaņotas."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nevarēja izveidot \"decodebin\" elementu."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Tika pamanīta tikai subtitru plūsma. Vai nu jūs ielādējat subtitru failu "
+#~ "vai cita veida teksta failu, vai arī mediju fails netika atpazīts."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Jums nav instalēta atkodētāja, lai apietos ar šo failu. Jums iespējams "
+#~ "vajadzētu instalēt nepieciešamos spraudņus."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Šis nav mediju fails"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Tika pamanīta subtitru plūsma, bet ne video plūsma."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Trūkst gan autovideosink, gan xvimagesink elementi."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Trūkst gan autoaudiosink, gan alsasink elementi."
+
+#~ msgid "No device specified."
+#~ msgstr "Nav norādīta ierīce."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Ierīce \"%s\" neeksistē."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Ierīce \"%s\" jau tiek izmantota."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Nevarēja atvērt ierīci \"%s\" lasīšanai vai rakstīšanai."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Radās kļūda nosūtot gdb galvenas datus uz \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Kļūda sūtot gdp iekrāvēja datus uz \"%s:%d\""
 
 #~ msgid "Could not create \"decodebin2\" element."
 #~ msgstr "Nav iespējams izveidot \"decodebin2\" elementu."
index d55ffdd..8258251 100644 (file)
--- a/po/nb.po
+++ b/po/nb.po
@@ -98,21 +98,6 @@ msgstr "Kunne ikke søke på CD."
 msgid "Could not read CD."
 msgstr "Kunne ikke lese CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Kunne ikke åpne VFS-fil «%s» for skriving: %s."
-
-msgid "No filename given"
-msgstr "Ingen filnavn oppgitt"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Kunne ikke lukke VFS-fil «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Feil under skriving til fil «%s»."
-
 msgid "Internal data stream error."
 msgstr "Intern feil i datastrøm."
 
@@ -122,58 +107,16 @@ msgstr ""
 "Et %s-tillegg kreves for å spille av denne strømmen, men det er ikke "
 "installert."
 
-msgid "This appears to be a text file"
-msgstr "Dette ser ut som en tekstfil"
-
 msgid "Could not determine type of stream"
 msgstr "Kunne ikke bestemme type strøm."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Ugyldig URI «%s» til undertekst. Undertekst er slått av."
-
-msgid "No URI specified to play from."
-msgstr "Ingen URI for avspilling oppgitt."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Ugyldig URI «%s»."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP-strømmer kan ikke spilles av ennå."
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr "Kildeelement er ugyldig."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-msgid "This is not a media file"
-msgstr "Dette er ikke en mediefil"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr ""
+msgid "This appears to be a text file"
+msgstr "Dette ser ut som en tekstfil"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -223,23 +166,25 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
-msgstr ""
+msgid "No URI specified to play from."
+msgstr "Ingen URI for avspilling oppgitt."
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
-msgstr ""
+msgid "Invalid URI \"%s\"."
+msgstr "Ugyldig URI «%s»."
 
-#, c-format
-msgid "Error while sending data to \"%s:%d\"."
+msgid "This stream type cannot be played yet."
 msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
+msgid "Source element is invalid."
+msgstr "Kildeelement er ugyldig."
+
 #, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Error while sending data to \"%s:%d\"."
 msgstr ""
 
 #, c-format
@@ -590,17 +535,35 @@ msgstr "Ukjent element for koding"
 msgid "Plugin or element of unknown type"
 msgstr "Tillegg eller element av ukjent type"
 
-msgid "No device specified."
-msgstr "Ingen enhet oppgitt."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Kunne ikke åpne VFS-fil «%s» for skriving: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Enhet «%s» eksisterer ikke."
+#~ msgid "No filename given"
+#~ msgstr "Ingen filnavn oppgitt"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Enhet «%s» er allerede i bruk."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Kunne ikke lukke VFS-fil «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Kunne ikke åpne enhet «%s» for lesing og skriving."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Feil under skriving til fil «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Ugyldig URI «%s» til undertekst. Undertekst er slått av."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP-strømmer kan ikke spilles av ennå."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Dette er ikke en mediefil"
+
+#~ msgid "No device specified."
+#~ msgstr "Ingen enhet oppgitt."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Enhet «%s» eksisterer ikke."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Enhet «%s» er allerede i bruk."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Kunne ikke åpne enhet «%s» for lesing og skriving."
index 6e888be..a17f255 100644 (file)
--- a/po/nl.po
+++ b/po/nl.po
@@ -99,21 +99,6 @@ msgstr "Kan geen seek doen op CD."
 msgid "Could not read CD."
 msgstr "Kan niet lezen van CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Kon het VFS-bestand \"%s\" niet openen om te schrijven: %s."
-
-msgid "No filename given"
-msgstr "Geen bestandsnaam opgegeven"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Kan het VFS-bestand \"%s\" niet sluiten."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Fout bij het schrijven naar bestand \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Interne fout in gegevensstroom."
 
@@ -123,63 +108,16 @@ msgstr ""
 "Een %s plugin is vereist voor het afspelen van deze gegevens, echter deze is "
 "niet geïnstalleerd."
 
-msgid "This appears to be a text file"
-msgstr "Dit lijkt een tekstbestand te zijn"
-
 msgid "Could not determine type of stream"
 msgstr "Kan het type stream niet bepalen"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Ongeldige ondertitel-URI \"%s\"; ondertitels zijn uitgezet."
-
-msgid "No URI specified to play from."
-msgstr "Geen URI opgegeven om van af te spelen."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Ongeldige URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP-gegevensstromen zijn nog niet af te spelen."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Kan \"decodebin\"-element niet aanmaken."
-
-msgid "Source element is invalid."
-msgstr "Bronelement is ongeldig."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Er is alleen een ondertitelgegevensstroom gedetecteerd. Ofwel bent u een "
-"ondertitelbestand of een ander type tekstbestand aan het laden, of het "
-"mediabestand is niet herkend."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"U hebt geen decoder geïnstalleerd voor dit bestand. U moet mogelijk de "
-"noodzakelijke plugins installeren."
-
-msgid "This is not a media file"
-msgstr "Dit is geen mediabestand."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Een ondertitelstroom is gedetecteerd, maar geen videostroom."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "De elementen 'autovideosink' en 'xvimagesink' ontbreken beide."
+msgid "This appears to be a text file"
+msgstr "Dit lijkt een tekstbestand te zijn"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Ontbrekend element '%s' - controleer de instalatie van uw GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "De elementen 'autoaudiosink' en 'alsasink' ontbreken beide."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "De elementen 'autovideosink' en '%s' ontbreken beide."
@@ -229,6 +167,13 @@ msgstr "Kan geen tekstbestand afspelen zonder video of visualisaties."
 msgid "No decoder available for type '%s'."
 msgstr "Geen decoder beschikbaar voor het type '%s'."
 
+msgid "No URI specified to play from."
+msgstr "Geen URI opgegeven om van af te spelen."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Ongeldige URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Deze stroom kan nog niet afgespeeld worden."
 
@@ -236,19 +181,14 @@ msgstr "Deze stroom kan nog niet afgespeeld worden."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Geen URI-handler geïmplementeerd voor \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Bronelement is ongeldig."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Fout bij het zenden van gegevens naar \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Fout tijdens het zenden van gdp-headergegevens naar \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Fout tijdens het zenden van gdp-gegevens naar \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Verbinding naar %s:%d is geweigerd."
 
@@ -605,17 +545,69 @@ msgstr "Onbekend encoder-element"
 msgid "Plugin or element of unknown type"
 msgstr "Plugin of element van onbekend type"
 
-msgid "No device specified."
-msgstr "Geen apparaat opgegeven."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Kon het VFS-bestand \"%s\" niet openen om te schrijven: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Apparaat \"%s\" bestaat niet."
+#~ msgid "No filename given"
+#~ msgstr "Geen bestandsnaam opgegeven"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Apparaat \"%s\" is al in gebruik."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Kan het VFS-bestand \"%s\" niet sluiten."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Kan apparaat \"%s\" niet openen voor lezen en schrijven."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Fout bij het schrijven naar bestand \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Ongeldige ondertitel-URI \"%s\"; ondertitels zijn uitgezet."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP-gegevensstromen zijn nog niet af te spelen."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Kan \"decodebin\"-element niet aanmaken."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Er is alleen een ondertitelgegevensstroom gedetecteerd. Ofwel bent u een "
+#~ "ondertitelbestand of een ander type tekstbestand aan het laden, of het "
+#~ "mediabestand is niet herkend."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "U hebt geen decoder geïnstalleerd voor dit bestand. U moet mogelijk de "
+#~ "noodzakelijke plugins installeren."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Dit is geen mediabestand."
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Een ondertitelstroom is gedetecteerd, maar geen videostroom."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "De elementen 'autovideosink' en 'xvimagesink' ontbreken beide."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "De elementen 'autoaudiosink' en 'alsasink' ontbreken beide."
+
+#~ msgid "No device specified."
+#~ msgstr "Geen apparaat opgegeven."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Apparaat \"%s\" bestaat niet."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Apparaat \"%s\" is al in gebruik."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Kan apparaat \"%s\" niet openen voor lezen en schrijven."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Fout tijdens het zenden van gdp-headergegevens naar \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Fout tijdens het zenden van gdp-gegevens naar \"%s:%d\"."
index f7ab8dc..9e91987 100644 (file)
--- a/po/or.po
+++ b/po/or.po
@@ -105,21 +105,6 @@ msgstr "ଭି.ଏଫ.ଏସ. ଫାଇଲ \"%s\" ବନ୍ଦ କରିହେ
 msgid "Could not read CD."
 msgstr "\"%s\" ଯନ୍ତ୍ରରେ ଲେଖିହେଲା ନାହିଁ."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "ଭି.ଏଫ.ଏସ. ଫାଇଲ \"%s\" ଲେଖିବା ପାଇଁ ଖୋଲିହେଲା ନାହିଁ: %s."
-
-msgid "No filename given"
-msgstr "କୌଣସି ଫାଇଲନାମ ଦିଆଯାଇ ନାହିଁ"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "ଭି.ଏଫ.ଏସ. ଫାଇଲ \"%s\" ବନ୍ଦ କରିହେଲା ନାହିଁ."
-
-#, fuzzy, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "\"%s\" ଫାଇଲ ବନ୍ଦ କରିବାରେ ତ୍ରୁଟି."
-
 msgid "Internal data stream error."
 msgstr ""
 
@@ -127,60 +112,17 @@ msgstr ""
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 
-msgid "This appears to be a text file"
-msgstr ""
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "\"%s\" ଫାଇଲ ଲେଖିହେଲା ନାହିଁ."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-
-msgid "No URI specified to play from."
-msgstr ""
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr ""
-
-msgid "RTSP streams cannot be played yet."
-msgstr ""
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr ""
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-#, fuzzy
-msgid "This is not a media file"
-msgstr "\"%s\" ଯନ୍ତ୍ର ଗୋଟିଏ ଅନୁଲିପିକାର ନୁହେଁ."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
+msgid "This appears to be a text file"
 msgstr ""
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -230,25 +172,27 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
+msgid "No URI specified to play from."
 msgstr ""
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
+msgid "Invalid URI \"%s\"."
 msgstr ""
 
-#, fuzzy, c-format
-msgid "Error while sending data to \"%s:%d\"."
-msgstr "\"%s\" ଫାଇଲ ବନ୍ଦ କରିବାରେ ତ୍ରୁଟି."
+msgid "This stream type cannot be played yet."
+msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Source element is invalid."
 msgstr ""
 
+#, fuzzy, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "\"%s\" ଫାଇଲ ବନ୍ଦ କରିବାରେ ତ୍ରୁଟି."
+
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr ""
@@ -597,20 +541,35 @@ msgstr ""
 msgid "Plugin or element of unknown type"
 msgstr ""
 
-msgid "No device specified."
-msgstr "କୌଣସି ଯନ୍ତ୍ର ଉଲ୍ଲେଖିତ କରାଯାଇ ନାହିଁ."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "ଭି.ଏଫ.ଏସ. ଫାଇଲ \"%s\" ଲେଖିବା ପାଇଁ ଖୋଲିହେଲା ନାହିଁ: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "\"%s\" ଯନ୍ତ୍ର ଅବସ୍ଥିତ ନାହିଁ."
+#~ msgid "No filename given"
+#~ msgstr "କୌଣସି ଫାଇଲନାମ ଦିଆଯାଇ ନାହିଁ"
 
-#, fuzzy, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "\"%s\" ଓ.ଏସ.ଏସ. ଯନ୍ତ୍ର ପୂର୍ବରୁ ଅନ୍ଯ କାରିକା ଦ୍ବାରା ବ୍ଯବହାର କରାଯାଉଛି."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "ଭି.ଏଫ.ଏସ. ଫାଇଲ \"%s\" ବନ୍ଦ କରିହେଲା ନାହିଁ."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "\"%s\" ଯନ୍ତ୍ର ପଢ଼ିବା ଓ ଲେଖିବା ପାଇଁ ଖୋଲିହେଲା ନାହିଁ."
+#, fuzzy
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "\"%s\" ଫାଇଲ ବନ୍ଦ କରିବାରେ ତ୍ରୁଟି."
+
+#, fuzzy
+#~ msgid "This is not a media file"
+#~ msgstr "\"%s\" ଯନ୍ତ୍ର ଗୋଟିଏ ଅନୁଲିପିକାର ନୁହେଁ."
+
+#~ msgid "No device specified."
+#~ msgstr "କୌଣସି ଯନ୍ତ୍ର ଉଲ୍ଲେଖିତ କରାଯାଇ ନାହିଁ."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "\"%s\" ଯନ୍ତ୍ର ଅବସ୍ଥିତ ନାହିଁ."
+
+#, fuzzy
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "\"%s\" ଓ.ଏସ.ଏସ. ଯନ୍ତ୍ର ପୂର୍ବରୁ ଅନ୍ଯ କାରିକା ଦ୍ବାରା ବ୍ଯବହାର କରାଯାଉଛି."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "\"%s\" ଯନ୍ତ୍ର ପଢ଼ିବା ଓ ଲେଖିବା ପାଇଁ ଖୋଲିହେଲା ନାହିଁ."
 
 #, fuzzy
 #~ msgid "Could not create \"typefind\" element."
index 6665d2f..abecc84 100644 (file)
--- a/po/pl.po
+++ b/po/pl.po
@@ -105,21 +105,6 @@ msgstr "Nie udało się ustawić położenia na CD."
 msgid "Could not read CD."
 msgstr "Nie udał się odczyt CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nie udało się otworzyć pliku vfs \"%s\" do zapisu: %s."
-
-msgid "No filename given"
-msgstr "Nie podano nazwy pliku"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nie udało się zamknąć pliku vfs \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Błąd podczas zapisu do pliku \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Błąd wewnętrzny strumienia danych."
 
@@ -129,62 +114,16 @@ msgstr ""
 "Wtyczka %s jest wymagana do otworzenia tego strumienia, ale nie jest "
 "zainstalowana."
 
-msgid "This appears to be a text file"
-msgstr "To wygląda na plik tekstowy"
-
 msgid "Could not determine type of stream"
 msgstr "Nie udało się określić typu strumienia"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Niepoprawne URI podpisów \"%s\", podpisy wyłączone."
-
-msgid "No URI specified to play from."
-msgstr "Nie podano URI do odtwarzania."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Niepoprawne URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Strumieni RTSP jeszcze nie można odtwarzać."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nie udało się utworzyć elementu \"decodebin\"."
-
-msgid "Source element is invalid."
-msgstr "Element źródłowy jest niepoprawny."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Wykryto tylko strumień podpisów. Albo żądano wczytania pliku podpisów lub "
-"innego rodzaju pliku tekstowego, albo nie rozpoznano pliku multimedialnego."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Nie ma zainstalowanego dekodera do obsługi tego pliku. Być może trzeba "
-"zainstalować potrzebne wtyczki."
-
-msgid "This is not a media file"
-msgstr "To nie jest plik multimedialny"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Wykryto strumień podpisów, ale brak strumienia obrazu."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Nie ma żadnego z elementów autovideosink i xvimagesink."
+msgid "This appears to be a text file"
+msgstr "To wygląda na plik tekstowy"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Brak elementu '%s' - proszę sprawdzić instalację GStreamera."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Nie ma żadnego z elementów autoaudiosink i alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Nie ma żadnego z elementów autovideosink i %s."
@@ -234,6 +173,13 @@ msgstr "Nie można odtwarzać pliku tekstowego bez obrazu lub wizualizacji."
 msgid "No decoder available for type '%s'."
 msgstr "Brak dostępnego dekodera dla typu '%s'."
 
+msgid "No URI specified to play from."
+msgstr "Nie podano URI do odtwarzania."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Niepoprawne URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Tego strumienia jeszcze nie można odtworzyć."
 
@@ -241,19 +187,14 @@ msgstr "Tego strumienia jeszcze nie można odtworzyć."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nie ma zaimplementowanej obsługi URI dla \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Element źródłowy jest niepoprawny."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Błąd podczas wysyłania danych do \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Błąd podczas wysyłania danych nagłówka gdp do \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Błąd podczas wysyłania danych gdp do \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Połączenie z %s:%d odrzucone."
 
@@ -601,17 +542,69 @@ msgstr "Nieznany element kodujący"
 msgid "Plugin or element of unknown type"
 msgstr "Wtyczka lub element nieznanego typu"
 
-msgid "No device specified."
-msgstr "Nie określono urządzenia."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nie udało się otworzyć pliku vfs \"%s\" do zapisu: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Urządzenie \"%s\" nie istnieje."
+#~ msgid "No filename given"
+#~ msgstr "Nie podano nazwy pliku"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Urządzenie \"%s\" jest już używane."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nie udało się zamknąć pliku vfs \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Nie udało się otworzyć urządzenia \"%s\" do odczytu i zapisu."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Błąd podczas zapisu do pliku \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Niepoprawne URI podpisów \"%s\", podpisy wyłączone."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Strumieni RTSP jeszcze nie można odtwarzać."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nie udało się utworzyć elementu \"decodebin\"."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Wykryto tylko strumień podpisów. Albo żądano wczytania pliku podpisów lub "
+#~ "innego rodzaju pliku tekstowego, albo nie rozpoznano pliku "
+#~ "multimedialnego."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Nie ma zainstalowanego dekodera do obsługi tego pliku. Być może trzeba "
+#~ "zainstalować potrzebne wtyczki."
+
+#~ msgid "This is not a media file"
+#~ msgstr "To nie jest plik multimedialny"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Wykryto strumień podpisów, ale brak strumienia obrazu."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Nie ma żadnego z elementów autovideosink i xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Nie ma żadnego z elementów autoaudiosink i alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Nie określono urządzenia."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Urządzenie \"%s\" nie istnieje."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Urządzenie \"%s\" jest już używane."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Nie udało się otworzyć urządzenia \"%s\" do odczytu i zapisu."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Błąd podczas wysyłania danych nagłówka gdp do \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Błąd podczas wysyłania danych gdp do \"%s:%d\"."
index 9df31ca..dab1d40 100644 (file)
@@ -101,21 +101,6 @@ msgstr "Não foi possível buscar no CD."
 msgid "Could not read CD."
 msgstr "Não foi possível ler o CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Não foi possível abrir o arquivo VFS \"%s\" para escrita: %s."
-
-msgid "No filename given"
-msgstr "Não foi fornecido um nome de arquivo"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Não foi possível fechar o arquivo VFS \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Erro ao gravar no arquivo \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Erro interno no fluxo de dados."
 
@@ -124,64 +109,17 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "O plug-in %s é necessário para reproduzir este fluxo, mas não está instalado."
 
-msgid "This appears to be a text file"
-msgstr "Este parece ser um arquivo de texto"
-
 msgid "Could not determine type of stream"
 msgstr "Não foi possível determinar o tipo de fluxo"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "O URI \"%s\" para legenda é inválido, legendas desabilitadas."
-
-msgid "No URI specified to play from."
-msgstr "Nenhum URI especificado para reprodução."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "O URI \"%s\" é inválido."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Os fluxos RTSP ainda não podem ser reproduzidos."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Não foi possível criar o elemento \"decodebin\"."
-
-msgid "Source element is invalid."
-msgstr "O elemente de origem é inválido."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Apenas um fluxo de legendas foi detectado. Ou você está carregando um "
-"arquivo de legenda ou algum outro tipo de arquivo de texto, ou o arquivo de "
-"mídia não é reconhecido."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Você não tem um decodificador instalado para manipular este arquivo. Você "
-"deveria instalar os plug-ins necessários."
-
-msgid "This is not a media file"
-msgstr "Este não é um arquivo de mídia"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Um fluxo de legenda foi detectado, mas nenhum fluxo de vídeo."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Os elementos autovideosink e xvimagesink estão faltando."
+msgid "This appears to be a text file"
+msgstr "Este parece ser um arquivo de texto"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 "O elemento \"%s\" está faltando, verifique a instalação do seu GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Os elementos autoaudiosink e alsasink estão faltando."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Os elementos autovideosink e %s estão faltando."
@@ -232,6 +170,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Decodificador não disponível para o tipo \"%s\"."
 
+msgid "No URI specified to play from."
+msgstr "Nenhum URI especificado para reprodução."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "O URI \"%s\" é inválido."
+
 msgid "This stream type cannot be played yet."
 msgstr "Este tipo de fluxo ainda não pode ser reproduzido."
 
@@ -239,19 +184,14 @@ msgstr "Este tipo de fluxo ainda não pode ser reproduzido."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nenhum manipulador para o URI \"%s\" foi implementado."
 
+msgid "Source element is invalid."
+msgstr "O elemente de origem é inválido."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Erro ao enviar dados para \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Erro ao enviar o cabeçalho de dados GDP para \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Erro ao enviar codificação de dados GDP para \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "A conexão para %s:%d foi recusada."
 
@@ -608,20 +548,72 @@ msgstr "Elemento codificador desconhecido"
 msgid "Plugin or element of unknown type"
 msgstr "Elemento ou plug-in de tipo desconhecido"
 
-msgid "No device specified."
-msgstr "Nenhum dispositivo especificado."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Não foi possível abrir o arquivo VFS \"%s\" para escrita: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "O dispositivo \"%s\" não existe."
+#~ msgid "No filename given"
+#~ msgstr "Não foi fornecido um nome de arquivo"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "O dispositivo \"%s\" já está sendo usado."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Não foi possível fechar o arquivo VFS \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Não foi possível abrir o dispositivo \"%s\" para leitura e escrita."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Erro ao gravar no arquivo \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "O URI \"%s\" para legenda é inválido, legendas desabilitadas."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Os fluxos RTSP ainda não podem ser reproduzidos."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Não foi possível criar o elemento \"decodebin\"."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Apenas um fluxo de legendas foi detectado. Ou você está carregando um "
+#~ "arquivo de legenda ou algum outro tipo de arquivo de texto, ou o arquivo "
+#~ "de mídia não é reconhecido."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Você não tem um decodificador instalado para manipular este arquivo. Você "
+#~ "deveria instalar os plug-ins necessários."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Este não é um arquivo de mídia"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Um fluxo de legenda foi detectado, mas nenhum fluxo de vídeo."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Os elementos autovideosink e xvimagesink estão faltando."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Os elementos autoaudiosink e alsasink estão faltando."
+
+#~ msgid "No device specified."
+#~ msgstr "Nenhum dispositivo especificado."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "O dispositivo \"%s\" não existe."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "O dispositivo \"%s\" já está sendo usado."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Não foi possível abrir o dispositivo \"%s\" para leitura e escrita."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Erro ao enviar o cabeçalho de dados GDP para \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Erro ao enviar codificação de dados GDP para \"%s:%d\"."
 
 #~ msgid "Could not create \"decodebin2\" element."
 #~ msgstr "Não foi possível criar o elemento \"decodebin2\"."
index a530073..eaa5c6f 100644 (file)
--- a/po/ro.po
+++ b/po/ro.po
@@ -100,21 +100,6 @@ msgstr "Nu s-a putut accesa CD-ul."
 msgid "Could not read CD."
 msgstr "Nu s-a putut citi CD-ul."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nu s-a putut deschide fișierul vsf „%s\" pentru scriere: %s."
-
-msgid "No filename given"
-msgstr "Niciun nume de fișier dat."
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nu s-a putut închide fișierul vsf „%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Eroare la scrierea fișierului „%s\"."
-
 msgid "Internal data stream error."
 msgstr "Eroare internă a fluxului de date."
 
@@ -124,62 +109,16 @@ msgstr ""
 "Un modul de extensie %s este necesar pentru a reda acest flux, dar acesta nu "
 "este instalat."
 
-msgid "This appears to be a text file"
-msgstr "Acesta pare să fie un fișier text."
-
 msgid "Could not determine type of stream"
 msgstr "Nu s-a putut determina tipul fluxului"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "URI subtitrare „%s” nevalid, subtitrare dezactivată."
-
-msgid "No URI specified to play from."
-msgstr "Nu s-a specificat URI pentru redare."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "URI „%s” nevalid."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Fluxurile RTSP nu pot fi redate încă."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nu se poate crea elementul „decodebin”."
-
-msgid "Source element is invalid."
-msgstr "Element sursă nevalid."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"A fost detectat doar un flux pentru subtitrare. Fie încărcați un fișier de "
-"subtitrare sau un alt tip de fișier text, sau fișierul nu a fost recunoscut."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Nu există instalat un decodor pentru deschiderea acestui fișier. Probabil "
-"trebuie să instalați modulele de extensie necesare."
-
-msgid "This is not a media file"
-msgstr "Acesta nu este un fișier media"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "A fost detectat un flux de subtitrare, dar nu există flux video."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Lipsesc ambele elemente autovideosink și xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Acesta pare să fie un fișier text."
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Element %s lipsă - verificați instalarea GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Lipsesc ambele elemente autoaudiosink și alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Lipsește atât elementul autovideosink cât și %s."
@@ -229,6 +168,13 @@ msgstr "Nu se poate reda un fișier text fără video sau vizualizări."
 msgid "No decoder available for type '%s'."
 msgstr "Niciun decodor disponibil pentru tipul „%s”."
 
+msgid "No URI specified to play from."
+msgstr "Nu s-a specificat URI pentru redare."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "URI „%s” nevalid."
+
 msgid "This stream type cannot be played yet."
 msgstr "Acest tip de flux nu poate fi redat încă."
 
@@ -236,19 +182,14 @@ msgstr "Acest tip de flux nu poate fi redat încă."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Nicio rutină de tratare de URI implementată pentru „%s”."
 
+msgid "Source element is invalid."
+msgstr "Element sursă nevalid."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Eroare la trimiterea datelor către „%s:%d”."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Eroare la trimiterea antetului gdp către „%s:%d”."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Eroare la trimiterea conținutului gdp către „%s:%d”."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Conexiunea la %s:%d a fost refuzată."
 
@@ -596,17 +537,69 @@ msgstr "Element codor necunoscut"
 msgid "Plugin or element of unknown type"
 msgstr "Modul de extensie sau element de tip necunoscut"
 
-msgid "No device specified."
-msgstr "Nu s-a specificat niciun dispozitiv."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nu s-a putut deschide fișierul vsf „%s\" pentru scriere: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Dispozitivul „%s” nu există."
+#~ msgid "No filename given"
+#~ msgstr "Niciun nume de fișier dat."
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Dispozitivul „%s” este deja folosit."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nu s-a putut închide fișierul vsf „%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Nu s-a putut deschide dispozitivul „%s” pentru citire și scriere."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Eroare la scrierea fișierului „%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "URI subtitrare „%s” nevalid, subtitrare dezactivată."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Fluxurile RTSP nu pot fi redate încă."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nu se poate crea elementul „decodebin”."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "A fost detectat doar un flux pentru subtitrare. Fie încărcați un fișier "
+#~ "de subtitrare sau un alt tip de fișier text, sau fișierul nu a fost "
+#~ "recunoscut."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Nu există instalat un decodor pentru deschiderea acestui fișier. Probabil "
+#~ "trebuie să instalați modulele de extensie necesare."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Acesta nu este un fișier media"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "A fost detectat un flux de subtitrare, dar nu există flux video."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Lipsesc ambele elemente autovideosink și xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Lipsesc ambele elemente autoaudiosink și alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Nu s-a specificat niciun dispozitiv."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Dispozitivul „%s” nu există."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Dispozitivul „%s” este deja folosit."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Nu s-a putut deschide dispozitivul „%s” pentru citire și scriere."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Eroare la trimiterea antetului gdp către „%s:%d”."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Eroare la trimiterea conținutului gdp către „%s:%d”."
index 029d3e9..bf281e5 100644 (file)
--- a/po/ru.po
+++ b/po/ru.po
@@ -103,21 +103,6 @@ msgstr "Не удалось сменить позицию воспроизвед
 msgid "Could not read CD."
 msgstr "Не удалось прочитать диск."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Не удалось открыть vfs-файл «%s» для записи: %s."
-
-msgid "No filename given"
-msgstr "Не указано имя файла"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Не удалось закрыть vfs-файл «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Ошибка записи в файл «%s»."
-
 msgid "Internal data stream error."
 msgstr "Внутренняя ошибка потока данных."
 
@@ -126,62 +111,16 @@ msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 "Для воспроизведения этого потока требуется модуль %s, но он не установлен."
 
-msgid "This appears to be a text file"
-msgstr "Этот файл является текстовым"
-
 msgid "Could not determine type of stream"
 msgstr "Не удалось определить тип потока"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Неверный URI субтитров «%s», субтитры выключены."
-
-msgid "No URI specified to play from."
-msgstr "Не указан URI источника воспроизведения."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Неверный URI «%s»."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Воспроизведение RTSP-потоков в данный момент невозможно."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Не удалось создать элемент «decodebin»."
-
-msgid "Source element is invalid."
-msgstr "Неверный элемент источника."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Обнаружен только поток субтитров. Либо вы загружаете файл субтитров или иной "
-"текстовый файл, либо медиа-файл не распознан."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Не установлен требуемый декодер для обработки этого файла. Возможно, вам "
-"следует поставить необходимые модули."
-
-msgid "This is not a media file"
-msgstr "Файл не является медиа-файлом"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Обнаружен только поток субтитров, поток видео не обнаружен."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Отсутствуют элементы autovideosink и xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Этот файл является текстовым"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Отсутствует элемент «%s» — проверьте правильность установки GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Отсутствуют элементы autoaudiosink и alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Отсутствуют элементы autovideosink и %s."
@@ -232,6 +171,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Для типа «%s» недоступен декодер."
 
+msgid "No URI specified to play from."
+msgstr "Не указан URI источника воспроизведения."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Неверный URI «%s»."
+
 msgid "This stream type cannot be played yet."
 msgstr "Воспроизведение этого потока в данный момент невозможно."
 
@@ -239,19 +185,14 @@ msgstr "Воспроизведение этого потока в данный 
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Для «%s» не реализован обработчик URI."
 
+msgid "Source element is invalid."
+msgstr "Неверный элемент источника."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Ошибка отправки данных в «%s:%d»."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Ошибка отправки данных заголовка gdp в «%s:%d»."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Ошибка отправки данных gdp в «%s:%d»."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "В соединении с %s:%d отказано."
 
@@ -601,20 +542,71 @@ msgstr "Неизвестный элемент-кодировщик"
 msgid "Plugin or element of unknown type"
 msgstr "Модуль или элемент неизвестного типа"
 
-msgid "No device specified."
-msgstr "Не указано устройство."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Не удалось открыть vfs-файл «%s» для записи: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Устройство «%s» не существует."
+#~ msgid "No filename given"
+#~ msgstr "Не указано имя файла"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Устройство «%s» уже используется."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Не удалось закрыть vfs-файл «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Не удалось открыть устройство «%s» для чтения и записи."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Ошибка записи в файл «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Неверный URI субтитров «%s», субтитры выключены."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Воспроизведение RTSP-потоков в данный момент невозможно."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Не удалось создать элемент «decodebin»."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Обнаружен только поток субтитров. Либо вы загружаете файл субтитров или "
+#~ "иной текстовый файл, либо медиа-файл не распознан."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Не установлен требуемый декодер для обработки этого файла. Возможно, вам "
+#~ "следует поставить необходимые модули."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Файл не является медиа-файлом"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Обнаружен только поток субтитров, поток видео не обнаружен."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Отсутствуют элементы autovideosink и xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Отсутствуют элементы autoaudiosink и alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Не указано устройство."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Устройство «%s» не существует."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Устройство «%s» уже используется."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Не удалось открыть устройство «%s» для чтения и записи."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Ошибка отправки данных заголовка gdp в «%s:%d»."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Ошибка отправки данных gdp в «%s:%d»."
 
 #~ msgid "No file name specified."
 #~ msgstr "Не указано имя файла."
index 449cae5..8f28eff 100644 (file)
--- a/po/sk.po
+++ b/po/sk.po
@@ -102,21 +102,6 @@ msgstr "Nepodarilo sa nastaviť pozíciu na CD."
 msgid "Could not read CD."
 msgstr "Nepodarilo sa čítať CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Nepodarilo sa otvoriť vfs súbor \"%s\" pre zápis: %s."
-
-msgid "No filename given"
-msgstr "Nebol zadaný názov súboru"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Nepodarilo sa zatvoriť súbor \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Chyba pri zápise do súboru \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Vnútorná chyba prúdu údajov."
 
@@ -126,62 +111,16 @@ msgstr ""
 "Na prehratie tohto prúdu údajov je vyžadovaný zásuvný modul %s, ktorý nie je "
 "nainštalovaný."
 
-msgid "This appears to be a text file"
-msgstr "Tento súbor je asi textový"
-
 msgid "Could not determine type of stream"
 msgstr "Nepodarilo sa zistiť typ prádu údajov"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Chybné URI titulkov \"%s\", titulky zakázané."
-
-msgid "No URI specified to play from."
-msgstr "Nebolo špecifikované žiadne URI, z ktorého by sa dalo prehrávať."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Chybné URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP prúdy sa teraz nedajú prehrávať."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Nepodarilo sa vytvoriť prvok \"decodebin\""
-
-msgid "Source element is invalid."
-msgstr "Zdrojový prvok je chybný."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Bol zistený iba prúd titulkov. Buď načítavate titulkový súbor alebo nejaký "
-"iný typ textového súboru, alebo ide o neznámy typ mediálneho súboru."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Nemáte nainštalovaný dekodér pre tento typ súboru. Zrejme bude potrebné "
-"nainštalovať príslušné zásuvné moduly."
-
-msgid "This is not a media file"
-msgstr "Toto nie je mediálny súbor"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Bol zistený prúd titulkov, ale bez video prúdu údajov."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Chýbajú prvky autovideosink aj xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Tento súbor je asi textový"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Chýa prvok '%s' - skontrolujte svoju inštaláciu GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Chýbajú prvky autoaudiosink aj alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Chýbajú prvky autovideosink aj %s."
@@ -231,6 +170,13 @@ msgstr "Nemôžem prehrať textový súbor bez videa alebo vizualizácií."
 msgid "No decoder available for type '%s'."
 msgstr "Pre typ '%s' nie je k dispozícii dekodér."
 
+msgid "No URI specified to play from."
+msgstr "Nebolo špecifikované žiadne URI, z ktorého by sa dalo prehrávať."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Chybné URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Tento typ prúdu údajov sa teraz nedá prehrávať."
 
@@ -238,19 +184,14 @@ msgstr "Tento typ prúdu údajov sa teraz nedá prehrávať."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Pre \"%s\" nie je implementovaná obsluha."
 
+msgid "Source element is invalid."
+msgstr "Zdrojový prvok je chybný."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Chyba pri posielaní údajov do \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Chyba pri posielaní hlavičky gdp údajov do \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Chyba pri posielaní gdp záťažových údajov do \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Spojenie s %s:%d bolo odmietnuté."
 
@@ -600,20 +541,72 @@ msgstr "Neznámy prvok enkodéra"
 msgid "Plugin or element of unknown type"
 msgstr "Neznámy typ zásuvného modulu alebo prvku"
 
-msgid "No device specified."
-msgstr "Nebolo zadané zariadenie."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Nepodarilo sa otvoriť vfs súbor \"%s\" pre zápis: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Zariadenie \"%s\" neexistuje."
+#~ msgid "No filename given"
+#~ msgstr "Nebol zadaný názov súboru"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Zariadenie \"%s\" sa už používa."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Nepodarilo sa zatvoriť súbor \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Nepodarilo sa otvoriť zariadenie  \"%s\" pre čítanie a zápis."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Chyba pri zápise do súboru \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Chybné URI titulkov \"%s\", titulky zakázané."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP prúdy sa teraz nedajú prehrávať."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Nepodarilo sa vytvoriť prvok \"decodebin\""
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Bol zistený iba prúd titulkov. Buď načítavate titulkový súbor alebo "
+#~ "nejaký iný typ textového súboru, alebo ide o neznámy typ mediálneho "
+#~ "súboru."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Nemáte nainštalovaný dekodér pre tento typ súboru. Zrejme bude potrebné "
+#~ "nainštalovať príslušné zásuvné moduly."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Toto nie je mediálny súbor"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Bol zistený prúd titulkov, ale bez video prúdu údajov."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Chýbajú prvky autovideosink aj xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Chýbajú prvky autoaudiosink aj alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Nebolo zadané zariadenie."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Zariadenie \"%s\" neexistuje."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Zariadenie \"%s\" sa už používa."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Nepodarilo sa otvoriť zariadenie  \"%s\" pre čítanie a zápis."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Chyba pri posielaní hlavičky gdp údajov do \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Chyba pri posielaní gdp záťažových údajov do \"%s:%d\"."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr "Nemôžem zobrazovať naraz textové titulky aj podobrázky."
index 2fb0b9b..0a284e7 100644 (file)
--- a/po/sl.po
+++ b/po/sl.po
@@ -103,21 +103,6 @@ msgstr "Po CD-ju ni mogoče iskati."
 msgid "Could not read CD."
 msgstr "CD-ja ni mogoče prebrati."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "VFS datoteke \"%s\" ni mogoče odpreti za pisanje: %s"
-
-msgid "No filename given"
-msgstr "Ni podanega imena datoteke"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "VFS datoteke \"%s\" ni mogoče zapreti."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Napaka med pisanjem v datoteko \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Notranja napaka pretoka podatkov."
 
@@ -125,63 +110,16 @@ msgstr "Notranja napaka pretoka podatkov."
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "Za predvajanje tega pretoka je potreben vstavek %s, ki pa ni nameščen."
 
-msgid "This appears to be a text file"
-msgstr "Datoteka je videti kot besedilna datoteka"
-
 msgid "Could not determine type of stream"
 msgstr "Vrste pretoka ni mogoče določiti."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Neveljaven URI podnapisov \"%s\", zato bodo onemogočeni."
-
-msgid "No URI specified to play from."
-msgstr "Ni navedenega naslova URI za predvajanje."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Neveljaven URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Pretokov RTSP še ni mogoče predvajati."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Predmeta \"decodebin\" ni mogoče ustvariti."
-
-msgid "Source element is invalid."
-msgstr "Izvorni predmet je neveljaven."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Zaznan je bil le pretok podnapisov. Morda je bila naložena datoteka "
-"podnapisov ali katera druga vrsta besedilne datoteke, ali pa predstavnostne "
-"datoteke ni mogoče prepoznati."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Za to vrsto datotek ni nameščenega ustreznega odkodirnika. Morda je potrebno "
-"namestiti manjkajoče vstavke."
-
-msgid "This is not a media file"
-msgstr "Datoteka ni predstavnostna datoteka"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Zaznan je bil pretok podnapisov, ne pa tudi pretok videa."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Predmeta autovideosink in xvimagesink manjkata."
+msgid "This appears to be a text file"
+msgstr "Datoteka je videti kot besedilna datoteka"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Predmet '%s' manjka - preverite namestitev paketa GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Predmeta autovideosink in alsasink manjkata."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Predmeta autovideosink in %s manjkata."
@@ -231,6 +169,13 @@ msgstr "Besedilne datoteke ni mogoče predvajati brez videa ali predočenja."
 msgid "No decoder available for type '%s'."
 msgstr "Za vrsto \"%s\" ni ustreznega odkodirnika."
 
+msgid "No URI specified to play from."
+msgstr "Ni navedenega naslova URI za predvajanje."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Neveljaven URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Te vrste pretoka še ni mogoče predvajati."
 
@@ -238,19 +183,14 @@ msgstr "Te vrste pretoka še ni mogoče predvajati."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Ni ročnika naslovov URI za \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Izvorni predmet je neveljaven."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Napaka med pošiljanjem podatkov na \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Napaka med pošiljanjem podatkov glave GDP na \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Napaka med pošiljanjem podatkov vsebine GDP na \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Povezava s %s:%d zavrnjena."
 
@@ -599,20 +539,72 @@ msgstr "Neznan predmet kodirnika"
 msgid "Plugin or element of unknown type"
 msgstr "Vstavek ali predmet neznane vrste"
 
-msgid "No device specified."
-msgstr "Ni navedene naprave."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "VFS datoteke \"%s\" ni mogoče odpreti za pisanje: %s"
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Naprava \"%s\" ne obstaja."
+#~ msgid "No filename given"
+#~ msgstr "Ni podanega imena datoteke"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Naprava \"%s\" je že v uporabi."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "VFS datoteke \"%s\" ni mogoče zapreti."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Naprave \"%s\" ni mogoče odpreti za branje in pisanje."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Napaka med pisanjem v datoteko \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Neveljaven URI podnapisov \"%s\", zato bodo onemogočeni."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Pretokov RTSP še ni mogoče predvajati."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Predmeta \"decodebin\" ni mogoče ustvariti."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Zaznan je bil le pretok podnapisov. Morda je bila naložena datoteka "
+#~ "podnapisov ali katera druga vrsta besedilne datoteke, ali pa "
+#~ "predstavnostne datoteke ni mogoče prepoznati."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Za to vrsto datotek ni nameščenega ustreznega odkodirnika. Morda je "
+#~ "potrebno namestiti manjkajoče vstavke."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Datoteka ni predstavnostna datoteka"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Zaznan je bil pretok podnapisov, ne pa tudi pretok videa."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Predmeta autovideosink in xvimagesink manjkata."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Predmeta autovideosink in alsasink manjkata."
+
+#~ msgid "No device specified."
+#~ msgstr "Ni navedene naprave."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Naprava \"%s\" ne obstaja."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Naprava \"%s\" je že v uporabi."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Naprave \"%s\" ni mogoče odpreti za branje in pisanje."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Napaka med pošiljanjem podatkov glave GDP na \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Napaka med pošiljanjem podatkov vsebine GDP na \"%s:%d\"."
 
 #, fuzzy
 #~ msgid "No Temp directory specified."
index 7b825c3..f7bde6e 100644 (file)
--- a/po/sq.po
+++ b/po/sq.po
@@ -103,21 +103,6 @@ msgstr "E pamundur mbyllja e file vfs \"%s\"."
 msgid "Could not read CD."
 msgstr "I pamundur shkrimi në dispozitivin \"%s\"."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "E pamundur hapja e file vfs \"%s\" për shkrim: %s."
-
-msgid "No filename given"
-msgstr "Nuk është dhënë asnjë emër file"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "E pamundur mbyllja e file vfs \"%s\"."
-
-#, fuzzy, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Gabim gjatë mbylljes së file \"%s\"."
-
 msgid "Internal data stream error."
 msgstr ""
 
@@ -125,60 +110,17 @@ msgstr ""
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 
-msgid "This appears to be a text file"
-msgstr ""
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "I pamundur shkrimi tek file \"%s\"."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-
-msgid "No URI specified to play from."
-msgstr ""
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr ""
-
-msgid "RTSP streams cannot be played yet."
-msgstr ""
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr ""
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-#, fuzzy
-msgid "This is not a media file"
-msgstr "Dispozitivi \"%s\" nuk është një dispozitiv marrje."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
+msgid "This appears to be a text file"
 msgstr ""
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -228,25 +170,27 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
+msgid "No URI specified to play from."
 msgstr ""
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
+msgid "Invalid URI \"%s\"."
 msgstr ""
 
-#, fuzzy, c-format
-msgid "Error while sending data to \"%s:%d\"."
-msgstr "Gabim gjatë mbylljes së file \"%s\"."
+msgid "This stream type cannot be played yet."
+msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Source element is invalid."
 msgstr ""
 
+#, fuzzy, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "Gabim gjatë mbylljes së file \"%s\"."
+
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr ""
@@ -595,20 +539,36 @@ msgstr ""
 msgid "Plugin or element of unknown type"
 msgstr ""
 
-msgid "No device specified."
-msgstr "Nuk është përcaktuar asnjë dispozitiv."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "E pamundur hapja e file vfs \"%s\" për shkrim: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Dispozitivi \"%s\" nuk ekziston."
+#~ msgid "No filename given"
+#~ msgstr "Nuk është dhënë asnjë emër file"
 
-#, fuzzy, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Dispozitivi OSS \"%s\" është duke u përdorur nga një tjetër program."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "E pamundur mbyllja e file vfs \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "E pamundur hapja e dispozitivit \"%s\" për lexim dhe shkrim."
+#, fuzzy
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Gabim gjatë mbylljes së file \"%s\"."
+
+#, fuzzy
+#~ msgid "This is not a media file"
+#~ msgstr "Dispozitivi \"%s\" nuk është një dispozitiv marrje."
+
+#~ msgid "No device specified."
+#~ msgstr "Nuk është përcaktuar asnjë dispozitiv."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Dispozitivi \"%s\" nuk ekziston."
+
+#, fuzzy
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr ""
+#~ "Dispozitivi OSS \"%s\" është duke u përdorur nga një tjetër program."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "E pamundur hapja e dispozitivit \"%s\" për lexim dhe shkrim."
 
 #, fuzzy
 #~ msgid "Could not create \"typefind\" element."
index 7f7d393..2b7631a 100644 (file)
--- a/po/sr.po
+++ b/po/sr.po
@@ -105,22 +105,6 @@ msgstr "Не могу да затворим ВСД датотеку „%s“."
 msgid "Could not read CD."
 msgstr "Не могу да пишем на видео уређај „%s“."
 
-#, fuzzy, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Не могу да отворим ВСД датотеку „%s“ ради уписа."
-
-#, fuzzy
-msgid "No filename given"
-msgstr "Име датотеке није задато."
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Не могу да затворим ВСД датотеку „%s“."
-
-#, fuzzy, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Грешка при затварању датотеке „%s“."
-
 msgid "Internal data stream error."
 msgstr ""
 
@@ -128,60 +112,17 @@ msgstr ""
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr ""
 
-msgid "This appears to be a text file"
-msgstr ""
-
 #, fuzzy
 msgid "Could not determine type of stream"
 msgstr "Не могу да пишем у датотеку „%s“."
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr ""
-
-msgid "No URI specified to play from."
-msgstr ""
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr ""
-
-msgid "RTSP streams cannot be played yet."
-msgstr ""
-
-msgid "Could not create \"decodebin\" element."
-msgstr ""
-
-msgid "Source element is invalid."
-msgstr ""
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-
-#, fuzzy
-msgid "This is not a media file"
-msgstr "Уређај „%s“ не представља уређај за снимање."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr ""
-
-msgid "Both autovideosink and xvimagesink elements are missing."
+msgid "This appears to be a text file"
 msgstr ""
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr ""
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr ""
@@ -231,25 +172,27 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr ""
 
-msgid "This stream type cannot be played yet."
+msgid "No URI specified to play from."
 msgstr ""
 
 #, c-format
-msgid "No URI handler implemented for \"%s\"."
+msgid "Invalid URI \"%s\"."
 msgstr ""
 
-#, fuzzy, c-format
-msgid "Error while sending data to \"%s:%d\"."
-msgstr "Грешка при затварању датотеке „%s“."
+msgid "This stream type cannot be played yet."
+msgstr ""
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
+msgid "No URI handler implemented for \"%s\"."
 msgstr ""
 
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
+msgid "Source element is invalid."
 msgstr ""
 
+#, fuzzy, c-format
+msgid "Error while sending data to \"%s:%d\"."
+msgstr "Грешка при затварању датотеке „%s“."
+
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr ""
@@ -598,20 +541,37 @@ msgstr ""
 msgid "Plugin or element of unknown type"
 msgstr ""
 
-msgid "No device specified."
-msgstr "Уређај није наведен."
+#, fuzzy
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Не могу да отворим ВСД датотеку „%s“ ради уписа."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Не постоји уређај „%s“."
+#, fuzzy
+#~ msgid "No filename given"
+#~ msgstr "Име датотеке није задато."
 
-#, fuzzy, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "OSS уређај „%s“ већ користи неки програм."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Не могу да затворим ВСД датотеку „%s“."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Не могу да отворим уређај „%s“ ради читања и уписа."
+#, fuzzy
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Грешка при затварању датотеке „%s“."
+
+#, fuzzy
+#~ msgid "This is not a media file"
+#~ msgstr "Уређај „%s“ не представља уређај за снимање."
+
+#~ msgid "No device specified."
+#~ msgstr "Уређај није наведен."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Не постоји уређај „%s“."
+
+#, fuzzy
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "OSS уређај „%s“ већ користи неки програм."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Не могу да отворим уређај „%s“ ради читања и уписа."
 
 #, fuzzy
 #~ msgid "Could not create \"typefind\" element."
index 5515c5c..df22aa7 100644 (file)
--- a/po/sv.po
+++ b/po/sv.po
@@ -99,21 +99,6 @@ msgstr "Kunde inte söka på cd-skivan."
 msgid "Could not read CD."
 msgstr "Kunde inte läsa cd-skivan."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Kunde inte öppna vfs-filen \"%s\" för skrivning: %s."
-
-msgid "No filename given"
-msgstr "Inget filnamn angivet"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Kunde inte stänga vfs-filen \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Fel vid skrivning till filen \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "Internt dataströmfel."
 
@@ -123,63 +108,16 @@ msgstr ""
 "En %s-insticksmodul krävs för att spela upp den här strömmen men är inte "
 "installerad."
 
-msgid "This appears to be a text file"
-msgstr "Den här ser ut att vara en textfil"
-
 msgid "Could not determine type of stream"
 msgstr "Kunde inte fastställa typ av ström"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Ogiltig uri för undertext \"%s\", undertexter inaktiverade."
-
-msgid "No URI specified to play from."
-msgstr "Ingen uri angiven att spela upp från."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Ogiltig uri \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP-strömmar kan inte spelas upp än."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Kunde inte skapa \"decodebin\"-element."
-
-msgid "Source element is invalid."
-msgstr "Källelementet är ogiltigt."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Endast en undertextström identifierades. Antingen läser du in en "
-"undertextfil eller någon annan typ av textfil, eller så kändes inte "
-"mediafilen igen."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Du har inte en installerad avkodare som kan hantera den här filen. Du kanske "
-"behöver installera de nödvändiga insticksmodulerna."
-
-msgid "This is not a media file"
-msgstr "Det här är inte en mediafil"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "En undertextström identifierades men ingen videoström."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Både autovideosink- och xvimagesink-elementet saknas."
+msgid "This appears to be a text file"
+msgstr "Den här ser ut att vara en textfil"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Saknar elementet \"%s\" - kontrollera din GStreamer-installation."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Både autoaudiosink- och alsasink-elementet saknas."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Både autovideosink- och %s-elementet saknas."
@@ -229,6 +167,13 @@ msgstr "Kan inte spela upp en textfil utan video eller visualiseringar."
 msgid "No decoder available for type '%s'."
 msgstr "Ingen avkodare finns tillgänglig för typen \"%s\"."
 
+msgid "No URI specified to play from."
+msgstr "Ingen uri angiven att spela upp från."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Ogiltig uri \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Den här strömtypen kan inte spelas upp än."
 
@@ -236,19 +181,14 @@ msgstr "Den här strömtypen kan inte spelas upp än."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Ingen URI-hanterare implementerad för \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Källelementet är ogiltigt."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Fel vid sändning av data till \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Fel vid sändning av gdp-huvuddata till \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Fel vid sändning av gdp-paketdata till \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Anslutningen till %s:%d nekades."
 
@@ -596,20 +536,72 @@ msgstr "Okänt kodarelement"
 msgid "Plugin or element of unknown type"
 msgstr "Insticksmodul eller element av okänd typ"
 
-msgid "No device specified."
-msgstr "Ingen enheten angiven."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Kunde inte öppna vfs-filen \"%s\" för skrivning: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Enheten \"%s\" finns inte."
+#~ msgid "No filename given"
+#~ msgstr "Inget filnamn angivet"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Enheten \"%s\" används redan."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Kunde inte stänga vfs-filen \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Kunde inte öppna enheten \"%s\" för läsning och skrivning."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Fel vid skrivning till filen \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Ogiltig uri för undertext \"%s\", undertexter inaktiverade."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP-strömmar kan inte spelas upp än."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Kunde inte skapa \"decodebin\"-element."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Endast en undertextström identifierades. Antingen läser du in en "
+#~ "undertextfil eller någon annan typ av textfil, eller så kändes inte "
+#~ "mediafilen igen."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Du har inte en installerad avkodare som kan hantera den här filen. Du "
+#~ "kanske behöver installera de nödvändiga insticksmodulerna."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Det här är inte en mediafil"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "En undertextström identifierades men ingen videoström."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Både autovideosink- och xvimagesink-elementet saknas."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Både autoaudiosink- och alsasink-elementet saknas."
+
+#~ msgid "No device specified."
+#~ msgstr "Ingen enheten angiven."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Enheten \"%s\" finns inte."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Enheten \"%s\" används redan."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Kunde inte öppna enheten \"%s\" för läsning och skrivning."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Fel vid sändning av gdp-huvuddata till \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Fel vid sändning av gdp-paketdata till \"%s:%d\"."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr "Kan inte visa både undertexter och underbilder."
index b2f28c0..3d90e33 100644 (file)
--- a/po/tr.po
+++ b/po/tr.po
@@ -96,21 +96,6 @@ msgstr "CD bulunamıyor."
 msgid "Could not read CD."
 msgstr "CD okunamıyor."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Vfs dosyası \"%s\" yazmak için açılamıyor: %s."
-
-msgid "No filename given"
-msgstr "Dosya adı verilmedi"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Vfs dosyası kapatılamıyor \"%s\"."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Dosyaya yazmada hata \"%s\"."
-
 msgid "Internal data stream error."
 msgstr "İç veri akışı hatası."
 
@@ -118,62 +103,16 @@ msgstr "İç veri akışı hatası."
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "Bir %s eklenti bu akışı çalmak için gerekli, fakat kurulu değil."
 
-msgid "This appears to be a text file"
-msgstr "Bu bir metin dosyasına benziyor"
-
 msgid "Could not determine type of stream"
 msgstr "Akışın türü belirlenemiyor"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Geçersiz altyazı adresi \"%s\", altyazılar kaldırıldı."
-
-msgid "No URI specified to play from."
-msgstr "Çalmak için bir ağ adresi belirtilmedi."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Geçersiz URI \"%s\"."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "RTSP akışları henüz çalınamıyor."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "\"decodebin\" öğesi oluşturulamıyor."
-
-msgid "Source element is invalid."
-msgstr "Kaynak öğesi geçersiz."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Bir altyazı dosyası algılandı. Siz ya bir altyazı veya başka bir metin "
-"dosyası yüklemek üzeresiniz, veya çokluortam dosyası tanınamadı."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Bu yüklü dosyası çözümleyecek bir kod çözücüye sahip değilsiniz. Gerekli "
-"eklentileri kurmak zorundasınız."
-
-msgid "This is not a media file"
-msgstr "Bu bir çokluortam dosyası değil."
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Bir altyazı akışı algılanda, ancak vidyo akışı bulunamadı."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Autovideosink ve xvimagesink öğelerininin ikisi de kayıp."
+msgid "This appears to be a text file"
+msgstr "Bu bir metin dosyasına benziyor"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Kayıp öğe '%s' - GStreamer kurulumunu denetleyin."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Autoaudiosink ve alsasink öğelerinin ikisi de kayıp."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Autovideosink ve xvimagesink %s öğelerininin ikisi de kayıp."
@@ -223,6 +162,13 @@ msgstr "Vidyo veya görsellik olmadan metin dosyasını oynatamaz."
 msgid "No decoder available for type '%s'."
 msgstr "Şu tür '%s' için kod çözücü bulunamadı."
 
+msgid "No URI specified to play from."
+msgstr "Çalmak için bir ağ adresi belirtilmedi."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Geçersiz URI \"%s\"."
+
 msgid "This stream type cannot be played yet."
 msgstr "Bu akış türü henüz çalınamıyor."
 
@@ -230,19 +176,14 @@ msgstr "Bu akış türü henüz çalınamıyor."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Hiç bir URI bağlantısı sağlanmadı \"%s\"."
 
+msgid "Source element is invalid."
+msgstr "Kaynak öğesi geçersiz."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Dosyayı şuraya gönderirken hata \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Bir gdp başlık verisini şuraya gönderirken hata \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Bir gdp verisini şuraya gönderirken hata \"%s:%d\"."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Şuraya bağlantı %s:%d reddedildi."
 
@@ -590,20 +531,71 @@ msgstr "Bilinmeyen kodlama öğesi"
 msgid "Plugin or element of unknown type"
 msgstr "Bilinmeyen türde eklenti veya öğe"
 
-msgid "No device specified."
-msgstr "Aygıt belirtilmedi."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Vfs dosyası \"%s\" yazmak için açılamıyor: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Aygıt \"%s\" bulunamadı."
+#~ msgid "No filename given"
+#~ msgstr "Dosya adı verilmedi"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Aygıt \"%s\" zaten kullanımda."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Vfs dosyası kapatılamıyor \"%s\"."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Şu aygıtı\"%s\" for okuma veya yazma için açamıyor."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Dosyaya yazmada hata \"%s\"."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Geçersiz altyazı adresi \"%s\", altyazılar kaldırıldı."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "RTSP akışları henüz çalınamıyor."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "\"decodebin\" öğesi oluşturulamıyor."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Bir altyazı dosyası algılandı. Siz ya bir altyazı veya başka bir metin "
+#~ "dosyası yüklemek üzeresiniz, veya çokluortam dosyası tanınamadı."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Bu yüklü dosyası çözümleyecek bir kod çözücüye sahip değilsiniz. Gerekli "
+#~ "eklentileri kurmak zorundasınız."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Bu bir çokluortam dosyası değil."
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Bir altyazı akışı algılanda, ancak vidyo akışı bulunamadı."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Autovideosink ve xvimagesink öğelerininin ikisi de kayıp."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Autoaudiosink ve alsasink öğelerinin ikisi de kayıp."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Bir gdp başlık verisini şuraya gönderirken hata \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Bir gdp verisini şuraya gönderirken hata \"%s:%d\"."
+
+#~ msgid "No device specified."
+#~ msgstr "Aygıt belirtilmedi."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Aygıt \"%s\" bulunamadı."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Aygıt \"%s\" zaten kullanımda."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Şu aygıtı\"%s\" for okuma veya yazma için açamıyor."
 
 #~ msgid "Can't display both text subtitles and subpictures."
 #~ msgstr "Metin altyazılarını altgörüntülerini oynatamıyor."
index c7286a5..ce12bba 100644 (file)
--- a/po/uk.po
+++ b/po/uk.po
@@ -101,22 +101,6 @@ msgstr "Не вдалося встановити позицію на CD."
 msgid "Could not read CD."
 msgstr "Не вдалося прочитати CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr ""
-"Не вдалося відкрити файл віртуальної файлової системи «%s» для запису: %s."
-
-msgid "No filename given"
-msgstr "Не вказано файл"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Не вдалося закрити файл віртуальної файлової системи «%s»."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Помилка при записі у файл «%s»."
-
 msgid "Internal data stream error."
 msgstr "Помилка внутрішнього потоку даних."
 
@@ -124,63 +108,17 @@ msgstr "Помилка внутрішнього потоку даних."
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "Для відтворення потоку потрібен модуль %s, але він не встановлений."
 
-msgid "This appears to be a text file"
-msgstr "Файл схожий на текстовий файл"
-
 msgid "Could not determine type of stream"
 msgstr "Не вдалося визначити тип даних потоку"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "Неправильний URI субтитру «%s», субтитри вимкнено."
-
-msgid "No URI specified to play from."
-msgstr "Не вказано URI для відтворення."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "Неправильний URI «%s»."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Відтворення потоків RTSP поки-що не підтримується."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Не вдалося створити елемент \"decodebin\"."
-
-msgid "Source element is invalid."
-msgstr "Неправильний вхідний елемент."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Виявлено лише потік субтитрів. Або ви завантажили файл субтитрів чи інший "
-"текстовий файл, або носій не розпізнано."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Не встановлено декодер для обробки цього файлу. Можливо потрібно встановити "
-"додаткові модулі."
-
-msgid "This is not a media file"
-msgstr "Файл не є мультимедійним"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Виявлено потік субтитрів, але не відеопотік."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Відсутні елементи autovideosink та xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Файл схожий на текстовий файл"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 "Відсутній елемент «%s». Перевірте чи встановлено GStreamer належним чином."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Відсутні елементи autoaudiosink та alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Не вказано елементів autovideosink і %s."
@@ -231,6 +169,13 @@ msgstr "Відтворення текстового файла без відео
 msgid "No decoder available for type '%s'."
 msgstr "Для типу '%s' немає доступних декодерів."
 
+msgid "No URI specified to play from."
+msgstr "Не вказано URI для відтворення."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "Неправильний URI «%s»."
+
 msgid "This stream type cannot be played yet."
 msgstr "Цей потік поки-що не може бути відтворений."
 
@@ -238,19 +183,14 @@ msgstr "Цей потік поки-що не може бути відтворе
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Не реалізовано обробник URI для «%s»."
 
+msgid "Source element is invalid."
+msgstr "Неправильний вхідний елемент."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Помилка при надсиланні даних до \"%s:%d\"."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Помилка при надсиланні заголовку gdp даних до \"%s:%d\"."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Помилка при надсиланні даних gdp до «%s:%d»."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "У з'єднанні з %s:%d відмовлено."
 
@@ -609,20 +549,72 @@ msgstr "Невідомий елемент кодера"
 msgid "Plugin or element of unknown type"
 msgstr "Модуль або елемент невідомого типу"
 
-msgid "No device specified."
-msgstr "Пристрій не вказано."
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr ""
+#~ "Не вдалося відкрити файл віртуальної файлової системи «%s» для запису: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Пристрою «%s» не існує."
+#~ msgid "No filename given"
+#~ msgstr "Не вказано файл"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Пристрій «%s» вже використовується іншою програмою."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Не вдалося закрити файл віртуальної файлової системи «%s»."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Не вдалося відкрити пристрій «%s» для читання чи запису."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Помилка при записі у файл «%s»."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "Неправильний URI субтитру «%s», субтитри вимкнено."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Відтворення потоків RTSP поки-що не підтримується."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Не вдалося створити елемент \"decodebin\"."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Виявлено лише потік субтитрів. Або ви завантажили файл субтитрів чи інший "
+#~ "текстовий файл, або носій не розпізнано."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Не встановлено декодер для обробки цього файлу. Можливо потрібно "
+#~ "встановити додаткові модулі."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Файл не є мультимедійним"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Виявлено потік субтитрів, але не відеопотік."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Відсутні елементи autovideosink та xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Відсутні елементи autoaudiosink та alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Пристрій не вказано."
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Пристрою «%s» не існує."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Пристрій «%s» вже використовується іншою програмою."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Не вдалося відкрити пристрій «%s» для читання чи запису."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Помилка при надсиланні заголовку gdp даних до \"%s:%d\"."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Помилка при надсиланні даних gdp до «%s:%d»."
 
 #~ msgid "No file name specified."
 #~ msgstr "Не вказано назву файлу."
index 30650ea..27c2c23 100644 (file)
--- a/po/vi.po
+++ b/po/vi.po
@@ -97,21 +97,6 @@ msgstr "Không thể tìm trên đĩa CD."
 msgid "Could not read CD."
 msgstr "Không thể đọc đĩa CD."
 
-#, c-format
-msgid "Could not open vfs file \"%s\" for writing: %s."
-msgstr "Không thể mở tập tin VFS « %s » để ghi: %s."
-
-msgid "No filename given"
-msgstr "Chưa nhập tên tập tin"
-
-#, c-format
-msgid "Could not close vfs file \"%s\"."
-msgstr "Không thể đóng tập tin VFS « %s »."
-
-#, c-format
-msgid "Error while writing to file \"%s\"."
-msgstr "Lỗi khi ghi vào tập tin « %s »."
-
 msgid "Internal data stream error."
 msgstr "Lỗi luồng dữ liệu nội bộ."
 
@@ -119,62 +104,16 @@ msgstr "Lỗi luồng dữ liệu nội bộ."
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "Cần phần bổ sung %s để phát luồng này nhưng chưa cài đặt."
 
-msgid "This appears to be a text file"
-msgstr "Hình như đây là tập tin văn bản"
-
 msgid "Could not determine type of stream"
 msgstr "Không thể quyết định loại luồng"
 
-#, c-format
-msgid "Invalid subtitle URI \"%s\", subtitles disabled."
-msgstr "URI phụ đề không hợp lệ « %s » nên tắt khả năng phụ đề."
-
-msgid "No URI specified to play from."
-msgstr "Chưa ghi rõ URI từ đó cần phát."
-
-#, c-format
-msgid "Invalid URI \"%s\"."
-msgstr "URI không hợp lệ « %s »."
-
-msgid "RTSP streams cannot be played yet."
-msgstr "Chưa có khả năng phát luồng RTSP."
-
-msgid "Could not create \"decodebin\" element."
-msgstr "Không thể tạo phần tử « decodebin »."
-
-msgid "Source element is invalid."
-msgstr "Phần tử nguồn không phải hợp lệ."
-
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"Chỉ phát hiện luồng phụ đề. Hoặc bạn đang nạp tập tin phụ đề hay tập tin văn "
-"bản kiểu khác, hoặc không nhận diện tập tin nhạc/ảnh."
-
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
-msgstr ""
-"Chưa cài đặt bộ giải mã có khả năng quản lý tập tin này. Có thể cần phải cài "
-"đặt các phần bổ sung thích hợp."
-
-msgid "This is not a media file"
-msgstr "Đây không phải tập tin nhạc/ảnh"
-
-msgid "A subtitle stream was detected, but no video stream."
-msgstr "Phát hiện luồng phụ đề, không có luồng ảnh động."
-
-msgid "Both autovideosink and xvimagesink elements are missing."
-msgstr "Thiếu phần tử autovideosink, cũng thiếu phần tử xvimagesink."
+msgid "This appears to be a text file"
+msgstr "Hình như đây là tập tin văn bản"
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "Thiếu phần tử « %s » — hãy kiểm tra lại cài đặt GStreamer."
 
-msgid "Both autoaudiosink and alsasink elements are missing."
-msgstr "Thiếu phần tử autoaudiosink, cũng thiếu phần tử alsasink."
-
 #, c-format
 msgid "Both autovideosink and %s elements are missing."
 msgstr "Thiếu phần tử autovideosink, cũng thiếu phần tử %s."
@@ -225,6 +164,13 @@ msgstr ""
 msgid "No decoder available for type '%s'."
 msgstr "Không có bộ giải mã sẵn sàng cho kiểu « %s »."
 
+msgid "No URI specified to play from."
+msgstr "Chưa ghi rõ URI từ đó cần phát."
+
+#, c-format
+msgid "Invalid URI \"%s\"."
+msgstr "URI không hợp lệ « %s »."
+
 msgid "This stream type cannot be played yet."
 msgstr "Chưa có khả năng phát kiểu luồng này."
 
@@ -232,19 +178,14 @@ msgstr "Chưa có khả năng phát kiểu luồng này."
 msgid "No URI handler implemented for \"%s\"."
 msgstr "Không có bộ quản lý địa chỉ URI được thực hiện cho « %s »."
 
+msgid "Source element is invalid."
+msgstr "Phần tử nguồn không phải hợp lệ."
+
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "Lỗi khi gởi dữ liệu cho « %s:%d »."
 
 #, c-format
-msgid "Error while sending gdp header data to \"%s:%d\"."
-msgstr "Lỗi khi gởi dữ liệu phần đầu GDP cho « %s:%d »."
-
-#, c-format
-msgid "Error while sending gdp payload data to \"%s:%d\"."
-msgstr "Lỗi khi gởi dữ liệu trọng tải GDP cho « %s:%d »."
-
-#, c-format
 msgid "Connection to %s:%d refused."
 msgstr "Kết nối tới « %s:%d » bị từ chối."
 
@@ -597,17 +538,68 @@ msgstr "Không rõ phần tử mã hoá"
 msgid "Plugin or element of unknown type"
 msgstr "Không rõ kiểu phần bổ sung hay phần tử"
 
-msgid "No device specified."
-msgstr "Chưa ghi rõ thiết bị nào"
+#~ msgid "Could not open vfs file \"%s\" for writing: %s."
+#~ msgstr "Không thể mở tập tin VFS « %s » để ghi: %s."
 
-#, c-format
-msgid "Device \"%s\" does not exist."
-msgstr "Không có thiết bị « %s »."
+#~ msgid "No filename given"
+#~ msgstr "Chưa nhập tên tập tin"
 
-#, c-format
-msgid "Device \"%s\" is already being used."
-msgstr "Thiết bị « %s » đang được dùng."
+#~ msgid "Could not close vfs file \"%s\"."
+#~ msgstr "Không thể đóng tập tin VFS « %s »."
 
-#, c-format
-msgid "Could not open device \"%s\" for reading and writing."
-msgstr "Không thể mở thiết bị « %s » để đọc và ghi."
+#~ msgid "Error while writing to file \"%s\"."
+#~ msgstr "Lỗi khi ghi vào tập tin « %s »."
+
+#~ msgid "Invalid subtitle URI \"%s\", subtitles disabled."
+#~ msgstr "URI phụ đề không hợp lệ « %s » nên tắt khả năng phụ đề."
+
+#~ msgid "RTSP streams cannot be played yet."
+#~ msgstr "Chưa có khả năng phát luồng RTSP."
+
+#~ msgid "Could not create \"decodebin\" element."
+#~ msgstr "Không thể tạo phần tử « decodebin »."
+
+#~ msgid ""
+#~ "Only a subtitle stream was detected. Either you are loading a subtitle "
+#~ "file or some other type of text file, or the media file was not "
+#~ "recognized."
+#~ msgstr ""
+#~ "Chỉ phát hiện luồng phụ đề. Hoặc bạn đang nạp tập tin phụ đề hay tập tin "
+#~ "văn bản kiểu khác, hoặc không nhận diện tập tin nhạc/ảnh."
+
+#~ msgid ""
+#~ "You do not have a decoder installed to handle this file. You might need "
+#~ "to install the necessary plugins."
+#~ msgstr ""
+#~ "Chưa cài đặt bộ giải mã có khả năng quản lý tập tin này. Có thể cần phải "
+#~ "cài đặt các phần bổ sung thích hợp."
+
+#~ msgid "This is not a media file"
+#~ msgstr "Đây không phải tập tin nhạc/ảnh"
+
+#~ msgid "A subtitle stream was detected, but no video stream."
+#~ msgstr "Phát hiện luồng phụ đề, không có luồng ảnh động."
+
+#~ msgid "Both autovideosink and xvimagesink elements are missing."
+#~ msgstr "Thiếu phần tử autovideosink, cũng thiếu phần tử xvimagesink."
+
+#~ msgid "Both autoaudiosink and alsasink elements are missing."
+#~ msgstr "Thiếu phần tử autoaudiosink, cũng thiếu phần tử alsasink."
+
+#~ msgid "No device specified."
+#~ msgstr "Chưa ghi rõ thiết bị nào"
+
+#~ msgid "Device \"%s\" does not exist."
+#~ msgstr "Không có thiết bị « %s »."
+
+#~ msgid "Device \"%s\" is already being used."
+#~ msgstr "Thiết bị « %s » đang được dùng."
+
+#~ msgid "Could not open device \"%s\" for reading and writing."
+#~ msgstr "Không thể mở thiết bị « %s » để đọc và ghi."
+
+#~ msgid "Error while sending gdp header data to \"%s:%d\"."
+#~ msgstr "Lỗi khi gởi dữ liệu phần đầu GDP cho « %s:%d »."
+
+#~ msgid "Error while sending gdp payload data to \"%s:%d\"."
+#~ msgstr "Lỗi khi gởi dữ liệu trọng tải GDP cho « %s:%d »."
index 76a304e..97aae50 100644 (file)
@@ -6,614 +6,574 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gst-plugins-base 0.10.21.3\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2011-08-20 12:18+0100\n"
+"POT-Creation-Date: 2009-01-09 22:45+0000\n"
 "PO-Revision-Date: 2009-01-14 12:41+0800\n"
 "Last-Translator: Ji ZhengYu <zhengyuji@gmail.com>\n"
 "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
-"Language: zh_CN\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
+#: ext/alsa/gstalsamixertrack.c:144
 msgid "Master"
 msgstr "主音量"
 
+#: ext/alsa/gstalsamixertrack.c:145
 msgid "Bass"
 msgstr "低音(Bass)"
 
+#: ext/alsa/gstalsamixertrack.c:146
 msgid "Treble"
 msgstr "高音(Treble)"
 
+#: ext/alsa/gstalsamixertrack.c:147
 msgid "PCM"
 msgstr "波形"
 
+#: ext/alsa/gstalsamixertrack.c:148
 msgid "Synth"
 msgstr "合成器"
 
+#: ext/alsa/gstalsamixertrack.c:149
 msgid "Line-in"
 msgstr "线路输入"
 
+#: ext/alsa/gstalsamixertrack.c:150
 msgid "CD"
 msgstr "CD"
 
+#: ext/alsa/gstalsamixertrack.c:151
 msgid "Microphone"
 msgstr "话筒"
 
+#: ext/alsa/gstalsamixertrack.c:152
 msgid "PC Speaker"
 msgstr "PC 扬声器"
 
+#: ext/alsa/gstalsamixertrack.c:153
 msgid "Playback"
 msgstr "回放"
 
+#: ext/alsa/gstalsamixertrack.c:154 ext/alsa/gstalsamixertrack.c:220
+#: ext/alsa/gstalsamixertrack.c:223
 msgid "Capture"
 msgstr "录音"
 
+#: ext/alsa/gstalsasink.c:479
 msgid "Could not open device for playback in mono mode."
 msgstr "无法在单声道模式打开设备播放。"
 
+#: ext/alsa/gstalsasink.c:481
 msgid "Could not open device for playback in stereo mode."
 msgstr "无法在立体声模式打开设备播放。"
 
+#: ext/alsa/gstalsasink.c:485
 #, c-format
 msgid "Could not open device for playback in %d-channel mode."
 msgstr "无法在 %d 声道模式打开设备播放。"
 
-msgid ""
-"Could not open audio device for playback. Device is being used by another "
-"application."
+#: ext/alsa/gstalsasink.c:687
+msgid "Could not open audio device for playback. Device is being used by another application."
 msgstr "无法打开音频设备用于回放。目前有另一个程序正在使用该设备。"
 
+#: ext/alsa/gstalsasink.c:692
 msgid "Could not open audio device for playback."
 msgstr "无法打开音频设备播放。"
 
+#: ext/alsa/gstalsasrc.c:417
 msgid "Could not open device for recording in mono mode."
 msgstr "无法在单声道模式打开设备录音。"
 
+#: ext/alsa/gstalsasrc.c:419
 msgid "Could not open device for recording in stereo mode."
 msgstr "无法在立体声模式打开设备录音。"
 
+#: ext/alsa/gstalsasrc.c:423
 #, c-format
 msgid "Could not open device for recording in %d-channel mode"
 msgstr "无法在 %d 声道模式打开设备录音。"
 
-msgid ""
-"Could not open audio device for recording. Device is being used by another "
-"application."
+#: ext/alsa/gstalsasrc.c:628
+msgid "Could not open audio device for recording. Device is being used by another application."
 msgstr "无法打开音频设备用于录音。目前有另一个程序正在使用该设备。"
 
+#: ext/alsa/gstalsasrc.c:633
 msgid "Could not open audio device for recording."
 msgstr "无法打开音频设备录音。"
 
+#: ext/cdparanoia/gstcdparanoiasrc.c:257 ext/cdparanoia/gstcdparanoiasrc.c:263
 msgid "Could not open CD device for reading."
 msgstr "无法打开 CD 设备读取。"
 
+#: ext/cdparanoia/gstcdparanoiasrc.c:389
 msgid "Could not seek CD."
 msgstr "无法搜索 CD。"
 
+#: ext/cdparanoia/gstcdparanoiasrc.c:397
 msgid "Could not read CD."
 msgstr "无法读取 CD。"
 
+#: ext/gnomevfs/gstgnomevfssink.c:379
 #, c-format
 msgid "Could not open vfs file \"%s\" for writing: %s."
 msgstr "无法打开 vfs 文件“%s”写入:%s。"
 
+#: ext/gnomevfs/gstgnomevfssink.c:386
 msgid "No filename given"
 msgstr "没有给定文件名"
 
+#: ext/gnomevfs/gstgnomevfssink.c:412
 #, c-format
 msgid "Could not close vfs file \"%s\"."
 msgstr "无法关闭 vfs 文件“%s”。"
 
+#: ext/gnomevfs/gstgnomevfssink.c:570
 #, c-format
 msgid "Error while writing to file \"%s\"."
 msgstr "写入文件“%s”时出错。"
 
+#: ext/ogg/gstoggdemux.c:3150
 msgid "Internal data stream error."
 msgstr "内部数据流错误。"
 
+#: gst/playback/gstdecodebin.c:985 gst/playback/gstdecodebin2.c:1028
+#: gst/playback/gstplaybasebin.c:1536 gst/playback/gstplaybasebin.c:1672
 #, c-format
 msgid "A %s plugin is required to play this stream, but not installed."
 msgstr "播放此数据流需要 %s 插件,但它未安装。"
 
+#: gst/playback/gstdecodebin.c:1799 gst/playback/gstdecodebin2.c:1424
 msgid "This appears to be a text file"
 msgstr "此文件是个文本文件"
 
-#, fuzzy
-msgid "Could not determine type of stream"
-msgstr "无法创建“typefind”组件。"
-
+#: gst/playback/gstplaybasebin.c:1519
 #, c-format
 msgid "Invalid subtitle URI \"%s\", subtitles disabled."
 msgstr "无效的字幕 URI “%s”,不使用字幕。"
 
+#: gst/playback/gstplaybasebin.c:1642 gst/playback/gsturidecodebin.c:812
 msgid "No URI specified to play from."
 msgstr "未指定要播放的 URI。"
 
+#: gst/playback/gstplaybasebin.c:1648 gst/playback/gsturidecodebin.c:818
 #, c-format
 msgid "Invalid URI \"%s\"."
 msgstr "无效的 URI“%s”。"
 
+#: gst/playback/gstplaybasebin.c:1654
 msgid "RTSP streams cannot be played yet."
 msgstr "RTSP 流尚不能播放。"
 
+#: gst/playback/gstplaybasebin.c:2006
 msgid "Could not create \"decodebin\" element."
 msgstr "无法创建“decodebin”组件。"
 
+#: gst/playback/gstplaybasebin.c:2224 gst/playback/gsturidecodebin.c:1406
 msgid "Source element is invalid."
 msgstr "无效的源组件。"
 
-msgid ""
-"Only a subtitle stream was detected. Either you are loading a subtitle file "
-"or some other type of text file, or the media file was not recognized."
-msgstr ""
-"仅检测到字幕流。您可能装入的是字幕文件或者其它类型文本文件,又或者是媒体文件"
-"无法识别。"
+#: gst/playback/gstplaybasebin.c:2301
+msgid "Only a subtitle stream was detected. Either you are loading a subtitle file or some other type of text file, or the media file was not recognized."
+msgstr "仅检测到字幕流。您可能装入的是字幕文件或者其它类型文本文件,又或者是媒体文件无法识别。"
 
-msgid ""
-"You do not have a decoder installed to handle this file. You might need to "
-"install the necessary plugins."
+#: gst/playback/gstplaybasebin.c:2306
+msgid "You do not have a decoder installed to handle this file. You might need to install the necessary plugins."
 msgstr "您没有安装可处理此文件的解码器。您可能需要安装必要的插件。"
 
+#: gst/playback/gstplaybasebin.c:2310
 msgid "This is not a media file"
 msgstr "此文件不是媒体文件"
 
+#: gst/playback/gstplaybasebin.c:2315
 msgid "A subtitle stream was detected, but no video stream."
 msgstr "检测到了字幕流,但无视频流。"
 
+#: gst/playback/gstplaybin.c:882 gst/playback/gstplaysink.c:758
 msgid "Both autovideosink and xvimagesink elements are missing."
 msgstr "autovideosink 和 xvimagesink 组件都缺少。"
 
+#: gst/playback/gstplaybin.c:890 gst/playback/gstplaybin.c:900
+#: gst/playback/gstplaybin.c:1157 gst/playback/gstplaybin.c:1166
+#: gst/playback/gstplaybin.c:1175 gst/playback/gstplaybin.c:1306
+#: gst/playback/gstplaybin.c:1315 gst/playback/gstplaybin.c:1324
+#: gst/playback/gstplaysink.c:714 gst/playback/gstplaysink.c:729
+#: gst/playback/gstplaysink.c:845 gst/playback/gstplaysink.c:854
+#: gst/playback/gstplaysink.c:955 gst/playback/gstplaysink.c:973
+#: gst/playback/gstplaysink.c:992 gst/playback/gstplaysink.c:1139
+#: gst/playback/gstplaysink.c:1148 gst/playback/gstplaysink.c:1157
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr "未找到组件‘%s’-请检查您的 GStreamer 安装情况。"
 
+#: gst/playback/gstplaybin.c:1150 gst/playback/gstplaysink.c:1045
 msgid "Both autoaudiosink and alsasink elements are missing."
 msgstr "autovideosink 和 alsasink 组件都缺少。"
 
-#, fuzzy, c-format
-msgid "Both autovideosink and %s elements are missing."
-msgstr "autovideosink 和 xvimagesink 组件都缺少。"
-
-#, fuzzy
-msgid "The autovideosink element is missing."
-msgstr "autovideosink 和 xvimagesink 组件都缺少。"
-
-#, c-format
-msgid "Configured videosink %s is not working."
-msgstr ""
-
-#, fuzzy, c-format
-msgid "Both autovideosink and %s elements are not working."
-msgstr "autovideosink 和 xvimagesink 组件都缺少。"
-
-#, fuzzy
-msgid "The autovideosink element is not working."
-msgstr "autovideosink 和 xvimagesink 组件都缺少。"
-
-msgid "Custom text sink element is not usable."
-msgstr ""
-
+#: gst/playback/gstplaysink.c:1028
 msgid "No volume control found"
 msgstr "未找到音量控制"
 
-#, fuzzy, c-format
-msgid "Both autoaudiosink and %s elements are missing."
-msgstr "autovideosink 和 alsasink 组件都缺少。"
+#: gst/playback/gstplaysink.c:1380
+msgid "Can't play a text file without video."
+msgstr "无法播放不带视频的文本文件。"
 
-#, fuzzy
-msgid "The autoaudiosink element is missing."
-msgstr "autovideosink 和 alsasink 组件都缺少。"
+#: gst/playback/gstqueue2.c:991
+msgid "No file name specified."
+msgstr "未给定文件名。"
 
+#: gst/playback/gstqueue2.c:997
 #, c-format
-msgid "Configured audiosink %s is not working."
-msgstr ""
-
-#, fuzzy, c-format
-msgid "Both autoaudiosink and %s elements are not working."
-msgstr "autovideosink 和 alsasink 组件都缺少。"
-
-#, fuzzy
-msgid "The autoaudiosink element is not working."
-msgstr "autovideosink 和 alsasink 组件都缺少。"
-
-#, fuzzy
-msgid "Can't play a text file without video or visualizations."
-msgstr "无法播放不带视频的文本文件。"
+msgid "Could not open file \"%s\" for reading."
+msgstr "无法打开文件“%s”读取。"
 
+#: gst/playback/gsturidecodebin.c:589
 #, c-format
 msgid "No decoder available for type '%s'."
 msgstr "找不到‘%s’类型可用的解码器。"
 
+#: gst/playback/gsturidecodebin.c:824
 msgid "This stream type cannot be played yet."
 msgstr "此类型的数据流尚不能播放。"
 
+#: gst/playback/gsturidecodebin.c:835
 #, c-format
 msgid "No URI handler implemented for \"%s\"."
 msgstr "“%s”未实现 URI 处理器。"
 
+#: gst/playback/gsturidecodebin.c:1126
+msgid "Could not create \"decodebin2\" element."
+msgstr "无法创建“decodebin”组件。"
+
+#: gst/playback/gsturidecodebin.c:1193
+msgid "Could not create \"queue2\" element."
+msgstr "无法创建“queue2”组件。"
+
+#: gst/playback/gsturidecodebin.c:1232
+msgid "Could not create \"typefind\" element."
+msgstr "无法创建“typefind”组件。"
+
+#: gst/tcp/gsttcp.c:503 gst/tcp/gsttcpclientsink.c:278
 #, c-format
 msgid "Error while sending data to \"%s:%d\"."
 msgstr "发送数据至“%s:%d”时出错。"
 
+#: gst/tcp/gsttcp.c:555
 #, fuzzy, c-format
 msgid "Error while sending gdp header data to \"%s:%d\"."
 msgstr "发送 gdp 头部数据至“%s:%d”时出错。"
 
+#: gst/tcp/gsttcp.c:564
 #, c-format
 msgid "Error while sending gdp payload data to \"%s:%d\"."
 msgstr "发送 gdp 负载数据至“%s:%d”时出错。"
 
+#: gst/tcp/gsttcpclientsink.c:390 gst/tcp/gsttcpclientsrc.c:373
 #, c-format
 msgid "Connection to %s:%d refused."
 msgstr "拒绝连接至 %s:%d。"
 
+#: gst-libs/gst/audio/gstbaseaudiosrc.c:804
 msgid "Can't record audio fast enough"
 msgstr "无法足够快的录音"
 
+#: gst-libs/gst/tag/gsttagdemux.c:1055
 msgid "Failed to read tag: not enough data"
 msgstr "无法读取标签: 数据不足"
 
+#: gst-libs/gst/tag/tags.c:59
 msgid "track ID"
 msgstr "音轨 ID"
 
+#: gst-libs/gst/tag/tags.c:59
 msgid "MusicBrainz track ID"
 msgstr "MusicBrainz 音轨 ID"
 
+#: gst-libs/gst/tag/tags.c:61
 msgid "artist ID"
 msgstr "艺人 ID"
 
+#: gst-libs/gst/tag/tags.c:61
 msgid "MusicBrainz artist ID"
 msgstr "MusicBrainz 艺人 ID"
 
+#: gst-libs/gst/tag/tags.c:63
 msgid "album ID"
 msgstr "专辑 ID"
 
+#: gst-libs/gst/tag/tags.c:63
 msgid "MusicBrainz album ID"
 msgstr "MusicBrainz 专辑 ID"
 
+#: gst-libs/gst/tag/tags.c:66
 msgid "album artist ID"
 msgstr "音轨艺人 ID"
 
+#: gst-libs/gst/tag/tags.c:66
 msgid "MusicBrainz album artist ID"
 msgstr "MusicBrainz 专辑艺人 ID"
 
+#: gst-libs/gst/tag/tags.c:68
 msgid "track TRM ID"
 msgstr "音轨 TRM ID"
 
+#: gst-libs/gst/tag/tags.c:68
 msgid "MusicBrainz TRM ID"
 msgstr "MusicBrainz TRM ID"
 
-msgid "capturing shutter speed"
-msgstr ""
-
-msgid "Shutter speed used when capturing an image, in seconds"
-msgstr ""
-
-msgid "capturing focal ratio"
-msgstr ""
-
-msgid "Focal ratio (f-number) used when capturing the image"
-msgstr ""
-
-msgid "capturing focal length"
-msgstr ""
-
-msgid "Focal length of the lens used capturing the image, in mm"
-msgstr ""
-
-msgid "capturing digital zoom ratio"
-msgstr ""
-
-msgid "Digital zoom ratio used when capturing an image"
-msgstr ""
-
-msgid "capturing iso speed"
-msgstr ""
-
-msgid "The ISO speed used when capturing an image"
-msgstr ""
-
-msgid "capturing exposure program"
-msgstr ""
-
-msgid "The exposure program used when capturing an image"
-msgstr ""
-
-msgid "capturing exposure mode"
-msgstr ""
-
-msgid "The exposure mode used when capturing an image"
-msgstr ""
-
-msgid "capturing exposure compensation"
-msgstr ""
-
-msgid "The exposure compensation used when capturing an image"
-msgstr ""
-
-msgid "capturing scene capture type"
-msgstr ""
-
-msgid "The scene capture mode used when capturing an image"
-msgstr ""
-
-msgid "capturing gain adjustment"
-msgstr ""
-
-msgid "The overall gain adjustment applied on an image"
-msgstr ""
-
-msgid "capturing white balance"
-msgstr ""
-
-msgid "The white balance mode set when capturing an image"
-msgstr ""
-
-msgid "capturing contrast"
-msgstr ""
-
-msgid "The direction of contrast processing applied when capturing an image"
-msgstr ""
-
-msgid "capturing saturation"
-msgstr ""
-
-msgid "The direction of saturation processing applied when capturing an image"
-msgstr ""
-
-msgid "capturing sharpness"
-msgstr ""
-
-msgid "The direction of sharpness processing applied when capturing an image"
-msgstr ""
-
-msgid "capturing flash fired"
-msgstr ""
-
-msgid "If the flash fired while capturing an image"
-msgstr ""
-
-msgid "capturing flash mode"
-msgstr ""
-
-msgid "The selected flash mode while capturing an image"
-msgstr ""
-
-msgid "capturing metering mode"
-msgstr ""
-
-msgid ""
-"The metering mode used while determining exposure for capturing an image"
-msgstr ""
-
-msgid "capturing source"
-msgstr ""
-
-msgid "The source or type of device used for the capture"
-msgstr ""
-
-msgid "image horizontal ppi"
-msgstr ""
-
-msgid "Media (image/video) intended horizontal pixel density in ppi"
-msgstr ""
-
-msgid "image vertical ppi"
-msgstr ""
-
-msgid "Media (image/video) intended vertical pixel density in ppi"
-msgstr ""
-
-msgid "ID3v2 frame"
-msgstr ""
-
-msgid "unparsed id3v2 tag frame"
-msgstr ""
-
+#: gst-libs/gst/cdda/gstcddabasesrc.c:1397
+#: gst-libs/gst/cdda/gstcddabasesrc.c:1430
 msgid "This CD has no audio tracks"
 msgstr "此 CD 无音轨"
 
+#: gst-libs/gst/pbutils/descriptions.c:66
 msgid "ID3 tag"
 msgstr "ID3 标识"
 
+#: gst-libs/gst/pbutils/descriptions.c:67
 msgid "APE tag"
 msgstr "APE 标识"
 
+#: gst-libs/gst/pbutils/descriptions.c:68
 msgid "ICY internet radio"
 msgstr "ICY 网络电台"
 
+#: gst-libs/gst/pbutils/descriptions.c:91
 msgid "Apple Lossless Audio (ALAC)"
 msgstr "Apple 无损音频(ALAC)"
 
+#: gst-libs/gst/pbutils/descriptions.c:100
 msgid "Free Lossless Audio Codec (FLAC)"
 msgstr "自由无损音频编码(FLAC)"
 
+#: gst-libs/gst/pbutils/descriptions.c:125
+#: gst-libs/gst/pbutils/descriptions.c:126
 msgid "Lossless True Audio (TTA)"
 msgstr "无损高保真音频(TTA)"
 
+#: gst-libs/gst/pbutils/descriptions.c:134
 msgid "Windows Media Speech"
 msgstr "Windows Media 语音"
 
+#: gst-libs/gst/pbutils/descriptions.c:148
 msgid "CYUV Lossless"
 msgstr "CYUV 无损"
 
+#: gst-libs/gst/pbutils/descriptions.c:151
 msgid "FFMpeg v1"
 msgstr "FFMpeg v1"
 
+#: gst-libs/gst/pbutils/descriptions.c:163
 msgid "Lossless MSZH"
 msgstr "无损 MSZH"
 
+#: gst-libs/gst/pbutils/descriptions.c:169
 msgid "Uncompressed Gray Image"
 msgstr "未压缩的灰度图像"
 
+#: gst-libs/gst/pbutils/descriptions.c:174
 msgid "Run-length encoding"
 msgstr "Run-length 编码"
 
+#: gst-libs/gst/pbutils/descriptions.c:208
 msgid "Sami subtitle format"
 msgstr "Sami 字幕格式"
 
+#: gst-libs/gst/pbutils/descriptions.c:209
 msgid "TMPlayer subtitle format"
 msgstr "TMPlayer 字幕格式"
 
+#: gst-libs/gst/pbutils/descriptions.c:210
 msgid "Kate subtitle format"
 msgstr "Kate 字幕格式"
 
+#: gst-libs/gst/pbutils/descriptions.c:269
 msgid "Uncompressed planar YUV 4:2:0"
 msgstr "未压缩的 planar YUV 4:2:0"
 
+#: gst-libs/gst/pbutils/descriptions.c:272
 msgid "Uncompressed planar YVU 4:2:0"
 msgstr "未压缩的 planar YVU 4:2:0"
 
+#: gst-libs/gst/pbutils/descriptions.c:275
+#: gst-libs/gst/pbutils/descriptions.c:285
 msgid "Uncompressed packed YUV 4:2:2"
 msgstr "未压缩的 packed YUV 4:2:2"
 
+#: gst-libs/gst/pbutils/descriptions.c:278
 msgid "Uncompressed packed YUV 4:1:0"
 msgstr "未压缩的 packed YUV 4:1:0"
 
+#: gst-libs/gst/pbutils/descriptions.c:281
 msgid "Uncompressed packed YVU 4:1:0"
 msgstr "未压缩的 packed YVU 4:1:0"
 
+#: gst-libs/gst/pbutils/descriptions.c:288
 msgid "Uncompressed packed YUV 4:1:1"
 msgstr "未压缩的 packed YUV 4:1:1"
 
+#: gst-libs/gst/pbutils/descriptions.c:291
 msgid "Uncompressed packed YUV 4:4:4"
 msgstr "未压缩的 packed YUV 4:4:4"
 
+#: gst-libs/gst/pbutils/descriptions.c:294
 msgid "Uncompressed planar YUV 4:2:2"
 msgstr "未压缩的 planar YUV 4:2:2"
 
+#: gst-libs/gst/pbutils/descriptions.c:297
 msgid "Uncompressed planar YUV 4:1:1"
 msgstr "未压缩的 planar YUV 4:1:1"
 
+#: gst-libs/gst/pbutils/descriptions.c:300
 msgid "Uncompressed black and white Y-plane"
 msgstr "未压缩的黑白 Y-plane"
 
+#: gst-libs/gst/pbutils/descriptions.c:303
 msgid "Uncompressed YUV"
 msgstr "未压缩的 YUV"
 
+#: gst-libs/gst/pbutils/descriptions.c:314
 #, fuzzy, c-format
 msgid "Uncompressed palettized %d-bit %s"
 msgstr "未压缩的 palettized %d-位 %s"
 
+#: gst-libs/gst/pbutils/descriptions.c:366
 #, c-format
 msgid "DivX MPEG-4 Version %d"
 msgstr "DivX MPEG-4 版本 %d"
 
+#: gst-libs/gst/pbutils/descriptions.c:584
 #, c-format
 msgid "Raw %d-bit PCM audio"
 msgstr "原始 %d-位 PCM 音频"
 
+#: gst-libs/gst/pbutils/descriptions.c:586
 msgid "Raw PCM audio"
 msgstr "原始 PCM 音频"
 
+#: gst-libs/gst/pbutils/descriptions.c:592
 #, c-format
 msgid "Raw %d-bit floating-point audio"
 msgstr "原始 %d-位浮点音频"
 
+#: gst-libs/gst/pbutils/descriptions.c:594
 msgid "Raw floating-point audio"
 msgstr "原始浮点音频"
 
+#: gst-libs/gst/pbutils/descriptions.c:681
 msgid "Audio CD source"
 msgstr "音频 CD 源"
 
+#: gst-libs/gst/pbutils/descriptions.c:684
 msgid "DVD source"
 msgstr "DVD 源"
 
+#: gst-libs/gst/pbutils/descriptions.c:687
 msgid "Real Time Streaming Protocol (RTSP) source"
 msgstr "实时流协议(RTSP)源"
 
+#: gst-libs/gst/pbutils/descriptions.c:691
 msgid "Microsoft Media Server (MMS) protocol source"
 msgstr "Microsoft 媒体服务协议(MMS)源"
 
+#: gst-libs/gst/pbutils/descriptions.c:699
 #, c-format
 msgid "%s protocol source"
 msgstr "%s 协议源"
 
+#: gst-libs/gst/pbutils/descriptions.c:767
 #, fuzzy, c-format
 msgid "%s video RTP depayloader"
 msgstr "%s 视频 RTP 去负载器"
 
+#: gst-libs/gst/pbutils/descriptions.c:769
 #, fuzzy, c-format
 msgid "%s audio RTP depayloader"
 msgstr "%s 音频 RTP 去负载器"
 
+#: gst-libs/gst/pbutils/descriptions.c:771
 #, fuzzy, c-format
 msgid "%s RTP depayloader"
 msgstr "%s RTP 去负载器"
 
+#: gst-libs/gst/pbutils/descriptions.c:778
 #, c-format
 msgid "%s demuxer"
 msgstr "%s 多路分配器"
 
+#: gst-libs/gst/pbutils/descriptions.c:780
 #, c-format
 msgid "%s decoder"
 msgstr "%s 解码器"
 
+#: gst-libs/gst/pbutils/descriptions.c:815
 #, c-format
 msgid "%s video RTP payloader"
 msgstr "%s 视频 RTP 负载器"
 
+#: gst-libs/gst/pbutils/descriptions.c:817
 #, c-format
 msgid "%s audio RTP payloader"
 msgstr "%s 音频 RTP 负载器"
 
+#: gst-libs/gst/pbutils/descriptions.c:819
 #, c-format
 msgid "%s RTP payloader"
 msgstr "%s RTP 负载器"
 
+#: gst-libs/gst/pbutils/descriptions.c:826
 #, c-format
 msgid "%s muxer"
 msgstr "%s 混音器"
 
+#: gst-libs/gst/pbutils/descriptions.c:828
 #, c-format
 msgid "%s encoder"
 msgstr "%s 编码器"
 
+#: gst-libs/gst/pbutils/descriptions.c:859
 #, c-format
 msgid "GStreamer element %s"
 msgstr "GStreamer 组件 %s"
 
+#: gst-libs/gst/pbutils/missing-plugins.c:554
 msgid "Unknown source element"
 msgstr "未知源组件"
 
+#: gst-libs/gst/pbutils/missing-plugins.c:557
 msgid "Unknown sink element"
 msgstr "未知消音组件"
 
+#: gst-libs/gst/pbutils/missing-plugins.c:560
 msgid "Unknown element"
 msgstr "未知组件"
 
+#: gst-libs/gst/pbutils/missing-plugins.c:563
 msgid "Unknown decoder element"
 msgstr "未知的解码组件"
 
+#: gst-libs/gst/pbutils/missing-plugins.c:566
 msgid "Unknown encoder element"
 msgstr "未知的编码组件"
 
+#: gst-libs/gst/pbutils/missing-plugins.c:571
 msgid "Plugin or element of unknown type"
 msgstr "未知类型的插件或组件"
 
+#: sys/v4l/v4l_calls.c:159
 msgid "No device specified."
 msgstr "未指定设备。"
 
+#: sys/v4l/v4l_calls.c:168
 #, c-format
 msgid "Device \"%s\" does not exist."
 msgstr "设备“%s”不存在。"
 
+#: sys/v4l/v4l_calls.c:173
 #, c-format
 msgid "Device \"%s\" is already being used."
 msgstr "设备“%s”目前已被使用了。"
 
+#: sys/v4l/v4l_calls.c:178
 #, c-format
 msgid "Could not open device \"%s\" for reading and writing."
 msgstr "无法打开设备“%s”读取。"
-
-#~ msgid "No file name specified."
-#~ msgstr "未给定文件名。"
-
-#~ msgid "Could not open file \"%s\" for reading."
-#~ msgstr "无法打开文件“%s”读取。"
-
-#~ msgid "Could not create \"decodebin2\" element."
-#~ msgstr "无法创建“decodebin”组件。"
-
-#~ msgid "Could not create \"queue2\" element."
-#~ msgstr "无法创建“queue2”组件。"
index 8a0309a..c3c2238 100644 (file)
@@ -1,9 +1,3 @@
-if USE_GST_V4L
-V4L_DIR=v4l
-else
-V4L_DIR=
-endif
-
 if USE_X
 XIMAGE_DIR=ximage
 else
@@ -18,11 +12,9 @@ endif
 
 SUBDIRS = \
   $(XIMAGE_DIR) \
-  $(XVIMAGE_DIR) \
-  $(V4L_DIR)
+  $(XVIMAGE_DIR)
 
 DIST_SUBDIRS = \
-  v4l \
   ximage \
   xvimage
 
diff --git a/sys/v4l/.gitignore b/sys/v4l/.gitignore
deleted file mode 100644 (file)
index bcb497a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-gstv4lelement-marshal.h
-gstv4lelement-marshal.c
diff --git a/sys/v4l/Makefile.am b/sys/v4l/Makefile.am
deleted file mode 100644 (file)
index 5f2b95f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-plugin_LTLIBRARIES = libgstvideo4linux.la
-
-if USE_XVIDEO
-xv_source = gstv4lxoverlay.c
-xv_libs = $(X_LIBS) $(XVIDEO_LIBS)
-else
-xv_source =
-xv_libs =
-endif
-
-libgstvideo4linux_la_SOURCES = \
-       gstv4l.c \
-       gstv4lcolorbalance.c \
-       gstv4lelement.c \
-       gstv4lsrc.c \
-       gstv4ltuner.c \
-       v4l_calls.c \
-       v4lsrc_calls.c $(xv_source)
-
-#      gstv4ljpegsrc.c \
-#      gstv4lmjpegsrc.c v4lmjpegsrc_calls.c \
-#      gstv4lmjpegsink.c v4lmjpegsink_calls.c
-
-libgstvideo4linux_la_CFLAGS = \
-       $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) \
-       $(GUDEV_CFLAGS)
-libgstvideo4linux_la_LIBADD = \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
-       $(GST_BASE_LIBS) $(GST_LIBS) $(xv_libs) \
-       $(GUDEV_LIBS)
-libgstvideo4linux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideo4linux_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstv4lelement.h v4l_calls.h \
-               gstv4lsrc.h v4lsrc_calls.h \
-               gstv4ljpegsrc.h \
-               gstv4lmjpegsrc.h v4lmjpegsrc_calls.h \
-               gstv4lmjpegsink.h v4lmjpegsink_calls.h \
-               videodev_mjpeg.h \
-               gstv4ltuner.h gstv4lxoverlay.h \
-               gstv4lcolorbalance.h
diff --git a/sys/v4l/README b/sys/v4l/README
deleted file mode 100644 (file)
index 980e193..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-General Idea:
-=============
-
-                            _____/ gstv4lsrc.[ch]
-                      _____/     \ v4lsrc_calls.[ch]
-                     /
-gstv4lelement.[ch] _/____________/ gstv4lmjpegsrc.[ch]
-v4l_calls.[ch]      \            \ v4lmjpegsrc_calls.[ch]
-                     \_____
-                           \_____/ gstv4lmjpegsink.[ch]
-                                 \ v4lmjpegsink_calls.[ch]
-
-I.e., all the files on the right are child classes of
-the v4lelement 'parent' on the left.
-
-* v4lelement handles generic v4l stuff (picture settings,
-    audio, norm/input setting, open()/close())
-* v4lsrc, v4lmjpegsrc handle the capture specific
-    functions. Maybe we'd need a v4lmpegsrc too
-* v4lmjpegsink handles mjpeg hardware playback of video
-
-Useful Documentation:
-=====================
-MJPEG/V4L API : ./videodev_mjpeg.h
-
-V4L API       : /usr/include/linux/videodev.h or
-                /usr/src/linux/Documentation/video4linux/API.html or
-                http://linux.bytesex.org/v4l2/API.html
-
-V4L2 API      : /usr/include/linux/videodev2.h or
-                http://v4l2spec.bytesex.org/
-
-BSD/Meteor API: /usr/include/machine/ioctl_meteor.h
-
-mjpegtools    : http://www.sourceforge.net/projects/mjpeg
diff --git a/sys/v4l/TODO b/sys/v4l/TODO
deleted file mode 100644 (file)
index 96616c0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-TODO list (short term):
-=======================
-* v4lsrc/v4lmjpegsrc/v4l2src: fix interlacing (not handled at all...)
-
-TODO list (long term):
-======================
-* v4lmpegsrc (*hint* MPEG card needed *hint*)
-* v4l2sink
-* BSD-videosrc (bktr)
-
-Useful Documentation:
-=====================
-MJPEG/V4L API : ./videodev_mjpeg.h
-
-V4L API       : /usr/include/linux/videodev.h or
-                /usr/src/linux/Documentation/video4linux/API.html or
-                http://linux.bytesex.org/v4l2/API.html
-
-V4L2 API      : /usr/include/linux/videodev2.h or
-                http://v4l2spec.bytesex.org/
-
-BSD/Meteor API: /usr/include/machine/ioctl_meteor.h
-
-mjpegtools    : http://www.sourceforge.net/projects/mjpeg
-
-Capturing:
-==========
-* sound is the master clock
-* it's probably a good idea to create an audiosource element:
-   - autodetect alsa/oss
-   - first try alsa, then oss... they work the same internally
-* same for videosource:
-   - autodetect v4l/v4l2 + mjpeg capabilities
-   - for this, just open device using v4l2element. On success:
-      + use v4l2
-   - on failure:
-      + use v4lelement and query for MJPEG capabilities
-      + if that's available, combine caps of v4lmjpegsrc and v4lsrc
-* both sources run in their own GstThread with a high priority
-* an encoder element takes care of encoding + muxing. A toplevel element
-   (reverse of spider) is probably a good idea here. How? Don't know...
-* format negotiation via filtered caps
-* statistics via listening to the frame_{lost,inserted,deleted,captures}
-   signals and GST_PAD_QUERY_POSITION (gst_pad_query())
diff --git a/sys/v4l/gstv4l.c b/sys/v4l/gstv4l.c
deleted file mode 100644 (file)
index aa467c4..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* GStreamer
- *
- * gstv4l.c: plugin for v4l elements
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include <gst/gst.h>
-
-#include "gstv4lelement.h"
-#include "gstv4lsrc.h"
-/* #include "gstv4ljpegsrc.h" */
-/* #include "gstv4lmjpegsrc.h" */
-/* #include "gstv4lmjpegsink.h" */
-
-GST_DEBUG_CATEGORY (v4l_debug); /* used in v4l_calls.c and v4lsrc_calls.c */
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  GST_DEBUG_CATEGORY_INIT (v4l_debug, "v4l", 0, "V4L API calls");
-
-  if (!gst_element_register (plugin, "v4lsrc", GST_RANK_MARGINAL,
-          GST_TYPE_V4LSRC))
-/*       !gst_element_register (plugin, "v4ljpegsrc", */
-/*           GST_RANK_NONE, GST_TYPE_V4LJPEGSRC) || */
-/*       !gst_element_register (plugin, "v4lmjpegsrc", */
-/*           GST_RANK_NONE, GST_TYPE_V4LMJPEGSRC) || */
-/*       !gst_element_register (plugin, "v4lmjpegsink", */
-/*           GST_RANK_NONE, GST_TYPE_V4LMJPEGSINK)) */
-    return FALSE;
-
-#ifdef ENABLE_NLS
-  setlocale (LC_ALL, "");
-  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    "video4linux",
-    "elements for Video 4 Linux",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/v4l/gstv4lcolorbalance.c b/sys/v4l/gstv4lcolorbalance.c
deleted file mode 100644 (file)
index 35745bb..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/* GStreamer
- *
- * gstv4lcolorbalance.c: color balance interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include "gstv4lcolorbalance.h"
-#include "gstv4lelement.h"
-
-static void
-gst_v4l_color_balance_channel_class_init (GstV4lColorBalanceChannelClass *
-    klass);
-static void gst_v4l_color_balance_channel_init (GstV4lColorBalanceChannel *
-    channel);
-
-static const GList *gst_v4l_color_balance_list_channels (GstColorBalance *
-    balance);
-static void gst_v4l_color_balance_set_value (GstColorBalance * balance,
-    GstColorBalanceChannel * channel, gint value);
-static gint gst_v4l_color_balance_get_value (GstColorBalance * balance,
-    GstColorBalanceChannel * channel);
-
-static GstColorBalanceChannelClass *parent_class = NULL;
-
-GType
-gst_v4l_color_balance_channel_get_type (void)
-{
-  static GType gst_v4l_color_balance_channel_type = 0;
-
-  if (!gst_v4l_color_balance_channel_type) {
-    static const GTypeInfo v4l_tuner_channel_info = {
-      sizeof (GstV4lColorBalanceChannelClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_v4l_color_balance_channel_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lColorBalanceChannel),
-      0,
-      (GInstanceInitFunc) gst_v4l_color_balance_channel_init,
-      NULL
-    };
-
-    gst_v4l_color_balance_channel_type =
-        g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL,
-        "GstV4lColorBalanceChannel", &v4l_tuner_channel_info, 0);
-  }
-
-  return gst_v4l_color_balance_channel_type;
-}
-
-static void
-gst_v4l_color_balance_channel_class_init (GstV4lColorBalanceChannelClass *
-    klass)
-{
-  parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4l_color_balance_channel_init (GstV4lColorBalanceChannel * channel)
-{
-  channel->index = 0;
-}
-
-void
-gst_v4l_color_balance_interface_init (GstColorBalanceClass * klass)
-{
-  GST_COLOR_BALANCE_TYPE (klass) = GST_COLOR_BALANCE_HARDWARE;
-
-  /* default virtual functions */
-  klass->list_channels = gst_v4l_color_balance_list_channels;
-  klass->set_value = gst_v4l_color_balance_set_value;
-  klass->get_value = gst_v4l_color_balance_get_value;
-}
-
-static G_GNUC_UNUSED gboolean
-gst_v4l_color_balance_contains_channel (GstV4lElement * v4lelement,
-    GstV4lColorBalanceChannel * v4lchannel)
-{
-  const GList *item;
-
-  for (item = v4lelement->colors; item != NULL; item = item->next)
-    if (item->data == v4lchannel)
-      return TRUE;
-
-  return FALSE;
-}
-
-static const GList *
-gst_v4l_color_balance_list_channels (GstColorBalance * balance)
-{
-  return GST_V4LELEMENT (balance)->colors;
-}
-
-static void
-gst_v4l_color_balance_set_value (GstColorBalance * balance,
-    GstColorBalanceChannel * channel, gint value)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (balance);
-  GstV4lColorBalanceChannel *v4lchannel =
-      GST_V4L_COLOR_BALANCE_CHANNEL (channel);
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
-  g_return_if_fail (gst_v4l_color_balance_contains_channel (v4lelement,
-          v4lchannel));
-
-  gst_v4l_set_picture (v4lelement, v4lchannel->index, value);
-}
-
-static gint
-gst_v4l_color_balance_get_value (GstColorBalance * balance,
-    GstColorBalanceChannel * channel)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (balance);
-  GstV4lColorBalanceChannel *v4lchannel =
-      GST_V4L_COLOR_BALANCE_CHANNEL (channel);
-  gint value;
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 0);
-  g_return_val_if_fail (gst_v4l_color_balance_contains_channel (v4lelement,
-          v4lchannel), 0);
-
-  if (!gst_v4l_get_picture (v4lelement, v4lchannel->index, &value))
-    return 0;
-
-  return value;
-}
diff --git a/sys/v4l/gstv4lcolorbalance.h b/sys/v4l/gstv4lcolorbalance.h
deleted file mode 100644 (file)
index 7f5c223..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- *
- * gstv4lcolorbalance.h: color balance interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4L_COLOR_BALANCE_H__
-#define __GST_V4L_COLOR_BALANCE_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/colorbalance.h>
-#include "v4l_calls.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4L_COLOR_BALANCE_CHANNEL \
-  (gst_v4l_color_balance_channel_get_type ())
-#define GST_V4L_COLOR_BALANCE_CHANNEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, \
-                               GstV4lColorBalanceChannel))
-#define GST_V4L_COLOR_BALANCE_CHANNEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, \
-                            GstV4lColorBalanceChannelClass))
-#define GST_IS_V4L_COLOR_BALANCE_CHANNEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL))
-#define GST_IS_V4L_COLOR_BALANCE_CHANNEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL))
-
-typedef struct _GstV4lColorBalanceChannel {
-  GstColorBalanceChannel parent;
-
-  GstV4lPictureType index;
-} GstV4lColorBalanceChannel;
-
-typedef struct _GstV4lColorBalanceChannelClass {
-  GstColorBalanceChannelClass parent;
-} GstV4lColorBalanceChannelClass;
-
-GType   gst_v4l_color_balance_channel_get_type  (void);
-
-void    gst_v4l_color_balance_interface_init    (GstColorBalanceClass *klass);
-
-#endif /* __GST_V4L_COLOR_BALANCE_H__ */
diff --git a/sys/v4l/gstv4lelement.c b/sys/v4l/gstv4lelement.c
deleted file mode 100644 (file)
index 91776af..0000000
+++ /dev/null
@@ -1,552 +0,0 @@
-/* GStreamer
- *
- * gstv4lelement.c: base class for V4L elements
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <gst/interfaces/propertyprobe.h>
-
-#ifdef HAVE_GUDEV
-#include <gudev/gudev.h>
-#endif
-
-#include "v4l_calls.h"
-#include "gstv4ltuner.h"
-#ifdef HAVE_XVIDEO
-#include "gstv4lxoverlay.h"
-#endif
-#include "gstv4lcolorbalance.h"
-
-
-enum
-{
-  PROP_0,
-  PROP_DEVICE,
-  PROP_DEVICE_NAME,
-  PROP_FLAGS
-};
-
-GST_DEBUG_CATEGORY (v4lelement_debug);
-#define GST_CAT_DEFAULT v4lelement_debug
-
-static void gst_v4lelement_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstV4lElement, gst_v4lelement, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_v4lelement_init_interfaces);
-
-static void gst_v4lelement_dispose (GObject * object);
-static void gst_v4lelement_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lelement_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-/* element methods */
-static GstStateChangeReturn gst_v4lelement_change_state (GstElement * element,
-    GstStateChange transition);
-
-static gboolean
-gst_v4l_iface_supported (GstImplementsInterface * iface, GType iface_type)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (iface);
-
-#ifdef HAVE_XVIDEO
-  g_assert (iface_type == GST_TYPE_TUNER ||
-      iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_COLOR_BALANCE);
-#else
-  g_assert (iface_type == GST_TYPE_TUNER ||
-      iface_type == GST_TYPE_COLOR_BALANCE);
-#endif
-
-  if (v4lelement->video_fd == -1)
-    return FALSE;
-
-#ifdef HAVE_XVIDEO
-  if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L_IS_OVERLAY (v4lelement))
-    return FALSE;
-#endif
-
-  return TRUE;
-}
-
-static void
-gst_v4l_interface_init (GstImplementsInterfaceClass * klass)
-{
-  /* default virtual functions */
-  klass->supported = gst_v4l_iface_supported;
-}
-
-static const GList *
-gst_v4l_probe_get_properties (GstPropertyProbe * probe)
-{
-  GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
-  static GList *list = NULL;
-
-  if (!list) {
-    list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
-  }
-
-  return list;
-}
-
-static gboolean init = FALSE;
-static GList *devices = NULL;
-
-#ifdef HAVE_GUDEV
-static gboolean
-gst_v4l_class_probe_devices_with_udev (GstV4lElementClass * klass,
-    gboolean check)
-{
-  GUdevClient *client = NULL;
-  GList *item;
-
-  if (!check) {
-    while (devices) {
-      gchar *device = devices->data;
-      devices = g_list_remove (devices, device);
-      g_free (device);
-    }
-
-    GST_INFO ("Enumerating video4linux devices from udev");
-    client = g_udev_client_new (NULL);
-    if (!client) {
-      GST_WARNING ("Failed to initialize gudev client");
-      goto finish;
-    }
-
-    item = g_udev_client_query_by_subsystem (client, "video4linux");
-    while (item) {
-      GUdevDevice *device = item->data;
-      gchar *devnode = g_strdup (g_udev_device_get_device_file (device));
-      gint api = g_udev_device_get_property_as_int (device, "ID_V4L_VERSION");
-      GST_INFO ("Found new device: %s, API: %d", devnode, api);
-      /* Append v4l1 devices only. If api is 0 probably v4l_id has
-         been stripped out of the current udev installation, append
-         anyway */
-      if (api == 0) {
-        GST_WARNING
-            ("Couldn't retrieve ID_V4L_VERSION, silly udev installation?");
-      }
-      if ((api == 1 || api == 0)) {
-        devices = g_list_append (devices, devnode);
-      } else {
-        g_free (devnode);
-      }
-      g_object_unref (device);
-      item = item->next;
-    }
-    g_list_free (item);
-    init = TRUE;
-  }
-
-finish:
-  if (client) {
-    g_object_unref (client);
-  }
-
-  klass->devices = devices;
-
-  return init;
-}
-#endif /* HAVE_GUDEV */
-
-static gboolean
-gst_v4l_class_probe_devices (GstV4lElementClass * klass, gboolean check)
-{
-  if (!check) {
-    const gchar *dev_base[] = { "/dev/video", "/dev/v4l/video", NULL };
-    gint base, n, fd;
-
-    while (devices) {
-      gchar *device = devices->data;
-      devices = g_list_remove (devices, device);
-      g_free (device);
-    }
-
-    /* detect /dev entries */
-    for (n = 0; n < 64; n++) {
-      for (base = 0; dev_base[base] != NULL; base++) {
-        struct stat s;
-        gchar *device = g_strdup_printf ("%s%d", dev_base[base], n);
-
-        /* does the /dev/ entry exist at all? */
-        if (stat (device, &s) == 0) {
-          /* yes: is a device attached? */
-          if ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) {
-            if (fd > 0)
-              close (fd);
-
-            devices = g_list_append (devices, device);
-            break;
-          }
-        }
-        g_free (device);
-      }
-    }
-
-    init = TRUE;
-  }
-
-  klass->devices = devices;
-
-  return init;
-}
-
-static void
-gst_v4l_probe_probe_property (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
-
-  switch (prop_id) {
-    case PROP_DEVICE:
-#ifdef HAVE_GUDEV
-      if (!gst_v4l_class_probe_devices_with_udev (klass, FALSE))
-        gst_v4l_class_probe_devices (klass, FALSE);
-#else /* !HAVE_GUDEV */
-      gst_v4l_class_probe_devices (klass, FALSE);
-#endif /* HAVE_GUDEV */
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-      break;
-  }
-}
-
-static gboolean
-gst_v4l_probe_needs_probe (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
-  gboolean ret = FALSE;
-
-  switch (prop_id) {
-    case PROP_DEVICE:
-#ifdef HAVE_GUDEV
-      ret = !gst_v4l_class_probe_devices_with_udev (klass, FALSE);
-#else /* !HAVE_GUDEV */
-      ret = !gst_v4l_class_probe_devices (klass, TRUE);
-#endif /* HAVE_GUDEV */
-      ret = !gst_v4l_class_probe_devices (klass, TRUE);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-      break;
-  }
-
-  return ret;
-}
-
-static GValueArray *
-gst_v4l_class_list_devices (GstV4lElementClass * klass)
-{
-  GValueArray *array;
-  GValue value = { 0 };
-  GList *item;
-
-  if (!klass->devices)
-    return NULL;
-
-  array = g_value_array_new (g_list_length (klass->devices));
-  item = klass->devices;
-  g_value_init (&value, G_TYPE_STRING);
-  while (item) {
-    gchar *device = item->data;
-
-    g_value_set_string (&value, device);
-    g_value_array_append (array, &value);
-
-    item = item->next;
-  }
-  g_value_unset (&value);
-
-  return array;
-}
-
-static GValueArray *
-gst_v4l_probe_get_values (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
-  GValueArray *array = NULL;
-
-  switch (prop_id) {
-    case PROP_DEVICE:
-      array = gst_v4l_class_list_devices (klass);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-      break;
-  }
-
-  return array;
-}
-
-static void
-gst_v4l_property_probe_interface_init (GstPropertyProbeInterface * iface)
-{
-  iface->get_properties = gst_v4l_probe_get_properties;
-  iface->probe_property = gst_v4l_probe_probe_property;
-  iface->needs_probe = gst_v4l_probe_needs_probe;
-  iface->get_values = gst_v4l_probe_get_values;
-}
-
-#define GST_TYPE_V4L_DEVICE_FLAGS (gst_v4l_device_get_type ())
-static GType
-gst_v4l_device_get_type (void)
-{
-  static GType v4l_device_type = 0;
-
-  if (v4l_device_type == 0) {
-    static const GFlagsValue values[] = {
-      {VID_TYPE_CAPTURE, "CAPTURE", "Device can capture"},
-      {VID_TYPE_TUNER, "TUNER", "Device has a tuner"},
-      {VID_TYPE_OVERLAY, "OVERLAY", "Device can do overlay"},
-      {VID_TYPE_MPEG_DECODER, "MPEG_DECODER", "Device can decode MPEG"},
-      {VID_TYPE_MPEG_ENCODER, "MPEG_ENCODER", "Device can encode MPEG"},
-      {VID_TYPE_MJPEG_DECODER, "MJPEG_DECODER", "Device can decode MJPEG"},
-      {VID_TYPE_MJPEG_ENCODER, "MJPEG_ENCODER", "Device can encode MJPEG"},
-      {0x10000, "AUDIO", "Device handles audio"},
-      {0, NULL, NULL}
-    };
-
-    v4l_device_type = g_flags_register_static ("GstV4lDeviceTypeFlags", values);
-  }
-
-  return v4l_device_type;
-}
-
-static void
-gst_v4lelement_init_interfaces (GType type)
-{
-  static const GInterfaceInfo v4liface_info = {
-    (GInterfaceInitFunc) gst_v4l_interface_init,
-    NULL,
-    NULL,
-  };
-  static const GInterfaceInfo v4l_tuner_info = {
-    (GInterfaceInitFunc) gst_v4l_tuner_interface_init,
-    NULL,
-    NULL,
-  };
-#ifdef HAVE_XVIDEO
-  static const GInterfaceInfo v4l_xoverlay_info = {
-    (GInterfaceInitFunc) gst_v4l_xoverlay_interface_init,
-    NULL,
-    NULL,
-  };
-#endif
-  static const GInterfaceInfo v4l_colorbalance_info = {
-    (GInterfaceInitFunc) gst_v4l_color_balance_interface_init,
-    NULL,
-    NULL,
-  };
-  static const GInterfaceInfo v4l_propertyprobe_info = {
-    (GInterfaceInitFunc) gst_v4l_property_probe_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type,
-      GST_TYPE_IMPLEMENTS_INTERFACE, &v4liface_info);
-  g_type_add_interface_static (type, GST_TYPE_TUNER, &v4l_tuner_info);
-#ifdef HAVE_XVIDEO
-  g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l_xoverlay_info);
-#endif
-  g_type_add_interface_static (type,
-      GST_TYPE_COLOR_BALANCE, &v4l_colorbalance_info);
-  g_type_add_interface_static (type,
-      GST_TYPE_PROPERTY_PROBE, &v4l_propertyprobe_info);
-}
-
-
-static void
-gst_v4lelement_base_init (gpointer g_class)
-{
-  GstV4lElementClass *klass = GST_V4LELEMENT_CLASS (g_class);
-
-  klass->devices = NULL;
-
-  GST_DEBUG_CATEGORY_INIT (v4lelement_debug, "v4lelement", 0,
-      "V4L Base Class debug");
-}
-
-static void
-gst_v4lelement_class_init (GstV4lElementClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *element_class;
-
-  gobject_class = (GObjectClass *) klass;
-  element_class = GST_ELEMENT_CLASS (klass);
-
-  gobject_class->set_property = gst_v4lelement_set_property;
-  gobject_class->get_property = gst_v4lelement_get_property;
-  gobject_class->dispose = gst_v4lelement_dispose;
-
-  element_class->change_state = gst_v4lelement_change_state;
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE,
-      g_param_spec_string ("device", "Device", "Device location",
-          NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
-      g_param_spec_string ("device-name", "Device name", "Name of the device",
-          NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FLAGS,
-      g_param_spec_flags ("flags", "Flags", "Device type flags",
-          GST_TYPE_V4L_DEVICE_FLAGS, 0,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-}
-
-
-static void
-gst_v4lelement_init (GstV4lElement * v4lelement, GstV4lElementClass * klass)
-{
-  /* some default values */
-  v4lelement->video_fd = -1;
-  v4lelement->buffer = NULL;
-  v4lelement->videodev = g_strdup ("/dev/video0");
-
-  v4lelement->norms = NULL;
-  v4lelement->channels = NULL;
-  v4lelement->colors = NULL;
-
-  v4lelement->xwindow_id = 0;
-}
-
-
-static void
-gst_v4lelement_dispose (GObject * object)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (object);
-
-  if (v4lelement->videodev) {
-    g_free (v4lelement->videodev);
-    v4lelement->videodev = NULL;
-  }
-
-  if (((GObjectClass *) parent_class)->dispose)
-    ((GObjectClass *) parent_class)->dispose (object);
-}
-
-
-static void
-gst_v4lelement_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (object);
-
-  switch (prop_id) {
-    case PROP_DEVICE:
-      if (v4lelement->videodev)
-        g_free (v4lelement->videodev);
-      v4lelement->videodev = g_strdup (g_value_get_string (value));
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-
-static void
-gst_v4lelement_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (object);
-
-  switch (prop_id) {
-    case PROP_DEVICE:
-      g_value_set_string (value, v4lelement->videodev);
-      break;
-    case PROP_DEVICE_NAME:{
-      gchar *new = NULL;
-
-      if (GST_V4L_IS_OPEN (v4lelement)) {
-        new = v4lelement->vcap.name;
-      } else if (gst_v4l_open (v4lelement)) {
-        new = v4lelement->vcap.name;
-        gst_v4l_close (v4lelement);
-      }
-      g_value_set_string (value, new);
-      break;
-    }
-    case PROP_FLAGS:{
-      guint flags = 0;
-
-      if (GST_V4L_IS_OPEN (v4lelement)) {
-        flags |= v4lelement->vcap.type & 0x3C0B;
-        if (v4lelement->vcap.audios)
-          flags |= 0x10000;
-      }
-      g_value_set_flags (value, flags);
-      break;
-    }
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static GstStateChangeReturn
-gst_v4lelement_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-  GstV4lElement *v4lelement = GST_V4LELEMENT (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      /* open the device */
-      if (!gst_v4l_open (v4lelement))
-        return GST_STATE_CHANGE_FAILURE;
-#ifdef HAVE_XVIDEO
-      gst_v4l_xoverlay_start (v4lelement);
-#endif
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      /* close the device */
-#ifdef HAVE_XVIDEO
-      gst_v4l_xoverlay_stop (v4lelement);
-#endif
-      if (!gst_v4l_close (v4lelement))
-        return GST_STATE_CHANGE_FAILURE;
-      break;
-    default:
-      break;
-  }
-
-  return ret;
-}
diff --git a/sys/v4l/gstv4lelement.h b/sys/v4l/gstv4lelement.h
deleted file mode 100644 (file)
index 056873c..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- *
- * gstv4lelement.h: base class for V4L elements
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LELEMENT_H__
-#define __GST_V4LELEMENT_H__
-
-/* Because of some really cool feature in video4linux1, also known as
- * 'not including sys/types.h and sys/time.h', we had to include it
- * ourselves. In all their intelligence, these people decided to fix
- * this in the next version (video4linux2) in such a cool way that it
- * breaks all compilations of old stuff...
- * The real problem is actually that linux/time.h doesn't use proper
- * macro checks before defining types like struct timeval. The proper
- * fix here is to either fuck the kernel header (which is what we do
- * by defining _LINUX_TIME_H, an innocent little hack) or by fixing it
- * upstream, which I'll consider doing later on. If you get compiler
- * errors here, check your linux/time.h && sys/time.h header setup.
- */
-#include <sys/types.h>
-#define _LINUX_TIME_H
-#include <linux/videodev.h>
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4LELEMENT \
-  (gst_v4lelement_get_type())
-#define GST_V4LELEMENT(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LELEMENT,GstV4lElement))
-#define GST_V4LELEMENT_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LELEMENT,GstV4lElementClass))
-#define GST_IS_V4LELEMENT(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LELEMENT))
-#define GST_IS_V4LELEMENT_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LELEMENT))
-#define GST_V4LELEMENT_GET_CLASS(klass) \
-  (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_V4LELEMENT, GstV4lElementClass))
-
-typedef struct _GstV4lElement GstV4lElement;
-typedef struct _GstV4lElementClass GstV4lElementClass;
-typedef struct _GstV4lXv GstV4lXv;
-
-struct _GstV4lElement {
-  GstPushSrc element;
-
-  /* the video device */
-  char *videodev;
-
-  /* the video-device's file descriptor */
-  gint video_fd;
-
-  /* the video buffer (mmap()'ed) */
-  guint8 *buffer;
-
-  /* the video device's capabilities */
-  struct video_capability vcap;
-
-  /* the video device's window properties */
-  struct video_window vwin;
-
-  /* some more info about the current input's capabilities */
-  struct video_channel vchan;
-
-  /* lists... */
-  GList *colors;
-  GList *norms;
-  GList *channels;
-
-  /* X-overlay */
-  GstV4lXv *xv;
-  gulong xwindow_id;
-};
-
-struct _GstV4lElementClass {
-  GstPushSrcClass parent_class;
-
-  /* probed devices */
-  GList *devices;
-
-  /* actions */
-  gboolean (*get_attribute)   (GstElement  *element,
-                               const gchar *attr_name,
-                               int         *value);
-  gboolean (*set_attribute)   (GstElement  *element,
-                               const gchar *attr_name,
-                               const int    value);
-};
-
-GType gst_v4lelement_get_type(void);
-
-
-G_END_DECLS
-
-#endif /* __GST_V4LELEMENT_H__ */
diff --git a/sys/v4l/gstv4ljpegsrc.c b/sys/v4l/gstv4ljpegsrc.c
deleted file mode 100644 (file)
index 724a66f..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/* GStreamer
- *
- * gstv4ljpegsrc.c: V4L source element for JPEG cameras
- *
- * Copyright (C) 2004-2005 Jan Schmidt <thaytan@mad.scientist.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- e Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <sys/time.h>
-#include "gstv4ljpegsrc.h"
-#include "v4lsrc_calls.h"
-
-GST_DEBUG_CATEGORY_STATIC (v4ljpegsrc_debug);
-#define GST_CAT_DEFAULT v4ljpegsrc_debug
-
-/* init functions */
-static void gst_v4ljpegsrc_base_init (gpointer g_class);
-static void gst_v4ljpegsrc_class_init (GstV4lJpegSrcClass * klass);
-static void gst_v4ljpegsrc_init (GstV4lJpegSrc * v4ljpegsrc);
-
-/* buffer functions */
-static GstPadLinkReturn gst_v4ljpegsrc_src_link (GstPad * pad,
-    const GstCaps * caps);
-static GstCaps *gst_v4ljpegsrc_getcaps (GstPad * pad);
-static GstData *gst_v4ljpegsrc_get (GstPad * pad);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_v4ljpegsrc_get_type (void)
-{
-  static GType v4ljpegsrc_type = 0;
-
-  if (!v4ljpegsrc_type) {
-    static const GTypeInfo v4ljpegsrc_info = {
-      sizeof (GstV4lJpegSrcClass),
-      gst_v4ljpegsrc_base_init,
-      NULL,
-      (GClassInitFunc) gst_v4ljpegsrc_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lJpegSrc),
-      0,
-      (GInstanceInitFunc) gst_v4ljpegsrc_init,
-      NULL
-    };
-
-    v4ljpegsrc_type =
-        g_type_register_static (GST_TYPE_V4LSRC, "GstV4lJpegSrc",
-        &v4ljpegsrc_info, 0);
-    GST_DEBUG_CATEGORY_INIT (v4ljpegsrc_debug, "v4ljpegsrc", 0,
-        "V4L JPEG source element");
-  }
-  return v4ljpegsrc_type;
-}
-
-static void
-gst_v4ljpegsrc_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (gstelement_class,
-      "Video (video4linux/raw) Jpeg Source", "Source/Video",
-      "Reads jpeg frames from a video4linux (eg ov519) device",
-      "Jan Schmidt <thaytan@mad.scientist.com>");
-}
-
-static void
-gst_v4ljpegsrc_class_init (GstV4lJpegSrcClass * klass)
-{
-  parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4ljpegsrc_init (GstV4lJpegSrc * v4ljpegsrc)
-{
-  GstV4lSrc *v4lsrc = GST_V4LSRC (v4ljpegsrc);
-  GstPad *pad = v4lsrc->srcpad;
-
-  /*
-   * Stash away and then replace the getcaps and get functions on the src pad
-   */
-  v4ljpegsrc->getfn = GST_RPAD_GETFUNC (pad);
-  v4ljpegsrc->getcapsfn = GST_RPAD_GETCAPSFUNC (pad);
-
-  gst_pad_set_get_function (v4lsrc->srcpad, gst_v4ljpegsrc_get);
-  gst_pad_set_getcaps_function (v4lsrc->srcpad, gst_v4ljpegsrc_getcaps);
-  gst_pad_set_link_function (v4lsrc->srcpad, gst_v4ljpegsrc_src_link);
-}
-
-static GstPadLinkReturn
-gst_v4ljpegsrc_src_link (GstPad * pad, const GstCaps * vscapslist)
-{
-  GstV4lJpegSrc *v4ljpegsrc;
-  GstV4lSrc *v4lsrc;
-  gint w, h, palette = -1;
-  const GValue *fps;
-  GstStructure *structure;
-  gboolean was_capturing;
-  struct video_window *vwin;
-
-  v4ljpegsrc = GST_V4LJPEGSRC (gst_pad_get_parent (pad));
-  v4lsrc = GST_V4LSRC (v4ljpegsrc);
-  vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-  was_capturing = v4lsrc->is_capturing;
-
-  /* in case the buffers are active (which means that we already
-   * did capsnego before and didn't clean up), clean up anyways */
-  if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc))) {
-    if (was_capturing) {
-      if (!gst_v4lsrc_capture_stop (v4lsrc))
-        return GST_PAD_LINK_REFUSED;
-    }
-    if (!gst_v4lsrc_capture_deinit (v4lsrc))
-      return GST_PAD_LINK_REFUSED;
-  } else if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
-    return GST_PAD_LINK_DELAYED;
-  }
-
-  structure = gst_caps_get_structure (vscapslist, 0);
-
-  gst_structure_get_int (structure, "width", &w);
-  gst_structure_get_int (structure, "height", &h);
-  fps = gst_structure_get_value (structure, "framerate");
-
-  GST_DEBUG_OBJECT (v4ljpegsrc, "linking with %dx%d at %d/%d fps", w, h,
-      gst_value_get_fraction_numerator (fps),
-      gst_value_get_fraction_denominator (fps));
-
-  /* set framerate if it's not already correct */
-  if (fps != gst_v4lsrc_get_fps (v4lsrc)) {
-    int fps_index = fps / 15.0 * 16;
-
-    GST_DEBUG_OBJECT (v4ljpegsrc, "Trying to set fps index %d", fps_index);
-    /* set bits 16 to 21 to 0 */
-    vwin->flags &= (0x3F00 - 1);
-    /* set bits 16 to 21 to the index */
-    vwin->flags |= fps_index << 16;
-    if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
-      return GST_PAD_LINK_DELAYED;
-    }
-  }
-
-  /*
-   * Try to set the camera to capture RGB24 
-   */
-  palette = VIDEO_PALETTE_RGB24;
-  v4lsrc->buffer_size = w * h * 3;
-
-  GST_DEBUG_OBJECT (v4ljpegsrc, "trying to set_capture %dx%d, palette %d",
-      w, h, palette);
-  /* this only fills in v4lsrc->mmap values */
-  if (!gst_v4lsrc_set_capture (v4lsrc, w, h, palette)) {
-    GST_WARNING_OBJECT (v4ljpegsrc, "could not set_capture %dx%d, palette %d",
-        w, h, palette);
-    return GST_PAD_LINK_REFUSED;
-  }
-
-  /* first try the negotiated settings using try_capture */
-  if (!gst_v4lsrc_try_capture (v4lsrc, w, h, palette)) {
-    GST_DEBUG_OBJECT (v4ljpegsrc, "failed trying palette %d for %dx%d", palette,
-        w, h);
-    return GST_PAD_LINK_REFUSED;
-  }
-
-  if (!gst_v4lsrc_capture_init (v4lsrc))
-    return GST_PAD_LINK_REFUSED;
-
-  if (was_capturing || GST_STATE (v4lsrc) == GST_STATE_PLAYING) {
-    if (!gst_v4lsrc_capture_start (v4lsrc))
-      return GST_PAD_LINK_REFUSED;
-  }
-
-  return GST_PAD_LINK_OK;
-}
-
-static GstCaps *
-gst_v4ljpegsrc_getcaps (GstPad * pad)
-{
-  GstCaps *list;
-  GstV4lJpegSrc *v4ljpegsrc = GST_V4LJPEGSRC (gst_pad_get_parent (pad));
-  GstV4lSrc *v4lsrc = GST_V4LSRC (v4ljpegsrc);
-  struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
-  gfloat fps = 0.0;
-
-  if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
-    return gst_caps_new_any ();
-  }
-  if (!v4lsrc->autoprobe) {
-    /* FIXME: query current caps and return those, with _any appended */
-    return gst_caps_new_any ();
-  }
-
-  list = gst_caps_new_simple ("image/jpeg", NULL);
-  GST_DEBUG_OBJECT (v4ljpegsrc,
-      "Device reports w: %d-%d, h: %d-%d, fps: %f",
-      vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight, fps);
-
-  if (vcap->minwidth < vcap->maxwidth) {
-    gst_caps_set_simple (list, "width", GST_TYPE_INT_RANGE, vcap->minwidth,
-        vcap->maxwidth, NULL);
-  } else {
-    gst_caps_set_simple (list, "width", G_TYPE_INT, vcap->minwidth, NULL);
-  }
-  if (vcap->minheight < vcap->maxheight) {
-    gst_caps_set_simple (list, "height", GST_TYPE_INT_RANGE, vcap->minheight,
-        vcap->maxheight, NULL);
-  } else {
-    gst_caps_set_simple (list, "height", G_TYPE_INT, vcap->minheight, NULL);
-  }
-
-  if (v4lsrc->fps_list) {
-    GstStructure *structure = gst_caps_get_structure (list, 0);
-
-    gst_structure_set_value (structure, "framerate", v4lsrc->fps_list);
-  }
-  GST_DEBUG_OBJECT (v4ljpegsrc, "caps: %" GST_PTR_FORMAT, list);
-
-  return list;
-}
-
-static GstData *
-gst_v4ljpegsrc_get (GstPad * pad)
-{
-  GstV4lJpegSrc *v4ljpegsrc;
-  GstV4lSrc *v4lsrc;
-  GstData *data;
-  GstBuffer *buf;
-  GstBuffer *outbuf;
-  int jpeg_size;
-
-  g_return_val_if_fail (pad != NULL, NULL);
-  v4ljpegsrc = GST_V4LJPEGSRC (gst_pad_get_parent (pad));
-  v4lsrc = GST_V4LSRC (v4ljpegsrc);
-
-  /* Fetch from the v4lsrc class get fn.  */
-  data = v4ljpegsrc->getfn (pad);
-
-  /* If not a buffer, return it unchanged */
-  if (!data || (!GST_IS_BUFFER (data)))
-    return data;
-
-  buf = GST_BUFFER (data);
-
-  /* Confirm that the buffer contains jpeg data */
-
-  /* 
-   * Create a new subbuffer from the jpeg data 
-   * The first 2 bytes in the buffer are the size of the jpeg data
-   */
-  if (GST_BUFFER_SIZE (buf) > 2) {
-    jpeg_size = (int) (GST_READ_UINT16_LE (GST_BUFFER_DATA (buf))) * 8;
-  } else
-    jpeg_size = 0;
-
-  /* Check that the size is sensible */
-  if ((jpeg_size <= 0) || (jpeg_size > GST_BUFFER_SIZE (buf) - 2)) {
-    GST_ELEMENT_ERROR (v4ljpegsrc, STREAM, FORMAT, (NULL),
-        ("Invalid non-jpeg frame from camera"));
-    return NULL;
-  }
-
-  GST_DEBUG_OBJECT (v4ljpegsrc, "Creating JPEG subbuffer of size %d",
-      jpeg_size);
-  outbuf = gst_buffer_create_sub (buf, 2, jpeg_size);
-
-  /* Copy timestamps onto the subbuffer */
-  gst_buffer_stamp (outbuf, buf);
-
-  /* Release the main buffer */
-  gst_buffer_unref (buf);
-
-  return GST_DATA (outbuf);
-}
diff --git a/sys/v4l/gstv4ljpegsrc.h b/sys/v4l/gstv4ljpegsrc.h
deleted file mode 100644 (file)
index 1d4eab0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* GStreamer
- *
- * gstv4ljpegsrc.h: V4L video source element for JPEG cameras
- *
- * Copyright (C) 2001-2005 Jan Schmidt <thaytan@mad.scientist.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LJPEGSRC_H__
-#define __GST_V4LJPEGSRC_H__
-
-#include <gstv4lsrc.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_V4LJPEGSRC \
-  (gst_v4ljpegsrc_get_type())
-#define GST_V4LJPEGSRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LJPEGSRC,GstV4lJpegSrc))
-#define GST_V4LJPEGSRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LJPEGSRC,GstV4lJpegSrcClass))
-#define GST_IS_V4LJPEGSRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LJPEGSRC))
-#define GST_IS_V4LJPEGSRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LJPEGSRC))
-typedef struct _GstV4lJpegSrc GstV4lJpegSrc;
-typedef struct _GstV4lJpegSrcClass GstV4lJpegSrcClass;
-
-struct _GstV4lJpegSrc
-{
-  GstV4lSrc             v4lsrc;
-  GstPadGetFunction     getfn;
-  GstPadGetCapsFunction getcapsfn;
-};
-
-struct _GstV4lJpegSrcClass
-{
-  GstV4lSrcClass parent_class;
-};
-
-GType gst_v4ljpegsrc_get_type (void);
-
-G_END_DECLS
-#endif /* __GST_V4LJPEGSRC_H__ */
diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c
deleted file mode 100644 (file)
index 3a5cfaa..0000000
+++ /dev/null
@@ -1,431 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsink.c: hardware MJPEG video sink plugin
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include "v4lmjpegsink_calls.h"
-
-GST_DEBUG_CATEGORY_STATIC (v4lmjpegsink_debug);
-#define GST_CAT_DEFAULT v4lmjpegsink_debug
-
-/* v4lmjpegsink signals and args */
-enum
-{
-  SIGNAL_FRAME_DISPLAYED,
-  LAST_SIGNAL
-};
-
-enum
-{
-  ARG_0,
-  ARG_NUMBUFS,
-  ARG_BUFSIZE,
-  ARG_X_OFFSET,
-  ARG_Y_OFFSET,
-  ARG_FRAMES_DISPLAYED,
-  ARG_FRAME_TIME
-};
-
-
-/* init functions */
-static void gst_v4lmjpegsink_base_init (gpointer g_class);
-static void gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass * klass);
-static void gst_v4lmjpegsink_init (GstV4lMjpegSink * v4lmjpegsink);
-
-/* the chain of buffers */
-static GstPadLinkReturn gst_v4lmjpegsink_sinkconnect (GstPad * pad,
-    const GstCaps * vscapslist);
-static void gst_v4lmjpegsink_chain (GstPad * pad, GstData * _data);
-
-/* get/set gst object functions */
-static void gst_v4lmjpegsink_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lmjpegsink_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn gst_v4lmjpegsink_change_state (GstElement *
-    element);
-static void gst_v4lmjpegsink_set_clock (GstElement * element, GstClock * clock);
-
-
-static GstElementClass *parent_class = NULL;
-static guint gst_v4lmjpegsink_signals[LAST_SIGNAL] = { 0 };
-
-
-GType
-gst_v4lmjpegsink_get_type (void)
-{
-  static GType v4lmjpegsink_type = 0;
-
-  if (!v4lmjpegsink_type) {
-    static const GTypeInfo v4lmjpegsink_info = {
-      sizeof (GstV4lMjpegSinkClass),
-      gst_v4lmjpegsink_base_init,
-      NULL,
-      (GClassInitFunc) gst_v4lmjpegsink_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lMjpegSink),
-      0,
-      (GInstanceInitFunc) gst_v4lmjpegsink_init,
-    };
-
-    v4lmjpegsink_type =
-        g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSink",
-        &v4lmjpegsink_info, 0);
-  }
-  return v4lmjpegsink_type;
-}
-
-static void
-gst_v4lmjpegsink_base_init (gpointer g_class)
-{
-  static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
-      GST_PAD_SINK,
-      GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("image/jpeg, "
-          "width = (int) [ 1, MAX ], "
-          "height = (int) [ 1, MAX ], " "framerate = (fraction) [ 0, MAX ]")
-      );
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (gstelement_class,
-      "Video (video4linux/MJPEG) sink", "Sink/Video",
-      "Writes MJPEG-encoded frames to a zoran MJPEG/video4linux device",
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&sink_template));
-}
-
-static void
-gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUMBUFS,
-      g_param_spec_int ("num-buffers", "num-buffers", "num-buffers",
-          G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
-      g_param_spec_int ("buffer-size", "buffer-size", "buffer-size",
-          G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X_OFFSET,
-      g_param_spec_int ("x-offset", "x-offset", "x-offset",
-          G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y_OFFSET,
-      g_param_spec_int ("y-offset", "y-offset", "y-offset",
-          G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED,
-      g_param_spec_int ("frames-displayed", "frames-displayed",
-          "frames-displayed", G_MININT, G_MAXINT, 0,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME,
-      g_param_spec_int ("frame-time", "frame-time", "frame-time", G_MININT,
-          G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  GST_DEBUG_CATEGORY_INIT (v4lmjpegsink_debug, "v4lmjpegsink", 0,
-      "V4L MJPEG sink element");
-  gobject_class->set_property = gst_v4lmjpegsink_set_property;
-  gobject_class->get_property = gst_v4lmjpegsink_get_property;
-
-  gst_v4lmjpegsink_signals[SIGNAL_FRAME_DISPLAYED] =
-      g_signal_new ("frame-displayed", G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSinkClass,
-          frame_displayed), NULL, NULL, g_cclosure_marshal_VOID__VOID,
-      G_TYPE_NONE, 0);
-
-  gstelement_class->change_state = gst_v4lmjpegsink_change_state;
-  gstelement_class->set_clock = gst_v4lmjpegsink_set_clock;
-}
-
-
-static void
-gst_v4lmjpegsink_init (GstV4lMjpegSink * v4lmjpegsink)
-{
-  GstElementClass *klass = GST_ELEMENT_GET_CLASS (v4lmjpegsink);
-
-  v4lmjpegsink->sinkpad =
-      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
-          "sink"), "sink");
-  gst_element_add_pad (GST_ELEMENT (v4lmjpegsink), v4lmjpegsink->sinkpad);
-
-  gst_pad_set_chain_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_chain);
-  gst_pad_set_link_function (v4lmjpegsink->sinkpad,
-      gst_v4lmjpegsink_sinkconnect);
-
-  v4lmjpegsink->clock = NULL;
-
-  v4lmjpegsink->width = -1;
-  v4lmjpegsink->height = -1;
-
-  v4lmjpegsink->x_offset = -1;
-  v4lmjpegsink->y_offset = -1;
-
-  v4lmjpegsink->numbufs = 64;
-  v4lmjpegsink->bufsize = 256;
-
-  GST_OBJECT_FLAG_SET (v4lmjpegsink, GST_ELEMENT_THREAD_SUGGESTED);
-}
-
-
-static GstPadLinkReturn
-gst_v4lmjpegsink_sinkconnect (GstPad * pad, const GstCaps * vscapslist)
-{
-  GstV4lMjpegSink *v4lmjpegsink;
-  GstStructure *structure;
-
-  v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
-
-  /* in case the buffers are active (which means that we already
-   * did capsnego before and didn't clean up), clean up anyways */
-  if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsink)))
-    if (!gst_v4lmjpegsink_playback_deinit (v4lmjpegsink))
-      return GST_PAD_LINK_REFUSED;
-
-  structure = gst_caps_get_structure (vscapslist, 0);
-
-  gst_structure_get_int (structure, "width", &v4lmjpegsink->width);
-  gst_structure_get_int (structure, "height", &v4lmjpegsink->height);
-
-  if (!gst_v4lmjpegsink_set_playback (v4lmjpegsink, v4lmjpegsink->width, v4lmjpegsink->height, v4lmjpegsink->x_offset, v4lmjpegsink->y_offset, GST_V4LELEMENT (v4lmjpegsink)->vchan.norm, 0))   /* TODO: interlacing */
-    return GST_PAD_LINK_REFUSED;
-
-  /* set buffer info */
-  if (!gst_v4lmjpegsink_set_buffer (v4lmjpegsink,
-          v4lmjpegsink->numbufs, v4lmjpegsink->bufsize))
-    return GST_PAD_LINK_REFUSED;
-  if (!gst_v4lmjpegsink_playback_init (v4lmjpegsink))
-    return GST_PAD_LINK_REFUSED;
-
-  return GST_PAD_LINK_OK;
-
-}
-
-
-static void
-gst_v4lmjpegsink_set_clock (GstElement * element, GstClock * clock)
-{
-  GstV4lMjpegSink *v4mjpegsink = GST_V4LMJPEGSINK (element);
-
-  v4mjpegsink->clock = clock;
-}
-
-
-static void
-gst_v4lmjpegsink_chain (GstPad * pad, GstData * _data)
-{
-  GstBuffer *buf = GST_BUFFER (_data);
-  GstV4lMjpegSink *v4lmjpegsink;
-  gint num;
-
-  g_return_if_fail (pad != NULL);
-  g_return_if_fail (GST_IS_PAD (pad));
-  g_return_if_fail (buf != NULL);
-
-  v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
-
-  if (v4lmjpegsink->clock) {
-    GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT,
-        GST_BUFFER_TIMESTAMP (buf));
-
-    gst_element_wait (GST_ELEMENT (v4lmjpegsink), GST_BUFFER_TIMESTAMP (buf));
-  }
-#if 0
-  if (GST_BUFFER_POOL (buf) == v4lmjpegsink->bufferpool) {
-    num = GPOINTER_TO_INT (GST_BUFFER_POOL_PRIVATE (buf));
-    gst_v4lmjpegsink_play_frame (v4lmjpegsink, num);
-  } else {
-#endif
-    /* check size */
-    if (GST_BUFFER_SIZE (buf) > v4lmjpegsink->breq.size) {
-      GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, WRITE, (NULL),
-          ("Buffer too big (%d KB), max. buffersize is %ld KB",
-              GST_BUFFER_SIZE (buf) / 1024, v4lmjpegsink->breq.size / 1024));
-      return;
-    }
-
-    /* put JPEG data to the device */
-    gst_v4lmjpegsink_wait_frame (v4lmjpegsink, &num);
-    memcpy (gst_v4lmjpegsink_get_buffer (v4lmjpegsink, num),
-        GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-    gst_v4lmjpegsink_play_frame (v4lmjpegsink, num);
-#if 0
-  }
-#endif
-
-  g_signal_emit (G_OBJECT (v4lmjpegsink),
-      gst_v4lmjpegsink_signals[SIGNAL_FRAME_DISPLAYED], 0);
-
-  gst_buffer_unref (buf);
-}
-
-
-#if 0
-static GstBuffer *
-gst_v4lmjpegsink_buffer_new (GstBufferPool * pool,
-    guint64 offset, guint size, gpointer user_data)
-{
-  GstV4lMjpegSink *v4lmjpegsink = GST_V4LMJPEGSINK (user_data);
-  GstBuffer *buffer = NULL;
-  guint8 *data;
-  gint num;
-
-  if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsink)))
-    return NULL;
-  if (v4lmjpegsink->breq.size < size) {
-    GST_DEBUG ("Requested buffer size is too large (%d > %ld)",
-        size, v4lmjpegsink->breq.size);
-    return NULL;
-  }
-  if (!gst_v4lmjpegsink_wait_frame (v4lmjpegsink, &num))
-    return NULL;
-  data = gst_v4lmjpegsink_get_buffer (v4lmjpegsink, num);
-  if (!data)
-    return NULL;
-  buffer = gst_buffer_new ();
-  GST_BUFFER_DATA (buffer) = data;
-  GST_BUFFER_MAXSIZE (buffer) = v4lmjpegsink->breq.size;
-  GST_BUFFER_SIZE (buffer) = size;
-  GST_BUFFER_POOL (buffer) = pool;
-  GST_BUFFER_POOL_PRIVATE (buffer) = GINT_TO_POINTER (num);
-
-  /* with this flag set, we don't need our own buffer_free() function */
-  GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_DONTFREE);
-
-  return buffer;
-}
-#endif
-
-
-static void
-gst_v4lmjpegsink_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec)
-{
-  GstV4lMjpegSink *v4lmjpegsink;
-
-  g_return_if_fail (GST_IS_V4LMJPEGSINK (object));
-
-  v4lmjpegsink = GST_V4LMJPEGSINK (object);
-
-  switch (prop_id) {
-    case ARG_NUMBUFS:
-      v4lmjpegsink->numbufs = g_value_get_int (value);
-      break;
-    case ARG_BUFSIZE:
-      v4lmjpegsink->bufsize = g_value_get_int (value);
-      break;
-    case ARG_X_OFFSET:
-      v4lmjpegsink->x_offset = g_value_get_int (value);
-      break;
-    case ARG_Y_OFFSET:
-      v4lmjpegsink->y_offset = g_value_get_int (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-
-static void
-gst_v4lmjpegsink_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec)
-{
-  GstV4lMjpegSink *v4lmjpegsink;
-
-  v4lmjpegsink = GST_V4LMJPEGSINK (object);
-
-  switch (prop_id) {
-    case ARG_FRAMES_DISPLAYED:
-      g_value_set_int (value, v4lmjpegsink->frames_displayed);
-      break;
-    case ARG_FRAME_TIME:
-      g_value_set_int (value, v4lmjpegsink->frame_time / 1000000);
-      break;
-    case ARG_NUMBUFS:
-      g_value_set_int (value, v4lmjpegsink->numbufs);
-      break;
-    case ARG_BUFSIZE:
-      g_value_set_int (value, v4lmjpegsink->bufsize);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-
-static GstStateChangeReturn
-gst_v4lmjpegsink_change_state (GstElement * element, GstStateChange transition)
-{
-  GstV4lMjpegSink *v4lmjpegsink;
-  GstStateChangeReturn parent_value;
-
-  g_return_val_if_fail (GST_IS_V4LMJPEGSINK (element),
-      GST_STATE_CHANGE_FAILURE);
-  v4lmjpegsink = GST_V4LMJPEGSINK (element);
-
-  /* set up change state */
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      /* we used to do buffer setup here, but that's now done
-       * right after capsnego */
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      /* start */
-      if (!gst_v4lmjpegsink_playback_start (v4lmjpegsink))
-        return GST_STATE_CHANGE_FAILURE;
-      break;
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      /* de-queue all queued buffers */
-      if (!gst_v4lmjpegsink_playback_stop (v4lmjpegsink))
-        return GST_STATE_CHANGE_FAILURE;
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      /* stop playback, unmap all buffers */
-      if (!gst_v4lmjpegsink_playback_deinit (v4lmjpegsink))
-        return GST_STATE_CHANGE_FAILURE;
-      break;
-  }
-
-  if (GST_ELEMENT_CLASS (parent_class)->change_state) {
-    parent_value =
-        GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-  } else {
-    parent_value = GST_STATE_CHANGE_FAILURE;
-  }
-
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return parent_value;
-
-  return GST_STATE_CHANGE_SUCCESS;
-}
diff --git a/sys/v4l/gstv4lmjpegsink.h b/sys/v4l/gstv4lmjpegsink.h
deleted file mode 100644 (file)
index e778f53..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsink.h: hardware MJPEG video sink element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LMJPEGSINK_H__
-#define __GST_V4LMJPEGSINK_H__
-
-#include <gstv4lelement.h>
-#include <sys/time.h>
-#include <videodev_mjpeg.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_V4LMJPEGSINK \
-  (gst_v4lmjpegsink_get_type())
-#define GST_V4LMJPEGSINK(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LMJPEGSINK,GstV4lMjpegSink))
-#define GST_V4LMJPEGSINK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LMJPEGSINK,GstV4lMjpegSinkClass))
-#define GST_IS_V4LMJPEGSINK(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LMJPEGSINK))
-#define GST_IS_V4LMJPEGSINK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LMJPEGSINK))
-
-typedef struct _GstV4lMjpegSink GstV4lMjpegSink;
-typedef struct _GstV4lMjpegSinkClass GstV4lMjpegSinkClass;
-
-struct _GstV4lMjpegSink {
-  GstV4lElement v4lelement;
-
-  /* the sink pas */
-  GstPad *sinkpad;
-
-  /* frame properties for common players */
-  gint frames_displayed;
-  guint64 frame_time;
-
-  /* system clock object */
-  GstClock *clock;
-
-  /* buffer/capture info */
-  struct mjpeg_sync bsync;
-  struct mjpeg_requestbuffers breq;
-
-  /* thread to keep track of synced frames */
-  gint8 *isqueued_queued_frames; /* 1 = queued, 0 = unqueued, -1 = error */
-  GThread *thread_queued_frames;
-  GMutex *mutex_queued_frames;
-  GCond **cond_queued_frames;
-  gint current_frame;
-
-  /* width/height/norm of the jpeg stream */
-  gint width;
-  gint height;
-  gint norm;
-
-  /* cache values */
-  gint x_offset;
-  gint y_offset;
-
-  gint numbufs;
-  gint bufsize; /* in KB */
-};
-
-struct _GstV4lMjpegSinkClass {
-  GstV4lElementClass parent_class;
-
-  /* signals */
-  void (*frame_displayed) (GstElement *element);
-};
-
-GType gst_v4lmjpegsink_get_type(void);
-
-
-G_END_DECLS
-
-#endif /* __GST_SDLVIDEOSINK_H__ */
diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c
deleted file mode 100644 (file)
index 61860a1..0000000
+++ /dev/null
@@ -1,868 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsrc.c: hardware MJPEG video source plugin
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include "v4lmjpegsrc_calls.h"
-
-GST_DEBUG_CATEGORY (v4lmjpegsrc_debug);
-#define GST_CAT_DEFAULT v4lmjpegsrc_debug
-
-/* V4lMjpegSrc signals and args */
-enum
-{
-  SIGNAL_FRAME_CAPTURE,
-  SIGNAL_FRAME_DROP,
-  SIGNAL_FRAME_INSERT,
-  SIGNAL_FRAME_LOST,
-  LAST_SIGNAL
-};
-
-/* arguments */
-enum
-{
-  ARG_0,
-#if 0
-  ARG_X_OFFSET,
-  ARG_Y_OFFSET,
-  ARG_F_WIDTH,
-  ARG_F_HEIGHT,
-  /* normally, we would want to use subframe capture, however,
-   * for the time being it's easier if we disable it first */
-#endif
-  ARG_QUALITY,
-  ARG_NUMBUFS,
-  ARG_BUFSIZE,
-  ARG_USE_FIXED_FPS
-};
-
-GST_FORMATS_FUNCTION (GstPad *, gst_v4lmjpegsrc_get_formats,
-    GST_FORMAT_TIME, GST_FORMAT_DEFAULT);
-GST_QUERY_TYPE_FUNCTION (GstPad *, gst_v4lmjpegsrc_get_query_types,
-    GST_QUERY_POSITION);
-
-/* init functions */
-static void gst_v4lmjpegsrc_base_init (gpointer g_class);
-static void gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass * klass);
-static void gst_v4lmjpegsrc_init (GstV4lMjpegSrc * v4lmjpegsrc);
-
-/* pad/info functions */
-static gboolean gst_v4lmjpegsrc_src_convert (GstPad * pad,
-    GstFormat src_format,
-    gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
-static gboolean gst_v4lmjpegsrc_src_query (GstPad * pad,
-    GstQueryType type, GstFormat * format, gint64 * value);
-
-/* buffer functions */
-static GstPadLinkReturn gst_v4lmjpegsrc_srcconnect (GstPad * pad,
-    const GstCaps * caps);
-static GstData *gst_v4lmjpegsrc_get (GstPad * pad);
-static GstCaps *gst_v4lmjpegsrc_getcaps (GstPad * pad);
-
-/* get/set params */
-static void gst_v4lmjpegsrc_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lmjpegsrc_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-/* set_clock function for A/V sync */
-static void gst_v4lmjpegsrc_set_clock (GstElement * element, GstClock * clock);
-
-/* state handling */
-static GstStateChangeReturn gst_v4lmjpegsrc_change_state (GstElement * element);
-
-/* requeue buffer after use */
-static void gst_v4lmjpegsrc_buffer_free (GstBuffer * buffer);
-
-static GstElementClass *parent_class = NULL;
-static guint gst_v4lmjpegsrc_signals[LAST_SIGNAL] = { 0 };
-
-
-GType
-gst_v4lmjpegsrc_get_type (void)
-{
-  static GType v4lmjpegsrc_type = 0;
-
-  if (!v4lmjpegsrc_type) {
-    static const GTypeInfo v4lmjpegsrc_info = {
-      sizeof (GstV4lMjpegSrcClass),
-      gst_v4lmjpegsrc_base_init,
-      NULL,
-      (GClassInitFunc) gst_v4lmjpegsrc_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lMjpegSrc),
-      0,
-      (GInstanceInitFunc) gst_v4lmjpegsrc_init,
-      NULL
-    };
-
-    v4lmjpegsrc_type =
-        g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSrc",
-        &v4lmjpegsrc_info, 0);
-  }
-  return v4lmjpegsrc_type;
-}
-
-
-static void
-gst_v4lmjpegsrc_base_init (gpointer g_class)
-{
-  static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
-      GST_PAD_SRC,
-      GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("image/jpeg, "
-          "width = (int) [ 0, MAX ], "
-          "height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0, MAX ]")
-      );
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_sinmple (gstelement_class,
-      "Video (video4linux/MJPEG) Source", "Source/Video",
-      "Reads MJPEG-encoded frames from a zoran MJPEG/video4linux device",
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&src_template));
-}
-
-static void
-gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  parent_class = g_type_class_peek_parent (klass);
-
-#if 0
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X_OFFSET,
-      g_param_spec_int ("x-offset", "x_offset", "x_offset",
-          G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y_OFFSET,
-      g_param_spec_int ("y-offset", "y_offset", "y_offset",
-          G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_F_WIDTH,
-      g_param_spec_int ("frame-width", "frame_width", "frame_width",
-          G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_F_HEIGHT,
-      g_param_spec_int ("frame-height", "frame_height", "frame_height",
-          G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-#endif
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
-      g_param_spec_int ("quality", "Quality", "JPEG frame quality",
-          1, 100, 50, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUMBUFS,
-      g_param_spec_int ("num-buffers", "Num Buffers", "Number of Buffers",
-          1, 256, 64, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
-      g_param_spec_int ("buffer-size", "Buffer Size", "Size of buffers",
-          0, 512 * 1024, 128 * 1024,
-          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_USE_FIXED_FPS,
-      g_param_spec_boolean ("use-fixed-fps", "Use Fixed FPS",
-          "Drop/Insert frames to reach a certain FPS (TRUE) "
-          "or adapt FPS to suit the number of grabbed frames",
-          TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  /* signals */
-  gst_v4lmjpegsrc_signals[SIGNAL_FRAME_CAPTURE] =
-      g_signal_new ("frame-capture", G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_capture),
-      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-  gst_v4lmjpegsrc_signals[SIGNAL_FRAME_DROP] =
-      g_signal_new ("frame-drop", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
-      G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_drop), NULL, NULL,
-      g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-  gst_v4lmjpegsrc_signals[SIGNAL_FRAME_INSERT] =
-      g_signal_new ("frame-insert", G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_insert),
-      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-  gst_v4lmjpegsrc_signals[SIGNAL_FRAME_LOST] =
-      g_signal_new ("frame-lost", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
-      G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_lost), NULL, NULL,
-      g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
-  GST_DEBUG_CATEGORY_INIT (v4lmjpegsrc_debug, "v4lmjpegsrc", 0,
-      "V4L MJPEG source element");
-  gobject_class->set_property = gst_v4lmjpegsrc_set_property;
-  gobject_class->get_property = gst_v4lmjpegsrc_get_property;
-
-  gstelement_class->change_state = gst_v4lmjpegsrc_change_state;
-
-  gstelement_class->set_clock = gst_v4lmjpegsrc_set_clock;
-}
-
-
-static void
-gst_v4lmjpegsrc_init (GstV4lMjpegSrc * v4lmjpegsrc)
-{
-  GstElementClass *klass = GST_ELEMENT_GET_CLASS (v4lmjpegsrc);
-
-  GST_OBJECT_FLAG_SET (GST_ELEMENT (v4lmjpegsrc), GST_ELEMENT_THREAD_SUGGESTED);
-
-  v4lmjpegsrc->srcpad =
-      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
-          "src"), "src");
-  gst_element_add_pad (GST_ELEMENT (v4lmjpegsrc), v4lmjpegsrc->srcpad);
-
-  gst_pad_set_get_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_get);
-  gst_pad_set_getcaps_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_getcaps);
-  gst_pad_set_link_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_srcconnect);
-  gst_pad_set_convert_function (v4lmjpegsrc->srcpad,
-      gst_v4lmjpegsrc_src_convert);
-  gst_pad_set_formats_function (v4lmjpegsrc->srcpad,
-      gst_v4lmjpegsrc_get_formats);
-  gst_pad_set_query_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_src_query);
-  gst_pad_set_query_type_function (v4lmjpegsrc->srcpad,
-      gst_v4lmjpegsrc_get_query_types);
-
-#if 0
-  v4lmjpegsrc->frame_width = 0;
-  v4lmjpegsrc->frame_height = 0;
-  v4lmjpegsrc->x_offset = -1;
-  v4lmjpegsrc->y_offset = -1;
-#endif
-
-  v4lmjpegsrc->quality = 50;
-
-  v4lmjpegsrc->numbufs = 64;
-
-  /* no clock */
-  v4lmjpegsrc->clock = NULL;
-
-  /* fps */
-  v4lmjpegsrc->use_fixed_fps = TRUE;
-
-  v4lmjpegsrc->is_capturing = FALSE;
-}
-
-
-static gboolean
-gst_v4lmjpegsrc_get_fps (GstV4lMjpegSrc * v4lmjpegsrc, GValue * fps)
-{
-  gint norm;
-
-  g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (fps), FALSE);
-
-  if (!v4lmjpegsrc->use_fixed_fps &&
-      v4lmjpegsrc->clock != NULL && v4lmjpegsrc->handled > 0) {
-    /* try to get time from clock master and calculate fps */
-    GstClockTime time =
-        gst_clock_get_time (v4lmjpegsrc->clock) - v4lmjpegsrc->substract_time;
-    return v4lmjpegsrc->handled * GST_SECOND / time;
-  }
-
-  /* if that failed ... */
-
-  if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc)))
-    return FALSE;
-
-  if (!gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lmjpegsrc), NULL, &norm))
-    return FALSE;
-
-  if (norm == VIDEO_MODE_NTSC)
-    gst_value_set_fraction (fps, 30000, 1001);
-  else
-    gst_value_set_fraction (fps, 25, 1);
-
-  return TRUE;
-}
-
-static gboolean
-gst_v4lmjpegsrc_src_convert (GstPad * pad,
-    GstFormat src_format,
-    gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc;
-  GValue fps = { 0 };
-  gboolean result = TRUE;
-
-  v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-
-  g_value_init (&fps, GST_VALUE_FRACTION);
-  if (!gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps))
-    return FALSE;
-
-  switch (src_format) {
-    case GST_FORMAT_TIME:
-      switch (*dest_format) {
-        case GST_FORMAT_DEFAULT:
-          *dest_value = gst_util_uint64_scale (src_value,
-              gst_value_get_fraction_numerator (&fps),
-              gst_value_get_fraction_denominator (&fps) * GST_SECOND);
-          break;
-        default:
-          result = FALSE;
-      }
-      break;
-
-    case GST_FORMAT_DEFAULT:
-      switch (*dest_format) {
-        case GST_FORMAT_TIME:
-          *dest_value = src_value * gst_util_uint64_scale_int (GST_SECOND,
-              gst_value_get_fraction_denominator (&fps),
-              gst_value_get_fraction_numerator (&fps));
-          break;
-        default:
-          result = FALSE;
-      }
-      break;
-
-    default:
-      result = FALSE;
-  }
-
-  g_value_unset (&fps);
-  return result;
-}
-
-static gboolean
-gst_v4lmjpegsrc_src_query (GstPad * pad,
-    GstQueryType type, GstFormat * format, gint64 * value)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-  gboolean res = TRUE;
-  GValue fps = { 0 };
-
-  g_value_init (&fps, GST_VALUE_FRACTION);
-  if (!gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps))
-    return FALSE;
-
-  switch (type) {
-    case GST_QUERY_POSITION:
-      switch (*format) {
-        case GST_FORMAT_TIME:
-          *value = v4lmjpegsrc->handled * gst_util_uint64_scale_int (GST_SECOND,
-              gst_value_get_fraction_denominator (&fps),
-              gst_value_get_fraction_numerator (&fps));
-          break;
-        case GST_FORMAT_DEFAULT:
-          *value = v4lmjpegsrc->handled;
-          break;
-        default:
-          res = FALSE;
-          break;
-      }
-      break;
-    default:
-      res = FALSE;
-      break;
-  }
-
-  g_value_unset (&fps);
-  return res;
-}
-
-static inline gulong
-calc_bufsize (int hor_dec, int ver_dec)
-{
-  guint8 div = hor_dec * ver_dec;
-  guint32 num = (1024 * 512) / (div);
-  guint32 result = 2;
-
-  num--;
-  while (num) {
-    num >>= 1;
-    result <<= 1;
-  }
-
-  if (result > (512 * 1024))
-    return (512 * 1024);
-  if (result < 8192)
-    return 8192;
-  return result;
-}
-
-static GstPadLinkReturn
-gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-  gint hor_dec, ver_dec;
-  gint w, h;
-  gint max_w = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth,
-      max_h = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxheight;
-  gulong bufsize;
-  GstStructure *structure;
-  gboolean was_capturing;
-
-  /* in case the buffers are active (which means that we already
-   * did capsnego before and didn't clean up), clean up anyways */
-  if ((was_capturing = v4lmjpegsrc->is_capturing)) {
-    if (!gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
-      return GST_PAD_LINK_REFUSED;
-  }
-  if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) {
-    if (!gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
-      return GST_PAD_LINK_REFUSED;
-  } else if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc))) {
-    return GST_PAD_LINK_DELAYED;
-  }
-
-  /* Note: basically, we don't give a damn about the opposite caps here.
-   * that might seem odd, but it isn't. we know that the opposite caps is
-   * either NULL or has mime type image/jpeg, and in both cases, we'll set
-   * our own mime type back and it'll work. Other properties are to be set
-   * by the src, not by the opposite caps */
-
-  structure = gst_caps_get_structure (caps, 0);
-  gst_structure_get_int (structure, "width", &w);
-  gst_structure_get_int (structure, "height", &h);
-
-  /* figure out decimation */
-  if (w >= max_w) {
-    hor_dec = 1;
-  } else if (w * 2 >= max_w) {
-    hor_dec = 2;
-  } else {
-    hor_dec = 4;
-  }
-  if (h >= max_h) {
-    ver_dec = 1;
-  } else if (h * 2 >= max_h) {
-    ver_dec = 2;
-  } else {
-    ver_dec = 4;
-  }
-
-  /* calculate bufsize */
-  bufsize = calc_bufsize (hor_dec, ver_dec);
-
-  /* set buffer info */
-  if (!gst_v4lmjpegsrc_set_buffer (v4lmjpegsrc, v4lmjpegsrc->numbufs, bufsize)) {
-    return GST_PAD_LINK_REFUSED;
-  }
-
-  /* set capture parameters and mmap the buffers */
-  if (hor_dec == ver_dec) {
-    if (!gst_v4lmjpegsrc_set_capture (v4lmjpegsrc,
-            hor_dec, v4lmjpegsrc->quality)) {
-      return GST_PAD_LINK_REFUSED;
-    }
-  } else {
-    if (!gst_v4lmjpegsrc_set_capture_m (v4lmjpegsrc,
-            0, 0, max_w, max_h, hor_dec, ver_dec, v4lmjpegsrc->quality)) {
-      return GST_PAD_LINK_REFUSED;
-    }
-  }
-#if 0
-  if (!v4lmjpegsrc->frame_width && !v4lmjpegsrc->frame_height &&
-      v4lmjpegsrc->x_offset < 0 && v4lmjpegsrc->y_offset < 0 &&
-      v4lmjpegsrc->horizontal_decimation == v4lmjpegsrc->vertical_decimation) {
-    if (!gst_v4lmjpegsrc_set_capture (v4lmjpegsrc,
-            v4lmjpegsrc->horizontal_decimation, v4lmjpegsrc->quality))
-      return GST_PAD_LINK_REFUSED;
-  } else {
-    if (!gst_v4lmjpegsrc_set_capture_m (v4lmjpegsrc,
-            v4lmjpegsrc->x_offset, v4lmjpegsrc->y_offset,
-            v4lmjpegsrc->frame_width, v4lmjpegsrc->frame_height,
-            v4lmjpegsrc->horizontal_decimation,
-            v4lmjpegsrc->vertical_decimation, v4lmjpegsrc->quality))
-      return GST_PAD_LINK_REFUSED;
-  }
-#endif
-
-  if (!gst_v4lmjpegsrc_capture_init (v4lmjpegsrc))
-    return GST_PAD_LINK_REFUSED;
-
-  if (was_capturing || GST_STATE (v4lmjpegsrc) == GST_STATE_PLAYING)
-    if (!gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
-      return GST_PAD_LINK_REFUSED;
-
-  return GST_PAD_LINK_OK;
-}
-
-
-static GstData *
-gst_v4lmjpegsrc_get (GstPad * pad)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc;
-  GstBuffer *buf;
-  gint num;
-  GValue fps = { 0 };
-  GstClockTime duration;
-  GstClockTime cur_frame_time;
-
-  g_return_val_if_fail (pad != NULL, NULL);
-
-  v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-
-  if (v4lmjpegsrc->use_fixed_fps) {
-    g_value_init (&fps, GST_VALUE_FRACTION);
-    duration = gst_util_uint64_scale_int (GST_SECOND,
-        gst_value_get_fraction_denominator (&fps),
-        gst_value_get_fraction_numerator (&fps));
-    cur_frame_time =
-        gst_util_uint64_scale_int (v4lmjpegsrc->handled * GST_SECOND,
-        gst_value_get_fraction_denominator (&fps),
-        gst_value_get_fraction_numerator (&fps));
-
-
-    if (!gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps)) {
-      g_value_unset (&fps);
-      return NULL;
-    }
-  }
-
-  if (v4lmjpegsrc->need_writes > 0) {
-    /* use last frame */
-    num = v4lmjpegsrc->last_frame;
-    v4lmjpegsrc->need_writes--;
-  } else if (v4lmjpegsrc->clock && v4lmjpegsrc->use_fixed_fps) {
-    GstClockTime time;
-    gboolean have_frame = FALSE;
-
-    do {
-      /* by default, we use the frame once */
-      v4lmjpegsrc->need_writes = 1;
-
-      /* grab a frame from the device */
-      if (!gst_v4lmjpegsrc_grab_frame (v4lmjpegsrc, &num,
-              &v4lmjpegsrc->last_size))
-        return NULL;
-
-      v4lmjpegsrc->last_frame = num;
-      time = GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) -
-          v4lmjpegsrc->substract_time;
-
-      /* first check whether we lost any frames according to the device */
-      if (v4lmjpegsrc->last_seq != 0) {
-        if (v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq > 1) {
-          v4lmjpegsrc->need_writes =
-              v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq;
-          g_signal_emit (G_OBJECT (v4lmjpegsrc),
-              gst_v4lmjpegsrc_signals[SIGNAL_FRAME_LOST], 0,
-              v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq - 1);
-        }
-      }
-      v4lmjpegsrc->last_seq = v4lmjpegsrc->bsync.seq;
-
-      /* decide how often we're going to write the frame - set
-       * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE
-       * if we're going to write it - else, just continue.
-       * 
-       * time is generally the system or audio clock. Let's
-       * say that we've written one second of audio, then we want
-       * to have written one second of video too, within the same
-       * timeframe. This means that if time - begin_time = X sec,
-       * we want to have written X*fps frames. If we've written
-       * more - drop, if we've written less - dup... */
-      if (cur_frame_time - time > 1.5 * duration) {
-        /* yo dude, we've got too many frames here! Drop! DROP! */
-        v4lmjpegsrc->need_writes--;     /* -= (v4lmjpegsrc->handled - (time / fps)); */
-        g_signal_emit (G_OBJECT (v4lmjpegsrc),
-            gst_v4lmjpegsrc_signals[SIGNAL_FRAME_DROP], 0);
-      } else if (cur_frame_time - time < -1.5 * duration) {
-        /* this means we're lagging far behind */
-        v4lmjpegsrc->need_writes++;     /* += ((time / fps) - v4lmjpegsrc->handled); */
-        g_signal_emit (G_OBJECT (v4lmjpegsrc),
-            gst_v4lmjpegsrc_signals[SIGNAL_FRAME_INSERT], 0);
-      }
-
-      if (v4lmjpegsrc->need_writes > 0) {
-        have_frame = TRUE;
-        v4lmjpegsrc->use_num_times[num] = v4lmjpegsrc->need_writes;
-        v4lmjpegsrc->need_writes--;
-      } else {
-        gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, num);
-      }
-    } while (!have_frame);
-  } else {
-    /* grab a frame from the device */
-    if (!gst_v4lmjpegsrc_grab_frame (v4lmjpegsrc, &num,
-            &v4lmjpegsrc->last_size))
-      return NULL;
-
-    v4lmjpegsrc->use_num_times[num] = 1;
-  }
-
-  buf = gst_buffer_new ();
-  GST_BUFFER_FREE_DATA_FUNC (buf) = gst_v4lmjpegsrc_buffer_free;
-  GST_BUFFER_PRIVATE (buf) = v4lmjpegsrc;
-  GST_BUFFER_DATA (buf) = gst_v4lmjpegsrc_get_buffer (v4lmjpegsrc, num);
-  GST_BUFFER_SIZE (buf) = v4lmjpegsrc->last_size;
-  GST_BUFFER_MAXSIZE (buf) = v4lmjpegsrc->breq.size;
-  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
-  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
-  if (v4lmjpegsrc->use_fixed_fps)
-    GST_BUFFER_TIMESTAMP (buf) = cur_frame_time;
-  else                          /* calculate time based on our own clock */
-    GST_BUFFER_TIMESTAMP (buf) =
-        GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) -
-        v4lmjpegsrc->substract_time;
-
-  v4lmjpegsrc->handled++;
-  g_signal_emit (G_OBJECT (v4lmjpegsrc),
-      gst_v4lmjpegsrc_signals[SIGNAL_FRAME_CAPTURE], 0);
-
-  return GST_DATA (buf);
-}
-
-
-static GstCaps *
-gst_v4lmjpegsrc_getcaps (GstPad * pad)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-  struct video_capability *vcap = &GST_V4LELEMENT (v4lmjpegsrc)->vcap;
-  GstCaps *caps;
-  GstStructure *str;
-  gint i;
-  GValue w = { 0 }, h = {
-  0}, w1 = {
-  0}, h1 = {
-  0}, fps = {
-  0};
-
-  if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc))) {
-    return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
-  }
-
-  g_value_init (&fps, GST_TYPE_FRACTION);
-  gst_return_val_if_fail (gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps), NULL);
-
-  caps = gst_caps_new_simple ("image/jpeg", NULL);
-  str = gst_caps_get_structure (caps, 0);
-  gst_structure_set_value (str, "framerate", &fps);
-  g_value_unset (&fps);
-
-  g_value_init (&w, GST_TYPE_LIST);
-  g_value_init (&h, GST_TYPE_LIST);
-  g_value_init (&w1, G_TYPE_INT);
-  g_value_init (&h1, G_TYPE_INT);
-  for (i = 0; i <= 2; i++) {
-    g_value_set_int (&w1, vcap->maxwidth / (1 << i));
-    g_value_set_int (&h1, vcap->maxheight / (1 << i));
-    gst_value_list_append_value (&w, &w1);
-    gst_value_list_append_value (&h, &h1);
-  }
-  g_value_unset (&h1);
-  g_value_unset (&w1);
-  gst_structure_set_value (str, "width", &w);
-  gst_structure_set_value (str, "height", &h);
-  g_value_unset (&w);
-  g_value_unset (&h);
-
-  return caps;
-}
-
-
-static void
-gst_v4lmjpegsrc_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc;
-
-  g_return_if_fail (GST_IS_V4LMJPEGSRC (object));
-  v4lmjpegsrc = GST_V4LMJPEGSRC (object);
-
-  switch (prop_id) {
-#if 0
-    case ARG_X_OFFSET:
-      v4lmjpegsrc->x_offset = g_value_get_int (value);
-      break;
-    case ARG_Y_OFFSET:
-      v4lmjpegsrc->y_offset = g_value_get_int (value);
-      break;
-    case ARG_F_WIDTH:
-      v4lmjpegsrc->frame_width = g_value_get_int (value);
-      break;
-    case ARG_F_HEIGHT:
-      v4lmjpegsrc->frame_height = g_value_get_int (value);
-      break;
-#endif
-    case ARG_QUALITY:
-      v4lmjpegsrc->quality = g_value_get_int (value);
-      break;
-    case ARG_NUMBUFS:
-      v4lmjpegsrc->numbufs = g_value_get_int (value);
-      break;
-    case ARG_USE_FIXED_FPS:
-      if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) {
-        v4lmjpegsrc->use_fixed_fps = g_value_get_boolean (value);
-      }
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-
-static void
-gst_v4lmjpegsrc_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc;
-
-  g_return_if_fail (GST_IS_V4LMJPEGSRC (object));
-  v4lmjpegsrc = GST_V4LMJPEGSRC (object);
-
-  switch (prop_id) {
-#if 0
-    case ARG_X_OFFSET:
-      g_value_set_int (value, v4lmjpegsrc->x_offset);
-      break;
-    case ARG_Y_OFFSET:
-      g_value_set_int (value, v4lmjpegsrc->y_offset);
-      break;
-    case ARG_F_WIDTH:
-      g_value_set_int (value, v4lmjpegsrc->frame_width);
-      break;
-    case ARG_F_HEIGHT:
-      g_value_set_int (value, v4lmjpegsrc->frame_height);
-      break;
-#endif
-    case ARG_QUALITY:
-      g_value_set_int (value, v4lmjpegsrc->quality);
-      break;
-    case ARG_NUMBUFS:
-      if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc)))
-        g_value_set_int (value, v4lmjpegsrc->breq.count);
-      else
-        g_value_set_int (value, v4lmjpegsrc->numbufs);
-      break;
-    case ARG_BUFSIZE:
-      g_value_set_int (value, v4lmjpegsrc->breq.size);
-      break;
-    case ARG_USE_FIXED_FPS:
-      g_value_set_boolean (value, v4lmjpegsrc->use_fixed_fps);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-
-static GstStateChangeReturn
-gst_v4lmjpegsrc_change_state (GstElement * element, GstStateChange transition)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc;
-  GTimeVal time;
-
-  g_return_val_if_fail (GST_IS_V4LMJPEGSRC (element), GST_STATE_CHANGE_FAILURE);
-
-  v4lmjpegsrc = GST_V4LMJPEGSRC (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      /* actual buffer set-up used to be done here - but I moved
-       * it to capsnego itself */
-      v4lmjpegsrc->handled = 0;
-      v4lmjpegsrc->need_writes = 0;
-      v4lmjpegsrc->last_frame = 0;
-      v4lmjpegsrc->substract_time = 0;
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      /* queue all buffer, start streaming capture */
-      if (GST_V4LELEMENT (v4lmjpegsrc)->buffer &&
-          !gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
-        return GST_STATE_CHANGE_FAILURE;
-      g_get_current_time (&time);
-      v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) -
-          v4lmjpegsrc->substract_time;
-      v4lmjpegsrc->last_seq = 0;
-      break;
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      g_get_current_time (&time);
-      v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) -
-          v4lmjpegsrc->substract_time;
-      /* de-queue all queued buffers */
-      if (v4lmjpegsrc->is_capturing &&
-          !gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
-        return GST_STATE_CHANGE_FAILURE;
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      /* stop capturing, unmap all buffers */
-      if (GST_V4LELEMENT (v4lmjpegsrc)->buffer &&
-          !gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
-        return GST_STATE_CHANGE_FAILURE;
-      break;
-  }
-
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  return GST_STATE_CHANGE_SUCCESS;
-}
-
-
-static void
-gst_v4lmjpegsrc_set_clock (GstElement * element, GstClock * clock)
-{
-  GST_V4LMJPEGSRC (element)->clock = clock;
-}
-
-
-#if 0
-static GstBuffer *
-gst_v4lmjpegsrc_buffer_new (GstBufferPool * pool,
-    guint64 offset, guint size, gpointer user_data)
-{
-  GstBuffer *buffer;
-  GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (user_data);
-
-  if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc)))
-    return NULL;
-
-  buffer = gst_buffer_new ();
-  if (!buffer)
-    return NULL;
-
-  /* TODO: add interlacing info to buffer as metadata */
-  GST_BUFFER_MAXSIZE (buffer) = v4lmjpegsrc->breq.size;
-  GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_DONTFREE);
-
-  return buffer;
-}
-#endif
-
-static void
-gst_v4lmjpegsrc_buffer_free (GstBuffer * buf)
-{
-  GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (GST_BUFFER_PRIVATE (buf));
-  int n;
-
-  if (gst_element_get_state (GST_ELEMENT (v4lmjpegsrc)) != GST_STATE_PLAYING)
-    return;                     /* we've already cleaned up ourselves */
-
-  for (n = 0; n < v4lmjpegsrc->breq.count; n++)
-    if (GST_BUFFER_DATA (buf) == gst_v4lmjpegsrc_get_buffer (v4lmjpegsrc, n)) {
-      v4lmjpegsrc->use_num_times[n]--;
-      if (v4lmjpegsrc->use_num_times[n] <= 0) {
-        gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, n);
-      }
-      break;
-    }
-
-  if (n == v4lmjpegsrc->breq.count)
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
-        ("Couldn't find the buffer"));
-}
diff --git a/sys/v4l/gstv4lmjpegsrc.h b/sys/v4l/gstv4lmjpegsrc.h
deleted file mode 100644 (file)
index 2e76906..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsrc.h: hardware MJPEG video source element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LMJPEGSRC_H__
-#define __GST_V4LMJPEGSRC_H__
-
-#include <gstv4lelement.h>
-#include <sys/time.h>
-#include <videodev_mjpeg.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4LMJPEGSRC \
-  (gst_v4lmjpegsrc_get_type())
-#define GST_V4LMJPEGSRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LMJPEGSRC,GstV4lMjpegSrc))
-#define GST_V4LMJPEGSRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LMJPEGSRC,GstV4lMjpegSrcClass))
-#define GST_IS_V4LMJPEGSRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LMJPEGSRC))
-#define GST_IS_V4LMJPEGSRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LMJPEGSRC))
-
-typedef struct _GstV4lMjpegSrc GstV4lMjpegSrc;
-typedef struct _GstV4lMjpegSrcClass GstV4lMjpegSrcClass;
-
-struct _GstV4lMjpegSrc {
-  GstV4lElement v4lelement;
-
-  /* pads */
-  GstPad *srcpad;
-
-  /* buffer/capture info */
-  struct mjpeg_sync bsync;
-  struct mjpeg_requestbuffers breq;
-
-  /* num of queued frames and some GThread stuff
-   * to wait if there's not enough */
-  gint8 *frame_queue_state;
-  GMutex *mutex_queue_state;
-  GCond *cond_queue_state;
-  gint num_queued;
-  gint queue_frame;
-
-  /* True if we want to stop */
-  gboolean quit, is_capturing;
-
-  /* A/V sync... frame counter and internal cache */
-  gulong handled;
-  gint last_frame;
-  gint last_size;
-  gint need_writes;
-  gulong last_seq;
-
-  /* clock */
-  GstClock *clock;
-
-  /* time to substract from clock time to get back to timestamp */
-  GstClockTime substract_time;
-
-  /* how often are we going to use each frame? */
-  gint *use_num_times;
-
-  /* how are we going to push buffers? */
-  gboolean use_fixed_fps;
-
-  /* end size */
-  gint end_width, end_height;
-
-  /* caching values */
-#if 0
-  gint x_offset;
-  gint y_offset;
-  gint frame_width;
-  gint frame_height;
-#endif
-
-  gint quality;
-  gint numbufs;
-};
-
-struct _GstV4lMjpegSrcClass {
-  GstV4lElementClass parent_class;
-
-  void (*frame_capture) (GObject *object);
-  void (*frame_drop)    (GObject *object);
-  void (*frame_insert)  (GObject *object);
-  void (*frame_lost)    (GObject *object,
-                         gint     num_lost);
-};
-
-GType gst_v4lmjpegsrc_get_type(void);
-
-
-G_END_DECLS
-
-#endif /* __GST_V4LMJPEGSRC_H__ */
diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c
deleted file mode 100644 (file)
index c0b5f78..0000000
+++ /dev/null
@@ -1,727 +0,0 @@
-/* GStreamer
- *
- * gstv4lsrc.c: BT8x8/V4L source element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <sys/time.h>
-#include "v4lsrc_calls.h"
-#include <sys/ioctl.h>
-
-
-GST_DEBUG_CATEGORY_STATIC (v4lsrc_debug);
-#define GST_CAT_DEFAULT v4lsrc_debug
-
-
-enum
-{
-  PROP_0,
-  PROP_AUTOPROBE,
-  PROP_AUTOPROBE_FPS,
-  PROP_COPY_MODE,
-  PROP_TIMESTAMP_OFFSET
-};
-
-
-GST_BOILERPLATE (GstV4lSrc, gst_v4lsrc, GstV4lElement, GST_TYPE_V4LELEMENT);
-
-static GstStaticPadTemplate v4l_src_template = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("ANY")
-    );
-
-/* basesrc methods */
-static gboolean gst_v4lsrc_start (GstBaseSrc * src);
-static gboolean gst_v4lsrc_stop (GstBaseSrc * src);
-static gboolean gst_v4lsrc_set_caps (GstBaseSrc * src, GstCaps * caps);
-static GstCaps *gst_v4lsrc_get_caps (GstBaseSrc * src);
-static GstFlowReturn gst_v4lsrc_create (GstPushSrc * src, GstBuffer ** out);
-static gboolean gst_v4lsrc_query (GstBaseSrc * bsrc, GstQuery * query);
-static void gst_v4lsrc_fixate (GstBaseSrc * bsrc, GstCaps * caps);
-
-static void gst_v4lsrc_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lsrc_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-
-static void
-gst_v4lsrc_base_init (gpointer g_class)
-{
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (gstelement_class,
-      "Video (video4linux/raw) Source", "Source/Video",
-      "Reads raw frames from a video4linux device",
-      "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&v4l_src_template));
-}
-
-static void
-gst_v4lsrc_class_init (GstV4lSrcClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstBaseSrcClass *basesrc_class;
-  GstPushSrcClass *pushsrc_class;
-
-  gobject_class = (GObjectClass *) klass;
-  basesrc_class = (GstBaseSrcClass *) klass;
-  pushsrc_class = (GstPushSrcClass *) klass;
-
-  gobject_class->set_property = gst_v4lsrc_set_property;
-  gobject_class->get_property = gst_v4lsrc_get_property;
-
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_AUTOPROBE,
-      g_param_spec_boolean ("autoprobe", "Autoprobe",
-          "Whether the device should be probed for all possible features",
-          TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_AUTOPROBE_FPS,
-      g_param_spec_boolean ("autoprobe-fps", "Autoprobe FPS",
-          "Whether the device should be probed for framerates",
-          TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COPY_MODE,
-      g_param_spec_boolean ("copy-mode", "Copy mode",
-          "Whether to send out copies of buffers, or direct pointers to the mmap region",
-          TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (G_OBJECT_CLASS (klass),
-      PROP_TIMESTAMP_OFFSET, g_param_spec_int64 ("timestamp-offset",
-          "Timestamp offset",
-          "A time offset subtracted from timestamps set on buffers (in ns)",
-          G_MININT64, G_MAXINT64, 0,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  GST_DEBUG_CATEGORY_INIT (v4lsrc_debug, "v4lsrc", 0, "V4L source element");
-
-  basesrc_class->get_caps = gst_v4lsrc_get_caps;
-  basesrc_class->set_caps = gst_v4lsrc_set_caps;
-  basesrc_class->start = gst_v4lsrc_start;
-  basesrc_class->stop = gst_v4lsrc_stop;
-  basesrc_class->fixate = gst_v4lsrc_fixate;
-  basesrc_class->query = gst_v4lsrc_query;
-
-  pushsrc_class->create = gst_v4lsrc_create;
-}
-
-static void
-gst_v4lsrc_init (GstV4lSrc * v4lsrc, GstV4lSrcClass * klass)
-{
-  v4lsrc->buffer_size = 0;
-
-  /* no colorspaces */
-  v4lsrc->colorspaces = NULL;
-
-  v4lsrc->is_capturing = FALSE;
-  v4lsrc->autoprobe = TRUE;
-  v4lsrc->autoprobe_fps = TRUE;
-  v4lsrc->copy_mode = TRUE;
-
-  v4lsrc->timestamp_offset = 0;
-
-  v4lsrc->fps_list = NULL;
-
-  gst_base_src_set_format (GST_BASE_SRC (v4lsrc), GST_FORMAT_TIME);
-  gst_base_src_set_live (GST_BASE_SRC (v4lsrc), TRUE);
-}
-
-static void
-gst_v4lsrc_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec)
-{
-  GstV4lSrc *v4lsrc = GST_V4LSRC (object);
-
-  switch (prop_id) {
-    case PROP_AUTOPROBE:
-      g_return_if_fail (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc)));
-      v4lsrc->autoprobe = g_value_get_boolean (value);
-      break;
-    case PROP_AUTOPROBE_FPS:
-      g_return_if_fail (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc)));
-      v4lsrc->autoprobe_fps = g_value_get_boolean (value);
-      break;
-    case PROP_COPY_MODE:
-      v4lsrc->copy_mode = g_value_get_boolean (value);
-      break;
-    case PROP_TIMESTAMP_OFFSET:
-      v4lsrc->timestamp_offset = g_value_get_int64 (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-
-static void
-gst_v4lsrc_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec)
-{
-  GstV4lSrc *v4lsrc = GST_V4LSRC (object);
-
-  switch (prop_id) {
-    case PROP_AUTOPROBE:
-      g_value_set_boolean (value, v4lsrc->autoprobe);
-      break;
-    case PROP_AUTOPROBE_FPS:
-      g_value_set_boolean (value, v4lsrc->autoprobe_fps);
-      break;
-    case PROP_COPY_MODE:
-      g_value_set_boolean (value, v4lsrc->copy_mode);
-      break;
-    case PROP_TIMESTAMP_OFFSET:
-      g_value_set_int64 (value, v4lsrc->timestamp_offset);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-/* this function is a bit of a last resort */
-static void
-gst_v4lsrc_fixate (GstBaseSrc * bsrc, GstCaps * caps)
-{
-  GstStructure *structure;
-  int i;
-  int targetwidth, targetheight;
-  GstV4lSrc *v4lsrc = GST_V4LSRC (bsrc);
-  struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
-  struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-
-  if (GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
-    GST_DEBUG_OBJECT (v4lsrc, "device reported w: %d-%d, h: %d-%d",
-        vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight);
-    targetwidth = vcap->minwidth;
-    targetheight = vcap->minheight;
-    /* if we can get the current vwin settings, we use those to fixate */
-    if (!gst_v4l_get_capabilities (GST_V4LELEMENT (v4lsrc)))
-      GST_DEBUG_OBJECT (v4lsrc, "failed getting capabilities");
-    else {
-      targetwidth = vwin->width;
-      targetheight = vwin->height;
-    }
-  } else {
-    GST_DEBUG_OBJECT (v4lsrc, "device closed, guessing");
-    targetwidth = 320;
-    targetheight = 200;
-  }
-
-  GST_DEBUG_OBJECT (v4lsrc, "targetting %dx%d", targetwidth, targetheight);
-
-  for (i = 0; i < gst_caps_get_size (caps); ++i) {
-    const GValue *v;
-
-    structure = gst_caps_get_structure (caps, i);
-    gst_structure_fixate_field_nearest_int (structure, "width", targetwidth);
-    gst_structure_fixate_field_nearest_int (structure, "height", targetheight);
-    gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2);
-
-    v = gst_structure_get_value (structure, "format");
-    if (v && G_VALUE_TYPE (v) != GST_TYPE_FOURCC) {
-      guint32 fourcc;
-
-      g_return_if_fail (G_VALUE_TYPE (v) == GST_TYPE_LIST);
-
-      fourcc = gst_value_get_fourcc (gst_value_list_get_value (v, 0));
-      gst_structure_set (structure, "format", GST_TYPE_FOURCC, fourcc, NULL);
-    }
-  }
-}
-
-static gint all_palettes[] = {
-  VIDEO_PALETTE_YUV422,
-  VIDEO_PALETTE_YUV420P,
-  VIDEO_PALETTE_UYVY,
-  VIDEO_PALETTE_YUV411P,
-  VIDEO_PALETTE_YUV422P,
-  VIDEO_PALETTE_YUV410P,
-  VIDEO_PALETTE_YUV411,
-  VIDEO_PALETTE_RGB555,
-  VIDEO_PALETTE_RGB565,
-  VIDEO_PALETTE_RGB24,
-  VIDEO_PALETTE_RGB32,
-  -1
-};
-
-static GstCaps *
-gst_v4lsrc_palette_to_caps (int palette)
-{
-  guint32 fourcc;
-  GstCaps *caps;
-
-  switch (palette) {
-    case VIDEO_PALETTE_YUV422:
-    case VIDEO_PALETTE_YUYV:
-      fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
-      break;
-    case VIDEO_PALETTE_YUV420P:
-      fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
-      break;
-    case VIDEO_PALETTE_UYVY:
-      fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
-      break;
-    case VIDEO_PALETTE_YUV411P:
-      fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
-      break;
-    case VIDEO_PALETTE_YUV411:
-      fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'P');
-      break;
-    case VIDEO_PALETTE_YUV422P:
-      fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
-      break;
-    case VIDEO_PALETTE_YUV410P:
-      fourcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
-      break;
-    case VIDEO_PALETTE_RGB555:
-    case VIDEO_PALETTE_RGB565:
-    case VIDEO_PALETTE_RGB24:
-    case VIDEO_PALETTE_RGB32:
-      fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
-      break;
-    default:
-      return NULL;
-  }
-
-  if (fourcc == GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) {
-    switch (palette) {
-      case VIDEO_PALETTE_RGB555:
-        caps = gst_caps_from_string ("video/x-raw-rgb, "
-            "bpp = (int) 16, "
-            "depth = (int) 15, "
-            "endianness = (int) BYTE_ORDER, "
-            "red_mask = 0x7c00, " "green_mask = 0x03e0, " "blue_mask = 0x001f");
-        break;
-      case VIDEO_PALETTE_RGB565:
-        caps = gst_caps_from_string ("video/x-raw-rgb, "
-            "bpp = (int) 16, "
-            "depth = (int) 16, "
-            "endianness = (int) BYTE_ORDER, "
-            "red_mask = 0xf800, " "green_mask = 0x07f0, " "blue_mask = 0x001f");
-        break;
-      case VIDEO_PALETTE_RGB24:
-        caps = gst_caps_from_string ("video/x-raw-rgb, "
-            "bpp = (int) 24, "
-            "depth = (int) 24, "
-            "endianness = (int) BIG_ENDIAN, "
-            "red_mask = 0xFF0000, "
-            "green_mask = 0x00FF00, " "blue_mask = 0x0000FF");
-        break;
-      case VIDEO_PALETTE_RGB32:
-        caps = gst_caps_from_string ("video/x-raw-rgb, "
-            "bpp = (int) 32, "
-            "depth = (int) 24, "
-            "endianness = (int) BIG_ENDIAN, "
-            "red_mask = 0xFF000000, "
-            "green_mask = 0x00FF0000, " "blue_mask = 0x0000FF00");
-        break;
-      default:
-        g_assert_not_reached ();
-        return NULL;
-    }
-  } else {
-    caps = gst_caps_new_simple ("video/x-raw-yuv",
-        "format", GST_TYPE_FOURCC, fourcc, NULL);
-  }
-
-  return caps;
-}
-
-static GstCaps *
-gst_v4lsrc_get_any_caps (void)
-{
-  gint i;
-  GstCaps *caps = gst_caps_new_empty (), *one;
-
-  for (i = 0; all_palettes[i] != -1; i++) {
-    one = gst_v4lsrc_palette_to_caps (all_palettes[i]);
-    gst_caps_append (caps, one);
-  }
-
-  return caps;
-}
-
-static GstCaps *
-gst_v4lsrc_get_caps (GstBaseSrc * src)
-{
-  GstCaps *list;
-  GstV4lSrc *v4lsrc = GST_V4LSRC (src);
-  struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
-  gint width = GST_V4LELEMENT (src)->vcap.minwidth;
-  gint height = GST_V4LELEMENT (src)->vcap.minheight;
-  gint i;
-  gint fps_n, fps_d;
-  GList *item;
-
-  if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
-    return gst_v4lsrc_get_any_caps ();
-  }
-
-  if (!v4lsrc->autoprobe) {
-    /* FIXME: query current caps and return those, with _any appended */
-    return gst_v4lsrc_get_any_caps ();
-  }
-
-  if (!v4lsrc->colorspaces) {
-    GST_DEBUG_OBJECT (v4lsrc, "Checking supported palettes");
-    for (i = 0; all_palettes[i] != -1; i++) {
-      /* try palette out */
-      if (!gst_v4lsrc_try_capture (v4lsrc, width, height, all_palettes[i]))
-        continue;
-      GST_DEBUG_OBJECT (v4lsrc, "Added palette %d (%s) to supported list",
-          all_palettes[i], gst_v4lsrc_palette_name (all_palettes[i]));
-      v4lsrc->colorspaces = g_list_append (v4lsrc->colorspaces,
-          GINT_TO_POINTER (all_palettes[i]));
-    }
-    GST_DEBUG_OBJECT (v4lsrc, "%d palette(s) supported",
-        g_list_length (v4lsrc->colorspaces));
-    if (v4lsrc->autoprobe_fps) {
-      GST_DEBUG_OBJECT (v4lsrc, "autoprobing framerates");
-      v4lsrc->fps_list = gst_v4lsrc_get_fps_list (v4lsrc);
-    }
-  }
-
-
-  if (!gst_v4lsrc_get_fps (v4lsrc, &fps_n, &fps_d)) {
-    fps_n = 0;
-    fps_d = 1;
-  }
-
-  list = gst_caps_new_empty ();
-  for (item = v4lsrc->colorspaces; item != NULL; item = item->next) {
-    GstCaps *one;
-
-    one = gst_v4lsrc_palette_to_caps (GPOINTER_TO_INT (item->data));
-    if (!one) {
-      GST_WARNING_OBJECT (v4lsrc, "Palette %d gave no caps\n",
-          GPOINTER_TO_INT (item->data));
-      continue;
-    }
-
-    GST_DEBUG_OBJECT (v4lsrc,
-        "Device reports w: %d-%d, h: %d-%d, fps: %d/%d for palette %d",
-        vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight,
-        fps_n, fps_d, GPOINTER_TO_INT (item->data));
-
-    if (vcap->minwidth < vcap->maxwidth) {
-      gst_caps_set_simple (one, "width", GST_TYPE_INT_RANGE, vcap->minwidth,
-          vcap->maxwidth, NULL);
-    } else {
-      gst_caps_set_simple (one, "width", G_TYPE_INT, vcap->minwidth, NULL);
-    }
-    if (vcap->minheight < vcap->maxheight) {
-      gst_caps_set_simple (one, "height", GST_TYPE_INT_RANGE, vcap->minheight,
-          vcap->maxheight, NULL);
-    } else {
-      gst_caps_set_simple (one, "height", G_TYPE_INT, vcap->minheight, NULL);
-    }
-
-    if (v4lsrc->autoprobe_fps) {
-      GstStructure *structure = gst_caps_get_structure (one, 0);
-
-      if (v4lsrc->fps_list) {
-        gst_structure_set_value (structure, "framerate", v4lsrc->fps_list);
-      } else {
-        gst_structure_set (structure, "framerate", GST_TYPE_FRACTION,
-            fps_n, fps_d, NULL);
-      }
-    } else {
-      gst_caps_set_simple (one, "framerate", GST_TYPE_FRACTION_RANGE,
-          1, 1, 100, 1, NULL);
-    }
-
-    GST_DEBUG_OBJECT (v4lsrc, "caps: %" GST_PTR_FORMAT, one);
-    gst_caps_append (list, one);
-  }
-
-  return list;
-}
-
-static gboolean
-gst_v4lsrc_set_caps (GstBaseSrc * src, GstCaps * caps)
-{
-  GstV4lSrc *v4lsrc;
-  guint32 fourcc;
-  gint bpp, depth, w, h, palette = -1;
-  const GValue *new_fps;
-  gint cur_fps_n, cur_fps_d;
-  GstStructure *structure;
-  struct video_window *vwin;
-
-  v4lsrc = GST_V4LSRC (src);
-  vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-
-  /* if we're not open, punt -- we'll get setcaps'd later via negotiate */
-  if (!GST_V4L_IS_OPEN (v4lsrc))
-    return FALSE;
-
-  /* make sure we stop capturing and dealloc buffers */
-  if (GST_V4L_IS_ACTIVE (v4lsrc)) {
-    if (!gst_v4lsrc_capture_stop (v4lsrc))
-      return FALSE;
-    if (!gst_v4lsrc_capture_deinit (v4lsrc))
-      return FALSE;
-  }
-
-  /* it's fixed, one struct */
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0)
-    gst_structure_get_fourcc (structure, "format", &fourcc);
-  else
-    fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
-
-  gst_structure_get_int (structure, "width", &w);
-  gst_structure_get_int (structure, "height", &h);
-  new_fps = gst_structure_get_value (structure, "framerate");
-
-  /* set framerate if it's not already correct */
-  if (!gst_v4lsrc_get_fps (v4lsrc, &cur_fps_n, &cur_fps_d))
-    return FALSE;
-
-  if (new_fps) {
-    GST_DEBUG_OBJECT (v4lsrc, "linking with %dx%d at %d/%d fps", w, h,
-        gst_value_get_fraction_numerator (new_fps),
-        gst_value_get_fraction_denominator (new_fps));
-
-    if (gst_value_get_fraction_numerator (new_fps) != cur_fps_n ||
-        gst_value_get_fraction_denominator (new_fps) != cur_fps_d) {
-      int fps_index = (gst_value_get_fraction_numerator (new_fps) * 16) /
-          (gst_value_get_fraction_denominator (new_fps) * 15);
-
-      GST_DEBUG_OBJECT (v4lsrc, "Trying to set fps index %d", fps_index);
-      /* set bits 16 to 21 to 0 */
-      vwin->flags &= (0x3F00 - 1);
-      /* set bits 16 to 21 to the index */
-      vwin->flags |= fps_index << 16;
-      if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
-        return FALSE;
-      }
-    }
-  }
-
-  switch (fourcc) {
-    case GST_MAKE_FOURCC ('I', '4', '2', '0'):
-      palette = VIDEO_PALETTE_YUV420P;
-      v4lsrc->buffer_size = ((w + 1) & ~1) * ((h + 1) & ~1) * 1.5;
-      break;
-    case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
-      palette = VIDEO_PALETTE_YUV422;
-      v4lsrc->buffer_size = ((w + 1) & ~1) * h * 2;
-      break;
-    case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
-      palette = VIDEO_PALETTE_UYVY;
-      v4lsrc->buffer_size = ((w + 1) & ~1) * h * 2;
-      break;
-    case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
-      palette = VIDEO_PALETTE_YUV411P;
-      v4lsrc->buffer_size = ((w + 3) & ~3) * h * 1.5;
-      break;
-    case GST_MAKE_FOURCC ('Y', '4', '1', 'P'):
-      palette = VIDEO_PALETTE_YUV411;
-      v4lsrc->buffer_size = ((w + 3) & ~3) * h * 1.5;
-      break;
-    case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
-      palette = VIDEO_PALETTE_YUV410P;
-      v4lsrc->buffer_size = ((w + 3) & ~3) * ((h + 3) & ~3) * 1.125;
-      break;
-    case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
-      palette = VIDEO_PALETTE_YUV422P;
-      v4lsrc->buffer_size = ((w + 1) & ~1) * h * 2;
-      break;
-    case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
-      gst_structure_get_int (structure, "depth", &depth);
-      switch (depth) {
-        case 15:
-          palette = VIDEO_PALETTE_RGB555;
-          v4lsrc->buffer_size = w * h * 2;
-          break;
-        case 16:
-          palette = VIDEO_PALETTE_RGB565;
-          v4lsrc->buffer_size = w * h * 2;
-          break;
-        case 24:
-          gst_structure_get_int (structure, "bpp", &bpp);
-          switch (bpp) {
-            case 24:
-              palette = VIDEO_PALETTE_RGB24;
-              v4lsrc->buffer_size = w * h * 3;
-              break;
-            case 32:
-              palette = VIDEO_PALETTE_RGB32;
-              v4lsrc->buffer_size = w * h * 4;
-              break;
-            default:
-              break;
-          }
-          break;
-        default:
-          break;
-      }
-      break;
-    default:
-      break;
-  }
-
-  if (palette == -1) {
-    GST_WARNING_OBJECT (v4lsrc, "palette for fourcc %" GST_FOURCC_FORMAT
-        " is -1, refusing link", GST_FOURCC_ARGS (fourcc));
-    return FALSE;
-  }
-
-  GST_DEBUG_OBJECT (v4lsrc, "trying to set_capture %dx%d, palette %d",
-      w, h, palette);
-  /* this only fills in v4lsrc->mmap values */
-  if (!gst_v4lsrc_set_capture (v4lsrc, w, h, palette)) {
-    GST_WARNING_OBJECT (v4lsrc, "could not set_capture %dx%d, palette %d",
-        w, h, palette);
-    return FALSE;
-  }
-
-  /* first try the negotiated settings using try_capture */
-  if (!gst_v4lsrc_try_capture (v4lsrc, w, h, palette)) {
-    GST_DEBUG_OBJECT (v4lsrc, "failed trying palette %d for %dx%d", palette,
-        w, h);
-    return FALSE;
-  }
-
-  if (!gst_v4lsrc_capture_init (v4lsrc))
-    return FALSE;
-
-  if (!gst_v4lsrc_capture_start (v4lsrc))
-    return FALSE;
-
-  return TRUE;
-}
-
-static gboolean
-gst_v4lsrc_query (GstBaseSrc * bsrc, GstQuery * query)
-{
-  GstV4lSrc *v4lsrc;
-  gboolean res = FALSE;
-
-  v4lsrc = GST_V4LSRC (bsrc);
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_LATENCY:
-    {
-      GstClockTime min_latency, max_latency;
-      gint fps_n, fps_d;
-
-      /* device must be open */
-      if (!GST_V4L_IS_OPEN (v4lsrc))
-        goto done;
-
-      /* we must have a framerate */
-      if (!(res = gst_v4lsrc_get_fps (v4lsrc, &fps_n, &fps_d)))
-        goto done;
-
-      /* min latency is the time to capture one frame */
-      min_latency = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
-
-      /* max latency is total duration of the frame buffer */
-      max_latency = v4lsrc->mbuf.frames * min_latency;
-
-      GST_DEBUG_OBJECT (bsrc,
-          "report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
-
-      /* we are always live, the min latency is 1 frame and the max latency is
-       * the complete buffer of frames. */
-      gst_query_set_latency (query, TRUE, min_latency, max_latency);
-
-      res = TRUE;
-      break;
-    }
-    default:
-      res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
-      break;
-  }
-done:
-  return res;
-}
-
-/* start and stop are not symmetric -- start will open the device, but not start
-   capture. it's setcaps that will start capture, which is called via basesrc's
-   negotiate method. stop will both stop capture and close the device.
- */
-static gboolean
-gst_v4lsrc_start (GstBaseSrc * src)
-{
-  GstV4lSrc *v4lsrc = GST_V4LSRC (src);
-
-  v4lsrc->offset = 0;
-
-  return TRUE;
-}
-
-static gboolean
-gst_v4lsrc_stop (GstBaseSrc * src)
-{
-  GstV4lSrc *v4lsrc = GST_V4LSRC (src);
-
-  if (GST_V4L_IS_ACTIVE (v4lsrc) && !gst_v4lsrc_capture_stop (v4lsrc))
-    return FALSE;
-
-  if (GST_V4LELEMENT (v4lsrc)->buffer != NULL) {
-    if (!gst_v4lsrc_capture_deinit (v4lsrc))
-      return FALSE;
-  }
-
-  g_list_free (v4lsrc->colorspaces);
-  v4lsrc->colorspaces = NULL;
-
-  if (v4lsrc->fps_list) {
-    g_value_unset (v4lsrc->fps_list);
-    g_free (v4lsrc->fps_list);
-    v4lsrc->fps_list = NULL;
-  }
-
-  return TRUE;
-}
-
-static GstFlowReturn
-gst_v4lsrc_create (GstPushSrc * src, GstBuffer ** buf)
-{
-  GstV4lSrc *v4lsrc;
-  gint num;
-
-  v4lsrc = GST_V4LSRC (src);
-
-  /* grab a frame from the device */
-  if (!gst_v4lsrc_grab_frame (v4lsrc, &num))
-    return GST_FLOW_ERROR;
-
-  *buf = gst_v4lsrc_buffer_new (v4lsrc, num);
-
-  if (v4lsrc->copy_mode) {
-    GstBuffer *copy = gst_buffer_copy (*buf);
-
-    gst_buffer_unref (*buf);
-    *buf = copy;
-  }
-
-  return GST_FLOW_OK;
-}
diff --git a/sys/v4l/gstv4lsrc.h b/sys/v4l/gstv4lsrc.h
deleted file mode 100644 (file)
index fbed86a..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/* GStreamer
- *
- * gstv4lsrc.h: BT8x8/V4L video source element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LSRC_H__
-#define __GST_V4LSRC_H__
-
-
-#include <gstv4lelement.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_V4LSRC \
-  (gst_v4lsrc_get_type())
-#define GST_V4LSRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LSRC,GstV4lSrc))
-#define GST_V4LSRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LSRC,GstV4lSrcClass))
-#define GST_IS_V4LSRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LSRC))
-#define GST_IS_V4LSRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LSRC))
-
-
-typedef struct _GstV4lSrc GstV4lSrc;
-typedef struct _GstV4lSrcClass GstV4lSrcClass;
-
-
-enum
-{
-  QUEUE_STATE_ERROR = -1,
-  QUEUE_STATE_READY_FOR_QUEUE,  /* the frame is ready to be queued for capture */
-  QUEUE_STATE_QUEUED,           /* the frame is queued for capture */
-  QUEUE_STATE_SYNCED            /* the frame is captured */
-};
-
-
-struct _GstV4lSrc
-{
-  GstV4lElement v4lelement;
-
-  /* pads */
-  GstPad *srcpad;
-
-  /* capture/buffer info */
-  struct video_mmap mmap;
-  struct video_mbuf mbuf;
-  guint buffer_size;
-  GstClockTime timestamp_sync;
-
-  /* num of queued frames and some GThread stuff
-   * to wait if there's not enough */
-  gint8 *frame_queue_state;
-  GMutex *mutex_queue_state;
-  GCond *cond_queue_state;
-  gint num_queued;
-  gint sync_frame, queue_frame;
-  gboolean is_capturing;
-  GstClockTimeDiff timestamp_offset;
-
-  /* True if we want to stop */
-  gboolean quit;
-
-  gint offset;
-
-  /* list of supported colorspaces (as integers) */
-  GList *colorspaces;
-
-  gboolean autoprobe;           /* probe features on startup ? */
-  gboolean autoprobe_fps;       /* probe fps on startup ? */
-  gboolean copy_mode;
-
-  GValue *fps_list;             /* list of fps probed */
-};
-
-struct _GstV4lSrcClass
-{
-  GstV4lElementClass parent_class;
-};
-
-
-GType gst_v4lsrc_get_type (void);
-
-
-G_END_DECLS
-
-
-#endif /* __GST_V4LSRC_H__ */
diff --git a/sys/v4l/gstv4ltuner.c b/sys/v4l/gstv4ltuner.c
deleted file mode 100644 (file)
index 8f432b4..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/* GStreamer
- *
- * gstv4ltuner.c: tuner interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include "gstv4ltuner.h"
-#include "gstv4lelement.h"
-#include "v4l_calls.h"
-
-static void gst_v4l_tuner_channel_class_init (GstV4lTunerChannelClass * klass);
-static void gst_v4l_tuner_channel_init (GstV4lTunerChannel * channel);
-
-static void gst_v4l_tuner_norm_class_init (GstV4lTunerNormClass * klass);
-static void gst_v4l_tuner_norm_init (GstV4lTunerNorm * norm);
-
-static const GList *gst_v4l_tuner_list_channels (GstTuner * tuner);
-static void gst_v4l_tuner_set_channel (GstTuner * tuner,
-    GstTunerChannel * channel);
-static GstTunerChannel *gst_v4l_tuner_get_channel (GstTuner * tuner);
-
-static const GList *gst_v4l_tuner_list_norms (GstTuner * tuner);
-static void gst_v4l_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm);
-static GstTunerNorm *gst_v4l_tuner_get_norm (GstTuner * tuner);
-
-static void gst_v4l_tuner_set_frequency (GstTuner * tuner,
-    GstTunerChannel * channel, gulong frequency);
-static gulong gst_v4l_tuner_get_frequency (GstTuner * tuner,
-    GstTunerChannel * channel);
-static gint gst_v4l_tuner_signal_strength (GstTuner * tuner,
-    GstTunerChannel * channel);
-
-static GstTunerNormClass *norm_parent_class = NULL;
-static GstTunerChannelClass *channel_parent_class = NULL;
-
-GType
-gst_v4l_tuner_channel_get_type (void)
-{
-  static GType gst_v4l_tuner_channel_type = 0;
-
-  if (!gst_v4l_tuner_channel_type) {
-    static const GTypeInfo v4l_tuner_channel_info = {
-      sizeof (GstV4lTunerChannelClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_v4l_tuner_channel_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lTunerChannel),
-      0,
-      (GInstanceInitFunc) gst_v4l_tuner_channel_init,
-      NULL
-    };
-
-    gst_v4l_tuner_channel_type =
-        g_type_register_static (GST_TYPE_TUNER_CHANNEL,
-        "GstV4lTunerChannel", &v4l_tuner_channel_info, 0);
-  }
-
-  return gst_v4l_tuner_channel_type;
-}
-
-static void
-gst_v4l_tuner_channel_class_init (GstV4lTunerChannelClass * klass)
-{
-  channel_parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4l_tuner_channel_init (GstV4lTunerChannel * channel)
-{
-  channel->index = 0;
-  channel->audio = 0;
-  channel->tuner = 0;
-}
-
-GType
-gst_v4l_tuner_norm_get_type (void)
-{
-  static GType gst_v4l_tuner_norm_type = 0;
-
-  if (!gst_v4l_tuner_norm_type) {
-    static const GTypeInfo v4l_tuner_norm_info = {
-      sizeof (GstV4lTunerNormClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_v4l_tuner_norm_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lTunerNorm),
-      0,
-      (GInstanceInitFunc) gst_v4l_tuner_norm_init,
-      NULL
-    };
-
-    gst_v4l_tuner_norm_type =
-        g_type_register_static (GST_TYPE_TUNER_NORM,
-        "GstV4lTunerNorm", &v4l_tuner_norm_info, 0);
-  }
-
-  return gst_v4l_tuner_norm_type;
-}
-
-static void
-gst_v4l_tuner_norm_class_init (GstV4lTunerNormClass * klass)
-{
-  norm_parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4l_tuner_norm_init (GstV4lTunerNorm * norm)
-{
-  norm->index = 0;
-}
-
-void
-gst_v4l_tuner_interface_init (GstTunerClass * klass)
-{
-  /* default virtual functions */
-  klass->list_channels = gst_v4l_tuner_list_channels;
-  klass->set_channel = gst_v4l_tuner_set_channel;
-  klass->get_channel = gst_v4l_tuner_get_channel;
-
-  klass->list_norms = gst_v4l_tuner_list_norms;
-  klass->set_norm = gst_v4l_tuner_set_norm;
-  klass->get_norm = gst_v4l_tuner_get_norm;
-
-  klass->set_frequency = gst_v4l_tuner_set_frequency;
-  klass->get_frequency = gst_v4l_tuner_get_frequency;
-  klass->signal_strength = gst_v4l_tuner_signal_strength;
-}
-
-static G_GNUC_UNUSED gboolean
-gst_v4l_tuner_contains_channel (GstV4lElement * v4lelement,
-    GstV4lTunerChannel * v4lchannel)
-{
-  const GList *item;
-
-  for (item = v4lelement->channels; item != NULL; item = item->next)
-    if (item->data == v4lchannel)
-      return TRUE;
-
-  return FALSE;
-}
-
-static const GList *
-gst_v4l_tuner_list_channels (GstTuner * tuner)
-{
-  return GST_V4LELEMENT (tuner)->channels;
-}
-
-static void
-gst_v4l_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
-  gint norm;
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
-  g_return_if_fail (gst_v4l_tuner_contains_channel (v4lelement, v4lchannel));
-
-  gst_v4l_get_chan_norm (v4lelement, NULL, &norm);
-  gst_v4l_set_chan_norm (v4lelement, v4lchannel->index, norm);
-}
-
-static GstTunerChannel *
-gst_v4l_tuner_get_channel (GstTuner * tuner)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GList *item;
-  gint channel;
-
-  /* assert that we're opened */
-  g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), NULL);
-
-  gst_v4l_get_chan_norm (v4lelement, &channel, NULL);
-
-  for (item = v4lelement->channels; item != NULL; item = item->next) {
-    if (channel == GST_V4L_TUNER_CHANNEL (item->data)->index)
-      return GST_TUNER_CHANNEL (item->data);
-  }
-
-  return NULL;
-}
-
-static G_GNUC_UNUSED gboolean
-gst_v4l_tuner_contains_norm (GstV4lElement * v4lelement,
-    GstV4lTunerNorm * v4lnorm)
-{
-  const GList *item;
-
-  for (item = v4lelement->norms; item != NULL; item = item->next)
-    if (item->data == v4lnorm)
-      return TRUE;
-
-  return FALSE;
-}
-
-static const GList *
-gst_v4l_tuner_list_norms (GstTuner * tuner)
-{
-  return GST_V4LELEMENT (tuner)->norms;
-}
-
-static void
-gst_v4l_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GstV4lTunerNorm *v4lnorm = GST_V4L_TUNER_NORM (norm);
-  gint channel;
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
-  g_return_if_fail (gst_v4l_tuner_contains_norm (v4lelement, v4lnorm));
-
-  gst_v4l_get_chan_norm (v4lelement, &channel, NULL);
-  gst_v4l_set_chan_norm (v4lelement, channel, v4lnorm->index);
-}
-
-static GstTunerNorm *
-gst_v4l_tuner_get_norm (GstTuner * tuner)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GList *item;
-  gint norm;
-
-  /* assert that we're opened */
-  g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), NULL);
-
-  gst_v4l_get_chan_norm (v4lelement, NULL, &norm);
-
-  for (item = v4lelement->norms; item != NULL; item = item->next) {
-    if (norm == GST_V4L_TUNER_NORM (item->data)->index)
-      return GST_TUNER_NORM (item->data);
-  }
-
-  return NULL;
-}
-
-static void
-gst_v4l_tuner_set_frequency (GstTuner * tuner,
-    GstTunerChannel * channel, gulong frequency)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
-  gint chan;
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
-  g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
-          GST_TUNER_CHANNEL_FREQUENCY));
-  g_return_if_fail (gst_v4l_tuner_contains_channel (v4lelement, v4lchannel));
-
-  gst_v4l_get_chan_norm (v4lelement, &chan, NULL);
-  if (chan == GST_V4L_TUNER_CHANNEL (channel)->index) {
-    gst_v4l_set_frequency (v4lelement, v4lchannel->tuner, frequency);
-  }
-}
-
-static gulong
-gst_v4l_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
-  gint chan;
-  gulong frequency = 0;
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 0);
-  g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
-          GST_TUNER_CHANNEL_FREQUENCY), 0);
-  g_return_val_if_fail (gst_v4l_tuner_contains_channel (v4lelement,
-          v4lchannel), 0);
-
-  gst_v4l_get_chan_norm (v4lelement, &chan, NULL);
-  if (chan == GST_V4L_TUNER_CHANNEL (channel)->index) {
-    gst_v4l_get_frequency (v4lelement, v4lchannel->tuner, &frequency);
-  }
-
-  return frequency;
-}
-
-static gint
-gst_v4l_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
-  GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
-  gint chan;
-  guint signal = 0;
-
-  /* assert that we're opened and that we're using a known item */
-  g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 0);
-  g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
-          GST_TUNER_CHANNEL_FREQUENCY), 0);
-  g_return_val_if_fail (gst_v4l_tuner_contains_channel (v4lelement,
-          v4lchannel), 0);
-
-  gst_v4l_get_chan_norm (v4lelement, &chan, NULL);
-  if (chan == GST_V4L_TUNER_CHANNEL (channel)->index &&
-      GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
-    gst_v4l_get_signal (v4lelement, v4lchannel->tuner, &signal);
-  }
-
-  return (gint) signal;
-}
diff --git a/sys/v4l/gstv4ltuner.h b/sys/v4l/gstv4ltuner.h
deleted file mode 100644 (file)
index ca5b93a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GStreamer
- *
- * gstv4ltuner.h: tuner interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4L_TUNER_H__
-#define __GST_V4L_TUNER_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/tuner.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4L_TUNER_CHANNEL \
-  (gst_v4l_tuner_channel_get_type ())
-#define GST_V4L_TUNER_CHANNEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L_TUNER_CHANNEL, \
-                               GstV4lTunerChannel))
-#define GST_V4L_TUNER_CHANNEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L_TUNER_CHANNEL, \
-                            GstV4lTunerChannelClass))
-#define GST_IS_V4L_TUNER_CHANNEL(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L_TUNER_CHANNEL))
-#define GST_IS_V4L_TUNER_CHANNEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L_TUNER_CHANNEL))
-
-typedef struct _GstV4lTunerChannel {
-  GstTunerChannel parent;
-
-  gint            index;
-  gint            tuner;
-  gint            audio;
-} GstV4lTunerChannel;
-
-typedef struct _GstV4lTunerChannelClass {
-  GstTunerChannelClass parent;
-} GstV4lTunerChannelClass;
-
-#define GST_TYPE_V4L_TUNER_NORM \
-  (gst_v4l_tuner_norm_get_type ())
-#define GST_V4L_TUNER_NORM(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L_TUNER_NORM, \
-                               GstV4lTunerNorm))
-#define GST_V4L_TUNER_NORM_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L_TUNER_NORM, \
-                            GstV4lTunerNormClass))
-#define GST_IS_V4L_TUNER_NORM(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L_TUNER_NORM))
-#define GST_IS_V4L_TUNER_NORM_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L_TUNER_NORM))
-
-typedef struct _GstV4lTunerNorm {
-  GstTunerNorm parent;
-
-  gint         index;
-} GstV4lTunerNorm;
-
-typedef struct _GstV4lTunerNormClass {
-  GstTunerNormClass parent;
-} GstV4lTunerNormClass;
-
-GType   gst_v4l_tuner_channel_get_type  (void);
-GType   gst_v4l_tuner_norm_get_type     (void);
-
-void    gst_v4l_tuner_interface_init    (GstTunerClass *klass);
-
-#endif /* __GST_V4L_TUNER_H__ */
diff --git a/sys/v4l/gstv4lxoverlay.c b/sys/v4l/gstv4lxoverlay.c
deleted file mode 100644 (file)
index 5867caf..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/* GStreamer
- *
- * gstv4lxoverlay.c: X-based overlay interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <sys/stat.h>
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-
-#include "gstv4lxoverlay.h"
-#include "gstv4lelement.h"
-#include "v4l_calls.h"
-
-GST_DEBUG_CATEGORY_STATIC (v4lxv_debug);
-#define GST_CAT_DEFAULT v4lxv_debug
-
-struct _GstV4lXv
-{
-  Display *dpy;
-  gint port, idle_id;
-  GMutex *mutex;
-};
-
-static void gst_v4l_xoverlay_set_window_handle (GstXOverlay * overlay,
-    guintptr xwindow_id);
-
-void
-gst_v4l_xoverlay_interface_init (GstXOverlayClass * klass)
-{
-  /* default virtual functions */
-  klass->set_window_handle = gst_v4l_xoverlay_set_window_handle;
-
-  GST_DEBUG_CATEGORY_INIT (v4lxv_debug, "v4lxv", 0,
-      "V4L XOverlay interface debugging");
-}
-
-static void
-gst_v4l_xoverlay_open (GstV4lElement * v4lelement)
-{
-  struct stat s;
-  GstV4lXv *v4lxv;
-  const gchar *name = g_getenv ("DISPLAY");
-  unsigned int ver, rel, req, ev, err, anum;
-  int i, id = 0, first_id = 0, min;
-  XvAdaptorInfo *ai;
-  Display *dpy;
-
-  /* we need a display, obviously */
-  if (!name || !(dpy = XOpenDisplay (name))) {
-    GST_WARNING ("No $DISPLAY set or failed to open - no overlay");
-    return;
-  }
-
-  /* First let's check that XVideo extension is available */
-  if (!XQueryExtension (dpy, "XVideo", &i, &i, &i)) {
-    GST_WARNING ("Xv extension not available - no overlay");
-    XCloseDisplay (dpy);
-    return;
-  }
-
-  /* find port that belongs to this device */
-  if (XvQueryExtension (dpy, &ver, &rel, &req, &ev, &err) != Success) {
-    GST_WARNING ("Xv extension not supported - no overlay");
-    XCloseDisplay (dpy);
-    return;
-  }
-  if (XvQueryAdaptors (dpy, DefaultRootWindow (dpy), &anum, &ai) != Success) {
-    GST_WARNING ("Failed to query Xv adaptors");
-    XCloseDisplay (dpy);
-    return;
-  }
-  if (fstat (v4lelement->video_fd, &s) < 0) {
-    GST_ERROR ("Failed to stat() file descriptor: %s", g_strerror (errno));
-    XCloseDisplay (dpy);
-    return;
-  }
-  min = s.st_rdev & 0xff;
-  for (i = 0; i < anum; i++) {
-    if (!strcmp (ai[i].name, "video4linux")) {
-      if (first_id == 0)
-        first_id = ai[i].base_id;
-
-      /* hmm... */
-      if (first_id != 0 && ai[i].base_id == first_id + min)
-        id = ai[i].base_id;
-    }
-  }
-  XvFreeAdaptorInfo (ai);
-
-  if (id == 0) {
-    GST_WARNING ("Did not find XvPortID for device - no overlay");
-    XCloseDisplay (dpy);
-    return;
-  }
-
-  v4lxv = g_new0 (GstV4lXv, 1);
-  v4lxv->dpy = dpy;
-  v4lxv->port = id;
-  v4lxv->mutex = g_mutex_new ();
-  v4lxv->idle_id = 0;
-  v4lelement->xv = v4lxv;
-
-  if (v4lelement->xwindow_id) {
-    gst_v4l_xoverlay_set_window_handle (GST_X_OVERLAY (v4lelement),
-        v4lelement->xwindow_id);
-  }
-}
-
-static void
-gst_v4l_xoverlay_close (GstV4lElement * v4lelement)
-{
-  GstV4lXv *v4lxv = v4lelement->xv;
-
-  if (!v4lelement->xv)
-    return;
-
-  if (v4lelement->xwindow_id) {
-    gst_v4l_xoverlay_set_window_handle (GST_X_OVERLAY (v4lelement), 0);
-  }
-
-  XCloseDisplay (v4lxv->dpy);
-  g_mutex_free (v4lxv->mutex);
-  if (v4lxv->idle_id)
-    g_source_remove (v4lxv->idle_id);
-  g_free (v4lxv);
-  v4lelement->xv = NULL;
-}
-
-void
-gst_v4l_xoverlay_start (GstV4lElement * v4lelement)
-{
-  if (v4lelement->xwindow_id) {
-    gst_v4l_xoverlay_open (v4lelement);
-  }
-}
-
-void
-gst_v4l_xoverlay_stop (GstV4lElement * v4lelement)
-{
-  gst_v4l_xoverlay_close (v4lelement);
-}
-
-static gboolean
-idle_refresh (gpointer data)
-{
-  GstV4lElement *v4lelement = GST_V4LELEMENT (data);
-  GstV4lXv *v4lxv = v4lelement->xv;
-  XWindowAttributes attr;
-
-  if (v4lxv) {
-    g_mutex_lock (v4lxv->mutex);
-
-    XGetWindowAttributes (v4lxv->dpy, v4lelement->xwindow_id, &attr);
-    XvPutVideo (v4lxv->dpy, v4lxv->port, v4lelement->xwindow_id,
-        DefaultGC (v4lxv->dpy, DefaultScreen (v4lxv->dpy)),
-        0, 0, attr.width, attr.height, 0, 0, attr.width, attr.height);
-
-    v4lxv->idle_id = 0;
-    g_mutex_unlock (v4lxv->mutex);
-  }
-
-  /* once */
-  return FALSE;
-}
-
-static void
-gst_v4l_xoverlay_set_window_handle (GstXOverlay * overlay, guintptr id)
-{
-  XID xwindow_id = id;
-  GstV4lElement *v4lelement = GST_V4LELEMENT (overlay);
-  GstV4lXv *v4lxv;
-  XWindowAttributes attr;
-  gboolean change = (v4lelement->xwindow_id != xwindow_id);
-
-  GST_LOG_OBJECT (v4lelement, "Changing port to %lx", xwindow_id);
-
-  if (!v4lelement->xv && GST_V4L_IS_OPEN (v4lelement))
-    gst_v4l_xoverlay_open (v4lelement);
-
-  v4lxv = v4lelement->xv;
-
-  if (v4lxv)
-    g_mutex_lock (v4lxv->mutex);
-
-  if (change) {
-    if (v4lelement->xwindow_id && v4lxv) {
-      GST_DEBUG_OBJECT (v4lelement,
-          "Disabling port %lx", v4lelement->xwindow_id);
-
-      XvSelectPortNotify (v4lxv->dpy, v4lxv->port, 0);
-      XvSelectVideoNotify (v4lxv->dpy, v4lelement->xwindow_id, 0);
-      XvStopVideo (v4lxv->dpy, v4lxv->port, v4lelement->xwindow_id);
-    }
-
-    v4lelement->xwindow_id = xwindow_id;
-  }
-
-  if (!v4lxv || xwindow_id == 0) {
-    if (v4lxv)
-      g_mutex_unlock (v4lxv->mutex);
-    return;
-  }
-
-  if (change) {
-    GST_DEBUG_OBJECT (v4lelement, "Enabling port %lx", xwindow_id);
-
-    /* draw */
-    XvSelectPortNotify (v4lxv->dpy, v4lxv->port, 1);
-    XvSelectVideoNotify (v4lxv->dpy, v4lelement->xwindow_id, 1);
-  }
-
-  XGetWindowAttributes (v4lxv->dpy, v4lelement->xwindow_id, &attr);
-  XvPutVideo (v4lxv->dpy, v4lxv->port, v4lelement->xwindow_id,
-      DefaultGC (v4lxv->dpy, DefaultScreen (v4lxv->dpy)),
-      0, 0, attr.width, attr.height, 0, 0, attr.width, attr.height);
-
-  if (v4lxv->idle_id)
-    g_source_remove (v4lxv->idle_id);
-  v4lxv->idle_id = g_idle_add (idle_refresh, v4lelement);
-  g_mutex_unlock (v4lxv->mutex);
-}
diff --git a/sys/v4l/gstv4lxoverlay.h b/sys/v4l/gstv4lxoverlay.h
deleted file mode 100644 (file)
index 959e5c9..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* GStreamer
- *
- * gstv4lxoverlay.h: tv mixer interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4L_X_OVERLAY_H__
-#define __GST_V4L_X_OVERLAY_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include "gstv4lelement.h"
-
-G_BEGIN_DECLS
-
-void    gst_v4l_xoverlay_interface_init (GstXOverlayClass *klass);
-
-void    gst_v4l_xoverlay_start          (GstV4lElement * v4lelement);
-void    gst_v4l_xoverlay_stop           (GstV4lElement * v4lelement);
-
-G_END_DECLS
-
-#endif /* __GST_V4L_X_OVERLAY_H__ */
diff --git a/sys/v4l/v4l_calls.c b/sys/v4l/v4l_calls.c
deleted file mode 100644 (file)
index b2b7573..0000000
+++ /dev/null
@@ -1,724 +0,0 @@
-/* GStreamer
- *
- * v4l_calls.c: generic V4L calls
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/tuner.h>
-#include <gst/interfaces/colorbalance.h>
-
-#include "v4l_calls.h"
-#include "gstv4ltuner.h"
-#include "gstv4lcolorbalance.h"
-
-#include "gstv4lsrc.h"
-/* #include "gstv4lmjpegsrc.h" */
-/* #include "gstv4lmjpegsink.h" */
-
-GST_DEBUG_CATEGORY_EXTERN (v4l_debug);
-#define GST_CAT_DEFAULT v4l_debug
-
-static const char *picture_name[] = {
-  "Hue",
-  "Brightness",
-  "Contrast",
-  "Saturation",
-  NULL
-};
-
-G_GNUC_UNUSED static const char *audio_name[] = {
-  "Volume",
-  "Mute",
-  "Mode",
-  NULL
-};
-
-static const char *norm_name[] = {
-  "PAL",
-  "NTSC",
-  "SECAM",
-  NULL
-};
-
-/******************************************************
- * gst_v4l_get_capabilities():
- *   get the device's capturing capabilities
- * sets v4lelement->vcap and v4lelement->vwin
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_capabilities (GstV4lElement * v4lelement)
-{
-  GST_DEBUG_OBJECT (v4lelement, "getting capabilities");
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  if (ioctl (v4lelement->video_fd, VIDIOCGCAP, &(v4lelement->vcap)) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("error getting capabilities %s of from device %s",
-            g_strerror (errno), v4lelement->videodev));
-    return FALSE;
-  }
-
-  if (ioctl (v4lelement->video_fd, VIDIOCGWIN, &(v4lelement->vwin)) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("error getting window properties %s of from device %s",
-            g_strerror (errno), v4lelement->videodev));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-/******************************************************
- * gst_v4l_set_window_properties():
- *   set the device's capturing parameters (vwin)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_window_properties (GstV4lElement * v4lelement)
-{
-  struct video_window vwin;
-
-  GST_DEBUG_OBJECT (v4lelement, "setting window flags 0x%x to device %s",
-      v4lelement->vwin.flags, v4lelement->videodev);
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  if (ioctl (v4lelement->video_fd, VIDIOCSWIN, &(v4lelement->vwin)) < 0) {
-    GST_DEBUG_OBJECT (v4lelement,
-        "could not ioctl window properties 0x%x to device %s",
-        v4lelement->vwin.flags, v4lelement->videodev);
-    return FALSE;
-  }
-
-  /* get it again to make sure we have it correctly */
-  if (ioctl (v4lelement->video_fd, VIDIOCGWIN, &(vwin)) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("error getting window properties %s of from device %s",
-            g_strerror (errno), v4lelement->videodev));
-    return FALSE;
-  }
-  if (vwin.flags != v4lelement->vwin.flags) {
-    GST_DEBUG_OBJECT (v4lelement, "set 0x%x but got 0x%x back",
-        v4lelement->vwin.flags, vwin.flags);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-/******************************************************
- * gst_v4l_open():
- *   open the video device (v4lelement->videodev)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_open (GstV4lElement * v4lelement)
-{
-  int num;
-
-  GST_DEBUG_OBJECT (v4lelement, "opening device %s", v4lelement->videodev);
-  GST_V4L_CHECK_NOT_OPEN (v4lelement);
-  GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
-
-  /* be sure we have a device */
-  if (!v4lelement->videodev) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, NOT_FOUND,
-        (_("No device specified.")), (NULL));
-    return FALSE;
-  }
-
-  /* open the device */
-  v4lelement->video_fd = open (v4lelement->videodev, O_RDWR);
-  if (!GST_V4L_IS_OPEN (v4lelement)) {
-    if (errno == ENODEV || errno == ENOENT) {
-      GST_ELEMENT_ERROR (v4lelement, RESOURCE, NOT_FOUND,
-          (_("Device \"%s\" does not exist."), v4lelement->videodev), (NULL));
-      return FALSE;
-    }
-    if (errno == EBUSY) {
-      GST_ELEMENT_ERROR (v4lelement, RESOURCE, BUSY,
-          (_("Device \"%s\" is already being used."), v4lelement->videodev),
-          (NULL));
-      return FALSE;
-    }
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, OPEN_READ_WRITE,
-        (_("Could not open device \"%s\" for reading and writing."),
-            v4lelement->videodev), GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  /* get capabilities */
-  if (!gst_v4l_get_capabilities (v4lelement)) {
-    close (v4lelement->video_fd);
-    v4lelement->video_fd = -1;
-    return FALSE;
-  }
-
-  /* device type check */
-  if ((GST_IS_V4LSRC (v4lelement) &&
-          !(v4lelement->vcap.type & VID_TYPE_CAPTURE))) {
-/*       (GST_IS_V4LMJPEGSRC (v4lelement) && */
-/*           !(v4lelement->vcap.type & VID_TYPE_MJPEG_ENCODER)) || */
-/*       (GST_IS_V4LMJPEGSINK (v4lelement) && */
-/*           !(v4lelement->vcap.type & VID_TYPE_MJPEG_DECODER))) { */
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Device opened, but wrong type (0x%x)", v4lelement->vcap.type));
-    close (v4lelement->video_fd);
-    v4lelement->video_fd = -1;
-    return FALSE;
-  }
-
-  GST_INFO_OBJECT (v4lelement, "Opened device \'%s\' (\'%s\') successfully",
-      v4lelement->vcap.name, v4lelement->videodev);
-
-  /* norms + inputs, for the tuner interface */
-  for (num = 0; norm_name[num] != NULL; num++) {
-    GstV4lTunerNorm *v4lnorm = g_object_new (GST_TYPE_V4L_TUNER_NORM,
-        NULL);
-    GstTunerNorm *norm = GST_TUNER_NORM (v4lnorm);
-
-    norm->label = g_strdup (norm_name[num]);
-    if (num == 1)
-      gst_value_set_fraction (&norm->framerate, 30000, 1001);
-    else
-      gst_value_set_fraction (&norm->framerate, 25, 1);
-
-    v4lnorm->index = num;
-    v4lelement->norms = g_list_append (v4lelement->norms, (gpointer) norm);
-  }
-  v4lelement->channels = gst_v4l_get_chan_names (v4lelement);
-
-  for (num = 0; picture_name[num] != NULL; num++) {
-    GstV4lColorBalanceChannel *v4lchannel =
-        g_object_new (GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, NULL);
-    GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (v4lchannel);
-
-    channel->label = g_strdup (picture_name[num]);
-    channel->min_value = 0;
-    channel->max_value = 65535;
-    v4lchannel->index = num;
-    v4lelement->colors = g_list_append (v4lelement->colors, channel);
-  }
-
-  GST_DEBUG_OBJECT (v4lelement, "Setting default norm/input");
-  gst_v4l_set_chan_norm (v4lelement, 0, 0);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_close():
- *   close the video device (v4lelement->video_fd)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_close (GstV4lElement * v4lelement)
-{
-  GST_DEBUG_OBJECT (v4lelement, "closing device");
-  GST_V4L_CHECK_OPEN (v4lelement);
-  GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
-
-  close (v4lelement->video_fd);
-  v4lelement->video_fd = -1;
-
-  g_list_foreach (v4lelement->channels, (GFunc) g_object_unref, NULL);
-  g_list_free (v4lelement->channels);
-  v4lelement->channels = NULL;
-
-  g_list_foreach (v4lelement->norms, (GFunc) g_object_unref, NULL);
-  g_list_free (v4lelement->norms);
-  v4lelement->norms = NULL;
-
-  g_list_foreach (v4lelement->colors, (GFunc) g_object_unref, NULL);
-  g_list_free (v4lelement->colors);
-  v4lelement->colors = NULL;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_num_chans()
- * return value: the number of video input channels
- ******************************************************/
-
-static gint
-gst_v4l_get_num_chans (GstV4lElement * v4lelement)
-{
-  GST_DEBUG_OBJECT (v4lelement, "getting number of channels");
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  return v4lelement->vcap.channels;
-}
-
-
-/******************************************************
- * gst_v4l_get_chan_names()
- * return value: a GList containing the channel names
- ******************************************************/
-
-GList *
-gst_v4l_get_chan_names (GstV4lElement * v4lelement)
-{
-  struct video_channel vchan = { 0 };
-  GList *list = NULL;
-  gint i;
-
-  GST_DEBUG_OBJECT (v4lelement, "getting channel names");
-
-  if (!GST_V4L_IS_OPEN (v4lelement))
-    return NULL;
-
-  for (i = 0; i < gst_v4l_get_num_chans (v4lelement); i++) {
-    GstV4lTunerChannel *v4lchannel;
-    GstTunerChannel *channel;
-
-    vchan.channel = i;
-    if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0) {
-      /* Skip this channel */
-      continue;
-    }
-    v4lchannel = g_object_new (GST_TYPE_V4L_TUNER_CHANNEL, NULL);
-    v4lchannel->index = i;
-
-    channel = GST_TUNER_CHANNEL (v4lchannel);
-    channel->label = g_strdup (vchan.name);
-    channel->flags = GST_TUNER_CHANNEL_INPUT;
-    if (vchan.flags & VIDEO_VC_TUNER) {
-      struct video_tuner vtun;
-      gint n;
-
-      for (n = 0; n < vchan.tuners; n++) {
-        vtun.tuner = n;
-        if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
-          continue;             /* no more tuners */
-        if (strcmp (vtun.name, vchan.name) != 0) {
-          continue;             /* not this one */
-        }
-
-        v4lchannel->tuner = n;
-        channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
-        channel->freq_multiplicator =
-            62.5 * ((vtun.flags & VIDEO_TUNER_LOW) ? 1 : 1000);
-        channel->min_frequency = vtun.rangelow * channel->freq_multiplicator;
-        channel->max_frequency = vtun.rangehigh * channel->freq_multiplicator;
-        channel->min_signal = 0;
-        channel->max_signal = 0xffff;
-        break;
-      }
-
-    }
-    if (vchan.flags & VIDEO_VC_AUDIO) {
-      struct video_audio vaud;
-      gint n;
-
-      for (n = 0; n < v4lelement->vcap.audios; n++) {
-        vaud.audio = n;
-        if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vaud) < 0)
-          continue;
-        if (!strcmp (vaud.name, vchan.name)) {
-          v4lchannel->audio = n;
-          channel->flags |= GST_TUNER_CHANNEL_AUDIO;
-          break;
-        }
-      }
-    }
-    list = g_list_prepend (list, (gpointer) channel);
-  }
-
-  return g_list_reverse (list);
-}
-
-
-/******************************************************
- * gst_v4l_get_chan_norm():
- *   get the currently active video-channel and it's
- *   norm (VIDEO_MODE_{PAL|NTSC|SECAM|AUTO})
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_chan_norm (GstV4lElement * v4lelement, gint * channel, gint * norm)
-{
-  GST_DEBUG_OBJECT (v4lelement, "getting current channel and norm");
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  if (channel)
-    *channel = v4lelement->vchan.channel;
-  if (norm)
-    *norm = v4lelement->vchan.norm;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_chan_norm():
- *   set a new active channel and it's norm
- *   (VIDEO_MODE_{PAL|NTSC|SECAM|AUTO})
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_chan_norm (GstV4lElement * v4lelement, gint channel, gint norm)
-{
-  GST_DEBUG_OBJECT (v4lelement, "setting channel = %d, norm = %d (%s)",
-      channel, norm, norm_name[norm]);
-  GST_V4L_CHECK_OPEN (v4lelement);
-  //GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
-
-  v4lelement->vchan.channel = channel;
-  v4lelement->vchan.norm = norm;
-
-  if (ioctl (v4lelement->video_fd, VIDIOCSCHAN, &(v4lelement->vchan)) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error setting the channel/norm settings: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &(v4lelement->vchan)) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting the channel/norm settings: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_signal():
- *   get the current signal
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_signal (GstV4lElement * v4lelement, gint tunernum, guint * signal)
-{
-  struct video_tuner tuner;
-
-  GST_DEBUG_OBJECT (v4lelement, "getting tuner signal");
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  tuner.tuner = tunernum;
-  if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &tuner) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting tuner signal: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  *signal = tuner.signal;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_frequency():
- *   get the current frequency
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_frequency (GstV4lElement * v4lelement,
-    gint tunernum, gulong * frequency)
-{
-  struct video_tuner vtun;
-  GstTunerChannel *channel;
-
-  GST_DEBUG_OBJECT (v4lelement, "getting tuner frequency");
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  channel = gst_tuner_get_channel (GST_TUNER (v4lelement));
-
-  /* check that this is the current input */
-  vtun.tuner = tunernum;
-  if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
-    return FALSE;
-  if (strcmp (vtun.name, v4lelement->vchan.name))
-    return FALSE;
-
-  if (ioctl (v4lelement->video_fd, VIDIOCGFREQ, frequency) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting tuner frequency: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  *frequency = *frequency * channel->freq_multiplicator;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_frequency():
- *   set frequency
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_frequency (GstV4lElement * v4lelement,
-    gint tunernum, gulong frequency)
-{
-  struct video_tuner vtun;
-  GstTunerChannel *channel;
-
-  GST_DEBUG_OBJECT (v4lelement, "setting tuner frequency to %lu", frequency);
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  channel = gst_tuner_get_channel (GST_TUNER (v4lelement));
-
-  /* check that this is the current input */
-  vtun.tuner = tunernum;
-  if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
-    return FALSE;
-  if (strcmp (vtun.name, v4lelement->vchan.name))
-    return FALSE;
-
-  frequency = frequency / channel->freq_multiplicator;
-
-  if (ioctl (v4lelement->video_fd, VIDIOCSFREQ, &frequency) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error setting tuner frequency: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_picture():
- *   get a picture value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_picture (GstV4lElement * v4lelement,
-    GstV4lPictureType type, gint * value)
-{
-  struct video_picture vpic;
-
-  GST_DEBUG_OBJECT (v4lelement, "getting picture property type %d (%s)", type,
-      picture_name[type]);
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  if (ioctl (v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting picture parameters: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  switch (type) {
-    case V4L_PICTURE_HUE:
-      *value = vpic.hue;
-      break;
-    case V4L_PICTURE_BRIGHTNESS:
-      *value = vpic.brightness;
-      break;
-    case V4L_PICTURE_CONTRAST:
-      *value = vpic.contrast;
-      break;
-    case V4L_PICTURE_SATURATION:
-      *value = vpic.colour;
-      break;
-    default:
-      GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-          ("Error getting picture parameters: unknown type %d", type));
-      return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_picture():
- *   set a picture value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_picture (GstV4lElement * v4lelement,
-    GstV4lPictureType type, gint value)
-{
-  struct video_picture vpic;
-
-  GST_DEBUG_OBJECT (v4lelement, "setting picture type %d (%s) to value %d",
-      type, picture_name[type], value);
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  if (ioctl (v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting picture parameters: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  switch (type) {
-    case V4L_PICTURE_HUE:
-      vpic.hue = value;
-      break;
-    case V4L_PICTURE_BRIGHTNESS:
-      vpic.brightness = value;
-      break;
-    case V4L_PICTURE_CONTRAST:
-      vpic.contrast = value;
-      break;
-    case V4L_PICTURE_SATURATION:
-      vpic.colour = value;
-      break;
-    default:
-      GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-          ("Error setting picture parameters: unknown type %d", type));
-      return FALSE;
-  }
-
-  if (ioctl (v4lelement->video_fd, VIDIOCSPICT, &vpic) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error setting picture parameters: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_audio():
- *   get some audio value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_audio (GstV4lElement * v4lelement,
-    gint audionum, GstV4lAudioType type, gint * value)
-{
-  struct video_audio vau;
-
-  GST_DEBUG_OBJECT (v4lelement, "getting audio parameter type %d (%s)", type,
-      audio_name[type]);
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  vau.audio = audionum;
-  if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting audio parameters: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  switch (type) {
-    case V4L_AUDIO_MUTE:
-      *value = (vau.flags & VIDEO_AUDIO_MUTE);
-      break;
-    case V4L_AUDIO_VOLUME:
-      *value = vau.volume;
-      break;
-    case V4L_AUDIO_MODE:
-      *value = vau.mode;
-      break;
-    default:
-      GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-          ("Error getting audio parameters: unknown type %d", type));
-      return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_audio():
- *   set some audio value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_audio (GstV4lElement * v4lelement,
-    gint audionum, GstV4lAudioType type, gint value)
-{
-  struct video_audio vau;
-
-  GST_DEBUG_OBJECT (v4lelement,
-      "setting audio parameter type %d (%s) to value %d", type,
-      audio_name[type], value);
-  GST_V4L_CHECK_OPEN (v4lelement);
-
-  vau.audio = audionum;
-  if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error getting audio parameters: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  switch (type) {
-    case V4L_AUDIO_MUTE:
-      if (!(vau.flags & VIDEO_AUDIO_MUTABLE)) {
-        GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL),
-            ("Error setting audio mute: (un)setting mute is not supported"));
-        return FALSE;
-      }
-      if (value)
-        vau.flags |= VIDEO_AUDIO_MUTE;
-      else
-        vau.flags &= ~VIDEO_AUDIO_MUTE;
-      break;
-    case V4L_AUDIO_VOLUME:
-      if (!(vau.flags & VIDEO_AUDIO_VOLUME)) {
-        GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL),
-            ("Error setting audio volume: setting volume is not supported"));
-        return FALSE;
-      }
-      vau.volume = value;
-      break;
-    case V4L_AUDIO_MODE:
-      vau.mode = value;
-      break;
-    default:
-      GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-          ("Error setting audio parameters: unknown type %d", type));
-      return FALSE;
-  }
-
-  if (ioctl (v4lelement->video_fd, VIDIOCSAUDIO, &vau) < 0) {
-    GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
-        ("Error setting audio parameters: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  return TRUE;
-}
diff --git a/sys/v4l/v4l_calls.h b/sys/v4l/v4l_calls.h
deleted file mode 100644 (file)
index 1f1d90a..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* GStreamer
- *
- * v4l_calls.h: header for generic V4L calls
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_CALLS_H__
-#define __V4L_CALLS_H__
-
-#include "gstv4lelement.h"
-#include "gst/gst-i18n-plugin.h"
-
-
-G_BEGIN_DECLS
-
-
-/* simple check whether the device is open */
-#define GST_V4L_IS_OPEN(element) \
-  (GST_V4LELEMENT (element)->video_fd > 0)
-
-/* check whether the device is 'active' */
-#define GST_V4L_IS_ACTIVE(element) \
-  (GST_V4LELEMENT (element)->buffer != NULL)
-
-#define GST_V4L_IS_OVERLAY(element) \
-  (GST_V4LELEMENT (element)->vcap.type & VID_TYPE_OVERLAY)
-
-/* checks whether the current v4lelement has already been open()'ed or not */
-#define GST_V4L_CHECK_OPEN(element)                             \
-  if (!GST_V4L_IS_OPEN (element))                               \
-  {                                                             \
-    GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY,             \
-      (_("Device is not open.")), (NULL));                      \
-    return FALSE;                                               \
-  }
-
-/* checks whether the current v4lelement is close()'ed or whether it is still open */
-#define GST_V4L_CHECK_NOT_OPEN(element)                         \
-  if (GST_V4L_IS_OPEN (element))                                \
-  {                                                             \
-    GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY,             \
-      (_("Device is open.")), (NULL));                          \
-    return FALSE;                                               \
-  }
-
-/* checks whether the current v4lelement does video overlay */
-#define GST_V4L_CHECK_OVERLAY(element)                          \
-  if (!(element->vcap.type & VID_TYPE_OVERLAY))                 \
-  {                                                             \
-    GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY,             \
-      (NULL), ("Device cannot handle overlay"));                \
-    return FALSE;                                               \
-  }
-
-/* checks whether we're in capture mode or not */
-#define GST_V4L_CHECK_ACTIVE(element)                           \
-  if (!GST_V4L_IS_ACTIVE (element))                             \
-  {                                                             \
-    GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS,             \
-      (NULL), ("Device is not in streaming mode"));             \
-    return FALSE;                                               \
-  }
-
-/* checks whether we're out of capture mode or not */
-#define GST_V4L_CHECK_NOT_ACTIVE(element)                       \
-  if (GST_V4L_IS_ACTIVE (element))                              \
-  {                                                             \
-    GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS,             \
-      (NULL), ("Device is in streaming mode"));                 \
-    return FALSE;                                               \
-  }
-
-
-typedef enum {
-  V4L_PICTURE_HUE = 0,
-  V4L_PICTURE_BRIGHTNESS,
-  V4L_PICTURE_CONTRAST,
-  V4L_PICTURE_SATURATION,
-} GstV4lPictureType;
-
-typedef enum {
-  V4L_AUDIO_VOLUME = 0,
-  V4L_AUDIO_MUTE,
-  V4L_AUDIO_MODE, /* stereo, mono, ... (see videodev.h) */
-} GstV4lAudioType;
-
-
-/* open/close the device */
-gboolean gst_v4l_open           (GstV4lElement *v4lelement);
-gboolean gst_v4l_close          (GstV4lElement *v4lelement);
-
-/* norm control (norm = VIDEO_MODE_{PAL|NTSC|SECAM|AUTO}) */
-gboolean gst_v4l_get_chan_norm  (GstV4lElement *v4lelement,
-                                 gint          *channel,
-                                 gint          *norm);
-gboolean gst_v4l_set_chan_norm  (GstV4lElement *v4lelement,
-                                 gint           channel,
-                                 gint           norm);
-GList   *gst_v4l_get_chan_names (GstV4lElement *v4lelement);
-
-/* frequency control */
-gboolean gst_v4l_get_signal     (GstV4lElement *v4lelement,
-                                 gint           tunernum,
-                                 guint         *signal);
-gboolean gst_v4l_get_frequency  (GstV4lElement *v4lelement,
-                                 gint           tunernum,
-                                 gulong        *frequency);
-gboolean gst_v4l_set_frequency  (GstV4lElement *v4lelement,
-                                 gint           tunernum,
-                                 gulong         frequency);
-
-/* picture control */
-gboolean gst_v4l_get_picture    (GstV4lElement *v4lelement,
-                                 GstV4lPictureType type,
-                                 gint          *value);
-gboolean gst_v4l_set_picture    (GstV4lElement *v4lelement,
-                                 GstV4lPictureType type,
-                                 gint           value);
-
-/* audio control */
-gboolean gst_v4l_get_audio      (GstV4lElement *v4lelement,
-                                 gint           audionum,
-                                 GstV4lAudioType type,
-                                 gint          *value);
-gboolean gst_v4l_set_audio      (GstV4lElement *v4lelement,
-                                 gint           audionum,
-                                 GstV4lAudioType type,
-                                 gint           value);
-
-/* functions that v4lsrc needs */
-gboolean gst_v4l_set_window_properties (GstV4lElement * v4lelement);
-gboolean gst_v4l_get_capabilities (GstV4lElement * v4lelement);
-
-
-G_END_DECLS
-
-
-#endif /* __V4L_CALLS_H__ */
diff --git a/sys/v4l/v4lmjpegsink_calls.c b/sys/v4l/v4lmjpegsink_calls.c
deleted file mode 100644 (file)
index 416f80e..0000000
+++ /dev/null
@@ -1,525 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsink_calls.c: functions for hardware MJPEG video sink
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "v4lmjpegsink_calls.h"
-
-/* On some systems MAP_FAILED seems to be missing */
-#ifndef MAP_FAILED
-#define MAP_FAILED ( (caddr_t) -1 )
-#endif
-
-GST_DEBUG_CATEGORY_EXTERN (v4lmjpegsink_debug);
-#define GST_CAT_DEFAULT v4lmjpegsink_debug
-
-/******************************************************
- * gst_v4lmjpegsink_sync_thread()
- *   thread keeps track of played frames
- ******************************************************/
-
-static void *
-gst_v4lmjpegsink_sync_thread (void *arg)
-{
-  GstV4lMjpegSink *v4lmjpegsink = GST_V4LMJPEGSINK (arg);
-  gint frame = 0;               /* frame that we're currently syncing on */
-
-  GST_DEBUG_OBJECT (v4lmjpegsink, "starting sync thread");
-
-#if 0
-  /* Allow easy shutting down by other processes... */
-  pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
-  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
-#endif
-
-  while (1) {
-    g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
-    if (!v4lmjpegsink->isqueued_queued_frames[frame]) {
-      g_cond_wait (v4lmjpegsink->cond_queued_frames[frame],
-          v4lmjpegsink->mutex_queued_frames);
-    }
-    if (v4lmjpegsink->isqueued_queued_frames[frame] != 1) {
-      g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-      goto end;
-    }
-    g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-
-    GST_DEBUG_OBJECT (v4lmjpegsink, "thread-syncing on next frame");
-    if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_SYNC,
-            &(v4lmjpegsink->bsync)) < 0) {
-      GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SYNC, (NULL),
-          ("Failed to sync on frame %d: %s", frame, g_strerror (errno)));
-      g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
-      v4lmjpegsink->isqueued_queued_frames[frame] = -1;
-      g_cond_broadcast (v4lmjpegsink->cond_queued_frames[frame]);
-      g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-      goto end;
-    } else {
-      /* be sure that we're not confusing */
-      if (frame != v4lmjpegsink->bsync.frame) {
-        GST_ELEMENT_ERROR (v4lmjpegsink, CORE, TOO_LAZY, (NULL),
-            ("Internal error: frame number confusion"));
-        goto end;
-      }
-      g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
-      v4lmjpegsink->isqueued_queued_frames[frame] = 0;
-      g_cond_broadcast (v4lmjpegsink->cond_queued_frames[frame]);
-      g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-    }
-
-    frame = (frame + 1) % v4lmjpegsink->breq.count;
-  }
-
-end:
-  GST_DEBUG_OBJECT (v4lmjpegsink, "Sync thread got signalled to exit");
-  g_thread_exit (NULL);
-  return NULL;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_queue_frame()
- *   queue a frame for playback
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsink_queue_frame (GstV4lMjpegSink * v4lmjpegsink, gint num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsink, "queueing frame %d", num);
-
-  /* queue on this frame */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_QBUF_PLAY,
-          &num) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, WRITE, (NULL),
-        ("Failed to queue frame %d: %s", num, g_strerror (errno)));
-    return FALSE;
-  }
-
-  g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
-  v4lmjpegsink->isqueued_queued_frames[num] = 1;
-  g_cond_broadcast (v4lmjpegsink->cond_queued_frames[num]);
-  g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_sync_frame()
- *   wait for a frame to be finished playing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsink_sync_frame (GstV4lMjpegSink * v4lmjpegsink, gint * num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsink, "syncing on next frame");
-
-  /* calculate next frame */
-  v4lmjpegsink->current_frame =
-      (v4lmjpegsink->current_frame + 1) % v4lmjpegsink->breq.count;
-  *num = v4lmjpegsink->current_frame;
-
-  g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
-  if (v4lmjpegsink->isqueued_queued_frames[*num] == 1) {
-    g_cond_wait (v4lmjpegsink->cond_queued_frames[*num],
-        v4lmjpegsink->mutex_queued_frames);
-  }
-  if (v4lmjpegsink->isqueued_queued_frames[*num] != 0) {
-    g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-    return FALSE;
-  } else
-    g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_set_buffer()
- *   set buffer options
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_set_buffer (GstV4lMjpegSink * v4lmjpegsink,
-    gint numbufs, gint bufsize)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsink,
-      "setting buffer info to numbufs = %d, bufsize = %d KB", numbufs, bufsize);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  v4lmjpegsink->breq.size = bufsize * 1024;
-  v4lmjpegsink->breq.count = numbufs;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_set_playback()
- *   set playback options (video, interlacing, etc.)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_set_playback (GstV4lMjpegSink * v4lmjpegsink,
-    gint width,
-    gint height, gint x_offset, gint y_offset, gint norm, gint interlacing)
-{
-  gint mw, mh;
-  struct mjpeg_params bparm;
-
-  GST_DEBUG_OBJECT (v4lmjpegsink,
-      "setting size=%dx%d, X/Y offsets=%d/%d, norm=%d, interlacing=%d\n",
-      width, height, x_offset, y_offset, norm, interlacing);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  /*GST_V4L_CHECK_NOT_ACTIVE(GST_V4LELEMENT(v4lmjpegsink)); */
-
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_G_PARAMS,
-          &bparm) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SETTINGS, (NULL),
-        GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  bparm.input = 0;
-  bparm.norm = norm;
-  bparm.decimation = 0;         /* we'll set proper values later on */
-
-  /* maxwidth is broken on marvel cards */
-  mw = GST_V4LELEMENT (v4lmjpegsink)->vcap.maxwidth;
-  if (mw != 768 && mw != 640)
-    mw = 720;
-  mh = (norm == VIDEO_MODE_NTSC ? 480 : 576);
-
-  if (width > mw || height > mh) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
-        ("Video dimensions (%dx%d) are larger than device max (%dx%d)",
-            width, height, mw, mh));
-    return FALSE;
-  }
-
-  if (width <= mw / 4)
-    bparm.HorDcm = 4;
-  else if (width <= mw / 2)
-    bparm.HorDcm = 2;
-  else
-    bparm.HorDcm = 1;
-
-  /* TODO: add proper interlacing handling */
-#if 0
-  if (interlacing != INTERLACING_NOT_INTERLACED) {
-    bparm.field_per_buff = 2;
-    bparm.TmpDcm = 1;
-
-    if (height <= mh / 2)
-      bparm.VerDcm = 2;
-    else
-      bparm.VerDcm = 1;
-  } else
-#endif
-  {
-    if (height > mh / 2) {
-      GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
-          ("Video dimensions (%dx%d) too large for non-interlaced playback (%dx%d)",
-              width, height, mw, mh / 2));
-      return FALSE;
-    }
-
-    bparm.field_per_buff = 1;
-    bparm.TmpDcm = 2;
-
-    if (height <= mh / 4)
-      bparm.VerDcm = 2;
-    else
-      bparm.VerDcm = 1;
-  }
-
-  /* TODO: add proper interlacing handling */
-#if 0
-  bparm.odd_even = (interlacing == INTERLACING_TOP_FIRST);
-#endif
-
-  bparm.quality = 100;
-  bparm.img_width = bparm.HorDcm * width;
-  bparm.img_height = bparm.VerDcm * height / bparm.field_per_buff;
-
-  /* image X/Y offset on device */
-  if (x_offset < 0)
-    bparm.img_x = (mw - bparm.img_width) / 2;
-  else {
-    if (x_offset + bparm.img_width > mw)
-      bparm.img_x = mw - bparm.img_width;
-    else
-      bparm.img_x = x_offset;
-  }
-
-  if (y_offset < 0)
-    bparm.img_y = (mh / 2 - bparm.img_height) / 2;
-  else {
-    if (y_offset + bparm.img_height * 2 > mh)
-      bparm.img_y = mh / 2 - bparm.img_height;
-    else
-      bparm.img_y = y_offset / 2;
-  }
-
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_S_PARAMS,
-          &bparm) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SETTINGS, (NULL),
-        GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_init()
- *   initialize playback system, set up buffer, etc.
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_init (GstV4lMjpegSink * v4lmjpegsink)
-{
-  gint n;
-
-  GST_DEBUG_OBJECT (v4lmjpegsink, "initting playback subsystem");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  /* Request buffers */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_REQBUFS,
-          &(v4lmjpegsink->breq)) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  GST_INFO_OBJECT (v4lmjpegsink, "Got %ld buffers of size %ld KB",
-      v4lmjpegsink->breq.count, v4lmjpegsink->breq.size / 1024);
-
-  /* Map the buffers */
-  GST_V4LELEMENT (v4lmjpegsink)->buffer = mmap (0,
-      v4lmjpegsink->breq.count * v4lmjpegsink->breq.size,
-      PROT_READ | PROT_WRITE, MAP_SHARED,
-      GST_V4LELEMENT (v4lmjpegsink)->video_fd, 0);
-  if (GST_V4LELEMENT (v4lmjpegsink)->buffer == MAP_FAILED) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
-        ("Error mapping video buffers: %s", g_strerror (errno)));
-    GST_V4LELEMENT (v4lmjpegsink)->buffer = NULL;
-    return FALSE;
-  }
-
-  /* allocate/init the GThread thingies */
-  v4lmjpegsink->mutex_queued_frames = g_mutex_new ();
-  v4lmjpegsink->isqueued_queued_frames = (gint8 *)
-      malloc (sizeof (gint8) * v4lmjpegsink->breq.count);
-  if (!v4lmjpegsink->isqueued_queued_frames) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
-        ("Failed to create queue tracker: %s", g_strerror (errno)));
-    return FALSE;
-  }
-  v4lmjpegsink->cond_queued_frames = (GCond **)
-      malloc (sizeof (GCond *) * v4lmjpegsink->breq.count);
-  if (!v4lmjpegsink->cond_queued_frames) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
-        ("Failed to create queue condition holders: %s", g_strerror (errno)));
-    return FALSE;
-  }
-  for (n = 0; n < v4lmjpegsink->breq.count; n++)
-    v4lmjpegsink->cond_queued_frames[n] = g_cond_new ();
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_start()
- *   start playback system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_start (GstV4lMjpegSink * v4lmjpegsink)
-{
-  GError *error;
-  gint n;
-
-  GST_DEBUG_OBJECT (v4lmjpegsink, "starting playback");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  /* mark all buffers as unqueued */
-  for (n = 0; n < v4lmjpegsink->breq.count; n++)
-    v4lmjpegsink->isqueued_queued_frames[n] = 0;
-
-  v4lmjpegsink->current_frame = -1;
-
-  /* create sync() thread */
-  v4lmjpegsink->thread_queued_frames =
-      g_thread_create (gst_v4lmjpegsink_sync_thread, (void *) v4lmjpegsink,
-      TRUE, &error);
-  if (!v4lmjpegsink->thread_queued_frames) {
-    GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
-        ("Failed to create sync thread: %s", error->message));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_get_buffer()
- *   get address of a buffer
- * return value: buffer's address or NULL
- ******************************************************/
-
-guint8 *
-gst_v4lmjpegsink_get_buffer (GstV4lMjpegSink * v4lmjpegsink, gint num)
-{
-  /*GST_DEBUG_OBJECT (v4lmjpegsink, gst_v4lmjpegsink_get_buffer(), num = %d", num); */
-
-  if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsink)) ||
-      !GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsink)))
-    return NULL;
-
-  if (num < 0 || num >= v4lmjpegsink->breq.count)
-    return NULL;
-
-  return GST_V4LELEMENT (v4lmjpegsink)->buffer +
-      (v4lmjpegsink->breq.size * num);
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_play_frame()
- *   queue a new buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_play_frame (GstV4lMjpegSink * v4lmjpegsink, gint num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsink, "playing frame %d", num);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  if (!gst_v4lmjpegsink_queue_frame (v4lmjpegsink, num))
-    return FALSE;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_wait_frame()
- *   wait for buffer to be actually played
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_wait_frame (GstV4lMjpegSink * v4lmjpegsink, gint * num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsink,
-      "waiting for next frame to be finished playing");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  if (!gst_v4lmjpegsink_sync_frame (v4lmjpegsink, num))
-    return FALSE;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_stop()
- *   stop playback system and sync on remaining frames
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_stop (GstV4lMjpegSink * v4lmjpegsink)
-{
-  gint num;
-
-  GST_DEBUG_OBJECT (v4lmjpegsink, "stopping playback");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  /* mark next buffer as wrong */
-  if (!gst_v4lmjpegsink_sync_frame (v4lmjpegsink, &num) ||
-      !gst_v4lmjpegsink_queue_frame (v4lmjpegsink, num)) {
-    return FALSE;
-  }
-
-  /* .. and wait for all buffers to be queued on */
-  g_thread_join (v4lmjpegsink->thread_queued_frames);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_deinit()
- *   deinitialize the playback system and unmap buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_deinit (GstV4lMjpegSink * v4lmjpegsink)
-{
-  int n;
-
-  GST_DEBUG_OBJECT (v4lmjpegsink, "quitting playback subsystem");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
-  /* free GThread thingies */
-  g_mutex_free (v4lmjpegsink->mutex_queued_frames);
-  for (n = 0; n < v4lmjpegsink->breq.count; n++)
-    g_cond_free (v4lmjpegsink->cond_queued_frames[n]);
-  free (v4lmjpegsink->cond_queued_frames);
-  free (v4lmjpegsink->isqueued_queued_frames);
-
-  /* unmap the buffer */
-  munmap (GST_V4LELEMENT (v4lmjpegsink)->buffer,
-      v4lmjpegsink->breq.size * v4lmjpegsink->breq.count);
-  GST_V4LELEMENT (v4lmjpegsink)->buffer = NULL;
-
-  return TRUE;
-}
diff --git a/sys/v4l/v4lmjpegsink_calls.h b/sys/v4l/v4lmjpegsink_calls.h
deleted file mode 100644 (file)
index beebaf4..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsink_calls.c: functions for hardware MJPEG video sink
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_MJPEG_SINK_CALLS_H__
-#define __V4L_MJPEG_SINK_CALLS_H__
-
-#include "gstv4lmjpegsink.h"
-#include "v4l_calls.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* frame playback on device */
-gboolean gst_v4lmjpegsink_set_buffer      (GstV4lMjpegSink *v4lmjpegsink,
-                                           gint            numbufs,
-                                           gint            bufsize);
-gboolean gst_v4lmjpegsink_set_playback    (GstV4lMjpegSink *v4lmjpegsink,
-                                           gint            width,
-                                           gint            height,
-                                           gint            x_offset,
-                                           gint            y_offset,
-                                           gint            norm,
-                                           gint            interlacing);
-gboolean gst_v4lmjpegsink_playback_init   (GstV4lMjpegSink *v4lmjpegsink);
-gboolean gst_v4lmjpegsink_playback_start  (GstV4lMjpegSink *v4lmjpegsink);
-guint8 * gst_v4lmjpegsink_get_buffer      (GstV4lMjpegSink *v4lmjpegsink,
-                                           gint            num);
-gboolean gst_v4lmjpegsink_play_frame      (GstV4lMjpegSink *v4lmjpegsink,
-                                           gint            num);
-gboolean gst_v4lmjpegsink_wait_frame      (GstV4lMjpegSink *v4lmjpegsink,
-                                           gint            *num);
-gboolean gst_v4lmjpegsink_playback_stop   (GstV4lMjpegSink *v4lmjpegsink);
-gboolean gst_v4lmjpegsink_playback_deinit (GstV4lMjpegSink *v4lmjpegsink);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __V4L_MJPEG_SINK_CALLS_H__ */
diff --git a/sys/v4l/v4lmjpegsrc_calls.c b/sys/v4l/v4lmjpegsrc_calls.c
deleted file mode 100644 (file)
index 60bdfce..0000000
+++ /dev/null
@@ -1,577 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsrc_calls.c: functions for hardware MJPEG video source
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "v4lmjpegsrc_calls.h"
-
-/* On some systems MAP_FAILED seems to be missing */
-#ifndef MAP_FAILED
-#define MAP_FAILED ( (caddr_t) -1 )
-#endif
-
-#define MIN_BUFFERS_QUEUED 2
-
-GST_DEBUG_CATEGORY_EXTERN (v4lmjpegsrc_debug);
-#define GST_CAT_DEFAULT v4lmjpegsrc_debug
-
-enum
-{
-  QUEUE_STATE_ERROR = -1,
-  QUEUE_STATE_READY_FOR_QUEUE,
-  QUEUE_STATE_QUEUED,
-  QUEUE_STATE_SYNCED,
-};
-
-/******************************************************
- * gst_v4lmjpegsrc_queue_frame():
- *   queue a frame for capturing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsrc_queue_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "queueing frame %d", num);
-
-  if (v4lmjpegsrc->frame_queue_state[num] != QUEUE_STATE_READY_FOR_QUEUE) {
-    return FALSE;
-  }
-
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_QBUF_CAPT,
-          &num) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL),
-        ("Error queueing a buffer (%d): %s", num, g_strerror (errno)));
-    return FALSE;
-  }
-
-  v4lmjpegsrc->frame_queue_state[num] = QUEUE_STATE_QUEUED;
-  v4lmjpegsrc->num_queued++;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_sync_next_frame():
- *   sync on the next frame for capturing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsrc_sync_next_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint * num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "syncing on next frame");
-
-  if (v4lmjpegsrc->num_queued <= 0) {
-    return FALSE;
-  }
-
-  while (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd,
-          MJPIOC_SYNC, &(v4lmjpegsrc->bsync)) < 0) {
-    if (errno != EINTR) {
-      GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM);
-      return FALSE;
-    }
-    GST_DEBUG_OBJECT (v4lmjpegsrc, "Sync got interrupted");
-  }
-
-  *num = v4lmjpegsrc->bsync.frame;
-
-  v4lmjpegsrc->frame_queue_state[*num] = QUEUE_STATE_SYNCED;
-  v4lmjpegsrc->num_queued--;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_set_buffer():
- *   set buffer parameters (size/count)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_set_buffer (GstV4lMjpegSrc * v4lmjpegsrc,
-    gint numbufs, gint bufsize)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc,
-      "setting buffer info to numbufs = %d, bufsize = %d KB", numbufs, bufsize);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  v4lmjpegsrc->breq.size = bufsize * 1024;
-  v4lmjpegsrc->breq.count = numbufs;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_set_capture():
- *   set capture parameters (simple)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc * v4lmjpegsrc,
-    gint decimation, gint quality)
-{
-  int norm, input, mw;
-  struct mjpeg_params bparm;
-
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "setting decimation = %d, quality = %d",
-      decimation, quality);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lmjpegsrc), &input, &norm);
-
-  /* Query params for capture */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS,
-          &bparm) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
-        GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  bparm.decimation = decimation;
-  bparm.quality = quality;
-  bparm.norm = norm;
-  bparm.input = input;
-  bparm.APP_len = 0;            /* no JPEG markers - TODO: this is definately not right for decimation==1 */
-
-  mw = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth;
-  if (mw != 768 && mw != 640) {
-    if (decimation == 1)
-      mw = 720;
-    else
-      mw = 704;
-  }
-  v4lmjpegsrc->end_width = mw / decimation;
-  v4lmjpegsrc->end_height = (norm == VIDEO_MODE_NTSC ? 480 : 576) / decimation;
-
-  /* TODO: interlacing */
-
-  /* Set params for capture */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS,
-          &bparm) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
-        GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_set_capture_m():
- *   set capture parameters (advanced)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc,
-    gint x_offset,
-    gint y_offset,
-    gint width, gint height, gint h_decimation, gint v_decimation, gint quality)
-{
-  gint norm, input;
-  gint maxwidth;
-  struct mjpeg_params bparm;
-
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "setting x_offset = %d, y_offset = %d, "
-      "width = %d, height = %d, h_decimation = %d, v_decimation = %d, quality = %d\n",
-      x_offset, y_offset, width, height, h_decimation, v_decimation, quality);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lmjpegsrc), &input, &norm);
-
-  if (GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth != 768 &&
-      GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth != 640)
-    maxwidth = 720;
-  else
-    maxwidth = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth;
-
-  /* Query params for capture */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS,
-          &bparm) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
-        GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  bparm.decimation = 0;
-  bparm.quality = quality;
-  bparm.norm = norm;
-  bparm.input = input;
-  bparm.APP_len = 0;            /* no JPEG markers - TODO: this is definately
-                                 * not right for decimation==1 */
-
-  if (width <= 0) {
-    if (x_offset < 0)
-      x_offset = 0;
-    width = (maxwidth == 720
-        && h_decimation != 1) ? 704 : maxwidth - 2 * x_offset;
-  } else {
-    if (x_offset < 0)
-      x_offset = (maxwidth - width) / 2;
-  }
-
-  if (height <= 0) {
-    if (y_offset < 0)
-      y_offset = 0;
-    height = (norm == VIDEO_MODE_NTSC) ? 480 : 576 - 2 * y_offset;
-  } else {
-    if (y_offset < 0)
-      y_offset = ((norm == VIDEO_MODE_NTSC) ? 480 : 576 - height) / 2;
-  }
-
-  if (width + x_offset > maxwidth) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
-        ("Image width+offset (%d) bigger than maximum (%d)",
-            width + x_offset, maxwidth));
-    return FALSE;
-  }
-  if ((width % (bparm.HorDcm * 16)) != 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, STREAM, FORMAT, (NULL),
-        ("Image width (%d) not multiple of %d (required for JPEG)",
-            width, bparm.HorDcm * 16));
-    return FALSE;
-  }
-  if (height + y_offset > (norm == VIDEO_MODE_NTSC ? 480 : 576)) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
-        ("Image height+offset (%d) bigger than maximum (%d)",
-            height + y_offset, (norm == VIDEO_MODE_NTSC ? 480 : 576)));
-    return FALSE;
-  }
-  /* RJ: Image height must only be a multiple of 8, but geom_height
-   * is double the field height
-   */
-  if ((height % (bparm.VerDcm * 16)) != 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, STREAM, FORMAT, (NULL),
-        ("Image height (%d) not multiple of %d (required for JPEG)",
-            height, bparm.VerDcm * 16));
-    return FALSE;
-  }
-
-  bparm.img_x = x_offset;
-  bparm.img_width = width;
-  bparm.img_y = y_offset;
-  bparm.img_height = height;
-  bparm.HorDcm = h_decimation;
-  bparm.VerDcm = (v_decimation == 4) ? 2 : 1;
-  bparm.TmpDcm = (v_decimation == 1) ? 1 : 2;
-  bparm.field_per_buff = (v_decimation == 1) ? 2 : 1;
-
-  v4lmjpegsrc->end_width = width / h_decimation;
-  v4lmjpegsrc->end_width = height / v_decimation;
-
-  /* TODO: interlacing */
-
-  /* Set params for capture */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS,
-          &bparm) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
-        GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_init():
- *   initialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc * v4lmjpegsrc)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "initting capture subsystem");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  /* Request buffers */
-  if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd,
-          MJPIOC_REQBUFS, &(v4lmjpegsrc->breq)) < 0) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
-    return FALSE;
-  }
-
-  if (v4lmjpegsrc->breq.count < MIN_BUFFERS_QUEUED) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL),
-        ("Too little buffers. We got %ld, we want at least %d",
-            v4lmjpegsrc->breq.count, MIN_BUFFERS_QUEUED));
-    return FALSE;
-  }
-
-  GST_INFO_OBJECT (v4lmjpegsrc, "Got %ld buffers of size %ld KB",
-      v4lmjpegsrc->breq.count, v4lmjpegsrc->breq.size / 1024);
-
-  /* keep track of queued buffers */
-  v4lmjpegsrc->frame_queue_state = (gint8 *)
-      g_malloc (sizeof (gint8) * v4lmjpegsrc->breq.count);
-
-  /* track how often to use each frame */
-  v4lmjpegsrc->use_num_times = (gint *)
-      g_malloc (sizeof (gint) * v4lmjpegsrc->breq.count);
-
-  /* lock for the frame_state */
-  v4lmjpegsrc->mutex_queue_state = g_mutex_new ();
-  v4lmjpegsrc->cond_queue_state = g_cond_new ();
-
-  /* Map the buffers */
-  GST_V4LELEMENT (v4lmjpegsrc)->buffer = mmap (0,
-      v4lmjpegsrc->breq.count * v4lmjpegsrc->breq.size,
-      PROT_READ | PROT_WRITE, MAP_SHARED,
-      GST_V4LELEMENT (v4lmjpegsrc)->video_fd, 0);
-  if (GST_V4LELEMENT (v4lmjpegsrc)->buffer == MAP_FAILED) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
-        ("Error mapping video buffers: %s", g_strerror (errno)));
-    GST_V4LELEMENT (v4lmjpegsrc)->buffer = NULL;
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_start():
- *   start streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_start (GstV4lMjpegSrc * v4lmjpegsrc)
-{
-  int n;
-
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "starting capture");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
-  v4lmjpegsrc->quit = FALSE;
-  v4lmjpegsrc->num_queued = 0;
-  v4lmjpegsrc->queue_frame = 0;
-
-  /* set all buffers ready to queue , this starts streaming capture */
-  for (n = 0; n < v4lmjpegsrc->breq.count; n++) {
-    v4lmjpegsrc->frame_queue_state[n] = QUEUE_STATE_READY_FOR_QUEUE;
-    if (!gst_v4lmjpegsrc_queue_frame (v4lmjpegsrc, n)) {
-      g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-      gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc);
-      return FALSE;
-    }
-  }
-
-  v4lmjpegsrc->is_capturing = TRUE;
-  g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_grab_frame():
- *   grab one frame during streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_grab_frame (GstV4lMjpegSrc * v4lmjpegsrc,
-    gint * num, gint * size)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "grabbing frame");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
-  /* do we have enough frames? */
-  while (v4lmjpegsrc->num_queued < MIN_BUFFERS_QUEUED ||
-      v4lmjpegsrc->frame_queue_state[v4lmjpegsrc->queue_frame] ==
-      QUEUE_STATE_READY_FOR_QUEUE) {
-    while (v4lmjpegsrc->frame_queue_state[v4lmjpegsrc->queue_frame] !=
-        QUEUE_STATE_READY_FOR_QUEUE && !v4lmjpegsrc->quit) {
-      GST_DEBUG_OBJECT (v4lmjpegsrc,
-          "Waiting for frames to become available (%d < %d)",
-          v4lmjpegsrc->num_queued, MIN_BUFFERS_QUEUED);
-      g_cond_wait (v4lmjpegsrc->cond_queue_state,
-          v4lmjpegsrc->mutex_queue_state);
-    }
-    if (v4lmjpegsrc->quit) {
-      g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-      return TRUE;              /* it won't get through anyway */
-    }
-    if (!gst_v4lmjpegsrc_queue_frame (v4lmjpegsrc, v4lmjpegsrc->queue_frame)) {
-      g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-      return FALSE;
-    }
-    v4lmjpegsrc->queue_frame =
-        (v4lmjpegsrc->queue_frame + 1) % v4lmjpegsrc->breq.count;
-  }
-
-  /* syncing on the buffer grabs it */
-  if (!gst_v4lmjpegsrc_sync_next_frame (v4lmjpegsrc, num)) {
-    return FALSE;
-  }
-
-  *size = v4lmjpegsrc->bsync.length;
-
-  g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_get_buffer():
- *   get the memory address of a single buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-guint8 *
-gst_v4lmjpegsrc_get_buffer (GstV4lMjpegSrc * v4lmjpegsrc, gint num)
-{
-  /*DEBUG("gst_v4lmjpegsrc_get_buffer(), num = %d", num); */
-
-  if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc)) ||
-      !GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc)))
-    return NULL;
-
-  if (num < 0 || num >= v4lmjpegsrc->breq.count)
-    return NULL;
-
-  return GST_V4LELEMENT (v4lmjpegsrc)->buffer + (v4lmjpegsrc->breq.size * num);
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_requeue_frame():
- *   requeue a frame for capturing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint num)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "requeueing frame %d", num);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  /* mark frame as 'ready to requeue' */
-  g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
-  if (v4lmjpegsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) {
-    GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
-        ("Invalid state %d (expected %d), can't requeue",
-            v4lmjpegsrc->frame_queue_state[num], QUEUE_STATE_SYNCED));
-    return FALSE;
-  }
-
-  v4lmjpegsrc->frame_queue_state[num] = QUEUE_STATE_READY_FOR_QUEUE;
-
-  /* let an optional wait know */
-  g_cond_broadcast (v4lmjpegsrc->cond_queue_state);
-
-  g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_stop():
- *   stop streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_stop (GstV4lMjpegSrc * v4lmjpegsrc)
-{
-  int n;
-
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "stopping capture");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
-  /* make an optional pending wait stop */
-  v4lmjpegsrc->quit = TRUE;
-  g_cond_broadcast (v4lmjpegsrc->cond_queue_state);
-
-  /* sync on remaining frames */
-  while (v4lmjpegsrc->num_queued > 0) {
-    gst_v4lmjpegsrc_sync_next_frame (v4lmjpegsrc, &n);
-  }
-
-  v4lmjpegsrc->is_capturing = FALSE;
-  g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_deinit():
- *   deinitialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_deinit (GstV4lMjpegSrc * v4lmjpegsrc)
-{
-  GST_DEBUG_OBJECT (v4lmjpegsrc, "quitting capture subsystem");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
-  /* unmap the buffer */
-  munmap (GST_V4LELEMENT (v4lmjpegsrc)->buffer,
-      v4lmjpegsrc->breq.size * v4lmjpegsrc->breq.count);
-  GST_V4LELEMENT (v4lmjpegsrc)->buffer = NULL;
-
-  /* free buffer tracker */
-  g_mutex_free (v4lmjpegsrc->mutex_queue_state);
-  g_cond_free (v4lmjpegsrc->cond_queue_state);
-  g_free (v4lmjpegsrc->frame_queue_state);
-  g_free (v4lmjpegsrc->use_num_times);
-
-  return TRUE;
-}
diff --git a/sys/v4l/v4lmjpegsrc_calls.h b/sys/v4l/v4lmjpegsrc_calls.h
deleted file mode 100644 (file)
index e873ea0..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsrc_calls.h: functions for hardware MJPEG video source
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_MJPEG_SRC_CALLS_H__
-#define __V4L_MJPEG_SRC_CALLS_H__
-
-#include "gstv4lmjpegsrc.h"
-#include "v4l_calls.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* frame grabbing/capture */
-gboolean gst_v4lmjpegsrc_set_buffer     (GstV4lMjpegSrc *v4lmjpegsrc,
-                                         gint           numbufs,
-                                         gint           bufsize);
-gboolean gst_v4lmjpegsrc_set_capture    (GstV4lMjpegSrc *v4lmjpegsrc,
-                                         gint           decimation,
-                                         gint           quality);
-gboolean gst_v4lmjpegsrc_set_capture_m  (GstV4lMjpegSrc *v4lmjpegsrc,
-                                         gint           x_offset,
-                                         gint           y_offset,
-                                         gint           width,
-                                         gint           height,
-                                         gint           h_decimation,
-                                         gint           v_decimation,
-                                         gint           quality);
-gboolean gst_v4lmjpegsrc_capture_init   (GstV4lMjpegSrc *v4lmjpegsrc);
-gboolean gst_v4lmjpegsrc_capture_start  (GstV4lMjpegSrc *v4lmjpegsrc);
-gboolean gst_v4lmjpegsrc_grab_frame     (GstV4lMjpegSrc *v4lmjpegsrc,
-                                         gint           *num,
-                                         gint           *size);
-guint8 * gst_v4lmjpegsrc_get_buffer     (GstV4lMjpegSrc *v4lmjpegsrc,
-                                         gint           num);
-gboolean gst_v4lmjpegsrc_requeue_frame  (GstV4lMjpegSrc *v4lmjpegsrc,
-                                         gint           num);
-gboolean gst_v4lmjpegsrc_capture_stop   (GstV4lMjpegSrc *v4lmjpegsrc);
-gboolean gst_v4lmjpegsrc_capture_deinit (GstV4lMjpegSrc *v4lmjpegsrc);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __V4L_MJPEG_SRC_CALLS_H__ */
diff --git a/sys/v4l/v4lsrc_calls.c b/sys/v4l/v4lsrc_calls.c
deleted file mode 100644 (file)
index 31bd6de..0000000
+++ /dev/null
@@ -1,764 +0,0 @@
-/* GStreamer
- *
- * v4lsrc_calls.c: generic V4L source functions
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "v4lsrc_calls.h"
-#include <sys/time.h>
-
-/* number of buffers to be queued *at least* before syncing */
-#define MIN_BUFFERS_QUEUED 2
-
-/* On some systems MAP_FAILED seems to be missing */
-#ifndef MAP_FAILED
-#define MAP_FAILED ( (caddr_t) -1 )
-#endif
-
-GST_DEBUG_CATEGORY_EXTERN (v4l_debug);
-
-#define GST_CAT_DEFAULT v4l_debug
-
-#ifndef GST_DISABLE_GST_DEBUG
-/* palette names */
-static const char *v4l_palette_name[] = {
-  "",                           /* 0 */
-  "grayscale",                  /* VIDEO_PALETTE_GREY */
-  "Hi-420",                     /* VIDEO_PALETTE_HI420 */
-  "16-bit RGB (RGB-565)",       /* VIDEO_PALETTE_RB565 */
-  "24-bit RGB",                 /* VIDEO_PALETTE_RGB24 */
-  "32-bit RGB",                 /* VIDEO_PALETTE_RGB32 */
-  "15-bit RGB (RGB-555)",       /* VIDEO_PALETTE_RGB555 */
-  "YUV-4:2:2 (packed)",         /* VIDEO_PALETTE_YUV422 */
-  "YUYV",                       /* VIDEO_PALETTE_YUYV */
-  "UYVY",                       /* VIDEO_PALETTE_UYVY */
-  "YUV-4:2:0 (packed)",         /* VIDEO_PALETTE_YUV420 */
-  "YUV-4:1:1 (packed)",         /* VIDEO_PALETTE_YUV411 */
-  "Raw",                        /* VIDEO_PALETTE_RAW */
-  "YUV-4:2:2 (planar)",         /* VIDEO_PALETTE_YUV422P */
-  "YUV-4:1:1 (planar)",         /* VIDEO_PALETTE_YUV411P */
-  "YUV-4:2:0 (planar)/I420",    /* VIDEO_PALETTE_YUV420P */
-  "YUV-4:1:0 (planar)"          /* VIDEO_PALETTE_YUV410P */
-};
-#endif
-
-/******************************************************
- * gst_v4lsrc_queue_frame():
- *   queue a frame for capturing
- *   (ie. instruct the hardware to start capture)
- *   Requires queue_state lock to be held!
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lsrc_queue_frame (GstV4lSrc * v4lsrc, gint num)
-{
-  GST_LOG_OBJECT (v4lsrc, "queueing frame %d", num);
-
-  if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_READY_FOR_QUEUE) {
-    return FALSE;
-  }
-
-  /* instruct the driver to prepare capture using buffer frame num */
-  v4lsrc->mmap.frame = num;
-  if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd,
-          VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, WRITE, (NULL),
-        ("Error queueing a buffer (%d): %s", num, g_strerror (errno)));
-    return FALSE;
-  }
-
-  v4lsrc->frame_queue_state[num] = QUEUE_STATE_QUEUED;
-  v4lsrc->num_queued++;
-
-  return TRUE;
-}
-
-/******************************************************
- * gst_v4lsrc_hard_sync_frame(GstV4lSrc *v4lsrc,gint num)
- *   sync a frame and set the timestamp correctly
- *   Requires queue_state lock to be held
- *****************************************************/
-
-static gboolean
-gst_v4lsrc_sync_frame (GstV4lSrc * v4lsrc, gint num)
-{
-  GST_LOG_OBJECT (v4lsrc, "VIOIOCSYNC on frame %d", num);
-
-  if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_QUEUED) {
-    return FALSE;
-  }
-
-  while (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCSYNC, &num) < 0) {
-    /* if the sync() got interrupted, we can retry */
-    if (errno != EINTR) {
-      v4lsrc->frame_queue_state[num] = QUEUE_STATE_ERROR;
-      GST_ELEMENT_ERROR (v4lsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM);
-      return FALSE;
-    }
-    GST_DEBUG_OBJECT (v4lsrc, "Sync got interrupted");
-  }
-  GST_LOG_OBJECT (v4lsrc, "VIOIOCSYNC on frame %d done", num);
-
-  v4lsrc->frame_queue_state[num] = QUEUE_STATE_SYNCED;
-  v4lsrc->num_queued--;
-
-  return TRUE;
-}
-
-/******************************************************
- * gst_v4lsrc_set_capture():
- *   set capture parameters, palette = VIDEO_PALETTE_*
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_set_capture (GstV4lSrc * v4lsrc,
-    gint width, gint height, gint palette)
-{
-  GST_DEBUG_OBJECT (v4lsrc,
-      "capture properties set to %dx%d, palette %d", width, height, palette);
-
-  v4lsrc->mmap.width = width;
-  v4lsrc->mmap.height = height;
-  v4lsrc->mmap.format = palette;
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_init():
- *   initialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_init (GstV4lSrc * v4lsrc)
-{
-  GST_DEBUG_OBJECT (v4lsrc, "initting capture subsystem");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  /* request the mmap buffer info:
-   * total size of mmap buffer, number of frames, offsets of frames */
-  if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCGMBUF,
-          &(v4lsrc->mbuf)) < 0) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL),
-        ("Error getting buffer information: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  if (v4lsrc->mbuf.frames < MIN_BUFFERS_QUEUED) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL),
-        ("Not enough buffers. We got %d, we want at least %d",
-            v4lsrc->mbuf.frames, MIN_BUFFERS_QUEUED));
-    return FALSE;
-  }
-
-  GST_INFO_OBJECT (v4lsrc, "Got %d buffers (\'%s\') with total size %d KB",
-      v4lsrc->mbuf.frames, v4l_palette_name[v4lsrc->mmap.format],
-      v4lsrc->mbuf.size / (v4lsrc->mbuf.frames * 1024));
-
-  /* keep track of queued buffers */
-  v4lsrc->frame_queue_state = (gint8 *)
-      g_malloc (sizeof (gint8) * v4lsrc->mbuf.frames);
-
-  /* lock for the frame_state */
-  v4lsrc->mutex_queue_state = g_mutex_new ();
-  v4lsrc->cond_queue_state = g_cond_new ();
-
-  /* Map the buffers */
-  GST_V4LELEMENT (v4lsrc)->buffer = mmap (NULL, v4lsrc->mbuf.size,
-      PROT_READ | PROT_WRITE, MAP_SHARED, GST_V4LELEMENT (v4lsrc)->video_fd, 0);
-  if (GST_V4LELEMENT (v4lsrc)->buffer == MAP_FAILED) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, OPEN_READ_WRITE, (NULL),
-        ("Error mapping video buffers: %s", g_strerror (errno)));
-    GST_V4LELEMENT (v4lsrc)->buffer = NULL;
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_start():
- *   start streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_start (GstV4lSrc * v4lsrc)
-{
-  int n;
-
-  GST_DEBUG_OBJECT (v4lsrc, "starting capture");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  g_mutex_lock (v4lsrc->mutex_queue_state);
-
-  v4lsrc->quit = FALSE;
-  v4lsrc->num_queued = 0;
-  v4lsrc->sync_frame = 0;
-  v4lsrc->queue_frame = 0;
-
-  /* set all buffers ready to queue, and queue captures to the device.
-   * This starts streaming capture */
-  for (n = 0; n < v4lsrc->mbuf.frames; n++) {
-    v4lsrc->frame_queue_state[n] = QUEUE_STATE_READY_FOR_QUEUE;
-    if (!gst_v4lsrc_queue_frame (v4lsrc, n)) {
-      g_mutex_unlock (v4lsrc->mutex_queue_state);
-      gst_v4lsrc_capture_stop (v4lsrc);
-      return FALSE;
-    }
-  }
-
-  v4lsrc->is_capturing = TRUE;
-  g_mutex_unlock (v4lsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_grab_frame():
- *   capture one frame during streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_grab_frame (GstV4lSrc * v4lsrc, gint * num)
-{
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  GST_LOG_OBJECT (v4lsrc, "grabbing frame");
-
-  g_mutex_lock (v4lsrc->mutex_queue_state);
-
-  /* do we have enough frames? */
-  while (v4lsrc->num_queued < MIN_BUFFERS_QUEUED ||
-      v4lsrc->frame_queue_state[v4lsrc->queue_frame] ==
-      QUEUE_STATE_READY_FOR_QUEUE) {
-    while (v4lsrc->frame_queue_state[v4lsrc->queue_frame] !=
-        QUEUE_STATE_READY_FOR_QUEUE && !v4lsrc->quit) {
-      GST_DEBUG_OBJECT (v4lsrc,
-          "Waiting for frames to become available (queued %d < minimum %d)",
-          v4lsrc->num_queued, MIN_BUFFERS_QUEUED);
-      g_cond_wait (v4lsrc->cond_queue_state, v4lsrc->mutex_queue_state);
-    }
-    if (v4lsrc->quit) {
-      g_mutex_unlock (v4lsrc->mutex_queue_state);
-      return FALSE;
-    }
-    if (!gst_v4lsrc_queue_frame (v4lsrc, v4lsrc->queue_frame)) {
-      g_mutex_unlock (v4lsrc->mutex_queue_state);
-      return FALSE;
-    }
-    v4lsrc->queue_frame = (v4lsrc->queue_frame + 1) % v4lsrc->mbuf.frames;
-  }
-
-  /* syncing on the buffer grabs it */
-  *num = v4lsrc->sync_frame;
-  if (!gst_v4lsrc_sync_frame (v4lsrc, *num)) {
-    g_mutex_unlock (v4lsrc->mutex_queue_state);
-    return FALSE;
-  }
-  v4lsrc->sync_frame = (v4lsrc->sync_frame + 1) % v4lsrc->mbuf.frames;
-
-  g_mutex_unlock (v4lsrc->mutex_queue_state);
-
-  GST_LOG_OBJECT (v4lsrc, "grabbed frame %d", *num);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_get_buffer():
- *   get the address of the given frame number in the mmap'd buffer
- * return value: the buffer's address or NULL
- ******************************************************/
-
-guint8 *
-gst_v4lsrc_get_buffer (GstV4lSrc * v4lsrc, gint num)
-{
-  if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc)) ||
-      !GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc)))
-    return NULL;
-
-  if (num < 0 || num >= v4lsrc->mbuf.frames)
-    return NULL;
-
-  return GST_V4LELEMENT (v4lsrc)->buffer + v4lsrc->mbuf.offsets[num];
-}
-
-
-/******************************************************
- * gst_v4lsrc_requeue_frame():
- *   re-queue a frame after we're done with the buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_requeue_frame (GstV4lSrc * v4lsrc, gint num)
-{
-  GST_LOG_OBJECT (v4lsrc, "requeueing frame %d", num);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  /* mark frame as 'ready to requeue' */
-  g_mutex_lock (v4lsrc->mutex_queue_state);
-
-  if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL),
-        ("Invalid state %d (expected %d), can't requeue",
-            v4lsrc->frame_queue_state[num], QUEUE_STATE_SYNCED));
-    return FALSE;
-  }
-
-  v4lsrc->frame_queue_state[num] = QUEUE_STATE_READY_FOR_QUEUE;
-
-  /* let an optional wait know */
-  g_cond_broadcast (v4lsrc->cond_queue_state);
-
-  g_mutex_unlock (v4lsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_stop():
- *   stop streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_stop (GstV4lSrc * v4lsrc)
-{
-  GST_DEBUG_OBJECT (v4lsrc, "stopping capture");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  g_mutex_lock (v4lsrc->mutex_queue_state);
-  v4lsrc->is_capturing = FALSE;
-
-  /* make an optional pending wait stop */
-  v4lsrc->quit = TRUE;
-  g_cond_broadcast (v4lsrc->cond_queue_state);
-
-  /* sync on remaining frames */
-  while (1) {
-    if (v4lsrc->frame_queue_state[v4lsrc->sync_frame] == QUEUE_STATE_QUEUED) {
-      gst_v4lsrc_sync_frame (v4lsrc, v4lsrc->sync_frame);
-      v4lsrc->sync_frame = (v4lsrc->sync_frame + 1) % v4lsrc->mbuf.frames;
-    } else {
-      break;
-    }
-  }
-
-  g_mutex_unlock (v4lsrc->mutex_queue_state);
-
-  return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_deinit():
- *   deinitialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_deinit (GstV4lSrc * v4lsrc)
-{
-  GST_DEBUG_OBJECT (v4lsrc, "quitting capture subsystem");
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  /* free buffer tracker */
-  g_mutex_free (v4lsrc->mutex_queue_state);
-  v4lsrc->mutex_queue_state = NULL;
-  g_cond_free (v4lsrc->cond_queue_state);
-  v4lsrc->cond_queue_state = NULL;
-  g_free (v4lsrc->frame_queue_state);
-  v4lsrc->frame_queue_state = NULL;
-
-  /* unmap the buffer */
-  if (munmap (GST_V4LELEMENT (v4lsrc)->buffer, v4lsrc->mbuf.size) == -1) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, CLOSE, (NULL),
-        ("error munmap'ing capture buffer: %s", g_strerror (errno)));
-    return FALSE;
-  }
-  GST_V4LELEMENT (v4lsrc)->buffer = NULL;
-
-  return TRUE;
-}
-
-/******************************************************
- * gst_v4lsrc_try_capture():
- *   try out a capture on the device
- *   This has to be done before initializing the
- *   actual capture system, to make sure we don't
- *   mess up anything. So we need to mini-mmap()
- *   a buffer here, queue and sync on one buffer,
- *   and unmap it.
- *   This is ugly, yes, I know - but it's a major
- *   design flaw of v4l1 that you don't know in
- *   advance which formats will be supported...
- *   This is better than "just assuming that it'll
- *   work"...
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_try_capture (GstV4lSrc * v4lsrc, gint width, gint height,
-    gint palette)
-{
-  /* so, we need a buffer and some more stuff */
-  int frame = 0;
-  guint8 *buffer;
-  struct video_mbuf vmbuf;
-  struct video_mmap vmmap;
-
-  GST_DEBUG_OBJECT (v4lsrc, "try out %dx%d, palette format %d (%s)",
-      width, height, palette, v4l_palette_name[palette]);
-  GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
-  GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
-  /* let's start by requesting a buffer and mmap()'ing it */
-  if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCGMBUF, &vmbuf) < 0) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL),
-        ("Error getting buffer information: %s", g_strerror (errno)));
-    return FALSE;
-  }
-  /* Map the buffers */
-  buffer = mmap (NULL, vmbuf.size, PROT_READ | PROT_WRITE,
-      MAP_SHARED, GST_V4LELEMENT (v4lsrc)->video_fd, 0);
-  if (buffer == MAP_FAILED) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, OPEN_READ_WRITE, (NULL),
-        ("Error mapping our try-out buffer: %s", g_strerror (errno)));
-    return FALSE;
-  }
-
-  /* now that we have a buffer, let's try out our format */
-  vmmap.width = width;
-  vmmap.height = height;
-  vmmap.format = palette;
-  vmmap.frame = frame;
-  if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCMCAPTURE, &vmmap) < 0) {
-    if (errno != EINVAL)        /* our format failed! */
-      GST_ERROR_OBJECT (v4lsrc,
-          "Error queueing our try-out buffer: %s", g_strerror (errno));
-    munmap (buffer, vmbuf.size);
-    return FALSE;
-  }
-
-  if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCSYNC, &frame) < 0) {
-    GST_ELEMENT_ERROR (v4lsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM);
-    munmap (buffer, vmbuf.size);
-    return FALSE;
-  }
-
-  munmap (buffer, vmbuf.size);
-
-  /* if we got here, it worked! woohoo, the format is supported! */
-  return TRUE;
-}
-
-#ifndef GST_DISABLE_GST_DEBUG
-const char *
-gst_v4lsrc_palette_name (int i)
-{
-  return v4l_palette_name[i];
-}
-#endif
-
-gboolean
-gst_v4lsrc_get_fps (GstV4lSrc * v4lsrc, gint * fps_n, gint * fps_d)
-{
-  gint norm;
-  gint fps_index;
-  struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-
-  /* check if we have vwin window properties giving a framerate,
-   * as is done for webcams
-   * See http://www.smcc.demon.nl/webcam/api.html
-   * which is used for the Philips and qce-ga drivers */
-  fps_index = (vwin->flags >> 16) & 0x3F;       /* 6 bit index for framerate */
-
-  /* webcams have a non-zero fps_index */
-  if (fps_index != 0) {
-    /* index of 16 corresponds to 15 fps */
-    GST_DEBUG_OBJECT (v4lsrc, "device reports fps of %d/%d (%.4f)",
-        fps_index * 15, 16, fps_index * 15.0 / 16);
-
-    if (fps_n)
-      *fps_n = fps_index * 15;
-    if (fps_d)
-      *fps_d = 16;
-
-    return TRUE;
-  }
-
-  /* removed fps estimation code here */
-
-  /* if that failed ... */
-
-  if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc)))
-    return FALSE;
-
-  if (!gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lsrc), NULL, &norm))
-    return FALSE;
-
-  if (norm == VIDEO_MODE_NTSC) {
-    if (fps_n)
-      *fps_n = 30000;
-    if (fps_d)
-      *fps_d = 1001;
-  } else {
-    if (fps_n)
-      *fps_n = 25;
-    if (fps_d)
-      *fps_d = 1;
-  }
-
-  return TRUE;
-}
-
-/* get a list of possible framerates
- * this is only done for webcams;
- * other devices return NULL here.
- * this function takes a LONG time to execute.
- */
-GValue *
-gst_v4lsrc_get_fps_list (GstV4lSrc * v4lsrc)
-{
-  gint fps_index;
-  struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-  GstV4lElement *v4lelement = GST_V4LELEMENT (v4lsrc);
-
-  /* check if we have vwin window properties giving a framerate,
-   * as is done for webcams
-   * See http://www.smcc.demon.nl/webcam/api.html
-   * which is used for the Philips and qce-ga drivers */
-  fps_index = (vwin->flags >> 16) & 0x3F;       /* 6 bit index for framerate */
-
-  /* webcams have a non-zero fps_index */
-  if (fps_index == 0) {
-    GST_DEBUG_OBJECT (v4lsrc, "fps_index is 0, no webcam");
-    return NULL;
-  }
-  GST_DEBUG_OBJECT (v4lsrc, "fps_index is %d, so webcam", fps_index);
-
-  {
-    int i;
-    GValue *list = NULL;
-    GValue value = { 0 };
-
-    /* webcam detected, so try all framerates and return a list */
-
-    list = g_new0 (GValue, 1);
-    g_value_init (list, GST_TYPE_LIST);
-
-    /* index of 16 corresponds to 15 fps */
-    GST_DEBUG_OBJECT (v4lsrc, "device reports fps of %d/%d (%.4f)",
-        fps_index * 15, 16, fps_index * 15.0 / 16);
-    for (i = 0; i < 63; ++i) {
-      /* set bits 16 to 21 to 0 */
-      vwin->flags &= (0x3F00 - 1);
-      /* set bits 16 to 21 to the index */
-      vwin->flags |= i << 16;
-      if (gst_v4l_set_window_properties (v4lelement)) {
-        /* setting it succeeded.  FIXME: get it and check. */
-        g_value_init (&value, GST_TYPE_FRACTION);
-        gst_value_set_fraction (&value, i * 15, 16);
-        gst_value_list_append_value (list, &value);
-        g_value_unset (&value);
-      }
-    }
-    /* FIXME: set back the original fps_index */
-    vwin->flags &= (0x3F00 - 1);
-    vwin->flags |= fps_index << 16;
-    gst_v4l_set_window_properties (v4lelement);
-    return list;
-  }
-}
-
-#define GST_TYPE_V4LSRC_BUFFER (gst_v4lsrc_buffer_get_type())
-#define GST_IS_V4LSRC_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4LSRC_BUFFER))
-#define GST_V4LSRC_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4LSRC_BUFFER, GstV4lSrcBuffer))
-
-typedef struct _GstV4lSrcBuffer
-{
-  GstBuffer buffer;
-
-  GstV4lSrc *v4lsrc;
-
-  gint num;
-} GstV4lSrcBuffer;
-
-static void gst_v4lsrc_buffer_class_init (gpointer g_class,
-    gpointer class_data);
-static void gst_v4lsrc_buffer_init (GTypeInstance * instance, gpointer g_class);
-static void gst_v4lsrc_buffer_finalize (GstV4lSrcBuffer * v4lsrc_buffer);
-
-static GstBufferClass *v4lbuffer_parent_class = NULL;
-
-static GType
-gst_v4lsrc_buffer_get_type (void)
-{
-  static GType _gst_v4lsrc_buffer_type;
-
-  if (G_UNLIKELY (_gst_v4lsrc_buffer_type == 0)) {
-    static const GTypeInfo v4lsrc_buffer_info = {
-      sizeof (GstBufferClass),
-      NULL,
-      NULL,
-      gst_v4lsrc_buffer_class_init,
-      NULL,
-      NULL,
-      sizeof (GstV4lSrcBuffer),
-      0,
-      gst_v4lsrc_buffer_init,
-      NULL
-    };
-    _gst_v4lsrc_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
-        "GstV4lSrcBuffer", &v4lsrc_buffer_info, 0);
-  }
-  return _gst_v4lsrc_buffer_type;
-}
-
-static void
-gst_v4lsrc_buffer_class_init (gpointer g_class, gpointer class_data)
-{
-  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
-  v4lbuffer_parent_class = g_type_class_peek_parent (g_class);
-
-  mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
-      gst_v4lsrc_buffer_finalize;
-}
-
-static void
-gst_v4lsrc_buffer_init (GTypeInstance * instance, gpointer g_class)
-{
-
-}
-
-static void
-gst_v4lsrc_buffer_finalize (GstV4lSrcBuffer * v4lsrc_buffer)
-{
-  GstMiniObjectClass *miniobject_class;
-  GstV4lSrc *v4lsrc;
-  gint num;
-
-  v4lsrc = v4lsrc_buffer->v4lsrc;
-  num = v4lsrc_buffer->num;
-
-  GST_LOG_OBJECT (v4lsrc, "freeing buffer %p for frame %d", v4lsrc_buffer, num);
-
-  /* only requeue if we still have an mmap buffer */
-  if (GST_V4LELEMENT (v4lsrc)->buffer) {
-    GST_LOG_OBJECT (v4lsrc, "requeueing frame %d", num);
-    gst_v4lsrc_requeue_frame (v4lsrc, num);
-  }
-
-  gst_object_unref (v4lsrc);
-
-  miniobject_class = (GstMiniObjectClass *) v4lbuffer_parent_class;
-  miniobject_class->finalize (GST_MINI_OBJECT_CAST (v4lsrc_buffer));
-}
-
-/* Create a V4lSrc buffer from our mmap'd data area */
-GstBuffer *
-gst_v4lsrc_buffer_new (GstV4lSrc * v4lsrc, gint num)
-{
-  GstClockTime duration, timestamp, latency;
-  GstBuffer *buf;
-  GstClock *clock;
-  gint fps_n, fps_d;
-
-  GST_DEBUG_OBJECT (v4lsrc, "creating buffer for frame %d", num);
-
-  if (!(gst_v4lsrc_get_fps (v4lsrc, &fps_n, &fps_d)))
-    return NULL;
-
-  buf = (GstBuffer *) gst_mini_object_new (GST_TYPE_V4LSRC_BUFFER);
-
-  GST_V4LSRC_BUFFER (buf)->num = num;
-  GST_V4LSRC_BUFFER (buf)->v4lsrc = gst_object_ref (v4lsrc);
-
-  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
-  GST_BUFFER_DATA (buf) = gst_v4lsrc_get_buffer (v4lsrc, num);
-  GST_BUFFER_SIZE (buf) = v4lsrc->buffer_size;
-  GST_BUFFER_OFFSET (buf) = v4lsrc->offset++;
-  GST_BUFFER_OFFSET_END (buf) = v4lsrc->offset;
-
-  /* timestamps, LOCK to get clock and base time. */
-  GST_OBJECT_LOCK (v4lsrc);
-  if ((clock = GST_ELEMENT_CLOCK (v4lsrc))) {
-    /* we have a clock, get base time and ref clock */
-    timestamp = GST_ELEMENT_CAST (v4lsrc)->base_time;
-    gst_object_ref (clock);
-  } else {
-    /* no clock, can't set timestamps */
-    timestamp = GST_CLOCK_TIME_NONE;
-  }
-  GST_OBJECT_UNLOCK (v4lsrc);
-
-  duration =
-      gst_util_uint64_scale_int (GST_SECOND, fps_d * v4lsrc->offset, fps_n) -
-      gst_util_uint64_scale_int (GST_SECOND, fps_d * (v4lsrc->offset - 1),
-      fps_n);
-
-  latency = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
-
-  if (clock) {
-    /* the time now is the time of the clock minus the base time */
-    timestamp = gst_clock_get_time (clock) - timestamp;
-    gst_object_unref (clock);
-
-    /* adjust timestamp for frame latency (we assume we have a framerate) */
-    if (timestamp > latency)
-      timestamp -= latency;
-    else
-      timestamp = 0;
-  }
-
-  GST_BUFFER_TIMESTAMP (buf) = timestamp;
-  GST_BUFFER_DURATION (buf) = duration;
-
-  return buf;
-}
diff --git a/sys/v4l/v4lsrc_calls.h b/sys/v4l/v4lsrc_calls.h
deleted file mode 100644 (file)
index 18b3525..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GStreamer
- *
- * v4lsrc_calls.h: functions for V4L video source
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_SRC_CALLS_H__
-#define __V4L_SRC_CALLS_H__
-
-#include "gstv4lsrc.h"
-#include "v4l_calls.h"
-
-
-G_BEGIN_DECLS
-
-
-/* frame grabbing/capture (palette = VIDEO_PALETTE_* - see videodev.h) */
-gboolean gst_v4lsrc_set_capture    (GstV4lSrc *v4lsrc, gint width, gint height, gint palette);
-gboolean gst_v4lsrc_capture_init   (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_capture_start  (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_grab_frame     (GstV4lSrc *v4lsrc, gint *num);
-guint8 * gst_v4lsrc_get_buffer     (GstV4lSrc *v4lsrc, gint  num);
-gboolean gst_v4lsrc_requeue_frame  (GstV4lSrc *v4lsrc, gint  num);
-gboolean gst_v4lsrc_capture_stop   (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_capture_deinit (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_get_fps        (GstV4lSrc * v4lsrc, gint *fps_n, gint *fps_d);
-GValue * gst_v4lsrc_get_fps_list   (GstV4lSrc * v4lsrc);
-GstBuffer *gst_v4lsrc_buffer_new   (GstV4lSrc * v4lsrc, gint num);
-
-/* "the ugliest hack ever, now available at your local mirror" */
-gboolean gst_v4lsrc_try_capture    (GstV4lSrc *v4lsrc, gint width, gint height, gint palette);
-
-/* For debug purposes, share the palette names */
-#ifndef GST_DISABLE_GST_DEBUG
-const char *gst_v4lsrc_palette_name (int i);
-#endif
-
-
-G_END_DECLS
-
-
-#endif /* __V4L_SRC_CALLS_H__ */
diff --git a/sys/v4l/videodev_mjpeg.h b/sys/v4l/videodev_mjpeg.h
deleted file mode 100644 (file)
index e217fe4..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/* These are the MJPEG API extensions for the Video4Linux API,
-   first introduced by the Iomega Buz driver by Rainer Johanni 
-   <rainer@johanni.de>
-*/
-
-#ifndef __VIDEODEV_MJPEG_H__
-#define __VIDEODEV_MJPEG_H__
-
-/* This is identical with the mgavideo internal params struct, 
-   please tell me if you change this struct here ! <gz@lysator.liu.se) */
-struct mjpeg_params
-{
-
-   /* The following parameters can only be queried */
-
-   int major_version;            /* Major version number of driver */
-   int minor_version;            /* Minor version number of driver */
-
-   /* Main control parameters */
-
-   int input;                    /* Input channel: 0 = Composite, 1 = S-VHS */
-   int norm;                     /* Norm: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */
-   int decimation;               /* decimation of captured video,
-                                    enlargement of video played back.
-                                    Valid values are 1, 2, 4 or 0.
-                                    0 is a special value where the user
-                                    has full control over video scaling */
-
-   /* The following parameters only have to be set if decimation==0,
-      for other values of decimation they provide the data how the image is captured */
-
-   int HorDcm;                    /* Horizontal decimation: 1, 2 or 4 */
-   int VerDcm;                    /* Vertical decimation: 1 or 2 */
-   int TmpDcm;                    /* Temporal decimation: 1 or 2,
-                                     if TmpDcm==2 in capture every second frame is dropped,
-                                     in playback every frame is played twice */
-   int field_per_buff;            /* Number of fields per buffer: 1 or 2 */
-   int img_x;                     /* start of image in x direction */
-   int img_y;                     /* start of image in y direction */
-   int img_width;                 /* image width BEFORE decimation,
-                                     must be a multiple of HorDcm*16 */
-   int img_height;                /* image height BEFORE decimation,
-                                     must be a multiple of VerDcm*8 */
-
-   /* --- End of parameters for decimation==0 only --- */
-
-   /* JPEG control parameters */
-
-   int  quality;                  /* Measure for quality of compressed images.
-                                     Scales linearly with the size of the compressed images.
-                                     Must be beetween 0 and 100, 100 is a compression
-                                     ratio of 1:4 */
-
-   int  odd_even;                 /* Which field should come first ???
-                                     This is more aptly named "top_first",
-                                     i.e. (odd_even==1) --> top-field-first */
-
-   int  APPn;                     /* Number of APP segment to be written, must be 0..15 */
-   int  APP_len;                  /* Length of data in JPEG APPn segment */
-   char APP_data[60];             /* Data in the JPEG APPn segment. */
-
-   int  COM_len;                  /* Length of data in JPEG COM segment */
-   char COM_data[60];             /* Data in JPEG COM segment */
-
-   unsigned long jpeg_markers;    /* Which markers should go into the JPEG output.
-                                     Unless you exactly know what you do, leave them untouched.
-                                     Inluding less markers will make the resulting code
-                                     smaller, but there will be fewer applications
-                                     which can read it.
-                                     The presence of the APP and COM marker is
-                                     influenced by APP0_len and COM_len ONLY! */
-#define JPEG_MARKER_DHT (1<<3)    /* Define Huffman Tables */
-#define JPEG_MARKER_DQT (1<<4)    /* Define Quantization Tables */
-#define JPEG_MARKER_DRI (1<<5)    /* Define Restart Interval */
-#define JPEG_MARKER_COM (1<<6)    /* Comment segment */
-#define JPEG_MARKER_APP (1<<7)    /* App segment, driver will allways use APP0 */
-
-   int  VFIFO_FB;                 /* Flag for enabling Video Fifo Feedback.
-                                     If this flag is turned on and JPEG decompressing
-                                     is going to the screen, the decompress process
-                                     is stopped every time the Video Fifo is full.
-                                     This enables a smooth decompress to the screen
-                                     but the video output signal will get scrambled */
-
-   /* Misc */
-
-        char reserved[312];  /* Makes 512 bytes for this structure */
-};
-
-struct mjpeg_requestbuffers
-{
-   unsigned long count;      /* Number of buffers for MJPEG grabbing */
-   unsigned long size;       /* Size PER BUFFER in bytes */
-};
-
-struct mjpeg_sync
-{
-   unsigned long frame;      /* Frame (0 - n) for double buffer */
-   unsigned long length;     /* number of code bytes in buffer (capture only) */
-   unsigned long seq;        /* frame sequence number */
-   struct timeval timestamp; /* timestamp */
-};
-
-struct mjpeg_status
-{
-   int input;                /* Input channel, has to be set prior to BUZIOC_G_STATUS */
-   int signal;               /* Returned: 1 if valid video signal detected */
-   int norm;                 /* Returned: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */
-   int color;                /* Returned: 1 if color signal detected */
-};
-
-/*
-Private IOCTL to set up for displaying MJPEG
-*/
-#define MJPIOC_G_PARAMS       _IOR ('v', BASE_VIDIOCPRIVATE+0,  struct mjpeg_params)
-#define MJPIOC_S_PARAMS       _IOWR('v', BASE_VIDIOCPRIVATE+1,  struct mjpeg_params)
-#define MJPIOC_REQBUFS        _IOWR('v', BASE_VIDIOCPRIVATE+2,  struct mjpeg_requestbuffers)
-#define MJPIOC_QBUF_CAPT      _IOW ('v', BASE_VIDIOCPRIVATE+3,  int)
-#define MJPIOC_QBUF_PLAY      _IOW ('v', BASE_VIDIOCPRIVATE+4,  int)
-#define MJPIOC_SYNC           _IOR ('v', BASE_VIDIOCPRIVATE+5,  struct mjpeg_sync)
-#define MJPIOC_G_STATUS       _IOWR('v', BASE_VIDIOCPRIVATE+6,  struct mjpeg_status)
-
-#endif /* __VIDEODEV_MJPEG_H__ */
index 69f9bbc..df14448 100644 (file)
@@ -1,6 +1,6 @@
 plugin_LTLIBRARIES = libgstximagesink.la
 
-libgstximagesink_la_SOURCES =  ximagesink.c ximage.c
+libgstximagesink_la_SOURCES =  ximagesink.c ximage.c ximagepool.c
 libgstximagesink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
 libgstximagesink_la_LIBADD = \
        $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
@@ -11,4 +11,4 @@ libgstximagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstximagesink_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la
 libgstximagesink_la_LIBTOOLFLAGS = --tag=disable-static
 
-noinst_HEADERS = ximagesink.h 
+noinst_HEADERS = ximagesink.h ximagepool.h
index 24b7bf2..24a9e61 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include "ximagesink.h"
 
+GST_DEBUG_CATEGORY (gst_debug_ximagepool);
 GST_DEBUG_CATEGORY (gst_debug_ximagesink);
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
 
 static gboolean
 plugin_init (GstPlugin * plugin)
@@ -36,6 +36,10 @@ plugin_init (GstPlugin * plugin)
 
   GST_DEBUG_CATEGORY_INIT (gst_debug_ximagesink, "ximagesink", 0,
       "ximagesink element");
+  GST_DEBUG_CATEGORY_INIT (gst_debug_ximagepool, "ximagepool", 0,
+      "ximagepool object");
+
+  GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
 
   return TRUE;
 }
diff --git a/sys/ximage/ximagepool.c b/sys/ximage/ximagepool.c
new file mode 100644 (file)
index 0000000..06a5c72
--- /dev/null
@@ -0,0 +1,649 @@
+/* GStreamer
+ * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* Object header */
+#include "ximagesink.h"
+
+/* Debugging category */
+#include <gst/gstinfo.h>
+
+/* Helper functions */
+#include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideopool.h>
+
+GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagepool);
+#define GST_CAT_DEFAULT gst_debug_ximagepool
+
+struct _GstXImageBufferPoolPrivate
+{
+  GstCaps *caps;
+  GstVideoInfo info;
+  GstVideoAlignment align;
+  guint padded_width;
+  guint padded_height;
+  gboolean add_metavideo;
+  gboolean need_alignment;
+};
+
+static void gst_meta_ximage_free (GstMetaXImage * meta, GstBuffer * buffer);
+
+/* ximage metadata */
+const GstMetaInfo *
+gst_meta_ximage_get_info (void)
+{
+  static const GstMetaInfo *meta_ximage_info = NULL;
+
+  if (meta_ximage_info == NULL) {
+    meta_ximage_info = gst_meta_register ("GstMetaXImage", "GstMetaXImage",
+        sizeof (GstMetaXImage),
+        (GstMetaInitFunction) NULL,
+        (GstMetaFreeFunction) gst_meta_ximage_free,
+        (GstMetaCopyFunction) NULL, (GstMetaTransformFunction) NULL);
+  }
+  return meta_ximage_info;
+}
+
+/* X11 stuff */
+static gboolean error_caught = FALSE;
+
+static int
+gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent)
+{
+  char error_msg[1024];
+
+  XGetErrorText (display, xevent->error_code, error_msg, 1024);
+  GST_DEBUG ("ximagesink triggered an XError. error: %s", error_msg);
+  error_caught = TRUE;
+  return 0;
+}
+
+static GstMetaXImage *
+gst_buffer_add_meta_ximage (GstBuffer * buffer, GstXImageBufferPool * xpool)
+{
+  GstXImageSink *ximagesink;
+  int (*handler) (Display *, XErrorEvent *);
+  gboolean success = FALSE;
+  GstXContext *xcontext;
+  GstMetaXImage *meta;
+  gint width, height;
+  GstXImageBufferPoolPrivate *priv;
+
+  priv = xpool->priv;
+  ximagesink = xpool->sink;
+  xcontext = ximagesink->xcontext;
+
+  width = priv->padded_width;
+  height = priv->padded_height;
+
+  meta =
+      (GstMetaXImage *) gst_buffer_add_meta (buffer, GST_META_INFO_XIMAGE,
+      NULL);
+#ifdef HAVE_XSHM
+  meta->SHMInfo.shmaddr = ((void *) -1);
+  meta->SHMInfo.shmid = -1;
+#endif
+  meta->x = priv->align.padding_left;
+  meta->y = priv->align.padding_top;
+  meta->width = GST_VIDEO_INFO_WIDTH (&priv->info);
+  meta->height = GST_VIDEO_INFO_HEIGHT (&priv->info);
+  meta->sink = gst_object_ref (ximagesink);
+
+  GST_DEBUG_OBJECT (ximagesink, "creating image %p (%dx%d)", buffer,
+      width, height);
+
+  g_mutex_lock (ximagesink->x_lock);
+
+  /* Setting an error handler to catch failure */
+  error_caught = FALSE;
+  handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
+
+#ifdef HAVE_XSHM
+  if (xcontext->use_xshm) {
+    meta->ximage = XShmCreateImage (xcontext->disp,
+        xcontext->visual,
+        xcontext->depth, ZPixmap, NULL, &meta->SHMInfo, width, height);
+    if (!meta->ximage || error_caught) {
+      g_mutex_unlock (ximagesink->x_lock);
+
+      /* Reset error flag */
+      error_caught = FALSE;
+
+      /* Push a warning */
+      GST_ELEMENT_WARNING (ximagesink, RESOURCE, WRITE,
+          ("Failed to create output image buffer of %dx%d pixels",
+              width, height),
+          ("could not XShmCreateImage a %dx%d image", width, height));
+
+      /* Retry without XShm */
+      ximagesink->xcontext->use_xshm = FALSE;
+
+      /* Hold X mutex again to try without XShm */
+      g_mutex_lock (ximagesink->x_lock);
+
+      goto no_xshm;
+    }
+
+    /* we have to use the returned bytes_per_line for our shm size */
+    meta->size = meta->ximage->bytes_per_line * meta->ximage->height;
+    GST_LOG_OBJECT (ximagesink,
+        "XShm image size is %" G_GSIZE_FORMAT ", width %d, stride %d",
+        meta->size, width, meta->ximage->bytes_per_line);
+
+    /* get shared memory */
+    meta->SHMInfo.shmid = shmget (IPC_PRIVATE, meta->size, IPC_CREAT | 0777);
+    if (meta->SHMInfo.shmid == -1)
+      goto shmget_failed;
+
+    /* attach */
+    meta->SHMInfo.shmaddr = shmat (meta->SHMInfo.shmid, NULL, 0);
+    if (meta->SHMInfo.shmaddr == ((void *) -1))
+      goto shmat_failed;
+
+    /* now we can set up the image data */
+    meta->ximage->data = meta->SHMInfo.shmaddr;
+    meta->SHMInfo.readOnly = FALSE;
+
+    if (XShmAttach (xcontext->disp, &meta->SHMInfo) == 0)
+      goto xattach_failed;
+
+    XSync (xcontext->disp, FALSE);
+
+    /* Now that everyone has attached, we can delete the shared memory segment.
+     * This way, it will be deleted as soon as we detach later, and not
+     * leaked if we crash. */
+    shmctl (meta->SHMInfo.shmid, IPC_RMID, NULL);
+
+    GST_DEBUG_OBJECT (ximagesink, "XServer ShmAttached to 0x%x, id 0x%lx",
+        meta->SHMInfo.shmid, meta->SHMInfo.shmseg);
+  } else
+  no_xshm:
+#endif /* HAVE_XSHM */
+  {
+    guint allocsize;
+
+    meta->ximage = XCreateImage (xcontext->disp,
+        xcontext->visual,
+        xcontext->depth, ZPixmap, 0, NULL, width, height, xcontext->bpp, 0);
+    if (!meta->ximage || error_caught)
+      goto create_failed;
+
+    /* upstream will assume that rowstrides are multiples of 4, but this
+     * doesn't always seem to be the case with XCreateImage() */
+    if ((meta->ximage->bytes_per_line % 4) != 0) {
+      GST_WARNING_OBJECT (ximagesink, "returned stride not a multiple of 4 as "
+          "usually assumed");
+    }
+
+    /* we have to use the returned bytes_per_line for our image size */
+    meta->size = meta->ximage->bytes_per_line * meta->ximage->height;
+
+    /* alloc a bit more for unexpected strides to avoid crashes upstream.
+     * FIXME: if we get an unrounded stride, the image will be displayed
+     * distorted, since all upstream elements assume a rounded stride */
+    allocsize =
+        GST_ROUND_UP_4 (meta->ximage->bytes_per_line) * meta->ximage->height;
+
+    meta->ximage->data = g_malloc (allocsize);
+    GST_LOG_OBJECT (ximagesink,
+        "non-XShm image size is %" G_GSIZE_FORMAT " (alloced: %u), width %d, "
+        "stride %d", meta->size, allocsize, width,
+        meta->ximage->bytes_per_line);
+
+    XSync (xcontext->disp, FALSE);
+  }
+
+  /* Reset error handler */
+  error_caught = FALSE;
+  XSetErrorHandler (handler);
+
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, meta->ximage->data,
+          NULL, meta->size, 0, meta->size));
+
+  g_mutex_unlock (ximagesink->x_lock);
+
+  success = TRUE;
+
+beach:
+  if (!success)
+    meta = NULL;
+
+  return meta;
+
+  /* ERRORS */
+create_failed:
+  {
+    g_mutex_unlock (ximagesink->x_lock);
+    /* Reset error handler */
+    error_caught = FALSE;
+    XSetErrorHandler (handler);
+    /* Push an error */
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height),
+        ("could not XShmCreateImage a %dx%d image", width, height));
+    goto beach;
+  }
+shmget_failed:
+  {
+    g_mutex_unlock (ximagesink->x_lock);
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height),
+        ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
+            meta->size));
+    goto beach;
+  }
+shmat_failed:
+  {
+    g_mutex_unlock (ximagesink->x_lock);
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height), ("Failed to shmat: %s", g_strerror (errno)));
+    /* Clean up the shared memory segment */
+    shmctl (meta->SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+xattach_failed:
+  {
+    /* Clean up the shared memory segment */
+    shmctl (meta->SHMInfo.shmid, IPC_RMID, NULL);
+    g_mutex_unlock (ximagesink->x_lock);
+
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height), ("Failed to XShmAttach"));
+    goto beach;
+  }
+}
+
+static void
+gst_meta_ximage_free (GstMetaXImage * meta, GstBuffer * buffer)
+{
+  GstXImageSink *ximagesink;
+
+  ximagesink = meta->sink;
+
+  GST_DEBUG_OBJECT (ximagesink, "free meta on buffer %p", buffer);
+
+  /* Hold the object lock to ensure the XContext doesn't disappear */
+  GST_OBJECT_LOCK (ximagesink);
+  /* We might have some buffers destroyed after changing state to NULL */
+  if (ximagesink->xcontext == NULL) {
+    GST_DEBUG_OBJECT (ximagesink, "Destroying XImage after XContext");
+#ifdef HAVE_XSHM
+    /* Need to free the shared memory segment even if the x context
+     * was already cleaned up */
+    if (meta->SHMInfo.shmaddr != ((void *) -1)) {
+      shmdt (meta->SHMInfo.shmaddr);
+    }
+#endif
+    goto beach;
+  }
+
+  g_mutex_lock (ximagesink->x_lock);
+
+#ifdef HAVE_XSHM
+  if (ximagesink->xcontext->use_xshm) {
+    if (meta->SHMInfo.shmaddr != ((void *) -1)) {
+      GST_DEBUG_OBJECT (ximagesink, "XServer ShmDetaching from 0x%x id 0x%lx",
+          meta->SHMInfo.shmid, meta->SHMInfo.shmseg);
+      XShmDetach (ximagesink->xcontext->disp, &meta->SHMInfo);
+      XSync (ximagesink->xcontext->disp, FALSE);
+      shmdt (meta->SHMInfo.shmaddr);
+      meta->SHMInfo.shmaddr = (void *) -1;
+    }
+    if (meta->ximage)
+      XDestroyImage (meta->ximage);
+  } else
+#endif /* HAVE_XSHM */
+  {
+    if (meta->ximage) {
+      XDestroyImage (meta->ximage);
+    }
+  }
+
+  XSync (ximagesink->xcontext->disp, FALSE);
+
+  g_mutex_unlock (ximagesink->x_lock);
+
+beach:
+  GST_OBJECT_UNLOCK (ximagesink);
+
+  gst_object_unref (meta->sink);
+}
+
+#ifdef HAVE_XSHM
+/* This function checks that it is actually really possible to create an image
+   using XShm */
+gboolean
+gst_ximagesink_check_xshm_calls (GstXImageSink * ximagesink,
+    GstXContext * xcontext)
+{
+  XImage *ximage;
+  XShmSegmentInfo SHMInfo;
+  size_t size;
+  int (*handler) (Display *, XErrorEvent *);
+  gboolean result = FALSE;
+  gboolean did_attach = FALSE;
+
+  g_return_val_if_fail (xcontext != NULL, FALSE);
+
+  /* Sync to ensure any older errors are already processed */
+  XSync (xcontext->disp, FALSE);
+
+  /* Set defaults so we don't free these later unnecessarily */
+  SHMInfo.shmaddr = ((void *) -1);
+  SHMInfo.shmid = -1;
+
+  /* Setting an error handler to catch failure */
+  error_caught = FALSE;
+  handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
+
+  /* Trying to create a 1x1 ximage */
+  GST_DEBUG ("XShmCreateImage of 1x1");
+
+  ximage = XShmCreateImage (xcontext->disp, xcontext->visual,
+      xcontext->depth, ZPixmap, NULL, &SHMInfo, 1, 1);
+
+  /* Might cause an error, sync to ensure it is noticed */
+  XSync (xcontext->disp, FALSE);
+  if (!ximage || error_caught) {
+    GST_WARNING ("could not XShmCreateImage a 1x1 image");
+    goto beach;
+  }
+  size = ximage->height * ximage->bytes_per_line;
+
+  SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
+  if (SHMInfo.shmid == -1) {
+    GST_WARNING ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
+        size);
+    goto beach;
+  }
+
+  SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
+  if (SHMInfo.shmaddr == ((void *) -1)) {
+    GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  ximage->data = SHMInfo.shmaddr;
+  SHMInfo.readOnly = FALSE;
+
+  if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
+    GST_WARNING ("Failed to XShmAttach");
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  /* Sync to ensure we see any errors we caused */
+  XSync (xcontext->disp, FALSE);
+
+  /* Delete the shared memory segment as soon as everyone is attached.
+   * This way, it will be deleted as soon as we detach later, and not
+   * leaked if we crash. */
+  shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+
+  if (!error_caught) {
+    GST_DEBUG ("XServer ShmAttached to 0x%x, id 0x%lx", SHMInfo.shmid,
+        SHMInfo.shmseg);
+
+    did_attach = TRUE;
+    /* store whether we succeeded in result */
+    result = TRUE;
+  } else {
+    GST_WARNING ("MIT-SHM extension check failed at XShmAttach. "
+        "Not using shared memory.");
+  }
+
+beach:
+  /* Sync to ensure we swallow any errors we caused and reset error_caught */
+  XSync (xcontext->disp, FALSE);
+
+  error_caught = FALSE;
+  XSetErrorHandler (handler);
+
+  if (did_attach) {
+    GST_DEBUG ("XServer ShmDetaching from 0x%x id 0x%lx",
+        SHMInfo.shmid, SHMInfo.shmseg);
+    XShmDetach (xcontext->disp, &SHMInfo);
+    XSync (xcontext->disp, FALSE);
+  }
+  if (SHMInfo.shmaddr != ((void *) -1))
+    shmdt (SHMInfo.shmaddr);
+  if (ximage)
+    XDestroyImage (ximage);
+  return result;
+}
+#endif /* HAVE_XSHM */
+
+/* bufferpool */
+static void gst_ximage_buffer_pool_finalize (GObject * object);
+
+#define GST_XIMAGE_BUFFER_POOL_GET_PRIVATE(obj)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_XIMAGE_BUFFER_POOL, GstXImageBufferPoolPrivate))
+
+#define gst_ximage_buffer_pool_parent_class parent_class
+G_DEFINE_TYPE (GstXImageBufferPool, gst_ximage_buffer_pool,
+    GST_TYPE_BUFFER_POOL);
+
+static const gchar **
+ximage_buffer_pool_get_options (GstBufferPool * pool)
+{
+  static const gchar *options[] = { GST_BUFFER_POOL_OPTION_META_VIDEO,
+    GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT, NULL
+  };
+
+  return options;
+}
+
+static gboolean
+ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
+{
+  GstXImageBufferPool *xpool = GST_XIMAGE_BUFFER_POOL_CAST (pool);
+  GstXImageBufferPoolPrivate *priv = xpool->priv;
+  GstVideoInfo info;
+  const GstCaps *caps;
+
+  if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL))
+    goto wrong_config;
+
+  if (caps == NULL)
+    goto no_caps;
+
+  /* now parse the caps from the config */
+  if (!gst_video_info_from_caps (&info, caps))
+    goto wrong_caps;
+
+  priv->info = info;
+
+  GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT, info.width, info.height,
+      caps);
+
+  /* keep track of the width and height and caps */
+  if (priv->caps)
+    gst_caps_unref (priv->caps);
+  priv->caps = gst_caps_copy (caps);
+
+  /* check for the configured metadata */
+  priv->add_metavideo =
+      gst_buffer_pool_config_has_option (config,
+      GST_BUFFER_POOL_OPTION_META_VIDEO);
+
+  /* parse extra alignment info */
+  priv->need_alignment = gst_buffer_pool_config_has_option (config,
+      GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
+
+  if (priv->need_alignment) {
+    gst_buffer_pool_config_get_video_alignment (config, &priv->align);
+
+    GST_LOG_OBJECT (pool, "padding %u-%ux%u-%u", priv->align.padding_top,
+        priv->align.padding_left, priv->align.padding_left,
+        priv->align.padding_bottom);
+
+    /* we need the video metadata too now */
+    priv->add_metavideo = TRUE;
+  }
+
+  /* add the padding */
+  priv->padded_width =
+      GST_VIDEO_INFO_WIDTH (&info) + priv->align.padding_left +
+      priv->align.padding_right;
+  priv->padded_height =
+      GST_VIDEO_INFO_HEIGHT (&info) + priv->align.padding_top +
+      priv->align.padding_bottom;
+
+  return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
+
+  /* ERRORS */
+wrong_config:
+  {
+    GST_WARNING_OBJECT (pool, "invalid config");
+    return FALSE;
+  }
+no_caps:
+  {
+    GST_WARNING_OBJECT (pool, "no caps in config");
+    return FALSE;
+  }
+wrong_caps:
+  {
+    GST_WARNING_OBJECT (pool,
+        "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
+}
+
+/* This function handles GstXImageBuffer creation depending on XShm availability */
+static GstFlowReturn
+ximage_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
+    GstBufferPoolParams * params)
+{
+  GstXImageBufferPool *xpool = GST_XIMAGE_BUFFER_POOL_CAST (pool);
+  GstXImageBufferPoolPrivate *priv = xpool->priv;
+  GstVideoInfo *info;
+  GstBuffer *ximage;
+  GstMetaXImage *meta;
+
+  info = &priv->info;
+
+  ximage = gst_buffer_new ();
+  meta = gst_buffer_add_meta_ximage (ximage, xpool);
+  if (meta == NULL) {
+    gst_buffer_unref (ximage);
+    goto no_buffer;
+  }
+  if (priv->add_metavideo) {
+    GstMetaVideo *meta;
+
+    GST_DEBUG_OBJECT (pool, "adding GstMetaVideo");
+    /* these are just the defaults for now */
+    meta = gst_buffer_add_meta_video (ximage, 0, GST_VIDEO_INFO_FORMAT (info),
+        priv->padded_width, priv->padded_height);
+
+    if (priv->need_alignment) {
+      gint vpad, hpad, pstride;
+
+      vpad = priv->align.padding_left;
+      hpad = priv->align.padding_top;
+
+      meta->width = GST_VIDEO_INFO_WIDTH (&priv->info);
+      meta->height = GST_VIDEO_INFO_HEIGHT (&priv->info);
+      pstride = GST_VIDEO_INFO_COMP_PSTRIDE (&priv->info, 0);
+
+      meta->offset[0] += (vpad * meta->stride[0]) + (hpad * pstride);
+    }
+  }
+  *buffer = ximage;
+
+  return GST_FLOW_OK;
+
+  /* ERROR */
+no_buffer:
+  {
+    GST_WARNING_OBJECT (pool, "can't create image");
+    return GST_FLOW_ERROR;
+  }
+}
+
+static void
+ximage_buffer_pool_free (GstBufferPool * pool, GstBuffer * buffer)
+{
+  gst_buffer_unref (buffer);
+}
+
+GstBufferPool *
+gst_ximage_buffer_pool_new (GstXImageSink * ximagesink)
+{
+  GstXImageBufferPool *pool;
+
+  g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
+
+  pool = g_object_new (GST_TYPE_XIMAGE_BUFFER_POOL, NULL);
+  pool->sink = gst_object_ref (ximagesink);
+
+  GST_LOG_OBJECT (pool, "new XImage buffer pool %p", pool);
+
+  return GST_BUFFER_POOL_CAST (pool);
+}
+
+static void
+gst_ximage_buffer_pool_class_init (GstXImageBufferPoolClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (GstXImageBufferPoolPrivate));
+
+  gobject_class->finalize = gst_ximage_buffer_pool_finalize;
+
+  gstbufferpool_class->get_options = ximage_buffer_pool_get_options;
+  gstbufferpool_class->set_config = ximage_buffer_pool_set_config;
+  gstbufferpool_class->alloc_buffer = ximage_buffer_pool_alloc;
+  gstbufferpool_class->free_buffer = ximage_buffer_pool_free;
+}
+
+static void
+gst_ximage_buffer_pool_init (GstXImageBufferPool * pool)
+{
+  pool->priv = GST_XIMAGE_BUFFER_POOL_GET_PRIVATE (pool);
+}
+
+static void
+gst_ximage_buffer_pool_finalize (GObject * object)
+{
+  GstXImageBufferPool *pool = GST_XIMAGE_BUFFER_POOL_CAST (object);
+  GstXImageBufferPoolPrivate *priv = pool->priv;
+
+  GST_LOG_OBJECT (pool, "finalize XImage buffer pool %p", pool);
+
+  if (priv->caps)
+    gst_caps_unref (priv->caps);
+  gst_object_unref (pool->sink);
+
+  G_OBJECT_CLASS (gst_ximage_buffer_pool_parent_class)->finalize (object);
+}
diff --git a/sys/ximage/ximagepool.h b/sys/ximage/ximagepool.h
new file mode 100644 (file)
index 0000000..ec88c27
--- /dev/null
@@ -0,0 +1,112 @@
+/* GStreamer
+ * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_XIMAGEPOOL_H__
+#define __GST_XIMAGEPOOL_H__
+
+#ifdef HAVE_XSHM
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif /* HAVE_XSHM */
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#ifdef HAVE_XSHM
+#include <X11/extensions/XShm.h>
+#endif /* HAVE_XSHM */
+
+#include <string.h>
+#include <math.h>
+
+
+G_BEGIN_DECLS
+
+typedef struct _GstMetaXImage GstMetaXImage;
+
+typedef struct _GstXImageBufferPool GstXImageBufferPool;
+typedef struct _GstXImageBufferPoolClass GstXImageBufferPoolClass;
+typedef struct _GstXImageBufferPoolPrivate GstXImageBufferPoolPrivate;
+
+#include "ximagesink.h"
+
+const GstMetaInfo * gst_meta_ximage_get_info (void);
+#define GST_META_INFO_XIMAGE  (gst_meta_ximage_get_info())
+
+#define gst_buffer_get_meta_ximage(b) ((GstMetaXImage*)gst_buffer_get_meta((b),GST_META_INFO_XIMAGE))
+
+/**
+ * GstMetaXImage:
+ * @simagesink: a reference to the our #GstXImageSink
+ * @ximage: the XImage of this buffer
+ * @width: the width in pixels of XImage @ximage
+ * @height: the height in pixels of XImage @ximage
+ * @size: the size in bytes of XImage @ximage
+ *
+ * Subclass of #GstMeta containing additional information about an XImage.
+ */
+struct _GstMetaXImage
+{
+  GstMeta meta;
+
+  /* Reference to the ximagesink we belong to */
+  GstXImageSink *sink;
+
+  XImage *ximage;
+
+#ifdef HAVE_XSHM
+  XShmSegmentInfo SHMInfo;
+#endif                          /* HAVE_XSHM */
+
+  gint x, y;
+  gint width, height;
+  size_t size;
+};
+
+/* buffer pool functions */
+#define GST_TYPE_XIMAGE_BUFFER_POOL      (gst_ximage_buffer_pool_get_type())
+#define GST_IS_XIMAGE_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XIMAGE_BUFFER_POOL))
+#define GST_XIMAGE_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XIMAGE_BUFFER_POOL, GstXImageBufferPool))
+#define GST_XIMAGE_BUFFER_POOL_CAST(obj) ((GstXImageBufferPool*)(obj))
+
+struct _GstXImageBufferPool
+{
+  GstBufferPool bufferpool;
+
+  GstXImageSink *sink;
+
+  GstXImageBufferPoolPrivate *priv;
+};
+
+struct _GstXImageBufferPoolClass
+{
+  GstBufferPoolClass parent_class;
+};
+
+GType gst_ximage_buffer_pool_get_type (void);
+
+GstBufferPool * gst_ximage_buffer_pool_new     (GstXImageSink * ximagesink);
+
+gboolean gst_ximagesink_check_xshm_calls (GstXImageSink * ximagesink,
+        GstXContext * xcontext);
+
+G_END_DECLS
+
+#endif /* __GST_XIMAGEPOOL_H__ */
index d68ec68..1ee33d9 100644 (file)
@@ -22,9 +22,9 @@
  *
  * XImageSink renders video frames to a drawable (XWindow) on a local or remote
  * display. This element can receive a Window ID from the application through
- * the XOverlay interface and will then render video frames in this drawable.
- * If no Window ID was provided by the application, the element will create its
- * own internal window and render into it.
+ * the #GstVideoOverlay interface and will then render video frames in this
+ * drawable. If no Window ID was provided by the application, the element will
+ * create its own internal window and render into it.
  *
  * <refsect2>
  * <title>Scaling</title>
@@ -81,7 +81,7 @@
  * size are allocated along the way. If you take away the queue, scaling will
  * happen almost immediately.
  * |[
- * gst-launch -v videotestsrc ! navigationtest ! ffmpegcolorspace ! ximagesink
+ * gst-launch -v videotestsrc ! navigationtest ! videoconvert ! ximagesink
  * ]| A pipeline to test navigation events.
  * While moving the mouse pointer over the test signal you will see a black box
  * following the mouse pointer. If you press the mouse button somewhere on the 
@@ -89,7 +89,7 @@
  * the button and a red one where you released it. (The navigationtest element
  * is part of gst-plugins-good.)
  * |[
- * gst-launch -v videotestsrc ! video/x-raw-rgb, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink
+ * gst-launch -v videotestsrc ! video/x-raw, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink
  * ]| This is faking a 4/3 pixel aspect ratio caps on video frames produced by
  * videotestsrc, in most cases the pixel aspect ratio of the display will be
  * 1/1. This means that videoscale will have to do the scaling to convert 
 
 /* Our interfaces */
 #include <gst/interfaces/navigation.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
+
+#include <gst/video/gstmetavideo.h>
 
 /* Object header */
 #include "ximagesink.h"
 #include <gst/gstinfo.h>
 
 GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
+GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
 #define GST_CAT_DEFAULT gst_debug_ximagesink
 
 typedef struct
@@ -129,16 +132,14 @@ MotifWmHints, MwmHints;
 #define MWM_HINTS_DECORATIONS   (1L << 1)
 
 static void gst_ximagesink_reset (GstXImageSink * ximagesink);
-static void gst_ximagesink_ximage_destroy (GstXImageSink * ximagesink,
-    GstXImageBuffer * ximage);
 static void gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink);
-static void gst_ximagesink_expose (GstXOverlay * overlay);
+static void gst_ximagesink_expose (GstVideoOverlay * overlay);
 
 static GstStaticPadTemplate gst_ximagesink_sink_template_factory =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-rgb, "
+    GST_STATIC_CAPS ("video/x-raw, "
         "framerate = (fraction) [ 0, MAX ], "
         "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
     );
@@ -156,489 +157,33 @@ enum
   PROP_WINDOW_HEIGHT
 };
 
-static GstVideoSinkClass *parent_class = NULL;
-
 /* ============================================================= */
 /*                                                               */
-/*                       Private Methods                         */
+/*                       Public Methods                          */
 /*                                                               */
 /* ============================================================= */
 
-/* ximage buffers */
-
-static GstBufferClass *ximage_buffer_parent_class = NULL;
-
-#define GST_TYPE_XIMAGE_BUFFER (gst_ximage_buffer_get_type())
-
-#define GST_IS_XIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XIMAGE_BUFFER))
-#define GST_XIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XIMAGE_BUFFER, GstXImageBuffer))
-#define GST_XIMAGE_BUFFER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_XIMAGE_BUFFER, GstXImageBufferClass))
-
-/* So some words about GstMiniObject, this is pretty messy...
-   GstMiniObject does not use the standard finalizing of GObjects, you are 
-   supposed to call gst_buffer_unref that's going to call gst_mini_objec_unref
-   which will handle its own refcount system and call gst_mini_object_free.
-   gst_mini_object_free will call the class finalize method which is not the 
-   one from GObject, after calling this finalize method it will free the object
-   instance for you if the refcount is still 0 so you should not chain up */
-static void
-gst_ximage_buffer_finalize (GstXImageBuffer * ximage)
-{
-  GstXImageSink *ximagesink = NULL;
-  gboolean recycled = FALSE;
-  gboolean running;
-
-  g_return_if_fail (ximage != NULL);
-
-  ximagesink = ximage->ximagesink;
-  if (G_UNLIKELY (ximagesink == NULL)) {
-    GST_WARNING_OBJECT (ximagesink, "no sink found");
-    goto beach;
-  }
-
-  GST_OBJECT_LOCK (ximagesink);
-  running = ximagesink->running;
-  GST_OBJECT_UNLOCK (ximagesink);
-
-  if (running == FALSE) {
-    /* If the sink is shutting down, need to clear the image */
-    GST_DEBUG_OBJECT (ximagesink,
-        "destroy image %p because the sink is shutting down", ximage);
-    gst_ximagesink_ximage_destroy (ximagesink, ximage);
-  } else if ((ximage->width != GST_VIDEO_SINK_WIDTH (ximagesink)) ||
-      (ximage->height != GST_VIDEO_SINK_HEIGHT (ximagesink))) {
-    /* If our geometry changed we can't reuse that image. */
-    GST_DEBUG_OBJECT (ximagesink,
-        "destroy image %p as its size changed %dx%d vs current %dx%d",
-        ximage, ximage->width, ximage->height,
-        GST_VIDEO_SINK_WIDTH (ximagesink), GST_VIDEO_SINK_HEIGHT (ximagesink));
-    gst_ximagesink_ximage_destroy (ximagesink, ximage);
-  } else {
-    /* In that case we can reuse the image and add it to our image pool. */
-    GST_LOG_OBJECT (ximagesink, "recycling image %p in pool", ximage);
-    /* need to increment the refcount again to recycle */
-    gst_buffer_ref (GST_BUFFER_CAST (ximage));
-    g_mutex_lock (ximagesink->pool_lock);
-    ximagesink->buffer_pool = g_slist_prepend (ximagesink->buffer_pool, ximage);
-    g_mutex_unlock (ximagesink->pool_lock);
-    recycled = TRUE;
-  }
-
-  if (!recycled)
-    GST_MINI_OBJECT_CLASS (ximage_buffer_parent_class)->finalize
-        (GST_MINI_OBJECT (ximage));
-
-beach:
-  return;
-}
-
-static void
-gst_ximage_buffer_free (GstXImageBuffer * ximage)
-{
-  /* make sure it is not recycled */
-  ximage->width = -1;
-  ximage->height = -1;
-  gst_buffer_unref (GST_BUFFER_CAST (ximage));
-}
-
-static void
-gst_ximage_buffer_init (GstXImageBuffer * ximage_buffer, gpointer g_class)
-{
-#ifdef HAVE_XSHM
-  ximage_buffer->SHMInfo.shmaddr = ((void *) -1);
-  ximage_buffer->SHMInfo.shmid = -1;
-#endif
-}
-
-static void
-gst_ximage_buffer_class_init (gpointer g_class, gpointer class_data)
-{
-  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
-  ximage_buffer_parent_class = g_type_class_peek_parent (g_class);
-
-  mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
-      gst_ximage_buffer_finalize;
-}
+/* =========================================== */
+/*                                             */
+/*          Object typing & Creation           */
+/*                                             */
+/* =========================================== */
+static void gst_ximagesink_navigation_init (GstNavigationInterface * klass);
+static void gst_ximagesink_video_overlay_init (GstVideoOverlayIface * iface);
+#define gst_ximagesink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstXImageSink, gst_ximagesink, GST_TYPE_VIDEO_SINK,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION, gst_ximagesink_navigation_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
+        gst_ximagesink_video_overlay_init));
 
-static GType
-gst_ximage_buffer_get_type (void)
-{
-  static GType _gst_ximage_buffer_type;
-
-  if (G_UNLIKELY (_gst_ximage_buffer_type == 0)) {
-    static const GTypeInfo ximage_buffer_info = {
-      sizeof (GstBufferClass),
-      NULL,
-      NULL,
-      gst_ximage_buffer_class_init,
-      NULL,
-      NULL,
-      sizeof (GstXImageBuffer),
-      0,
-      (GInstanceInitFunc) gst_ximage_buffer_init,
-      NULL
-    };
-    _gst_ximage_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
-        "GstXImageBuffer", &ximage_buffer_info, 0);
-  }
-  return _gst_ximage_buffer_type;
-}
+/* ============================================================= */
+/*                                                               */
+/*                       Private Methods                         */
+/*                                                               */
+/* ============================================================= */
 
 /* X11 stuff */
 
-static gboolean error_caught = FALSE;
-
-static int
-gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent)
-{
-  char error_msg[1024];
-
-  XGetErrorText (display, xevent->error_code, error_msg, 1024);
-  GST_DEBUG ("ximagesink triggered an XError. error: %s", error_msg);
-  error_caught = TRUE;
-  return 0;
-}
-
-#ifdef HAVE_XSHM                /* Check that XShm calls actually work */
-
-static gboolean
-gst_ximagesink_check_xshm_calls (GstXImageSink * ximagesink,
-    GstXContext * xcontext)
-{
-  XImage *ximage;
-  XShmSegmentInfo SHMInfo;
-  size_t size;
-  int (*handler) (Display *, XErrorEvent *);
-  gboolean result = FALSE;
-  gboolean did_attach = FALSE;
-
-  g_return_val_if_fail (xcontext != NULL, FALSE);
-
-  /* Sync to ensure any older errors are already processed */
-  XSync (xcontext->disp, FALSE);
-
-  /* Set defaults so we don't free these later unnecessarily */
-  SHMInfo.shmaddr = ((void *) -1);
-  SHMInfo.shmid = -1;
-
-  /* Setting an error handler to catch failure */
-  error_caught = FALSE;
-  handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
-
-  /* Trying to create a 1x1 ximage */
-  GST_DEBUG ("XShmCreateImage of 1x1");
-
-  ximage = XShmCreateImage (xcontext->disp, xcontext->visual,
-      xcontext->depth, ZPixmap, NULL, &SHMInfo, 1, 1);
-
-  /* Might cause an error, sync to ensure it is noticed */
-  XSync (xcontext->disp, FALSE);
-  if (!ximage || error_caught) {
-    GST_WARNING ("could not XShmCreateImage a 1x1 image");
-    goto beach;
-  }
-  size = ximage->height * ximage->bytes_per_line;
-
-  SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
-  if (SHMInfo.shmid == -1) {
-    GST_WARNING ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
-        size);
-    goto beach;
-  }
-
-  SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
-  if (SHMInfo.shmaddr == ((void *) -1)) {
-    GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
-    /* Clean up shm seg */
-    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-    goto beach;
-  }
-
-  ximage->data = SHMInfo.shmaddr;
-  SHMInfo.readOnly = FALSE;
-
-  if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
-    GST_WARNING ("Failed to XShmAttach");
-    /* Clean up shm seg */
-    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-    goto beach;
-  }
-
-  /* Sync to ensure we see any errors we caused */
-  XSync (xcontext->disp, FALSE);
-
-  /* Delete the shared memory segment as soon as everyone is attached. 
-   * This way, it will be deleted as soon as we detach later, and not
-   * leaked if we crash. */
-  shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-
-  if (!error_caught) {
-    did_attach = TRUE;
-    /* store whether we succeeded in result */
-    result = TRUE;
-  }
-
-beach:
-  /* Sync to ensure we swallow any errors we caused and reset error_caught */
-  XSync (xcontext->disp, FALSE);
-  error_caught = FALSE;
-  XSetErrorHandler (handler);
-
-  if (did_attach) {
-    XShmDetach (xcontext->disp, &SHMInfo);
-    XSync (xcontext->disp, FALSE);
-  }
-  if (SHMInfo.shmaddr != ((void *) -1))
-    shmdt (SHMInfo.shmaddr);
-  if (ximage)
-    XDestroyImage (ximage);
-  return result;
-}
-#endif /* HAVE_XSHM */
-
-/* This function handles GstXImageBuffer creation depending on XShm availability */
-static GstXImageBuffer *
-gst_ximagesink_ximage_new (GstXImageSink * ximagesink, GstCaps * caps)
-{
-  GstXImageBuffer *ximage = NULL;
-  GstStructure *structure = NULL;
-  gboolean succeeded = FALSE;
-  int (*handler) (Display *, XErrorEvent *);
-
-  g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
-
-  ximage = (GstXImageBuffer *) gst_mini_object_new (GST_TYPE_XIMAGE_BUFFER);
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (!gst_structure_get_int (structure, "width", &ximage->width) ||
-      !gst_structure_get_int (structure, "height", &ximage->height)) {
-    GST_WARNING ("failed getting geometry from caps %" GST_PTR_FORMAT, caps);
-  }
-
-  GST_DEBUG_OBJECT (ximagesink, "creating image %p (%dx%d)", ximage,
-      ximage->width, ximage->height);
-
-  g_mutex_lock (ximagesink->x_lock);
-
-  /* Setting an error handler to catch failure */
-  error_caught = FALSE;
-  handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
-
-#ifdef HAVE_XSHM
-  if (ximagesink->xcontext->use_xshm) {
-    ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp,
-        ximagesink->xcontext->visual,
-        ximagesink->xcontext->depth,
-        ZPixmap, NULL, &ximage->SHMInfo, ximage->width, ximage->height);
-    if (!ximage->ximage || error_caught) {
-      g_mutex_unlock (ximagesink->x_lock);
-
-      /* Reset error flag */
-      error_caught = FALSE;
-
-      /* Push a warning */
-      GST_ELEMENT_WARNING (ximagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              ximage->width, ximage->height),
-          ("could not XShmCreateImage a %dx%d image",
-              ximage->width, ximage->height));
-
-      /* Retry without XShm */
-      ximagesink->xcontext->use_xshm = FALSE;
-
-      /* Hold X mutex again to try without XShm */
-      g_mutex_lock (ximagesink->x_lock);
-      goto no_xshm;
-    }
-
-    /* we have to use the returned bytes_per_line for our shm size */
-    ximage->size = ximage->ximage->bytes_per_line * ximage->ximage->height;
-    GST_LOG_OBJECT (ximagesink,
-        "XShm image size is %" G_GSIZE_FORMAT ", width %d, stride %d",
-        ximage->size, ximage->width, ximage->ximage->bytes_per_line);
-
-    ximage->SHMInfo.shmid = shmget (IPC_PRIVATE, ximage->size,
-        IPC_CREAT | 0777);
-    if (ximage->SHMInfo.shmid == -1) {
-      g_mutex_unlock (ximagesink->x_lock);
-      GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              ximage->width, ximage->height),
-          ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
-              ximage->size));
-      goto beach;
-    }
-
-    ximage->SHMInfo.shmaddr = shmat (ximage->SHMInfo.shmid, NULL, 0);
-    if (ximage->SHMInfo.shmaddr == ((void *) -1)) {
-      g_mutex_unlock (ximagesink->x_lock);
-      GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              ximage->width, ximage->height),
-          ("Failed to shmat: %s", g_strerror (errno)));
-      /* Clean up the shared memory segment */
-      shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
-      goto beach;
-    }
-
-    ximage->ximage->data = ximage->SHMInfo.shmaddr;
-    ximage->SHMInfo.readOnly = FALSE;
-
-    if (XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo) == 0) {
-      /* Clean up shm seg */
-      shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
-
-      g_mutex_unlock (ximagesink->x_lock);
-      GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              ximage->width, ximage->height), ("Failed to XShmAttach"));
-      goto beach;
-    }
-
-    XSync (ximagesink->xcontext->disp, FALSE);
-
-    /* Now that everyone has attached, we can delete the shared memory segment.
-     * This way, it will be deleted as soon as we detach later, and not
-     * leaked if we crash. */
-    shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
-
-  } else
-  no_xshm:
-#endif /* HAVE_XSHM */
-  {
-    guint allocsize;
-
-    ximage->ximage = XCreateImage (ximagesink->xcontext->disp,
-        ximagesink->xcontext->visual,
-        ximagesink->xcontext->depth,
-        ZPixmap, 0, NULL,
-        ximage->width, ximage->height, ximagesink->xcontext->bpp, 0);
-    if (!ximage->ximage || error_caught) {
-      g_mutex_unlock (ximagesink->x_lock);
-      /* Reset error handler */
-      error_caught = FALSE;
-      XSetErrorHandler (handler);
-      /* Push an error */
-      GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              ximage->width, ximage->height),
-          ("could not XCreateImage a %dx%d image",
-              ximage->width, ximage->height));
-      goto beach;
-    }
-
-    /* upstream will assume that rowstrides are multiples of 4, but this
-     * doesn't always seem to be the case with XCreateImage() */
-    if ((ximage->ximage->bytes_per_line % 4) != 0) {
-      GST_WARNING_OBJECT (ximagesink, "returned stride not a multiple of 4 as "
-          "usually assumed");
-    }
-
-    /* we have to use the returned bytes_per_line for our image size */
-    ximage->size = ximage->ximage->bytes_per_line * ximage->ximage->height;
-
-    /* alloc a bit more for unexpected strides to avoid crashes upstream.
-     * FIXME: if we get an unrounded stride, the image will be displayed
-     * distorted, since all upstream elements assume a rounded stride */
-    allocsize =
-        GST_ROUND_UP_4 (ximage->ximage->bytes_per_line) *
-        ximage->ximage->height;
-    ximage->ximage->data = g_malloc (allocsize);
-    GST_LOG_OBJECT (ximagesink,
-        "non-XShm image size is %" G_GSIZE_FORMAT " (alloced: %u), width %d, "
-        "stride %d", ximage->size, allocsize, ximage->width,
-        ximage->ximage->bytes_per_line);
-
-    XSync (ximagesink->xcontext->disp, FALSE);
-  }
-
-  /* Reset error handler */
-  error_caught = FALSE;
-  XSetErrorHandler (handler);
-
-  succeeded = TRUE;
-
-  GST_BUFFER_DATA (ximage) = (guchar *) ximage->ximage->data;
-  GST_BUFFER_SIZE (ximage) = ximage->size;
-
-  /* Keep a ref to our sink */
-  ximage->ximagesink = gst_object_ref (ximagesink);
-
-  g_mutex_unlock (ximagesink->x_lock);
-beach:
-  if (!succeeded) {
-    gst_ximage_buffer_free (ximage);
-    ximage = NULL;
-  }
-
-  return ximage;
-}
-
-/* This function destroys a GstXImageBuffer handling XShm availability */
-static void
-gst_ximagesink_ximage_destroy (GstXImageSink * ximagesink,
-    GstXImageBuffer * ximage)
-{
-  g_return_if_fail (ximage != NULL);
-  g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
-  /* Hold the object lock to ensure the XContext doesn't disappear */
-  GST_OBJECT_LOCK (ximagesink);
-
-  /* If the destroyed image is the current one we destroy our reference too */
-  if (ximagesink->cur_image == ximage) {
-    ximagesink->cur_image = NULL;
-  }
-
-  /* We might have some buffers destroyed after changing state to NULL */
-  if (!ximagesink->xcontext) {
-    GST_DEBUG_OBJECT (ximagesink, "Destroying XImage after XContext");
-#ifdef HAVE_XSHM
-    if (ximage->SHMInfo.shmaddr != ((void *) -1)) {
-      shmdt (ximage->SHMInfo.shmaddr);
-    }
-#endif
-    goto beach;
-  }
-
-  g_mutex_lock (ximagesink->x_lock);
-
-#ifdef HAVE_XSHM
-  if (ximagesink->xcontext->use_xshm) {
-    if (ximage->SHMInfo.shmaddr != ((void *) -1)) {
-      XShmDetach (ximagesink->xcontext->disp, &ximage->SHMInfo);
-      XSync (ximagesink->xcontext->disp, 0);
-      shmdt (ximage->SHMInfo.shmaddr);
-    }
-    if (ximage->ximage)
-      XDestroyImage (ximage->ximage);
-
-  } else
-#endif /* HAVE_XSHM */
-  {
-    if (ximage->ximage) {
-      XDestroyImage (ximage->ximage);
-    }
-  }
-
-  XSync (ximagesink->xcontext->disp, FALSE);
-
-  g_mutex_unlock (ximagesink->x_lock);
-
-beach:
-  GST_OBJECT_UNLOCK (ximagesink);
-
-  if (ximage->ximagesink) {
-    /* Release the ref to our sink */
-    ximage->ximagesink = NULL;
-    gst_object_unref (ximagesink);
-  }
-
-  return;
-}
-
 /* We are called with the x_lock taken */
 static void
 gst_ximagesink_xwindow_draw_borders (GstXImageSink * ximagesink,
@@ -677,13 +222,13 @@ gst_ximagesink_xwindow_draw_borders (GstXImageSink * ximagesink,
 
 /* This function puts a GstXImageBuffer on a GstXImageSink's window */
 static gboolean
-gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
+gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstBuffer * ximage)
 {
+  GstMetaXImage *meta;
+  GstMetaVideoCrop *crop;
   GstVideoRectangle src, dst, result;
   gboolean draw_border = FALSE;
 
-  g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), FALSE);
-
   /* We take the flow_lock. If expose is in there we don't want to run
      concurrently from the data flow thread */
   g_mutex_lock (ximagesink->flow_lock);
@@ -703,11 +248,10 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
   if (ximage && ximagesink->cur_image != ximage) {
     if (ximagesink->cur_image) {
       GST_LOG_OBJECT (ximagesink, "unreffing %p", ximagesink->cur_image);
-      gst_buffer_unref (GST_BUFFER_CAST (ximagesink->cur_image));
+      gst_buffer_unref (ximagesink->cur_image);
     }
     GST_LOG_OBJECT (ximagesink, "reffing %p as our current image", ximage);
-    ximagesink->cur_image =
-        GST_XIMAGE_BUFFER (gst_buffer_ref (GST_BUFFER_CAST (ximage)));
+    ximagesink->cur_image = gst_buffer_ref (ximage);
   }
 
   /* Expose sends a NULL image, we take the latest frame */
@@ -721,8 +265,20 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
     }
   }
 
-  src.w = ximage->width;
-  src.h = ximage->height;
+  meta = gst_buffer_get_meta_ximage (ximage);
+  crop = gst_buffer_get_meta_video_crop (ximage);
+
+  if (crop) {
+    src.x = crop->x + meta->x;
+    src.y = crop->y + meta->y;
+    src.w = crop->width;
+    src.h = crop->height;
+  } else {
+    src.x = meta->x;
+    src.y = meta->y;
+    src.w = meta->width;
+    src.h = meta->height;
+  }
   dst.w = ximagesink->xwindow->width;
   dst.h = ximagesink->xwindow->height;
 
@@ -742,7 +298,7 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
         ximage, 0, 0, result.x, result.y, result.w, result.h,
         ximagesink->xwindow->width, ximagesink->xwindow->height);
     XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
-        ximagesink->xwindow->gc, ximage->ximage, 0, 0, result.x, result.y,
+        ximagesink->xwindow->gc, meta->ximage, src.x, src.y, result.x, result.y,
         result.w, result.h, FALSE);
   } else
 #endif /* HAVE_XSHM */
@@ -752,7 +308,7 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
         ximage, 0, 0, result.x, result.y, result.w, result.h,
         ximagesink->xwindow->width, ximagesink->xwindow->height);
     XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
-        ximagesink->xwindow->gc, ximage->ximage, 0, 0, result.x, result.y,
+        ximagesink->xwindow->gc, meta->ximage, src.x, src.y, result.x, result.y,
         result.w, result.h);
   }
 
@@ -777,7 +333,8 @@ gst_ximagesink_xwindow_decorate (GstXImageSink * ximagesink,
 
   g_mutex_lock (ximagesink->x_lock);
 
-  hints_atom = XInternAtom (ximagesink->xcontext->disp, "_MOTIF_WM_HINTS", 1);
+  hints_atom = XInternAtom (ximagesink->xcontext->disp, "_MOTIF_WM_HINTS",
+      True);
   if (hints_atom == None) {
     g_mutex_unlock (ximagesink->x_lock);
     return FALSE;
@@ -861,7 +418,7 @@ gst_ximagesink_xwindow_new (GstXImageSink * ximagesink, gint width, gint height)
 
   xwindow->win = XCreateSimpleWindow (ximagesink->xcontext->disp,
       ximagesink->xcontext->root,
-      0, 0, xwindow->width, xwindow->height, 0, 0, ximagesink->xcontext->black);
+      0, 0, width, height, 0, 0, ximagesink->xcontext->black);
 
   /* We have to do that to prevent X from redrawing the background on 
      ConfigureNotify. This takes away flickering of video when resizing. */
@@ -896,7 +453,8 @@ gst_ximagesink_xwindow_new (GstXImageSink * ximagesink, gint width, gint height)
 
   gst_ximagesink_xwindow_decorate (ximagesink, xwindow);
 
-  gst_x_overlay_got_window_handle (GST_X_OVERLAY (ximagesink), xwindow->win);
+  gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (ximagesink),
+      xwindow->win);
 
   return xwindow;
 }
@@ -930,6 +488,7 @@ static void
 gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink)
 {
   XWindowAttributes attr;
+  gboolean reconfigure;
 
   g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
 
@@ -943,10 +502,17 @@ gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink)
   XGetWindowAttributes (ximagesink->xcontext->disp,
       ximagesink->xwindow->win, &attr);
 
+  /* Check if we would suggest a different width/height now */
+  reconfigure = (ximagesink->xwindow->width != attr.width)
+      || (ximagesink->xwindow->height != attr.height);
   ximagesink->xwindow->width = attr.width;
   ximagesink->xwindow->height = attr.height;
 
   g_mutex_unlock (ximagesink->x_lock);
+
+  if (reconfigure)
+    gst_pad_push_event (GST_BASE_SINK (ximagesink)->sinkpad,
+        gst_event_new_reconfigure ());
 }
 
 static void
@@ -1060,7 +626,6 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
           g_mutex_unlock (ximagesink->x_lock);
           gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
               e.type == KeyPress ? "key-press" : "key-release", key_str);
-
         } else {
           gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
               e.type == KeyPress ? "key-press" : "key-release", "unknown");
@@ -1074,6 +639,7 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
     g_mutex_lock (ximagesink->x_lock);
   }
 
+  /* Handle Expose */
   while (XCheckWindowEvent (ximagesink->xcontext->disp,
           ximagesink->xwindow->win, ExposureMask | StructureNotifyMask, &e)) {
     switch (e.type) {
@@ -1095,7 +661,7 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
     g_mutex_unlock (ximagesink->x_lock);
     g_mutex_unlock (ximagesink->flow_lock);
 
-    gst_ximagesink_expose (GST_X_OVERLAY (ximagesink));
+    gst_ximagesink_expose (GST_VIDEO_OVERLAY (ximagesink));
 
     g_mutex_lock (ximagesink->flow_lock);
     g_mutex_lock (ximagesink->x_lock);
@@ -1261,6 +827,8 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
   GstXContext *xcontext = NULL;
   XPixmapFormatValues *px_formats = NULL;
   gint nb_formats = 0, i;
+  gint endianness;
+  GstVideoFormat vformat;
 
   g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
 
@@ -1304,7 +872,7 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
     g_mutex_unlock (ximagesink->x_lock);
     g_free (xcontext->par);
     g_free (xcontext);
-    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, SETTINGS,
         ("Could not get supported pixmap formats"), (NULL));
     return NULL;
   }
@@ -1317,8 +885,7 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
 
   XFree (px_formats);
 
-  xcontext->endianness =
-      (ImageByteOrder (xcontext->disp) ==
+  endianness = (ImageByteOrder (xcontext->disp) ==
       LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
 
   /* Search for XShm extension support */
@@ -1328,25 +895,18 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
     xcontext->use_xshm = TRUE;
     GST_DEBUG ("ximagesink is using XShm extension");
   } else
-#endif
+#endif /* HAVE_XSHM */
   {
     xcontext->use_xshm = FALSE;
     GST_DEBUG ("ximagesink is not using XShm extension");
   }
 
-  /* our caps system handles 24/32bpp RGB as big-endian. */
-  if ((xcontext->bpp == 24 || xcontext->bpp == 32) &&
-      xcontext->endianness == G_LITTLE_ENDIAN) {
-    xcontext->endianness = G_BIG_ENDIAN;
-    xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
-    xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
-    xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
-    if (xcontext->bpp == 24) {
-      xcontext->visual->red_mask >>= 8;
-      xcontext->visual->green_mask >>= 8;
-      xcontext->visual->blue_mask >>= 8;
-    }
-  }
+  vformat = gst_video_format_from_masks (xcontext->depth, xcontext->bpp,
+      endianness, xcontext->visual->red_mask, xcontext->visual->green_mask,
+      xcontext->visual->blue_mask, 0);
+
+  if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
+    goto unknown_format;
 
   /* update object's par with calculated one if not set yet */
   if (!ximagesink->par) {
@@ -1354,13 +914,8 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
     gst_value_init_and_copy (ximagesink->par, xcontext->par);
     GST_DEBUG_OBJECT (ximagesink, "set calculated PAR on object's PAR");
   }
-  xcontext->caps = gst_caps_new_simple ("video/x-raw-rgb",
-      "bpp", G_TYPE_INT, xcontext->bpp,
-      "depth", G_TYPE_INT, xcontext->depth,
-      "endianness", G_TYPE_INT, xcontext->endianness,
-      "red_mask", G_TYPE_INT, xcontext->visual->red_mask,
-      "green_mask", G_TYPE_INT, xcontext->visual->green_mask,
-      "blue_mask", G_TYPE_INT, xcontext->visual->blue_mask,
+  xcontext->caps = gst_caps_new_simple ("video/x-raw",
+      "format", G_TYPE_STRING, gst_video_format_to_string (vformat),
       "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
       "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
       "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
@@ -1376,6 +931,13 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
   g_mutex_unlock (ximagesink->x_lock);
 
   return xcontext;
+
+  /* ERRORS */
+unknown_format:
+  {
+    GST_ERROR_OBJECT (ximagesink, "unknown format");
+    return NULL;
+  }
 }
 
 /* This function cleans the X context. Closing the Display and unrefing the
@@ -1418,27 +980,10 @@ gst_ximagesink_xcontext_clear (GstXImageSink * ximagesink)
   g_free (xcontext);
 }
 
-static void
-gst_ximagesink_bufferpool_clear (GstXImageSink * ximagesink)
-{
-
-  g_mutex_lock (ximagesink->pool_lock);
-
-  while (ximagesink->buffer_pool) {
-    GstXImageBuffer *ximage = ximagesink->buffer_pool->data;
-
-    ximagesink->buffer_pool = g_slist_delete_link (ximagesink->buffer_pool,
-        ximagesink->buffer_pool);
-    gst_ximage_buffer_free (ximage);
-  }
-
-  g_mutex_unlock (ximagesink->pool_lock);
-}
-
 /* Element stuff */
 
 static GstCaps *
-gst_ximagesink_getcaps (GstBaseSink * bsink)
+gst_ximagesink_getcaps (GstBaseSink * bsink, GstCaps * filter)
 {
   GstXImageSink *ximagesink;
   GstCaps *caps;
@@ -1446,17 +991,59 @@ gst_ximagesink_getcaps (GstBaseSink * bsink)
 
   ximagesink = GST_XIMAGESINK (bsink);
 
-  if (ximagesink->xcontext)
-    return gst_caps_ref (ximagesink->xcontext->caps);
+  g_mutex_lock (ximagesink->x_lock);
+  if (ximagesink->xcontext) {
+    GstCaps *caps;
 
-  /* get a template copy and add the pixel aspect ratio */
-  caps =
-      gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK
-          (ximagesink)->sinkpad));
-  for (i = 0; i < gst_caps_get_size (caps); ++i) {
-    GstStructure *structure = gst_caps_get_structure (caps, i);
+    caps = gst_caps_ref (ximagesink->xcontext->caps);
 
-    if (ximagesink->par) {
+    if (filter) {
+      GstCaps *intersection;
+
+      intersection =
+          gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+      gst_caps_unref (caps);
+      caps = intersection;
+    }
+
+    if (ximagesink->xwindow && ximagesink->xwindow->width) {
+      GstStructure *s0, *s1;
+
+      caps = gst_caps_make_writable (caps);
+
+      /* There can only be a single structure because the xcontext
+       * caps only have a single structure */
+      s0 = gst_caps_get_structure (caps, 0);
+      s1 = gst_structure_copy (gst_caps_get_structure (caps, 0));
+
+      gst_structure_set (s0, "width", G_TYPE_INT, ximagesink->xwindow->width,
+          "height", G_TYPE_INT, ximagesink->xwindow->height, NULL);
+      gst_caps_append_structure (caps, s1);
+
+      /* This will not change the order but will remove the
+       * fixed width/height caps again if not possible
+       * upstream */
+      if (filter) {
+        GstCaps *intersection;
+
+        intersection =
+            gst_caps_intersect_full (caps, filter, GST_CAPS_INTERSECT_FIRST);
+        gst_caps_unref (caps);
+        caps = intersection;
+      }
+    }
+
+    g_mutex_unlock (ximagesink->x_lock);
+    return caps;
+  }
+  g_mutex_unlock (ximagesink->x_lock);
+
+  /* get a template copy and add the pixel aspect ratio */
+  caps = gst_pad_get_pad_template_caps (GST_BASE_SINK (ximagesink)->sinkpad);
+  if (ximagesink->par) {
+    caps = gst_caps_make_writable (caps);
+    for (i = 0; i < gst_caps_get_size (caps); ++i) {
+      GstStructure *structure = gst_caps_get_structure (caps, i);
       int nom, den;
 
       nom = gst_value_get_fraction_numerator (ximagesink->par);
@@ -1466,6 +1053,15 @@ gst_ximagesink_getcaps (GstBaseSink * bsink)
     }
   }
 
+  if (filter) {
+    GstCaps *intersection;
+
+    intersection =
+        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = intersection;
+  }
+
   return caps;
 }
 
@@ -1473,11 +1069,11 @@ static gboolean
 gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 {
   GstXImageSink *ximagesink;
-  gboolean ret = TRUE;
   GstStructure *structure;
+  GstVideoInfo info;
+  GstBufferPool *newpool, *oldpool;
   const GValue *par;
-  gint new_width, new_height;
-  const GValue *fps;
+  gint size;
 
   ximagesink = GST_XIMAGESINK (bsink);
 
@@ -1492,15 +1088,12 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   if (!gst_caps_can_intersect (ximagesink->xcontext->caps, caps))
     goto incompatible_caps;
 
-  structure = gst_caps_get_structure (caps, 0);
+  if (!gst_video_info_from_caps (&info, caps))
+    goto invalid_format;
 
-  ret &= gst_structure_get_int (structure, "width", &new_width);
-  ret &= gst_structure_get_int (structure, "height", &new_height);
-  fps = gst_structure_get_value (structure, "framerate");
-  ret &= (fps != NULL);
-  if (!ret)
-    return FALSE;
+  size = info.size;
 
+  structure = gst_caps_get_structure (caps, 0);
   /* if the caps contain pixel-aspect-ratio, they have to match ours,
    * otherwise linking should fail */
   par = gst_structure_get_value (structure, "pixel-aspect-ratio");
@@ -1516,47 +1109,54 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
     }
   }
 
-  GST_VIDEO_SINK_WIDTH (ximagesink) = new_width;
-  GST_VIDEO_SINK_HEIGHT (ximagesink) = new_height;
-  ximagesink->fps_n = gst_value_get_fraction_numerator (fps);
-  ximagesink->fps_d = gst_value_get_fraction_denominator (fps);
+  GST_VIDEO_SINK_WIDTH (ximagesink) = info.width;
+  GST_VIDEO_SINK_HEIGHT (ximagesink) = info.height;
+  ximagesink->fps_n = info.fps_n;
+  ximagesink->fps_d = info.fps_d;
 
   /* Notify application to set xwindow id now */
   g_mutex_lock (ximagesink->flow_lock);
   if (!ximagesink->xwindow) {
     g_mutex_unlock (ximagesink->flow_lock);
-    gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (ximagesink));
+    gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (ximagesink));
   } else {
     g_mutex_unlock (ximagesink->flow_lock);
   }
 
   /* Creating our window and our image */
   if (GST_VIDEO_SINK_WIDTH (ximagesink) <= 0 ||
-      GST_VIDEO_SINK_HEIGHT (ximagesink) <= 0) {
-    GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL),
-        ("Invalid image size."));
-    return FALSE;
-  }
+      GST_VIDEO_SINK_HEIGHT (ximagesink) <= 0)
+    goto invalid_size;
 
   g_mutex_lock (ximagesink->flow_lock);
   if (!ximagesink->xwindow) {
     ximagesink->xwindow = gst_ximagesink_xwindow_new (ximagesink,
         GST_VIDEO_SINK_WIDTH (ximagesink), GST_VIDEO_SINK_HEIGHT (ximagesink));
   }
+
+  ximagesink->info = info;
+
   /* Remember to draw borders for next frame */
   ximagesink->draw_border = TRUE;
-  g_mutex_unlock (ximagesink->flow_lock);
 
-  /* If our ximage has changed we destroy it, next chain iteration will create
-     a new one */
-  if ((ximagesink->ximage) &&
-      ((GST_VIDEO_SINK_WIDTH (ximagesink) != ximagesink->ximage->width) ||
-          (GST_VIDEO_SINK_HEIGHT (ximagesink) != ximagesink->ximage->height))) {
-    GST_DEBUG_OBJECT (ximagesink, "our image is not usable anymore, unref %p",
-        ximagesink->ximage);
-    gst_buffer_unref (GST_BUFFER_CAST (ximagesink->ximage));
-    ximagesink->ximage = NULL;
+  /* create a new pool for the new configuration */
+  newpool = gst_ximage_buffer_pool_new (ximagesink);
+
+  structure = gst_buffer_pool_get_config (newpool);
+  gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 15);
+  if (!gst_buffer_pool_set_config (newpool, structure))
+    goto config_failed;
+
+  oldpool = ximagesink->pool;
+  ximagesink->pool = newpool;
+
+  /* unref the old sink */
+  if (oldpool) {
+    /* we don't deactivate, some elements might still be using it, it will be
+     * deactivated when the last ref is gone */
+    gst_object_unref (oldpool);
   }
+  g_mutex_unlock (ximagesink->flow_lock);
 
   return TRUE;
 
@@ -1566,25 +1166,41 @@ incompatible_caps:
     GST_ERROR_OBJECT (ximagesink, "caps incompatible");
     return FALSE;
   }
+invalid_format:
+  {
+    GST_ERROR_OBJECT (ximagesink, "caps invalid");
+    return FALSE;
+  }
 wrong_aspect:
   {
     GST_INFO_OBJECT (ximagesink, "pixel aspect ratio does not match");
     return FALSE;
   }
+invalid_size:
+  {
+    GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL),
+        ("Invalid image size."));
+    return FALSE;
+  }
+config_failed:
+  {
+    GST_ERROR_OBJECT (ximagesink, "failed to set config.");
+    g_mutex_unlock (ximagesink->flow_lock);
+    return FALSE;
+  }
 }
 
 static GstStateChangeReturn
 gst_ximagesink_change_state (GstElement * element, GstStateChange transition)
 {
-  GstXImageSink *ximagesink;
   GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+  GstXImageSink *ximagesink;
   GstXContext *xcontext = NULL;
 
   ximagesink = GST_XIMAGESINK (element);
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
-
       /* Initializing the XContext */
       if (ximagesink->xcontext == NULL) {
         xcontext = gst_ximagesink_xcontext_get (ximagesink);
@@ -1628,6 +1244,10 @@ gst_ximagesink_change_state (GstElement * element, GstStateChange transition)
       ximagesink->fps_d = 1;
       GST_VIDEO_SINK_WIDTH (ximagesink) = 0;
       GST_VIDEO_SINK_HEIGHT (ximagesink) = 0;
+      g_mutex_lock (ximagesink->flow_lock);
+      if (ximagesink->pool)
+        gst_buffer_pool_set_active (ximagesink->pool, FALSE);
+      g_mutex_unlock (ximagesink->flow_lock);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_ximagesink_reset (ximagesink);
@@ -1665,70 +1285,115 @@ gst_ximagesink_get_times (GstBaseSink * bsink, GstBuffer * buf,
 static GstFlowReturn
 gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
 {
+  GstFlowReturn res;
   GstXImageSink *ximagesink;
-
-  g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
+  GstMetaXImage *meta;
+  GstBuffer *to_put = NULL;
 
   ximagesink = GST_XIMAGESINK (vsink);
 
-  /* This shouldn't really happen because state changes will fail
-   * if the xcontext can't be allocated */
-  if (!ximagesink->xcontext)
-    return GST_FLOW_ERROR;
+  meta = gst_buffer_get_meta_ximage (buf);
 
-  /* If this buffer has been allocated using our buffer management we simply
-     put the ximage which is in the PRIVATE pointer */
-  if (GST_IS_XIMAGE_BUFFER (buf)) {
+  if (meta && meta->sink == ximagesink) {
+    /* If this buffer has been allocated using our buffer management we simply
+       put the ximage which is in the PRIVATE pointer */
     GST_LOG_OBJECT (ximagesink, "buffer from our pool, writing directly");
-    if (!gst_ximagesink_ximage_put (ximagesink, GST_XIMAGE_BUFFER (buf)))
-      goto no_window;
+    to_put = buf;
+    res = GST_FLOW_OK;
   } else {
+    GstVideoFrame src, dest;
+
     /* Else we have to copy the data into our private image, */
     /* if we have one... */
-    GST_LOG_OBJECT (ximagesink, "normal buffer, copying from it");
-    if (!ximagesink->ximage) {
-      GST_DEBUG_OBJECT (ximagesink, "creating our ximage");
-      ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
-          GST_BUFFER_CAPS (buf));
-      if (!ximagesink->ximage)
-        /* The create method should have posted an informative error */
-        goto no_ximage;
-
-      if (ximagesink->ximage->size < GST_BUFFER_SIZE (buf)) {
-        GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
-            ("Failed to create output image buffer of %dx%d pixels",
-                ximagesink->ximage->width, ximagesink->ximage->height),
-            ("XServer allocated buffer size did not match input buffer"));
-
-        gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
-        ximagesink->ximage = NULL;
-        goto no_ximage;
-      }
+    GST_LOG_OBJECT (ximagesink, "buffer not from our pool, copying");
+
+    /* we should have a pool, configured in setcaps */
+    if (ximagesink->pool == NULL)
+      goto no_pool;
+
+    if (!gst_buffer_pool_set_active (ximagesink->pool, TRUE))
+      goto activate_failed;
+
+    /* take a buffer form our pool */
+    res = gst_buffer_pool_acquire_buffer (ximagesink->pool, &to_put, NULL);
+    if (res != GST_FLOW_OK)
+      goto no_buffer;
+
+    if (gst_buffer_get_size (to_put) < gst_buffer_get_size (buf))
+      goto wrong_size;
+
+    GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, ximagesink,
+        "slow copy into bufferpool buffer %p", to_put);
+
+    if (!gst_video_frame_map (&src, &ximagesink->info, buf, GST_MAP_READ))
+      goto invalid_buffer;
+
+    if (!gst_video_frame_map (&dest, &ximagesink->info, to_put, GST_MAP_WRITE)) {
+      gst_video_frame_unmap (&src);
+      goto invalid_buffer;
     }
-    memcpy (GST_BUFFER_DATA (ximagesink->ximage), GST_BUFFER_DATA (buf),
-        MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size));
-    if (!gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage))
-      goto no_window;
+
+    gst_video_frame_copy (&dest, &src);
+
+    gst_video_frame_unmap (&dest);
+    gst_video_frame_unmap (&src);
   }
 
-  return GST_FLOW_OK;
+  if (!gst_ximagesink_ximage_put (ximagesink, to_put))
+    goto no_window;
+
+done:
+  if (to_put != buf)
+    gst_buffer_unref (to_put);
+
+  return res;
 
   /* ERRORS */
-no_ximage:
+no_pool:
+  {
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+        ("Internal error: can't allocate images"),
+        ("We don't have a bufferpool negotiated"));
+    return GST_FLOW_ERROR;
+  }
+no_buffer:
   {
     /* No image available. That's very bad ! */
     GST_WARNING_OBJECT (ximagesink, "could not create image");
-    return GST_FLOW_ERROR;
+    return res;
+  }
+wrong_size:
+  {
+    GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer"),
+        ("XServer allocated buffer size did not match input buffer %"
+            G_GSIZE_FORMAT " - %" G_GSIZE_FORMAT, gst_buffer_get_size (to_put),
+            gst_buffer_get_size (buf)));
+    res = GST_FLOW_ERROR;
+    goto done;
+  }
+invalid_buffer:
+  {
+    /* No Window available to put our image into */
+    GST_WARNING_OBJECT (ximagesink, "could map image");
+    res = GST_FLOW_OK;
+    goto done;
   }
 no_window:
   {
     /* No Window available to put our image into */
     GST_WARNING_OBJECT (ximagesink, "could not output image - no window");
-    return GST_FLOW_ERROR;
+    res = GST_FLOW_ERROR;
+    goto done;
+  }
+activate_failed:
+  {
+    GST_ERROR_OBJECT (ximagesink, "failed to activate bufferpool.");
+    res = GST_FLOW_ERROR;
+    goto done;
   }
 }
 
-
 static gboolean
 gst_ximagesink_event (GstBaseSink * sink, GstEvent * event)
 {
@@ -1760,217 +1425,89 @@ gst_ximagesink_event (GstBaseSink * sink, GstEvent * event)
     return TRUE;
 }
 
-
-/* Buffer management
- *
- * The buffer_alloc function must either return a buffer with given size and
- * caps or create a buffer with different caps attached to the buffer. This
- * last option is called reverse negotiation, ie, where the sink suggests a
- * different format from the upstream peer. 
- *
- * We try to do reverse negotiation when our geometry changes and we like a
- * resized buffer.
- */
-static GstFlowReturn
-gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
+static gboolean
+gst_ximagesink_setup_allocation (GstBaseSink * bsink, GstQuery * query)
 {
-  GstXImageSink *ximagesink;
-  GstXImageBuffer *ximage = NULL;
-  GstStructure *structure = NULL;
-  GstFlowReturn ret = GST_FLOW_OK;
-  GstCaps *alloc_caps;
-  gboolean alloc_unref = FALSE;
-  gint width, height;
-  GstVideoRectangle dst, src, result;
-  gboolean caps_accepted = FALSE;
-
-  ximagesink = GST_XIMAGESINK (bsink);
-
-  if (G_UNLIKELY (!caps)) {
-    GST_WARNING_OBJECT (ximagesink, "have no caps, doing fallback allocation");
-    *buf = NULL;
-    ret = GST_FLOW_OK;
-    goto beach;
-  }
-
-  /* This shouldn't really happen because state changes will fail
-   * if the xcontext can't be allocated */
-  if (!ximagesink->xcontext)
-    return GST_FLOW_ERROR;
-
-  GST_LOG_OBJECT (ximagesink,
-      "a buffer of %d bytes was requested with caps %" GST_PTR_FORMAT
-      " and offset %" G_GUINT64_FORMAT, size, caps, offset);
-
-  /* assume we're going to alloc what was requested, keep track of
-   * wheter we need to unref or not. When we suggest a new format 
-   * upstream we will create a new caps that we need to unref. */
-  alloc_caps = caps;
-  alloc_unref = FALSE;
+  GstXImageSink *ximagesink = GST_XIMAGESINK (bsink);
+  GstBufferPool *pool;
+  GstStructure *config;
+  GstCaps *caps;
+  guint size;
+  gboolean need_pool;
 
-  /* get struct to see what is requested */
-  structure = gst_caps_get_structure (caps, 0);
-  if (!gst_structure_get_int (structure, "width", &width) ||
-      !gst_structure_get_int (structure, "height", &height)) {
-    GST_WARNING_OBJECT (ximagesink, "invalid caps for buffer allocation %"
-        GST_PTR_FORMAT, caps);
-    ret = GST_FLOW_NOT_NEGOTIATED;
-    goto beach;
-  }
+  gst_query_parse_allocation (query, &caps, &need_pool);
 
-  src.w = width;
-  src.h = height;
+  if (caps == NULL)
+    goto no_caps;
 
-  /* We take the flow_lock because the window might go away */
   g_mutex_lock (ximagesink->flow_lock);
-  if (!ximagesink->xwindow) {
-    g_mutex_unlock (ximagesink->flow_lock);
-    goto alloc;
-  }
-
-  /* What is our geometry */
-  dst.w = ximagesink->xwindow->width;
-  dst.h = ximagesink->xwindow->height;
-
+  if ((pool = ximagesink->pool))
+    gst_object_ref (pool);
   g_mutex_unlock (ximagesink->flow_lock);
 
-  if (ximagesink->keep_aspect) {
-    GST_LOG_OBJECT (ximagesink, "enforcing aspect ratio in reverse caps "
-        "negotiation");
-    gst_video_sink_center_rect (src, dst, &result, TRUE);
-  } else {
-    GST_LOG_OBJECT (ximagesink, "trying to resize to window geometry "
-        "ignoring aspect ratio");
-    result.x = result.y = 0;
-    result.w = dst.w;
-    result.h = dst.h;
-  }
+  if (pool != NULL) {
+    const GstCaps *pcaps;
 
-  /* We would like another geometry */
-  if (width != result.w || height != result.h) {
-    int nom, den;
-    GstCaps *desired_caps;
-    GstStructure *desired_struct;
+    /* we had a pool, check caps */
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL);
 
-    /* make a copy of the incomming caps to create the new
-     * suggestion. We can't use make_writable because we might
-     * then destroy the original caps which we still need when the
-     * peer does not accept the suggestion. */
-    desired_caps = gst_caps_copy (caps);
-    desired_struct = gst_caps_get_structure (desired_caps, 0);
-
-    GST_DEBUG ("we would love to receive a %dx%d video", result.w, result.h);
-    gst_structure_set (desired_struct, "width", G_TYPE_INT, result.w, NULL);
-    gst_structure_set (desired_struct, "height", G_TYPE_INT, result.h, NULL);
-
-    /* PAR property overrides the X calculated one */
-    if (ximagesink->par) {
-      nom = gst_value_get_fraction_numerator (ximagesink->par);
-      den = gst_value_get_fraction_denominator (ximagesink->par);
-      gst_structure_set (desired_struct, "pixel-aspect-ratio",
-          GST_TYPE_FRACTION, nom, den, NULL);
-    } else if (ximagesink->xcontext->par) {
-      nom = gst_value_get_fraction_numerator (ximagesink->xcontext->par);
-      den = gst_value_get_fraction_denominator (ximagesink->xcontext->par);
-      gst_structure_set (desired_struct, "pixel-aspect-ratio",
-          GST_TYPE_FRACTION, nom, den, NULL);
+    GST_DEBUG_OBJECT (ximagesink,
+        "we had a pool with caps %" GST_PTR_FORMAT, pcaps);
+    if (!gst_caps_is_equal (caps, pcaps)) {
+      /* different caps, we can't use this pool */
+      GST_DEBUG_OBJECT (ximagesink, "pool has different caps");
+      gst_object_unref (pool);
+      pool = NULL;
     }
+  }
+  if (pool == NULL && need_pool) {
+    GstVideoInfo info;
 
+    GST_DEBUG_OBJECT (ximagesink, "create new pool");
+    pool = gst_ximage_buffer_pool_new (ximagesink);
 
-    /* see if peer accepts our new suggestion, if there is no peer, this 
-     * function returns true. */
-    if (!ximagesink->xcontext->last_caps ||
-        !gst_caps_is_equal (desired_caps, ximagesink->xcontext->last_caps)) {
-      caps_accepted =
-          gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink),
-          desired_caps);
+    if (!gst_video_info_from_caps (&info, caps))
+      goto invalid_caps;
 
-      /* Suggestion failed, prevent future attempts for the same caps
-       * to fail as well. */
-      if (!caps_accepted)
-        gst_caps_replace (&ximagesink->xcontext->last_caps, desired_caps);
-    }
+    /* the normal size of a frame */
+    size = info.size;
 
-    if (caps_accepted) {
-      /* we will not alloc a buffer of the new suggested caps. Make sure
-       * we also unref this new caps after we set it on the buffer. */
-      alloc_caps = desired_caps;
-      alloc_unref = TRUE;
-      width = result.w;
-      height = result.h;
-      GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT,
-          desired_caps);
-    } else {
-      GST_DEBUG ("peer pad does not accept our desired caps %" GST_PTR_FORMAT,
-          desired_caps);
-      /* we alloc a buffer with the original incomming caps already in the
-       * width and height variables */
-      gst_caps_unref (desired_caps);
-    }
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0);
+    if (!gst_buffer_pool_set_config (pool, config))
+      goto config_failed;
   }
+  /* we need at least 2 buffer because we hold on to the last one */
+  gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
 
-alloc:
-  /* Inspect our buffer pool */
-  g_mutex_lock (ximagesink->pool_lock);
-  while (ximagesink->buffer_pool) {
-    ximage = (GstXImageBuffer *) ximagesink->buffer_pool->data;
+  /* we also support various metadata */
+  gst_query_add_allocation_meta (query, GST_META_API_VIDEO);
+  gst_query_add_allocation_meta (query, GST_META_API_VIDEO_CROP);
 
-    if (ximage) {
-      /* Removing from the pool */
-      ximagesink->buffer_pool = g_slist_delete_link (ximagesink->buffer_pool,
-          ximagesink->buffer_pool);
+  gst_object_unref (pool);
 
-      /* If the ximage is invalid for our need, destroy */
-      if ((ximage->width != width) || (ximage->height != height)) {
-        gst_ximage_buffer_free (ximage);
-        ximage = NULL;
-      } else {
-        /* We found a suitable ximage */
-        break;
-      }
-    }
-  }
-  g_mutex_unlock (ximagesink->pool_lock);
+  return TRUE;
 
-  /* We haven't found anything, creating a new one */
-  if (!ximage) {
-    ximage = gst_ximagesink_ximage_new (ximagesink, alloc_caps);
+  /* ERRORS */
+no_caps:
+  {
+    GST_DEBUG_OBJECT (bsink, "no caps specified");
+    return FALSE;
   }
-  /* Now we should have a ximage, set appropriate caps on it */
-  if (ximage) {
-    /* Make sure the buffer is cleared of any previously used flags */
-    GST_MINI_OBJECT_CAST (ximage)->flags = 0;
-    gst_buffer_set_caps (GST_BUFFER_CAST (ximage), alloc_caps);
+invalid_caps:
+  {
+    GST_DEBUG_OBJECT (bsink, "invalid caps specified");
+    return FALSE;
   }
-
-  /* could be our new reffed suggestion or the original unreffed caps */
-  if (alloc_unref)
-    gst_caps_unref (alloc_caps);
-
-  *buf = GST_BUFFER_CAST (ximage);
-
-beach:
-  return ret;
-}
-
-/* Interfaces stuff */
-
-static gboolean
-gst_ximagesink_interface_supported (GstImplementsInterface * iface, GType type)
-{
-  if (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY)
-    return TRUE;
-  else
+config_failed:
+  {
+    GST_DEBUG_OBJECT (bsink, "failed setting config");
     return FALSE;
+  }
 }
 
-static void
-gst_ximagesink_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = gst_ximagesink_interface_supported;
-}
-
+/* Interfaces stuff */
 static void
 gst_ximagesink_navigation_send_event (GstNavigation * navigation,
     GstStructure * structure)
@@ -2027,7 +1564,7 @@ gst_ximagesink_navigation_init (GstNavigationInterface * iface)
 }
 
 static void
-gst_ximagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
+gst_ximagesink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
 {
   XID xwindow_id = id;
   GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
@@ -2097,7 +1634,7 @@ gst_ximagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
 }
 
 static void
-gst_ximagesink_expose (GstXOverlay * overlay)
+gst_ximagesink_expose (GstVideoOverlay * overlay)
 {
   GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
 
@@ -2106,7 +1643,7 @@ gst_ximagesink_expose (GstXOverlay * overlay)
 }
 
 static void
-gst_ximagesink_set_event_handling (GstXOverlay * overlay,
+gst_ximagesink_set_event_handling (GstVideoOverlay * overlay,
     gboolean handle_events)
 {
   GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
@@ -2142,7 +1679,7 @@ gst_ximagesink_set_event_handling (GstXOverlay * overlay,
 }
 
 static void
-gst_ximagesink_xoverlay_init (GstXOverlayClass * iface)
+gst_ximagesink_video_overlay_init (GstVideoOverlayIface * iface)
 {
   iface->set_window_handle = gst_ximagesink_set_window_handle;
   iface->expose = gst_ximagesink_expose;
@@ -2203,7 +1740,7 @@ gst_ximagesink_set_property (GObject * object, guint prop_id,
     }
       break;
     case PROP_HANDLE_EVENTS:
-      gst_ximagesink_set_event_handling (GST_X_OVERLAY (ximagesink),
+      gst_ximagesink_set_event_handling (GST_VIDEO_OVERLAY (ximagesink),
           g_value_get_boolean (value));
       gst_ximagesink_manage_event_thread (ximagesink);
       break;
@@ -2281,18 +1818,18 @@ gst_ximagesink_reset (GstXImageSink * ximagesink)
   if (thread)
     g_thread_join (thread);
 
-  if (ximagesink->ximage) {
-    gst_buffer_unref (GST_BUFFER_CAST (ximagesink->ximage));
-    ximagesink->ximage = NULL;
-  }
   if (ximagesink->cur_image) {
-    gst_buffer_unref (GST_BUFFER_CAST (ximagesink->cur_image));
+    gst_buffer_unref (ximagesink->cur_image);
     ximagesink->cur_image = NULL;
   }
 
-  gst_ximagesink_bufferpool_clear (ximagesink);
-
   g_mutex_lock (ximagesink->flow_lock);
+
+  if (ximagesink->pool) {
+    gst_object_unref (ximagesink->pool);
+    ximagesink->pool = NULL;
+  }
+
   if (ximagesink->xwindow) {
     gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
     gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
@@ -2328,10 +1865,6 @@ gst_ximagesink_finalize (GObject * object)
     g_mutex_free (ximagesink->flow_lock);
     ximagesink->flow_lock = NULL;
   }
-  if (ximagesink->pool_lock) {
-    g_mutex_free (ximagesink->pool_lock);
-    ximagesink->pool_lock = NULL;
-  }
 
   g_free (ximagesink->media_title);
 
@@ -2344,7 +1877,6 @@ gst_ximagesink_init (GstXImageSink * ximagesink)
   ximagesink->display_name = NULL;
   ximagesink->xcontext = NULL;
   ximagesink->xwindow = NULL;
-  ximagesink->ximage = NULL;
   ximagesink->cur_image = NULL;
 
   ximagesink->event_thread = NULL;
@@ -2358,8 +1890,7 @@ gst_ximagesink_init (GstXImageSink * ximagesink)
 
   ximagesink->par = NULL;
 
-  ximagesink->pool_lock = g_mutex_new ();
-  ximagesink->buffer_pool = NULL;
+  ximagesink->pool = NULL;
 
   ximagesink->synchronous = FALSE;
   ximagesink->keep_aspect = FALSE;
@@ -2368,19 +1899,6 @@ gst_ximagesink_init (GstXImageSink * ximagesink)
 }
 
 static void
-gst_ximagesink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Video sink", "Sink/Video",
-      "A standard X based videosink", "Julien Moutte <julien@moutte.net>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
-}
-
-static void
 gst_ximagesink_class_init (GstXImageSinkClass * klass)
 {
   GObjectClass *gobject_class;
@@ -2393,8 +1911,6 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass)
   gstbasesink_class = (GstBaseSinkClass *) klass;
   videosink_class = (GstVideoSinkClass *) klass;
 
-  parent_class = g_type_class_peek_parent (klass);
-
   gobject_class->finalize = gst_ximagesink_finalize;
   gobject_class->set_property = gst_ximagesink_set_property;
   gobject_class->get_property = gst_ximagesink_get_property;
@@ -2449,70 +1965,21 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass)
           "Height of the window", 0, G_MAXUINT64, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "Video sink", "Sink/Video",
+      "A standard X based videosink", "Julien Moutte <julien@moutte.net>");
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
+
   gstelement_class->change_state = gst_ximagesink_change_state;
 
   gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_getcaps);
   gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_setcaps);
-  gstbasesink_class->buffer_alloc =
-      GST_DEBUG_FUNCPTR (gst_ximagesink_buffer_alloc);
   gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_ximagesink_get_times);
+  gstbasesink_class->setup_allocation =
+      GST_DEBUG_FUNCPTR (gst_ximagesink_setup_allocation);
   gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_ximagesink_event);
 
   videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_ximagesink_show_frame);
 }
-
-/* ============================================================= */
-/*                                                               */
-/*                       Public Methods                          */
-/*                                                               */
-/* ============================================================= */
-
-/* =========================================== */
-/*                                             */
-/*          Object typing & Creation           */
-/*                                             */
-/* =========================================== */
-
-GType
-gst_ximagesink_get_type (void)
-{
-  static GType ximagesink_type = 0;
-
-  if (!ximagesink_type) {
-    static const GTypeInfo ximagesink_info = {
-      sizeof (GstXImageSinkClass),
-      gst_ximagesink_base_init,
-      NULL,
-      (GClassInitFunc) gst_ximagesink_class_init,
-      NULL,
-      NULL,
-      sizeof (GstXImageSink), 0, (GInstanceInitFunc) gst_ximagesink_init,
-    };
-    static const GInterfaceInfo iface_info = {
-      (GInterfaceInitFunc) gst_ximagesink_interface_init, NULL, NULL,
-    };
-    static const GInterfaceInfo navigation_info = {
-      (GInterfaceInitFunc) gst_ximagesink_navigation_init, NULL, NULL,
-    };
-    static const GInterfaceInfo overlay_info = {
-      (GInterfaceInitFunc) gst_ximagesink_xoverlay_init, NULL, NULL,
-    };
-
-    ximagesink_type = g_type_register_static (GST_TYPE_VIDEO_SINK,
-        "GstXImageSink", &ximagesink_info, 0);
-
-    g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
-        &iface_info);
-    g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION,
-        &navigation_info);
-    g_type_add_interface_static (ximagesink_type, GST_TYPE_X_OVERLAY,
-        &overlay_info);
-
-    /* register type and create class in a more safe place instead of at
-     * runtime since the type registration and class creation is not
-     * threadsafe. */
-    g_type_class_ref (gst_ximage_buffer_get_type ());
-  }
-
-  return ximagesink_type;
-}
index 83e973f..0cdd896 100644 (file)
@@ -38,6 +38,9 @@
 #include <string.h>
 #include <math.h>
 
+/* Helper functions */
+#include <gst/video/video.h>
+
 G_BEGIN_DECLS
 #define GST_TYPE_XIMAGESINK \
   (gst_ximagesink_get_type())
@@ -49,15 +52,15 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XIMAGESINK))
 #define GST_IS_XIMAGESINK_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XIMAGESINK))
+
 typedef struct _GstXContext GstXContext;
 typedef struct _GstXWindow GstXWindow;
 
-typedef struct _GstXImageBuffer GstXImageBuffer;
-typedef struct _GstXImageBufferClass GstXImageBufferClass;
-
 typedef struct _GstXImageSink GstXImageSink;
 typedef struct _GstXImageSinkClass GstXImageSinkClass;
 
+#include "ximagepool.h"
+
 /*
  * GstXContext:
  * @disp: the X11 Display of this context
@@ -98,7 +101,6 @@ struct _GstXContext
 
   gint depth;
   gint bpp;
-  gint endianness;
 
   gint width, height;
   gint widthmm, heightmm;
@@ -130,33 +132,6 @@ struct _GstXWindow
 };
 
 /**
- * GstXImageBuffer:
- * @ximagesink: a reference to our #GstXImageSink
- * @ximage: the XImage of this buffer
- * @width: the width in pixels of XImage @ximage
- * @height: the height in pixels of XImage @ximage
- * @size: the size in bytes of XImage @ximage
- *
- * Subclass of #GstBuffer containing additional information about an XImage.
- */
-struct _GstXImageBuffer
-{
-  GstBuffer buffer;
-
-  /* Reference to the ximagesink we belong to */
-  GstXImageSink *ximagesink;
-
-  XImage *ximage;
-
-#ifdef HAVE_XSHM
-  XShmSegmentInfo SHMInfo;
-#endif                          /* HAVE_XSHM */
-
-  gint width, height;
-  size_t size;
-};
-
-/**
  * GstXImageSink:
  * @display_name: the name of the Display we want to render to
  * @xcontext: our instance's #GstXContext
@@ -194,12 +169,13 @@ struct _GstXImageSink
 
   GstXContext *xcontext;
   GstXWindow *xwindow;
-  GstXImageBuffer *ximage;
-  GstXImageBuffer *cur_image;
+  GstBuffer *cur_image;
 
   GThread *event_thread;
   gboolean running;
 
+  GstVideoInfo info;
+
   /* Framerate numerator and denominator */
   gint fps_n;
   gint fps_d;
@@ -210,8 +186,8 @@ struct _GstXImageSink
   /* object-set pixel aspect ratio */
   GValue *par;
 
-  GMutex *pool_lock;
-  GSList *buffer_pool;
+  /* the buffer pool */
+  GstBufferPool *pool;
 
   gboolean synchronous;
   gboolean keep_aspect;
index fbff4d8..9669e72 100644 (file)
@@ -1,6 +1,6 @@
 plugin_LTLIBRARIES = libgstxvimagesink.la
 
-libgstxvimagesink_la_SOURCES =  xvimagesink.c 
+libgstxvimagesink_la_SOURCES =  xvimagesink.c xvimage.c xvimagepool.c 
 libgstxvimagesink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
 libgstxvimagesink_la_LIBADD = \
        $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
@@ -12,4 +12,4 @@ libgstxvimagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstxvimagesink_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la
 libgstxvimagesink_la_LIBTOOLFLAGS = --tag=disable-static
 
-noinst_HEADERS = xvimagesink.h 
+noinst_HEADERS = xvimagesink.h xvimagepool.h
diff --git a/sys/xvimage/xvimage.c b/sys/xvimage/xvimage.c
new file mode 100644 (file)
index 0000000..5e2d619
--- /dev/null
@@ -0,0 +1,51 @@
+/* GStreamer
+ * Copyright (C) <2003> Julien Moutte <julien@moutte.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "xvimagesink.h"
+
+GST_DEBUG_CATEGORY (gst_debug_xvimagepool);
+GST_DEBUG_CATEGORY (gst_debug_xvimagesink);
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  if (!gst_element_register (plugin, "xvimagesink",
+          GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK))
+    return FALSE;
+
+  GST_DEBUG_CATEGORY_INIT (gst_debug_xvimagesink, "xvimagesink", 0,
+      "xvimagesink element");
+  GST_DEBUG_CATEGORY_INIT (gst_debug_xvimagepool, "xvimagepool", 0,
+      "xvimagepool object");
+
+  GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
+
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "xvimagesink",
+    "XFree86 video output plugin using Xv extension",
+    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/xvimage/xvimagepool.c b/sys/xvimage/xvimagepool.c
new file mode 100644 (file)
index 0000000..855d877
--- /dev/null
@@ -0,0 +1,733 @@
+/* GStreamer
+ * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* Object header */
+#include "xvimagesink.h"
+
+/* Debugging category */
+#include <gst/gstinfo.h>
+
+/* Helper functions */
+#include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideopool.h>
+
+
+GST_DEBUG_CATEGORY_EXTERN (gst_debug_xvimagepool);
+#define GST_CAT_DEFAULT gst_debug_xvimagepool
+
+
+struct _GstXvImageBufferPoolPrivate
+{
+  GstCaps *caps;
+  gint im_format;
+  GstVideoInfo info;
+  GstVideoAlignment align;
+  guint padded_width;
+  guint padded_height;
+  gboolean add_metavideo;
+  gboolean need_alignment;
+};
+
+static void gst_meta_xvimage_free (GstMetaXvImage * meta, GstBuffer * buffer);
+
+/* xvimage metadata */
+const GstMetaInfo *
+gst_meta_xvimage_get_info (void)
+{
+  static const GstMetaInfo *meta_xvimage_info = NULL;
+
+  if (meta_xvimage_info == NULL) {
+    meta_xvimage_info = gst_meta_register ("GstMetaXvImage", "GstMetaXvImage",
+        sizeof (GstMetaXvImage),
+        (GstMetaInitFunction) NULL,
+        (GstMetaFreeFunction) gst_meta_xvimage_free,
+        (GstMetaCopyFunction) NULL, (GstMetaTransformFunction) NULL);
+  }
+  return meta_xvimage_info;
+}
+
+/* X11 stuff */
+static gboolean error_caught = FALSE;
+
+static int
+gst_xvimagesink_handle_xerror (Display * display, XErrorEvent * xevent)
+{
+  char error_msg[1024];
+
+  XGetErrorText (display, xevent->error_code, error_msg, 1024);
+  GST_DEBUG ("xvimagesink triggered an XError. error: %s", error_msg);
+  error_caught = TRUE;
+  return 0;
+}
+
+static GstMetaXvImage *
+gst_buffer_add_meta_xvimage (GstBuffer * buffer, GstXvImageBufferPool * xvpool)
+{
+  GstXvImageSink *xvimagesink;
+  int (*handler) (Display *, XErrorEvent *);
+  gboolean success = FALSE;
+  GstXContext *xcontext;
+  GstMetaXvImage *meta;
+  gint width, height, im_format;
+  GstXvImageBufferPoolPrivate *priv;
+
+  priv = xvpool->priv;
+  xvimagesink = xvpool->sink;
+  xcontext = xvimagesink->xcontext;
+
+  width = priv->padded_width;
+  height = priv->padded_height;
+  im_format = priv->im_format;
+
+  meta =
+      (GstMetaXvImage *) gst_buffer_add_meta (buffer, GST_META_INFO_XVIMAGE,
+      NULL);
+#ifdef HAVE_XSHM
+  meta->SHMInfo.shmaddr = ((void *) -1);
+  meta->SHMInfo.shmid = -1;
+#endif
+  meta->x = priv->align.padding_left;
+  meta->y = priv->align.padding_top;
+  meta->width = priv->info.width;
+  meta->height = priv->info.height;
+  meta->sink = gst_object_ref (xvimagesink);
+  meta->im_format = im_format;
+
+  GST_DEBUG_OBJECT (xvimagesink, "creating image %p (%dx%d)", buffer,
+      width, height);
+
+  g_mutex_lock (xvimagesink->x_lock);
+
+  /* Setting an error handler to catch failure */
+  error_caught = FALSE;
+  handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
+
+#ifdef HAVE_XSHM
+  if (xcontext->use_xshm) {
+    int expected_size;
+
+    meta->xvimage = XvShmCreateImage (xcontext->disp,
+        xcontext->xv_port_id, im_format, NULL, width, height, &meta->SHMInfo);
+    if (!meta->xvimage || error_caught) {
+      g_mutex_unlock (xvimagesink->x_lock);
+
+      /* Reset error flag */
+      error_caught = FALSE;
+
+      /* Push a warning */
+      GST_ELEMENT_WARNING (xvimagesink, RESOURCE, WRITE,
+          ("Failed to create output image buffer of %dx%d pixels",
+              width, height),
+          ("could not XShmCreateImage a %dx%d image", width, height));
+
+      /* Retry without XShm */
+      xvimagesink->xcontext->use_xshm = FALSE;
+
+      /* Hold X mutex again to try without XShm */
+      g_mutex_lock (xvimagesink->x_lock);
+      goto no_xshm;
+    }
+
+    /* we have to use the returned data_size for our shm size */
+    meta->size = meta->xvimage->data_size;
+    GST_LOG_OBJECT (xvimagesink, "XShm image size is %" G_GSIZE_FORMAT,
+        meta->size);
+
+    /* calculate the expected size.  This is only for sanity checking the
+     * number we get from X. */
+    switch (im_format) {
+      case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+      case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+      {
+        gint pitches[3];
+        gint offsets[3];
+        guint plane;
+
+        offsets[0] = 0;
+        pitches[0] = GST_ROUND_UP_4 (width);
+        offsets[1] = offsets[0] + pitches[0] * GST_ROUND_UP_2 (height);
+        pitches[1] = GST_ROUND_UP_8 (width) / 2;
+        offsets[2] = offsets[1] + pitches[1] * GST_ROUND_UP_2 (height) / 2;
+        pitches[2] = GST_ROUND_UP_8 (pitches[0]) / 2;
+
+        expected_size = offsets[2] + pitches[2] * GST_ROUND_UP_2 (height) / 2;
+
+        for (plane = 0; plane < meta->xvimage->num_planes; plane++) {
+          GST_DEBUG_OBJECT (xvimagesink,
+              "Plane %u has a expected pitch of %d bytes, " "offset of %d",
+              plane, pitches[plane], offsets[plane]);
+        }
+        break;
+      }
+      case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+      case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
+        expected_size = height * GST_ROUND_UP_4 (width * 2);
+        break;
+      default:
+        expected_size = 0;
+        break;
+    }
+    if (expected_size != 0 && meta->size != expected_size) {
+      GST_WARNING_OBJECT (xvimagesink,
+          "unexpected XShm image size (got %" G_GSIZE_FORMAT ", expected %d)",
+          meta->size, expected_size);
+    }
+
+    /* Be verbose about our XvImage stride */
+    {
+      guint plane;
+
+      for (plane = 0; plane < meta->xvimage->num_planes; plane++) {
+        GST_DEBUG_OBJECT (xvimagesink, "Plane %u has a pitch of %d bytes, "
+            "offset of %d", plane, meta->xvimage->pitches[plane],
+            meta->xvimage->offsets[plane]);
+      }
+    }
+
+    /* get shared memory */
+    meta->SHMInfo.shmid = shmget (IPC_PRIVATE, meta->size, IPC_CREAT | 0777);
+    if (meta->SHMInfo.shmid == -1)
+      goto shmget_failed;
+
+    /* attach */
+    meta->SHMInfo.shmaddr = shmat (meta->SHMInfo.shmid, NULL, 0);
+    if (meta->SHMInfo.shmaddr == ((void *) -1))
+      goto shmat_failed;
+
+    /* now we can set up the image data */
+    meta->xvimage->data = meta->SHMInfo.shmaddr;
+    meta->SHMInfo.readOnly = FALSE;
+
+    if (XShmAttach (xcontext->disp, &meta->SHMInfo) == 0)
+      goto xattach_failed;
+
+    XSync (xcontext->disp, FALSE);
+
+    /* Delete the shared memory segment as soon as we everyone is attached.
+     * This way, it will be deleted as soon as we detach later, and not
+     * leaked if we crash. */
+    shmctl (meta->SHMInfo.shmid, IPC_RMID, NULL);
+
+    GST_DEBUG_OBJECT (xvimagesink, "XServer ShmAttached to 0x%x, id 0x%lx",
+        meta->SHMInfo.shmid, meta->SHMInfo.shmseg);
+  } else
+  no_xshm:
+#endif /* HAVE_XSHM */
+  {
+    meta->xvimage = XvCreateImage (xcontext->disp,
+        xcontext->xv_port_id, im_format, NULL, width, height);
+    if (!meta->xvimage || error_caught)
+      goto create_failed;
+
+    /* we have to use the returned data_size for our image size */
+    meta->size = meta->xvimage->data_size;
+    meta->xvimage->data = g_malloc (meta->size);
+
+    XSync (xcontext->disp, FALSE);
+  }
+
+  /* Reset error handler */
+  error_caught = FALSE;
+  XSetErrorHandler (handler);
+
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, meta->xvimage->data,
+          NULL, meta->size, 0, meta->size));
+
+  g_mutex_unlock (xvimagesink->x_lock);
+
+  success = TRUE;
+
+beach:
+  if (!success)
+    meta = NULL;
+
+  return meta;
+
+  /* ERRORS */
+create_failed:
+  {
+    g_mutex_unlock (xvimagesink->x_lock);
+    /* Reset error handler */
+    error_caught = FALSE;
+    XSetErrorHandler (handler);
+    /* Push an error */
+    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height),
+        ("could not XvShmCreateImage a %dx%d image", width, height));
+    goto beach;
+  }
+shmget_failed:
+  {
+    g_mutex_unlock (xvimagesink->x_lock);
+    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height),
+        ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
+            meta->size));
+    goto beach;
+  }
+shmat_failed:
+  {
+    g_mutex_unlock (xvimagesink->x_lock);
+    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height), ("Failed to shmat: %s", g_strerror (errno)));
+    /* Clean up the shared memory segment */
+    shmctl (meta->SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+xattach_failed:
+  {
+    /* Clean up the shared memory segment */
+    shmctl (meta->SHMInfo.shmid, IPC_RMID, NULL);
+    g_mutex_unlock (xvimagesink->x_lock);
+
+    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            width, height), ("Failed to XShmAttach"));
+    goto beach;
+  }
+}
+
+static void
+gst_meta_xvimage_free (GstMetaXvImage * meta, GstBuffer * buffer)
+{
+  GstXvImageSink *xvimagesink;
+
+  xvimagesink = meta->sink;
+
+  GST_DEBUG_OBJECT (xvimagesink, "free meta on buffer %p", buffer);
+
+  /* Hold the object lock to ensure the XContext doesn't disappear */
+  GST_OBJECT_LOCK (xvimagesink);
+  /* We might have some buffers destroyed after changing state to NULL */
+  if (xvimagesink->xcontext == NULL) {
+    GST_DEBUG_OBJECT (xvimagesink, "Destroying XvImage after Xcontext");
+#ifdef HAVE_XSHM
+    /* Need to free the shared memory segment even if the x context
+     * was already cleaned up */
+    if (meta->SHMInfo.shmaddr != ((void *) -1)) {
+      shmdt (meta->SHMInfo.shmaddr);
+    }
+#endif
+    goto beach;
+  }
+
+  g_mutex_lock (xvimagesink->x_lock);
+
+#ifdef HAVE_XSHM
+  if (xvimagesink->xcontext->use_xshm) {
+    if (meta->SHMInfo.shmaddr != ((void *) -1)) {
+      GST_DEBUG_OBJECT (xvimagesink, "XServer ShmDetaching from 0x%x id 0x%lx",
+          meta->SHMInfo.shmid, meta->SHMInfo.shmseg);
+      XShmDetach (xvimagesink->xcontext->disp, &meta->SHMInfo);
+      XSync (xvimagesink->xcontext->disp, FALSE);
+      shmdt (meta->SHMInfo.shmaddr);
+      meta->SHMInfo.shmaddr = (void *) -1;
+    }
+    if (meta->xvimage)
+      XFree (meta->xvimage);
+  } else
+#endif /* HAVE_XSHM */
+  {
+    if (meta->xvimage) {
+      g_free (meta->xvimage->data);
+      XFree (meta->xvimage);
+    }
+  }
+
+  XSync (xvimagesink->xcontext->disp, FALSE);
+
+  g_mutex_unlock (xvimagesink->x_lock);
+
+beach:
+  GST_OBJECT_UNLOCK (xvimagesink);
+
+  gst_object_unref (meta->sink);
+}
+
+#ifdef HAVE_XSHM
+/* This function checks that it is actually really possible to create an image
+   using XShm */
+gboolean
+gst_xvimagesink_check_xshm_calls (GstXvImageSink * xvimagesink,
+    GstXContext * xcontext)
+{
+  XvImage *xvimage;
+  XShmSegmentInfo SHMInfo;
+  size_t size;
+  int (*handler) (Display *, XErrorEvent *);
+  gboolean result = FALSE;
+  gboolean did_attach = FALSE;
+
+  g_return_val_if_fail (xcontext != NULL, FALSE);
+
+  /* Sync to ensure any older errors are already processed */
+  XSync (xcontext->disp, FALSE);
+
+  /* Set defaults so we don't free these later unnecessarily */
+  SHMInfo.shmaddr = ((void *) -1);
+  SHMInfo.shmid = -1;
+
+  /* Setting an error handler to catch failure */
+  error_caught = FALSE;
+  handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
+
+  /* Trying to create a 1x1 picture */
+  GST_DEBUG ("XvShmCreateImage of 1x1");
+  xvimage = XvShmCreateImage (xcontext->disp, xcontext->xv_port_id,
+      xcontext->im_format, NULL, 1, 1, &SHMInfo);
+
+  /* Might cause an error, sync to ensure it is noticed */
+  XSync (xcontext->disp, FALSE);
+  if (!xvimage || error_caught) {
+    GST_WARNING ("could not XvShmCreateImage a 1x1 image");
+    goto beach;
+  }
+  size = xvimage->data_size;
+
+  SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
+  if (SHMInfo.shmid == -1) {
+    GST_WARNING ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
+        size);
+    goto beach;
+  }
+
+  SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
+  if (SHMInfo.shmaddr == ((void *) -1)) {
+    GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  xvimage->data = SHMInfo.shmaddr;
+  SHMInfo.readOnly = FALSE;
+
+  if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
+    GST_WARNING ("Failed to XShmAttach");
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  /* Sync to ensure we see any errors we caused */
+  XSync (xcontext->disp, FALSE);
+
+  /* Delete the shared memory segment as soon as everyone is attached.
+   * This way, it will be deleted as soon as we detach later, and not
+   * leaked if we crash. */
+  shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+
+  if (!error_caught) {
+    GST_DEBUG ("XServer ShmAttached to 0x%x, id 0x%lx", SHMInfo.shmid,
+        SHMInfo.shmseg);
+
+    did_attach = TRUE;
+    /* store whether we succeeded in result */
+    result = TRUE;
+  } else {
+    GST_WARNING ("MIT-SHM extension check failed at XShmAttach. "
+        "Not using shared memory.");
+  }
+
+beach:
+  /* Sync to ensure we swallow any errors we caused and reset error_caught */
+  XSync (xcontext->disp, FALSE);
+
+  error_caught = FALSE;
+  XSetErrorHandler (handler);
+
+  if (did_attach) {
+    GST_DEBUG ("XServer ShmDetaching from 0x%x id 0x%lx",
+        SHMInfo.shmid, SHMInfo.shmseg);
+    XShmDetach (xcontext->disp, &SHMInfo);
+    XSync (xcontext->disp, FALSE);
+  }
+  if (SHMInfo.shmaddr != ((void *) -1))
+    shmdt (SHMInfo.shmaddr);
+  if (xvimage)
+    XFree (xvimage);
+  return result;
+}
+#endif /* HAVE_XSHM */
+
+/* bufferpool */
+static void gst_xvimage_buffer_pool_finalize (GObject * object);
+
+#define GST_XVIMAGE_BUFFER_POOL_GET_PRIVATE(obj)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_XVIMAGE_BUFFER_POOL, GstXvImageBufferPoolPrivate))
+
+#define gst_xvimage_buffer_pool_parent_class parent_class
+G_DEFINE_TYPE (GstXvImageBufferPool, gst_xvimage_buffer_pool,
+    GST_TYPE_BUFFER_POOL);
+
+static const gchar **
+xvimage_buffer_pool_get_options (GstBufferPool * pool)
+{
+  static const gchar *options[] = { GST_BUFFER_POOL_OPTION_META_VIDEO,
+    GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT, NULL
+  };
+
+  return options;
+}
+
+static gboolean
+xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
+{
+  GstXvImageBufferPool *xvpool = GST_XVIMAGE_BUFFER_POOL_CAST (pool);
+  GstXvImageBufferPoolPrivate *priv = xvpool->priv;
+  GstVideoInfo info;
+  const GstCaps *caps;
+
+  if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL))
+    goto wrong_config;
+
+  if (caps == NULL)
+    goto no_caps;
+
+  /* now parse the caps from the config */
+  if (!gst_video_info_from_caps (&info, caps))
+    goto wrong_caps;
+
+  GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT, info.width, info.height,
+      caps);
+
+  priv->im_format = gst_xvimagesink_get_format_from_info (xvpool->sink, &info);
+  if (priv->im_format == -1)
+    goto unknown_format;
+
+  if (priv->caps)
+    gst_caps_unref (priv->caps);
+  priv->caps = gst_caps_copy (caps);
+  priv->info = info;
+
+  /* enable metadata based on config of the pool */
+  priv->add_metavideo =
+      gst_buffer_pool_config_has_option (config,
+      GST_BUFFER_POOL_OPTION_META_VIDEO);
+
+  /* parse extra alignment info */
+  priv->need_alignment = gst_buffer_pool_config_has_option (config,
+      GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
+
+  if (priv->need_alignment) {
+    gst_buffer_pool_config_get_video_alignment (config, &priv->align);
+
+    GST_LOG_OBJECT (pool, "padding %u-%ux%u-%u", priv->align.padding_top,
+        priv->align.padding_left, priv->align.padding_left,
+        priv->align.padding_bottom);
+
+    /* we need the video metadata too now */
+    priv->add_metavideo = TRUE;
+  }
+
+  /* add the padding */
+  priv->padded_width =
+      GST_VIDEO_INFO_WIDTH (&info) + priv->align.padding_left +
+      priv->align.padding_right;
+  priv->padded_height =
+      GST_VIDEO_INFO_HEIGHT (&info) + priv->align.padding_top +
+      priv->align.padding_bottom;
+
+  return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
+
+  /* ERRORS */
+wrong_config:
+  {
+    GST_WARNING_OBJECT (pool, "invalid config");
+    return FALSE;
+  }
+no_caps:
+  {
+    GST_WARNING_OBJECT (pool, "no caps in config");
+    return FALSE;
+  }
+wrong_caps:
+  {
+    GST_WARNING_OBJECT (pool,
+        "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
+unknown_format:
+  {
+    GST_WARNING_OBJECT (xvpool->sink, "failed to get format from caps %"
+        GST_PTR_FORMAT, caps);
+    GST_ELEMENT_ERROR (xvpool->sink, RESOURCE, WRITE,
+        ("Failed to create output image buffer of %dx%d pixels",
+            priv->info.width, priv->info.height), ("Invalid input caps"));
+    return FALSE;;
+  }
+}
+
+/* This function handles GstXImageBuffer creation depending on XShm availability */
+static GstFlowReturn
+xvimage_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
+    GstBufferPoolParams * params)
+{
+  GstXvImageBufferPool *xvpool = GST_XVIMAGE_BUFFER_POOL_CAST (pool);
+  GstXvImageBufferPoolPrivate *priv = xvpool->priv;
+  GstVideoInfo *info;
+  GstBuffer *xvimage;
+  GstMetaXvImage *meta;
+
+  info = &priv->info;
+
+  xvimage = gst_buffer_new ();
+  meta = gst_buffer_add_meta_xvimage (xvimage, xvpool);
+  if (meta == NULL) {
+    gst_buffer_unref (xvimage);
+    goto no_buffer;
+  }
+
+  if (priv->add_metavideo) {
+    GstMetaVideo *meta;
+    const GstVideoFormatInfo *vinfo = info->finfo;
+    gint i;
+
+    GST_DEBUG_OBJECT (pool, "adding GstMetaVideo");
+    /* these are just the defaults for now */
+    meta = gst_buffer_add_meta_video (xvimage, 0, GST_VIDEO_INFO_FORMAT (info),
+        priv->padded_width, priv->padded_height);
+
+    if (priv->need_alignment) {
+      meta->width = GST_VIDEO_INFO_WIDTH (&priv->info);
+      meta->height = GST_VIDEO_INFO_HEIGHT (&priv->info);
+
+      /* FIXME, not quite correct, NV12 would apply the vedge twice on the second
+       * plane */
+      for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (info); i++) {
+        gint vedge, hedge, plane;
+
+        hedge =
+            GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (vinfo, i,
+            priv->align.padding_left);
+        vedge =
+            GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (vinfo, i,
+            priv->align.padding_top);
+        plane = GST_VIDEO_FORMAT_INFO_PLANE (vinfo, i);
+
+        GST_LOG_OBJECT (pool, "comp %d, plane %d: hedge %d, vedge %d", i,
+            plane, hedge, vedge);
+
+        meta->offset[plane] += (vedge * meta->stride[plane]) + hedge;
+      }
+    }
+  }
+
+  *buffer = xvimage;
+
+  return GST_FLOW_OK;
+
+  /* ERROR */
+no_buffer:
+  {
+    GST_WARNING_OBJECT (pool, "can't create image");
+    return GST_FLOW_ERROR;
+  }
+}
+
+static void
+xvimage_buffer_pool_free (GstBufferPool * pool, GstBuffer * buffer)
+{
+  gst_buffer_unref (buffer);
+}
+
+GstBufferPool *
+gst_xvimage_buffer_pool_new (GstXvImageSink * xvimagesink)
+{
+  GstXvImageBufferPool *pool;
+
+  g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
+
+  pool = g_object_new (GST_TYPE_XVIMAGE_BUFFER_POOL, NULL);
+  pool->sink = gst_object_ref (xvimagesink);
+
+  GST_LOG_OBJECT (pool, "new XvImage buffer pool %p", pool);
+
+  return GST_BUFFER_POOL_CAST (pool);
+}
+
+static void
+gst_xvimage_buffer_pool_class_init (GstXvImageBufferPoolClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (GstXvImageBufferPoolPrivate));
+
+  gobject_class->finalize = gst_xvimage_buffer_pool_finalize;
+
+  gstbufferpool_class->get_options = xvimage_buffer_pool_get_options;
+  gstbufferpool_class->set_config = xvimage_buffer_pool_set_config;
+  gstbufferpool_class->alloc_buffer = xvimage_buffer_pool_alloc;
+  gstbufferpool_class->free_buffer = xvimage_buffer_pool_free;
+}
+
+static void
+gst_xvimage_buffer_pool_init (GstXvImageBufferPool * pool)
+{
+  pool->priv = GST_XVIMAGE_BUFFER_POOL_GET_PRIVATE (pool);
+}
+
+static void
+gst_xvimage_buffer_pool_finalize (GObject * object)
+{
+  GstXvImageBufferPool *pool = GST_XVIMAGE_BUFFER_POOL_CAST (object);
+  GstXvImageBufferPoolPrivate *priv = pool->priv;
+
+  GST_LOG_OBJECT (pool, "finalize XvImage buffer pool %p", pool);
+
+  if (priv->caps)
+    gst_caps_unref (priv->caps);
+  gst_object_unref (pool->sink);
+
+  G_OBJECT_CLASS (gst_xvimage_buffer_pool_parent_class)->finalize (object);
+}
+
+/* This function tries to get a format matching with a given caps in the
+   supported list of formats we generated in gst_xvimagesink_get_xv_support */
+gint
+gst_xvimagesink_get_format_from_info (GstXvImageSink * xvimagesink,
+    GstVideoInfo * info)
+{
+  GList *list = NULL;
+
+  g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), 0);
+
+  list = xvimagesink->xcontext->formats_list;
+
+  while (list) {
+    GstXvImageFormat *format = list->data;
+
+    if (format && format->vformat == GST_VIDEO_INFO_FORMAT (info))
+      return format->format;
+
+    list = g_list_next (list);
+  }
+
+  return -1;
+}
diff --git a/sys/xvimage/xvimagepool.h b/sys/xvimage/xvimagepool.h
new file mode 100644 (file)
index 0000000..7136498
--- /dev/null
@@ -0,0 +1,117 @@
+/* GStreamer
+ * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_XVIMAGEPOOL_H__
+#define __GST_XVIMAGEPOOL_H__
+
+#ifdef HAVE_XSHM
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif /* HAVE_XSHM */
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#ifdef HAVE_XSHM
+#include <X11/extensions/XShm.h>
+#endif /* HAVE_XSHM */
+
+#include <string.h>
+#include <math.h>
+
+
+G_BEGIN_DECLS
+
+typedef struct _GstMetaXvImage GstMetaXvImage;
+
+typedef struct _GstXvImageBufferPool GstXvImageBufferPool;
+typedef struct _GstXvImageBufferPoolClass GstXvImageBufferPoolClass;
+typedef struct _GstXvImageBufferPoolPrivate GstXvImageBufferPoolPrivate;
+
+#include "xvimagesink.h"
+
+const GstMetaInfo * gst_meta_xvimage_get_info (void);
+#define GST_META_INFO_XVIMAGE  (gst_meta_xvimage_get_info())
+
+#define gst_buffer_get_meta_xvimage(b) ((GstMetaXvImage*)gst_buffer_get_meta((b),GST_META_INFO_XVIMAGE))
+
+/**
+ * GstMetaXvImage:
+ * @sink: a reference to the our #GstXvImageSink
+ * @xvimage: the XvImage of this buffer
+ * @width: the width in pixels of XvImage @xvimage
+ * @height: the height in pixels of XvImage @xvimage
+ * @im_format: the format of XvImage @xvimage
+ * @size: the size in bytes of XvImage @xvimage
+ *
+ * Subclass of #GstMeta containing additional information about an XvImage.
+ */
+struct _GstMetaXvImage
+{
+  GstMeta meta;
+
+  /* Reference to the xvimagesink we belong to */
+  GstXvImageSink *sink;
+
+  XvImage *xvimage;
+
+#ifdef HAVE_XSHM
+  XShmSegmentInfo SHMInfo;
+#endif                          /* HAVE_XSHM */
+
+  gint x, y;
+  gint width, height;
+  gint im_format;
+  size_t size;
+};
+
+/* buffer pool functions */
+#define GST_TYPE_XVIMAGE_BUFFER_POOL      (gst_xvimage_buffer_pool_get_type())
+#define GST_IS_XVIMAGE_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XVIMAGE_BUFFER_POOL))
+#define GST_XVIMAGE_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XVIMAGE_BUFFER_POOL, GstXvImageBufferPool))
+#define GST_XVIMAGE_BUFFER_POOL_CAST(obj) ((GstXvImageBufferPool*)(obj))
+
+struct _GstXvImageBufferPool
+{
+  GstBufferPool bufferpool;
+
+  GstXvImageSink *sink;
+
+  GstXvImageBufferPoolPrivate *priv;
+};
+
+struct _GstXvImageBufferPoolClass
+{
+  GstBufferPoolClass parent_class;
+};
+
+GType gst_xvimage_buffer_pool_get_type (void);
+
+GstBufferPool *gst_xvimage_buffer_pool_new (GstXvImageSink * xvimagesink);
+
+gboolean gst_xvimagesink_check_xshm_calls (GstXvImageSink * xvimagesink,
+      GstXContext * xcontext);
+
+gint gst_xvimagesink_get_format_from_info (GstXvImageSink * xvimagesink,
+    GstVideoInfo * info);
+
+G_END_DECLS
+
+#endif /*__GST_XVIMAGEPOOL_H__*/
index ba10ef0..e5e0345 100644 (file)
@@ -94,7 +94,7 @@
  * position. This also handles borders correctly, limiting coordinates to the
  * image area
  * |[
- * gst-launch -v videotestsrc ! video/x-raw-yuv, pixel-aspect-ratio=(fraction)4/3 ! xvimagesink
+ * gst-launch -v videotestsrc ! video/x-raw, pixel-aspect-ratio=(fraction)4/3 ! xvimagesink
  * ]| This is faking a 4/3 pixel aspect ratio caps on video frames produced by
  * videotestsrc, in most cases the pixel aspect ratio of the display will be
  * 1/1. This means that XvImageSink will have to do the scaling to convert
 
 /* Our interfaces */
 #include <gst/interfaces/navigation.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 #include <gst/interfaces/colorbalance.h>
 #include <gst/interfaces/propertyprobe.h>
 /* Helper functions */
-#include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
 
 /* Object header */
 #include "xvimagesink.h"
 
 /* Debugging category */
 #include <gst/gstinfo.h>
-GST_DEBUG_CATEGORY_STATIC (gst_debug_xvimagesink);
+
+GST_DEBUG_CATEGORY_EXTERN (gst_debug_xvimagesink);
+GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
 #define GST_CAT_DEFAULT gst_debug_xvimagesink
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
 
 typedef struct
 {
@@ -143,27 +144,17 @@ MotifWmHints, MwmHints;
 #define MWM_HINTS_DECORATIONS   (1L << 1)
 
 static void gst_xvimagesink_reset (GstXvImageSink * xvimagesink);
-
-static GstBufferClass *xvimage_buffer_parent_class = NULL;
-static void gst_xvimage_buffer_finalize (GstXvImageBuffer * xvimage);
-
 static void gst_xvimagesink_xwindow_update_geometry (GstXvImageSink *
     xvimagesink);
-static gint gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
-    GstCaps * caps);
-static void gst_xvimagesink_expose (GstXOverlay * overlay);
+static void gst_xvimagesink_expose (GstVideoOverlay * overlay);
 
 /* Default template - initiated with class struct to allow gst-register to work
    without X running */
 static GstStaticPadTemplate gst_xvimagesink_sink_template_factory =
-    GST_STATIC_PAD_TEMPLATE ("sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-rgb, "
-        "framerate = (fraction) [ 0, MAX ], "
-        "width = (int) [ 1, MAX ], "
-        "height = (int) [ 1, MAX ]; "
-        "video/x-raw-yuv, "
+    GST_STATIC_CAPS ("video/x-raw, "
         "framerate = (fraction) [ 0, MAX ], "
         "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
     );
@@ -191,548 +182,41 @@ enum
   PROP_WINDOW_HEIGHT
 };
 
-static void gst_xvimagesink_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstXvImageSink, gst_xvimagesink, GstVideoSink,
-    GST_TYPE_VIDEO_SINK, gst_xvimagesink_init_interfaces);
-
-
 /* ============================================================= */
 /*                                                               */
-/*                       Private Methods                         */
+/*                       Public Methods                          */
 /*                                                               */
 /* ============================================================= */
 
-/* xvimage buffers */
-
-#define GST_TYPE_XVIMAGE_BUFFER (gst_xvimage_buffer_get_type())
-
-#define GST_IS_XVIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XVIMAGE_BUFFER))
-#define GST_XVIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XVIMAGE_BUFFER, GstXvImageBuffer))
-#define GST_XVIMAGE_BUFFER_CAST(obj) ((GstXvImageBuffer *)(obj))
-
-/* This function destroys a GstXvImage handling XShm availability */
-static void
-gst_xvimage_buffer_destroy (GstXvImageBuffer * xvimage)
-{
-  GstXvImageSink *xvimagesink;
-
-  GST_DEBUG_OBJECT (xvimage, "Destroying buffer");
-
-  xvimagesink = xvimage->xvimagesink;
-  if (G_UNLIKELY (xvimagesink == NULL))
-    goto no_sink;
-
-  g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
-  GST_OBJECT_LOCK (xvimagesink);
-
-  /* If the destroyed image is the current one we destroy our reference too */
-  if (xvimagesink->cur_image == xvimage)
-    xvimagesink->cur_image = NULL;
-
-  /* We might have some buffers destroyed after changing state to NULL */
-  if (xvimagesink->xcontext == NULL) {
-    GST_DEBUG_OBJECT (xvimagesink, "Destroying XvImage after Xcontext");
-#ifdef HAVE_XSHM
-    /* Need to free the shared memory segment even if the x context
-     * was already cleaned up */
-    if (xvimage->SHMInfo.shmaddr != ((void *) -1)) {
-      shmdt (xvimage->SHMInfo.shmaddr);
-    }
-#endif
-    goto beach;
-  }
-
-  g_mutex_lock (xvimagesink->x_lock);
-
-#ifdef HAVE_XSHM
-  if (xvimagesink->xcontext->use_xshm) {
-    if (xvimage->SHMInfo.shmaddr != ((void *) -1)) {
-      GST_DEBUG_OBJECT (xvimagesink, "XServer ShmDetaching from 0x%x id 0x%lx",
-          xvimage->SHMInfo.shmid, xvimage->SHMInfo.shmseg);
-      XShmDetach (xvimagesink->xcontext->disp, &xvimage->SHMInfo);
-      XSync (xvimagesink->xcontext->disp, FALSE);
-
-      shmdt (xvimage->SHMInfo.shmaddr);
-    }
-    if (xvimage->xvimage)
-      XFree (xvimage->xvimage);
-  } else
-#endif /* HAVE_XSHM */
-  {
-    if (xvimage->xvimage) {
-      if (xvimage->xvimage->data) {
-        g_free (xvimage->xvimage->data);
-      }
-      XFree (xvimage->xvimage);
-    }
-  }
-
-  XSync (xvimagesink->xcontext->disp, FALSE);
-
-  g_mutex_unlock (xvimagesink->x_lock);
-
-beach:
-  GST_OBJECT_UNLOCK (xvimagesink);
-  xvimage->xvimagesink = NULL;
-  gst_object_unref (xvimagesink);
-
-  GST_MINI_OBJECT_CLASS (xvimage_buffer_parent_class)->finalize (GST_MINI_OBJECT
-      (xvimage));
-
-  return;
-
-no_sink:
-  {
-    GST_WARNING ("no sink found");
-    return;
-  }
-}
-
-static void
-gst_xvimage_buffer_finalize (GstXvImageBuffer * xvimage)
-{
-  GstXvImageSink *xvimagesink;
-  gboolean running;
-
-  xvimagesink = xvimage->xvimagesink;
-  if (G_UNLIKELY (xvimagesink == NULL))
-    goto no_sink;
-
-  g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
-  GST_OBJECT_LOCK (xvimagesink);
-  running = xvimagesink->running;
-  GST_OBJECT_UNLOCK (xvimagesink);
-
-  /* If our geometry changed we can't reuse that image. */
-  if (running == FALSE) {
-    GST_LOG_OBJECT (xvimage, "destroy image as sink is shutting down");
-    gst_xvimage_buffer_destroy (xvimage);
-  } else if ((xvimage->width != xvimagesink->video_width) ||
-      (xvimage->height != xvimagesink->video_height)) {
-    GST_LOG_OBJECT (xvimage,
-        "destroy image as its size changed %dx%d vs current %dx%d",
-        xvimage->width, xvimage->height,
-        xvimagesink->video_width, xvimagesink->video_height);
-    gst_xvimage_buffer_destroy (xvimage);
-  } else {
-    /* In that case we can reuse the image and add it to our image pool. */
-    GST_LOG_OBJECT (xvimage, "recycling image in pool");
-    /* need to increment the refcount again to recycle */
-    gst_buffer_ref (GST_BUFFER_CAST (xvimage));
-    g_mutex_lock (xvimagesink->pool_lock);
-    xvimagesink->image_pool = g_slist_prepend (xvimagesink->image_pool,
-        xvimage);
-    g_mutex_unlock (xvimagesink->pool_lock);
-  }
-  return;
-
-no_sink:
-  {
-    GST_WARNING ("no sink found");
-    return;
-  }
-}
-
-static void
-gst_xvimage_buffer_free (GstXvImageBuffer * xvimage)
-{
-  /* make sure it is not recycled */
-  xvimage->width = -1;
-  xvimage->height = -1;
-  gst_buffer_unref (GST_BUFFER (xvimage));
-}
-
-static void
-gst_xvimage_buffer_init (GstXvImageBuffer * xvimage, gpointer g_class)
-{
-#ifdef HAVE_XSHM
-  xvimage->SHMInfo.shmaddr = ((void *) -1);
-  xvimage->SHMInfo.shmid = -1;
-#endif
-}
-
+/* =========================================== */
+/*                                             */
+/*          Object typing & Creation           */
+/*                                             */
+/* =========================================== */
+static void gst_xvimagesink_navigation_init (GstNavigationInterface * iface);
+static void gst_xvimagesink_video_overlay_init (GstVideoOverlayIface * iface);
+static void gst_xvimagesink_colorbalance_init (GstColorBalanceClass * iface);
 static void
-gst_xvimage_buffer_class_init (gpointer g_class, gpointer class_data)
-{
-  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
-  xvimage_buffer_parent_class = g_type_class_peek_parent (g_class);
-
-  mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
-      gst_xvimage_buffer_finalize;
-}
-
-static GType
-gst_xvimage_buffer_get_type (void)
-{
-  static GType _gst_xvimage_buffer_type;
-
-  if (G_UNLIKELY (_gst_xvimage_buffer_type == 0)) {
-    static const GTypeInfo xvimage_buffer_info = {
-      sizeof (GstBufferClass),
-      NULL,
-      NULL,
-      gst_xvimage_buffer_class_init,
-      NULL,
-      NULL,
-      sizeof (GstXvImageBuffer),
-      0,
-      (GInstanceInitFunc) gst_xvimage_buffer_init,
-      NULL
-    };
-    _gst_xvimage_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
-        "GstXvImageBuffer", &xvimage_buffer_info, 0);
-  }
-  return _gst_xvimage_buffer_type;
-}
-
-/* X11 stuff */
-
-static gboolean error_caught = FALSE;
-
-static int
-gst_xvimagesink_handle_xerror (Display * display, XErrorEvent * xevent)
-{
-  char error_msg[1024];
-
-  XGetErrorText (display, xevent->error_code, error_msg, 1024);
-  GST_DEBUG ("xvimagesink triggered an XError. error: %s", error_msg);
-  error_caught = TRUE;
-  return 0;
-}
-
-#ifdef HAVE_XSHM
-/* This function checks that it is actually really possible to create an image
-   using XShm */
-static gboolean
-gst_xvimagesink_check_xshm_calls (GstXContext * xcontext)
-{
-  XvImage *xvimage;
-  XShmSegmentInfo SHMInfo;
-  gint size;
-  int (*handler) (Display *, XErrorEvent *);
-  gboolean result = FALSE;
-  gboolean did_attach = FALSE;
-
-  g_return_val_if_fail (xcontext != NULL, FALSE);
-
-  /* Sync to ensure any older errors are already processed */
-  XSync (xcontext->disp, FALSE);
-
-  /* Set defaults so we don't free these later unnecessarily */
-  SHMInfo.shmaddr = ((void *) -1);
-  SHMInfo.shmid = -1;
-
-  /* Setting an error handler to catch failure */
-  error_caught = FALSE;
-  handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
-
-  /* Trying to create a 1x1 picture */
-  GST_DEBUG ("XvShmCreateImage of 1x1");
-  xvimage = XvShmCreateImage (xcontext->disp, xcontext->xv_port_id,
-      xcontext->im_format, NULL, 1, 1, &SHMInfo);
-
-  /* Might cause an error, sync to ensure it is noticed */
-  XSync (xcontext->disp, FALSE);
-  if (!xvimage || error_caught) {
-    GST_WARNING ("could not XvShmCreateImage a 1x1 image");
-    goto beach;
-  }
-  size = xvimage->data_size;
-
-  SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
-  if (SHMInfo.shmid == -1) {
-    GST_WARNING ("could not get shared memory of %d bytes", size);
-    goto beach;
-  }
-
-  SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
-  if (SHMInfo.shmaddr == ((void *) -1)) {
-    GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
-    /* Clean up the shared memory segment */
-    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-    goto beach;
-  }
-
-  xvimage->data = SHMInfo.shmaddr;
-  SHMInfo.readOnly = FALSE;
-
-  if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
-    GST_WARNING ("Failed to XShmAttach");
-    /* Clean up the shared memory segment */
-    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-    goto beach;
-  }
-
-  /* Sync to ensure we see any errors we caused */
-  XSync (xcontext->disp, FALSE);
-
-  /* Delete the shared memory segment as soon as everyone is attached.
-   * This way, it will be deleted as soon as we detach later, and not
-   * leaked if we crash. */
-  shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-
-  if (!error_caught) {
-    GST_DEBUG ("XServer ShmAttached to 0x%x, id 0x%lx", SHMInfo.shmid,
-        SHMInfo.shmseg);
-
-    did_attach = TRUE;
-    /* store whether we succeeded in result */
-    result = TRUE;
-  } else {
-    GST_WARNING ("MIT-SHM extension check failed at XShmAttach. "
-        "Not using shared memory.");
-  }
-
-beach:
-  /* Sync to ensure we swallow any errors we caused and reset error_caught */
-  XSync (xcontext->disp, FALSE);
-
-  error_caught = FALSE;
-  XSetErrorHandler (handler);
-
-  if (did_attach) {
-    GST_DEBUG ("XServer ShmDetaching from 0x%x id 0x%lx",
-        SHMInfo.shmid, SHMInfo.shmseg);
-    XShmDetach (xcontext->disp, &SHMInfo);
-    XSync (xcontext->disp, FALSE);
-  }
-  if (SHMInfo.shmaddr != ((void *) -1))
-    shmdt (SHMInfo.shmaddr);
-  if (xvimage)
-    XFree (xvimage);
-  return result;
-}
-#endif /* HAVE_XSHM */
-
-/* This function handles GstXvImage creation depending on XShm availability */
-static GstXvImageBuffer *
-gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink, GstCaps * caps)
-{
-  GstXvImageBuffer *xvimage = NULL;
-  GstStructure *structure = NULL;
-  gboolean succeeded = FALSE;
-  int (*handler) (Display *, XErrorEvent *);
-
-  g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
-
-  if (caps == NULL)
-    return NULL;
-
-  xvimage = (GstXvImageBuffer *) gst_mini_object_new (GST_TYPE_XVIMAGE_BUFFER);
-  GST_DEBUG_OBJECT (xvimage, "Creating new XvImageBuffer");
-
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (!gst_structure_get_int (structure, "width", &xvimage->width) ||
-      !gst_structure_get_int (structure, "height", &xvimage->height)) {
-    GST_WARNING ("failed getting geometry from caps %" GST_PTR_FORMAT, caps);
-  }
-
-  GST_LOG_OBJECT (xvimagesink, "creating %dx%d", xvimage->width,
-      xvimage->height);
-
-  xvimage->im_format = gst_xvimagesink_get_format_from_caps (xvimagesink, caps);
-  if (xvimage->im_format == -1) {
-    GST_WARNING_OBJECT (xvimagesink, "failed to get format from caps %"
-        GST_PTR_FORMAT, caps);
-    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
-        ("Failed to create output image buffer of %dx%d pixels",
-            xvimage->width, xvimage->height), ("Invalid input caps"));
-    goto beach_unlocked;
-  }
-  xvimage->xvimagesink = gst_object_ref (xvimagesink);
-
-  g_mutex_lock (xvimagesink->x_lock);
-
-  /* Setting an error handler to catch failure */
-  error_caught = FALSE;
-  handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
-
-#ifdef HAVE_XSHM
-  if (xvimagesink->xcontext->use_xshm) {
-    int expected_size;
-
-    xvimage->xvimage = XvShmCreateImage (xvimagesink->xcontext->disp,
-        xvimagesink->xcontext->xv_port_id,
-        xvimage->im_format, NULL,
-        xvimage->width, xvimage->height, &xvimage->SHMInfo);
-    if (!xvimage->xvimage || error_caught) {
-      g_mutex_unlock (xvimagesink->x_lock);
-
-      /* Reset error flag */
-      error_caught = FALSE;
-
-      /* Push a warning */
-      GST_ELEMENT_WARNING (xvimagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              xvimage->width, xvimage->height),
-          ("could not XvShmCreateImage a %dx%d image",
-              xvimage->width, xvimage->height));
-
-      /* Retry without XShm */
-      xvimagesink->xcontext->use_xshm = FALSE;
-
-      /* Hold X mutex again to try without XShm */
-      g_mutex_lock (xvimagesink->x_lock);
-      goto no_xshm;
-    }
-
-    /* we have to use the returned data_size for our shm size */
-    xvimage->size = xvimage->xvimage->data_size;
-    GST_LOG_OBJECT (xvimagesink, "XShm image size is %" G_GSIZE_FORMAT,
-        xvimage->size);
-
-    /* calculate the expected size.  This is only for sanity checking the
-     * number we get from X. */
-    switch (xvimage->im_format) {
-      case GST_MAKE_FOURCC ('I', '4', '2', '0'):
-      case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
-      {
-        gint pitches[3];
-        gint offsets[3];
-        guint plane;
-
-        offsets[0] = 0;
-        pitches[0] = GST_ROUND_UP_4 (xvimage->width);
-        offsets[1] = offsets[0] + pitches[0] * GST_ROUND_UP_2 (xvimage->height);
-        pitches[1] = GST_ROUND_UP_8 (xvimage->width) / 2;
-        offsets[2] =
-            offsets[1] + pitches[1] * GST_ROUND_UP_2 (xvimage->height) / 2;
-        pitches[2] = GST_ROUND_UP_8 (pitches[0]) / 2;
-
-        expected_size =
-            offsets[2] + pitches[2] * GST_ROUND_UP_2 (xvimage->height) / 2;
-
-        for (plane = 0; plane < xvimage->xvimage->num_planes; plane++) {
-          GST_DEBUG_OBJECT (xvimagesink,
-              "Plane %u has a expected pitch of %d bytes, " "offset of %d",
-              plane, pitches[plane], offsets[plane]);
-        }
-        break;
-      }
-      case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
-      case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
-        expected_size = xvimage->height * GST_ROUND_UP_4 (xvimage->width * 2);
-        break;
-      default:
-        expected_size = 0;
-        break;
-    }
-    if (expected_size != 0 && xvimage->size != expected_size) {
-      GST_WARNING_OBJECT (xvimagesink,
-          "unexpected XShm image size (got %" G_GSIZE_FORMAT ", expected %d)",
-          xvimage->size, expected_size);
-    }
-
-    /* Be verbose about our XvImage stride */
-    {
-      guint plane;
-
-      for (plane = 0; plane < xvimage->xvimage->num_planes; plane++) {
-        GST_DEBUG_OBJECT (xvimagesink, "Plane %u has a pitch of %d bytes, "
-            "offset of %d", plane, xvimage->xvimage->pitches[plane],
-            xvimage->xvimage->offsets[plane]);
-      }
-    }
-
-    xvimage->SHMInfo.shmid = shmget (IPC_PRIVATE, xvimage->size,
-        IPC_CREAT | 0777);
-    if (xvimage->SHMInfo.shmid == -1) {
-      g_mutex_unlock (xvimagesink->x_lock);
-      GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              xvimage->width, xvimage->height),
-          ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
-              xvimage->size));
-      goto beach_unlocked;
-    }
-
-    xvimage->SHMInfo.shmaddr = shmat (xvimage->SHMInfo.shmid, NULL, 0);
-    if (xvimage->SHMInfo.shmaddr == ((void *) -1)) {
-      g_mutex_unlock (xvimagesink->x_lock);
-      GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              xvimage->width, xvimage->height),
-          ("Failed to shmat: %s", g_strerror (errno)));
-      /* Clean up the shared memory segment */
-      shmctl (xvimage->SHMInfo.shmid, IPC_RMID, NULL);
-      goto beach_unlocked;
-    }
-
-    xvimage->xvimage->data = xvimage->SHMInfo.shmaddr;
-    xvimage->SHMInfo.readOnly = FALSE;
-
-    if (XShmAttach (xvimagesink->xcontext->disp, &xvimage->SHMInfo) == 0) {
-      /* Clean up the shared memory segment */
-      shmctl (xvimage->SHMInfo.shmid, IPC_RMID, NULL);
-
-      g_mutex_unlock (xvimagesink->x_lock);
-      GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
-          ("Failed to create output image buffer of %dx%d pixels",
-              xvimage->width, xvimage->height), ("Failed to XShmAttach"));
-      goto beach_unlocked;
-    }
-
-    XSync (xvimagesink->xcontext->disp, FALSE);
-
-    /* Delete the shared memory segment as soon as we everyone is attached.
-     * This way, it will be deleted as soon as we detach later, and not
-     * leaked if we crash. */
-    shmctl (xvimage->SHMInfo.shmid, IPC_RMID, NULL);
-
-    GST_DEBUG_OBJECT (xvimagesink, "XServer ShmAttached to 0x%x, id 0x%lx",
-        xvimage->SHMInfo.shmid, xvimage->SHMInfo.shmseg);
-  } else
-  no_xshm:
-#endif /* HAVE_XSHM */
-  {
-    xvimage->xvimage = XvCreateImage (xvimagesink->xcontext->disp,
-        xvimagesink->xcontext->xv_port_id,
-        xvimage->im_format, NULL, xvimage->width, xvimage->height);
-    if (!xvimage->xvimage || error_caught) {
-      g_mutex_unlock (xvimagesink->x_lock);
-      /* Reset error handler */
-      error_caught = FALSE;
-      XSetErrorHandler (handler);
-      /* Push an error */
-      GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
-          ("Failed to create outputimage buffer of %dx%d pixels",
-              xvimage->width, xvimage->height),
-          ("could not XvCreateImage a %dx%d image",
-              xvimage->width, xvimage->height));
-      goto beach_unlocked;
-    }
-
-    /* we have to use the returned data_size for our image size */
-    xvimage->size = xvimage->xvimage->data_size;
-    xvimage->xvimage->data = g_malloc (xvimage->size);
-
-    XSync (xvimagesink->xcontext->disp, FALSE);
-  }
-
-  /* Reset error handler */
-  error_caught = FALSE;
-  XSetErrorHandler (handler);
-
-  succeeded = TRUE;
-
-  GST_BUFFER_DATA (xvimage) = (guchar *) xvimage->xvimage->data;
-  GST_BUFFER_SIZE (xvimage) = xvimage->size;
+gst_xvimagesink_property_probe_interface_init (GstPropertyProbeInterface *
+    iface);
+#define gst_xvimagesink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstXvImageSink, gst_xvimagesink, GST_TYPE_VIDEO_SINK,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
+        gst_xvimagesink_navigation_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
+        gst_xvimagesink_video_overlay_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
+        gst_xvimagesink_colorbalance_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_PROPERTY_PROBE,
+        gst_xvimagesink_property_probe_interface_init));
 
-  g_mutex_unlock (xvimagesink->x_lock);
 
-beach_unlocked:
-  if (!succeeded) {
-    gst_xvimage_buffer_free (xvimage);
-    xvimage = NULL;
-  }
+/* ============================================================= */
+/*                                                               */
+/*                       Private Methods                         */
+/*                                                               */
+/* ============================================================= */
 
-  return xvimage;
-}
 
 /* We are called with the x_lock taken */
 static void
@@ -781,11 +265,13 @@ gst_xvimagesink_xwindow_draw_borders (GstXvImageSink * xvimagesink,
 /* This function puts a GstXvImage on a GstXvImageSink's window. Returns FALSE
  * if no window was available  */
 static gboolean
-gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
-    GstXvImageBuffer * xvimage)
+gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstBuffer * xvimage)
 {
+  GstMetaXvImage *meta;
+  GstMetaVideoCrop *crop;
   GstVideoRectangle result;
   gboolean draw_border = FALSE;
+  GstVideoRectangle src, dst;
 
   /* We take the flow_lock. If expose is in there we don't want to run
      concurrently from the data flow thread */
@@ -806,11 +292,10 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
   if (xvimage && xvimagesink->cur_image != xvimage) {
     if (xvimagesink->cur_image) {
       GST_LOG_OBJECT (xvimagesink, "unreffing %p", xvimagesink->cur_image);
-      gst_buffer_unref (GST_BUFFER_CAST (xvimagesink->cur_image));
+      gst_buffer_unref (xvimagesink->cur_image);
     }
     GST_LOG_OBJECT (xvimagesink, "reffing %p as our current image", xvimage);
-    xvimagesink->cur_image =
-        GST_XVIMAGE_BUFFER_CAST (gst_buffer_ref (GST_BUFFER_CAST (xvimage)));
+    xvimagesink->cur_image = gst_buffer_ref (xvimage);
   }
 
   /* Expose sends a NULL image, we take the latest frame */
@@ -824,13 +309,23 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
     }
   }
 
-  if (xvimagesink->keep_aspect) {
-    GstVideoRectangle src, dst;
+  meta = gst_buffer_get_meta_xvimage (xvimage);
+
+  crop = gst_buffer_get_meta_video_crop (xvimage);
+
+  if (crop) {
+    src.x = crop->x + meta->x;
+    src.y = crop->y + meta->y;
+    src.w = crop->width;
+    src.h = crop->height;
+  } else {
+    src.x = meta->x;
+    src.y = meta->y;
+    src.w = meta->width;
+    src.h = meta->height;
+  }
 
-    /* We use the calculated geometry from _setcaps as a source to respect
-       source and screen pixel aspect ratios. */
-    src.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
-    src.h = GST_VIDEO_SINK_HEIGHT (xvimagesink);
+  if (xvimagesink->keep_aspect) {
     dst.w = xvimagesink->render_rect.w;
     dst.h = xvimagesink->render_rect.h;
 
@@ -848,22 +343,18 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
         result);
     xvimagesink->redraw_border = FALSE;
   }
-
-  /* We scale to the window's geometry */
 #ifdef HAVE_XSHM
   if (xvimagesink->xcontext->use_xshm) {
     GST_LOG_OBJECT (xvimagesink,
         "XvShmPutImage with image %dx%d and window %dx%d, from xvimage %"
-        GST_PTR_FORMAT,
-        xvimage->width, xvimage->height,
+        GST_PTR_FORMAT, meta->width, meta->height,
         xvimagesink->render_rect.w, xvimagesink->render_rect.h, xvimage);
 
     XvShmPutImage (xvimagesink->xcontext->disp,
         xvimagesink->xcontext->xv_port_id,
         xvimagesink->xwindow->win,
-        xvimagesink->xwindow->gc, xvimage->xvimage,
-        xvimagesink->disp_x, xvimagesink->disp_y,
-        xvimagesink->disp_width, xvimagesink->disp_height,
+        xvimagesink->xwindow->gc, meta->xvimage,
+        src.x, src.y, src.w, src.h,
         result.x, result.y, result.w, result.h, FALSE);
   } else
 #endif /* HAVE_XSHM */
@@ -871,10 +362,8 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
     XvPutImage (xvimagesink->xcontext->disp,
         xvimagesink->xcontext->xv_port_id,
         xvimagesink->xwindow->win,
-        xvimagesink->xwindow->gc, xvimage->xvimage,
-        xvimagesink->disp_x, xvimagesink->disp_y,
-        xvimagesink->disp_width, xvimagesink->disp_height,
-        result.x, result.y, result.w, result.h);
+        xvimagesink->xwindow->gc, meta->xvimage,
+        src.x, src.y, src.w, src.h, result.x, result.y, result.w, result.h);
   }
 
   XSync (xvimagesink->xcontext->disp, FALSE);
@@ -1026,7 +515,8 @@ gst_xvimagesink_xwindow_new (GstXvImageSink * xvimagesink,
 
   gst_xvimagesink_xwindow_decorate (xvimagesink, xwindow);
 
-  gst_x_overlay_got_window_handle (GST_X_OVERLAY (xvimagesink), xwindow->win);
+  gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (xvimagesink),
+      xwindow->win);
 
   return xwindow;
 }
@@ -1208,6 +698,7 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
     g_mutex_lock (xvimagesink->flow_lock);
     g_mutex_lock (xvimagesink->x_lock);
   }
+
   if (pointer_moved) {
     g_mutex_unlock (xvimagesink->x_lock);
     g_mutex_unlock (xvimagesink->flow_lock);
@@ -1273,7 +764,8 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
         }
         break;
       default:
-        GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type);
+        GST_DEBUG_OBJECT (xvimagesink, "xvimagesink unhandled X event (%d)",
+            e.type);
     }
     g_mutex_lock (xvimagesink->flow_lock);
     g_mutex_lock (xvimagesink->x_lock);
@@ -1301,7 +793,7 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
     g_mutex_unlock (xvimagesink->x_lock);
     g_mutex_unlock (xvimagesink->flow_lock);
 
-    gst_xvimagesink_expose (GST_X_OVERLAY (xvimagesink));
+    gst_xvimagesink_expose (GST_VIDEO_OVERLAY (xvimagesink));
 
     g_mutex_lock (xvimagesink->flow_lock);
     g_mutex_lock (xvimagesink->x_lock);
@@ -1551,6 +1043,7 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
   for (i = 0; i < nb_formats; i++) {
     GstCaps *format_caps = NULL;
     gboolean is_rgb_format = FALSE;
+    GstVideoFormat vformat;
 
     /* We set the image format of the xcontext to an existing one. This
        is just some valid image format for making our xshm calls check before
@@ -1561,31 +1054,18 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
       case XvRGB:
       {
         XvImageFormatValues *fmt = &(formats[i]);
-        gint endianness = G_BIG_ENDIAN;
-
-        if (fmt->byte_order == LSBFirst) {
-          /* our caps system handles 24/32bpp RGB as big-endian. */
-          if (fmt->bits_per_pixel == 24 || fmt->bits_per_pixel == 32) {
-            fmt->red_mask = GUINT32_TO_BE (fmt->red_mask);
-            fmt->green_mask = GUINT32_TO_BE (fmt->green_mask);
-            fmt->blue_mask = GUINT32_TO_BE (fmt->blue_mask);
-
-            if (fmt->bits_per_pixel == 24) {
-              fmt->red_mask >>= 8;
-              fmt->green_mask >>= 8;
-              fmt->blue_mask >>= 8;
-            }
-          } else
-            endianness = G_LITTLE_ENDIAN;
-        }
+        gint endianness;
+
+        endianness =
+            (fmt->byte_order == LSBFirst ? G_LITTLE_ENDIAN : G_BIG_ENDIAN);
+
+        vformat = gst_video_format_from_masks (fmt->depth, fmt->bits_per_pixel,
+            endianness, fmt->red_mask, fmt->green_mask, fmt->blue_mask, 0);
+        if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
+          break;
 
-        format_caps = gst_caps_new_simple ("video/x-raw-rgb",
-            "endianness", G_TYPE_INT, endianness,
-            "depth", G_TYPE_INT, fmt->depth,
-            "bpp", G_TYPE_INT, fmt->bits_per_pixel,
-            "red_mask", G_TYPE_INT, fmt->red_mask,
-            "green_mask", G_TYPE_INT, fmt->green_mask,
-            "blue_mask", G_TYPE_INT, fmt->blue_mask,
+        format_caps = gst_caps_new_simple ("video/x-raw",
+            "format", G_TYPE_STRING, gst_video_format_to_string (vformat),
             "width", GST_TYPE_INT_RANGE, 1, max_w,
             "height", GST_TYPE_INT_RANGE, 1, max_h,
             "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
@@ -1594,13 +1074,20 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
         break;
       }
       case XvYUV:
-        format_caps = gst_caps_new_simple ("video/x-raw-yuv",
-            "format", GST_TYPE_FOURCC, formats[i].id,
+      {
+        vformat = gst_video_format_from_fourcc (formats[i].id);
+        if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
+          break;
+
+        format_caps = gst_caps_new_simple ("video/x-raw",
+            "format", G_TYPE_STRING, gst_video_format_to_string (vformat),
             "width", GST_TYPE_INT_RANGE, 1, max_w,
             "height", GST_TYPE_INT_RANGE, 1, max_h,
             "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
         break;
+      }
       default:
+        vformat = GST_VIDEO_FORMAT_UNKNOWN;
         g_assert_not_reached ();
         break;
     }
@@ -1611,6 +1098,7 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
       format = g_new0 (GstXvImageFormat, 1);
       if (format) {
         format->format = formats[i].id;
+        format->vformat = vformat;
         format->caps = gst_caps_copy (format_caps);
         xcontext->formats_list = g_list_append (xcontext->formats_list, format);
       }
@@ -1739,6 +1227,7 @@ gst_xvimagesink_calculate_pixel_aspect_ratio (GstXContext * xcontext)
     ratio = 4.0 * 576 / (3.0 * 720);
   }
   GST_DEBUG ("calculated pixel aspect ratio: %f", ratio);
+
   /* now find the one from par[][2] with the lowest delta to the real one */
   delta = DELTA (0);
   index = 0;
@@ -1855,18 +1344,10 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink)
 
   xcontext->caps = gst_xvimagesink_get_xv_support (xvimagesink, xcontext);
 
-  if (!xcontext->caps) {
-    XCloseDisplay (xcontext->disp);
-    g_mutex_unlock (xvimagesink->x_lock);
-    g_free (xcontext->par);
-    g_free (xcontext);
-    /* GST_ELEMENT_ERROR is thrown by gst_xvimagesink_get_xv_support */
-    return NULL;
-  }
-#ifdef HAVE_XSHM
   /* Search for XShm extension support */
+#ifdef HAVE_XSHM
   if (XShmQueryExtension (xcontext->disp) &&
-      gst_xvimagesink_check_xshm_calls (xcontext)) {
+      gst_xvimagesink_check_xshm_calls (xvimagesink, xcontext)) {
     xcontext->use_xshm = TRUE;
     GST_DEBUG ("xvimagesink is using XShm extension");
   } else
@@ -1876,6 +1357,15 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink)
     GST_DEBUG ("xvimagesink is not using XShm extension");
   }
 
+  if (!xcontext->caps) {
+    XCloseDisplay (xcontext->disp);
+    g_mutex_unlock (xvimagesink->x_lock);
+    g_free (xcontext->par);
+    g_free (xcontext);
+    /* GST_ELEMENT_ERROR is thrown by gst_xvimagesink_get_xv_support */
+    return NULL;
+  }
+
   xv_attr = XvQueryPortAttributes (xcontext->disp,
       xcontext->xv_port_id, &N_attr);
 
@@ -1901,8 +1391,8 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink)
 
       channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
       channel->label = g_strdup (channels[i]);
-      channel->min_value = matching_attr->min_value;
-      channel->max_value = matching_attr->max_value;
+      channel->min_value = matching_attr ? matching_attr->min_value : -1000;
+      channel->max_value = matching_attr ? matching_attr->max_value : 1000;
 
       xcontext->channels_list = g_list_append (xcontext->channels_list,
           channel);
@@ -2012,63 +1502,34 @@ gst_xvimagesink_xcontext_clear (GstXvImageSink * xvimagesink)
   g_free (xcontext);
 }
 
-static void
-gst_xvimagesink_imagepool_clear (GstXvImageSink * xvimagesink)
-{
-  g_mutex_lock (xvimagesink->pool_lock);
-
-  while (xvimagesink->image_pool) {
-    GstXvImageBuffer *xvimage = xvimagesink->image_pool->data;
-
-    xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool,
-        xvimagesink->image_pool);
-    gst_xvimage_buffer_free (xvimage);
-  }
-
-  g_mutex_unlock (xvimagesink->pool_lock);
-}
-
 /* Element stuff */
 
-/* This function tries to get a format matching with a given caps in the
-   supported list of formats we generated in gst_xvimagesink_get_xv_support */
-static gint
-gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
-    GstCaps * caps)
-{
-  GList *list = NULL;
-
-  g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), 0);
-
-  list = xvimagesink->xcontext->formats_list;
-
-  while (list) {
-    GstXvImageFormat *format = list->data;
-
-    if (format) {
-      if (gst_caps_can_intersect (caps, format->caps)) {
-        return format->format;
-      }
-    }
-    list = g_list_next (list);
-  }
-
-  return -1;
-}
-
 static GstCaps *
-gst_xvimagesink_getcaps (GstBaseSink * bsink)
+gst_xvimagesink_getcaps (GstBaseSink * bsink, GstCaps * filter)
 {
   GstXvImageSink *xvimagesink;
+  GstCaps *caps;
 
   xvimagesink = GST_XVIMAGESINK (bsink);
 
-  if (xvimagesink->xcontext)
-    return gst_caps_ref (xvimagesink->xcontext->caps);
+  if (xvimagesink->xcontext) {
+    if (filter)
+      return gst_caps_intersect_full (filter, xvimagesink->xcontext->caps,
+          GST_CAPS_INTERSECT_FIRST);
+    else
+      return gst_caps_ref (xvimagesink->xcontext->caps);
+  }
+
+  caps = gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD (xvimagesink));
+  if (filter) {
+    GstCaps *intersection;
 
-  return
-      gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD
-          (xvimagesink)));
+    intersection =
+        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = intersection;
+  }
+  return caps;
 }
 
 static gboolean
@@ -2076,17 +1537,13 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 {
   GstXvImageSink *xvimagesink;
   GstStructure *structure;
+  GstBufferPool *newpool, *oldpool;
+  GstVideoInfo info;
   guint32 im_format = 0;
-  gboolean ret;
-  gint video_width, video_height;
-  gint disp_x, disp_y;
-  gint disp_width, disp_height;
   gint video_par_n, video_par_d;        /* video's PAR */
   gint display_par_n, display_par_d;    /* display's PAR */
-  const GValue *caps_par;
-  const GValue *caps_disp_reg;
-  const GValue *fps;
   guint num, den;
+  gint size;
 
   xvimagesink = GST_XVIMAGESINK (bsink);
 
@@ -2097,38 +1554,31 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   if (!gst_caps_can_intersect (xvimagesink->xcontext->caps, caps))
     goto incompatible_caps;
 
-  structure = gst_caps_get_structure (caps, 0);
-  ret = gst_structure_get_int (structure, "width", &video_width);
-  ret &= gst_structure_get_int (structure, "height", &video_height);
-  fps = gst_structure_get_value (structure, "framerate");
-  ret &= (fps != NULL);
+  if (!gst_video_info_from_caps (&info, caps))
+    goto invalid_format;
 
-  if (!ret)
-    goto incomplete_caps;
+  structure = gst_caps_get_structure (caps, 0);
 
-  xvimagesink->fps_n = gst_value_get_fraction_numerator (fps);
-  xvimagesink->fps_d = gst_value_get_fraction_denominator (fps);
+  xvimagesink->fps_n = info.fps_n;
+  xvimagesink->fps_d = info.fps_d;
 
-  xvimagesink->video_width = video_width;
-  xvimagesink->video_height = video_height;
+  xvimagesink->video_width = info.width;
+  xvimagesink->video_height = info.height;
 
-  im_format = gst_xvimagesink_get_format_from_caps (xvimagesink, caps);
+  im_format = gst_xvimagesink_get_format_from_info (xvimagesink, &info);
   if (im_format == -1)
     goto invalid_format;
 
+  size = info.size;
+
   /* get aspect ratio from caps if it's present, and
    * convert video width and height to a display width and height
    * using wd / hd = wv / hv * PARv / PARd */
 
   /* get video's PAR */
-  caps_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-  if (caps_par) {
-    video_par_n = gst_value_get_fraction_numerator (caps_par);
-    video_par_d = gst_value_get_fraction_denominator (caps_par);
-  } else {
-    video_par_n = 1;
-    video_par_d = 1;
-  }
+  video_par_n = info.par_n;
+  video_par_d = info.par_d;
+
   /* get display's PAR */
   if (xvimagesink->par) {
     display_par_n = gst_value_get_fraction_numerator (xvimagesink->par);
@@ -2138,32 +1588,13 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
     display_par_d = 1;
   }
 
-  /* get the display region */
-  caps_disp_reg = gst_structure_get_value (structure, "display-region");
-  if (caps_disp_reg) {
-    disp_x = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 0));
-    disp_y = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 1));
-    disp_width = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 2));
-    disp_height =
-        g_value_get_int (gst_value_array_get_value (caps_disp_reg, 3));
-  } else {
-    disp_x = disp_y = 0;
-    disp_width = video_width;
-    disp_height = video_height;
-  }
-
-  if (!gst_video_calculate_display_ratio (&num, &den, video_width,
-          video_height, video_par_n, video_par_d, display_par_n, display_par_d))
+  if (!gst_video_calculate_display_ratio (&num, &den, info.width,
+          info.height, video_par_n, video_par_d, display_par_n, display_par_d))
     goto no_disp_ratio;
 
-  xvimagesink->disp_x = disp_x;
-  xvimagesink->disp_y = disp_y;
-  xvimagesink->disp_width = disp_width;
-  xvimagesink->disp_height = disp_height;
-
   GST_DEBUG_OBJECT (xvimagesink,
       "video width/height: %dx%d, calculated display ratio: %d/%d",
-      video_width, video_height, num, den);
+      info.width, info.height, num, den);
 
   /* now find a width x height that respects this display ratio.
    * prefer those that have one of w/h the same as the incoming video
@@ -2171,21 +1602,21 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
 
   /* start with same height, because of interlaced video */
   /* check hd / den is an integer scale factor, and scale wd with the PAR */
-  if (video_height % den == 0) {
+  if (info.height % den == 0) {
     GST_DEBUG_OBJECT (xvimagesink, "keeping video height");
     GST_VIDEO_SINK_WIDTH (xvimagesink) = (guint)
-        gst_util_uint64_scale_int (video_height, num, den);
-    GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
-  } else if (video_width % num == 0) {
+        gst_util_uint64_scale_int (info.height, num, den);
+    GST_VIDEO_SINK_HEIGHT (xvimagesink) = info.height;
+  } else if (info.width % num == 0) {
     GST_DEBUG_OBJECT (xvimagesink, "keeping video width");
-    GST_VIDEO_SINK_WIDTH (xvimagesink) = video_width;
+    GST_VIDEO_SINK_WIDTH (xvimagesink) = info.width;
     GST_VIDEO_SINK_HEIGHT (xvimagesink) = (guint)
-        gst_util_uint64_scale_int (video_width, den, num);
+        gst_util_uint64_scale_int (info.width, den, num);
   } else {
     GST_DEBUG_OBJECT (xvimagesink, "approximating while keeping video height");
     GST_VIDEO_SINK_WIDTH (xvimagesink) = (guint)
-        gst_util_uint64_scale_int (video_height, num, den);
-    GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
+        gst_util_uint64_scale_int (info.height, num, den);
+    GST_VIDEO_SINK_HEIGHT (xvimagesink) = info.height;
   }
   GST_DEBUG_OBJECT (xvimagesink, "scaling to %dx%d",
       GST_VIDEO_SINK_WIDTH (xvimagesink), GST_VIDEO_SINK_HEIGHT (xvimagesink));
@@ -2194,7 +1625,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   g_mutex_lock (xvimagesink->flow_lock);
   if (!xvimagesink->xwindow) {
     g_mutex_unlock (xvimagesink->flow_lock);
-    gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (xvimagesink));
+    gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (xvimagesink));
   } else {
     g_mutex_unlock (xvimagesink->flow_lock);
   }
@@ -2211,27 +1642,31 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
         GST_VIDEO_SINK_HEIGHT (xvimagesink));
   }
 
+  xvimagesink->info = info;
+
   /* After a resize, we want to redraw the borders in case the new frame size
    * doesn't cover the same area */
   xvimagesink->redraw_border = TRUE;
 
-  /* We renew our xvimage only if size or format changed;
-   * the xvimage is the same size as the video pixel size */
-  if ((xvimagesink->xvimage) &&
-      ((im_format != xvimagesink->xvimage->im_format) ||
-          (video_width != xvimagesink->xvimage->width) ||
-          (video_height != xvimagesink->xvimage->height))) {
-    GST_DEBUG_OBJECT (xvimagesink,
-        "old format %" GST_FOURCC_FORMAT ", new format %" GST_FOURCC_FORMAT,
-        GST_FOURCC_ARGS (xvimagesink->xvimage->im_format),
-        GST_FOURCC_ARGS (im_format));
-    GST_DEBUG_OBJECT (xvimagesink, "renewing xvimage");
-    gst_buffer_unref (GST_BUFFER (xvimagesink->xvimage));
-    xvimagesink->xvimage = NULL;
-  }
+  /* create a new pool for the new configuration */
+  newpool = gst_xvimage_buffer_pool_new (xvimagesink);
 
+  structure = gst_buffer_pool_get_config (newpool);
+  gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 15);
+  if (!gst_buffer_pool_set_config (newpool, structure))
+    goto config_failed;
+
+  oldpool = xvimagesink->pool;
+  xvimagesink->pool = newpool;
   g_mutex_unlock (xvimagesink->flow_lock);
 
+  /* unref the old sink */
+  if (oldpool) {
+    /* we don't deactivate, some elements might still be using it, it will
+     * be deactivated when the last ref is gone */
+    gst_object_unref (oldpool);
+  }
+
   return TRUE;
 
   /* ERRORS */
@@ -2240,12 +1675,6 @@ incompatible_caps:
     GST_ERROR_OBJECT (xvimagesink, "caps incompatible");
     return FALSE;
   }
-incomplete_caps:
-  {
-    GST_DEBUG_OBJECT (xvimagesink, "Failed to retrieve either width, "
-        "height or framerate from intersected caps");
-    return FALSE;
-  }
 invalid_format:
   {
     GST_DEBUG_OBJECT (xvimagesink,
@@ -2264,6 +1693,12 @@ no_display_size:
         ("Error calculating the output display ratio of the video."));
     return FALSE;
   }
+config_failed:
+  {
+    GST_ERROR_OBJECT (xvimagesink, "failed to set config.");
+    g_mutex_unlock (xvimagesink->flow_lock);
+    return FALSE;
+  }
 }
 
 static GstStateChangeReturn
@@ -2280,8 +1715,10 @@ gst_xvimagesink_change_state (GstElement * element, GstStateChange transition)
       /* Initializing the XContext */
       if (xvimagesink->xcontext == NULL) {
         xcontext = gst_xvimagesink_xcontext_get (xvimagesink);
-        if (xcontext == NULL)
-          return GST_STATE_CHANGE_FAILURE;
+        if (xcontext == NULL) {
+          ret = GST_STATE_CHANGE_FAILURE;
+          goto beach;
+        }
         GST_OBJECT_LOCK (xvimagesink);
         if (xcontext)
           xvimagesink->xcontext = xcontext;
@@ -2302,16 +1739,10 @@ gst_xvimagesink_change_state (GstElement * element, GstStateChange transition)
       gst_xvimagesink_manage_event_thread (xvimagesink);
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
-      g_mutex_lock (xvimagesink->pool_lock);
-      xvimagesink->pool_invalid = FALSE;
-      g_mutex_unlock (xvimagesink->pool_lock);
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      g_mutex_lock (xvimagesink->pool_lock);
-      xvimagesink->pool_invalid = TRUE;
-      g_mutex_unlock (xvimagesink->pool_lock);
       break;
     default:
       break;
@@ -2327,6 +1758,10 @@ gst_xvimagesink_change_state (GstElement * element, GstStateChange transition)
       xvimagesink->fps_d = 1;
       GST_VIDEO_SINK_WIDTH (xvimagesink) = 0;
       GST_VIDEO_SINK_HEIGHT (xvimagesink) = 0;
+      g_mutex_lock (xvimagesink->flow_lock);
+      if (xvimagesink->pool)
+        gst_buffer_pool_set_active (xvimagesink->pool, FALSE);
+      g_mutex_unlock (xvimagesink->flow_lock);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_xvimagesink_reset (xvimagesink);
@@ -2335,6 +1770,7 @@ gst_xvimagesink_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
+beach:
   return ret;
 }
 
@@ -2363,66 +1799,113 @@ gst_xvimagesink_get_times (GstBaseSink * bsink, GstBuffer * buf,
 static GstFlowReturn
 gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
 {
+  GstFlowReturn res;
   GstXvImageSink *xvimagesink;
+  GstMetaXvImage *meta;
+  GstBuffer *to_put;
 
   xvimagesink = GST_XVIMAGESINK (vsink);
 
-  /* If this buffer has been allocated using our buffer management we simply
-     put the ximage which is in the PRIVATE pointer */
-  if (GST_IS_XVIMAGE_BUFFER (buf)) {
-    GST_LOG_OBJECT (xvimagesink, "fast put of bufferpool buffer %p", buf);
-    if (!gst_xvimagesink_xvimage_put (xvimagesink,
-            GST_XVIMAGE_BUFFER_CAST (buf)))
-      goto no_window;
+  meta = gst_buffer_get_meta_xvimage (buf);
+
+  if (meta && meta->sink == xvimagesink) {
+    /* If this buffer has been allocated using our buffer management we simply
+       put the ximage which is in the PRIVATE pointer */
+    GST_LOG_OBJECT (xvimagesink, "buffer %p from our pool, writing directly",
+        buf);
+    to_put = buf;
+    res = GST_FLOW_OK;
   } else {
-    GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, xvimagesink,
-        "slow copy into bufferpool buffer %p", buf);
+    GstVideoFrame src, dest;
+
     /* Else we have to copy the data into our private image, */
     /* if we have one... */
-    if (!xvimagesink->xvimage) {
-      GST_DEBUG_OBJECT (xvimagesink, "creating our xvimage");
+    GST_LOG_OBJECT (xvimagesink, "buffer %p not from our pool, copying", buf);
 
-      xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink,
-          GST_BUFFER_CAPS (buf));
+    /* we should have a pool, configured in setcaps */
+    if (xvimagesink->pool == NULL)
+      goto no_pool;
 
-      if (!xvimagesink->xvimage)
-        /* The create method should have posted an informative error */
-        goto no_image;
+    if (!gst_buffer_pool_set_active (xvimagesink->pool, TRUE))
+      goto activate_failed;
 
-      if (xvimagesink->xvimage->size < GST_BUFFER_SIZE (buf)) {
-        GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
-            ("Failed to create output image buffer of %dx%d pixels",
-                xvimagesink->xvimage->width, xvimagesink->xvimage->height),
-            ("XServer allocated buffer size did not match input buffer"));
+    /* take a buffer form our pool */
+    res = gst_buffer_pool_acquire_buffer (xvimagesink->pool, &to_put, NULL);
+    if (res != GST_FLOW_OK)
+      goto no_buffer;
 
-        gst_xvimage_buffer_destroy (xvimagesink->xvimage);
-        xvimagesink->xvimage = NULL;
-        goto no_image;
-      }
+    if (gst_buffer_get_size (to_put) < gst_buffer_get_size (buf))
+      goto wrong_size;
+
+    GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, xvimagesink,
+        "slow copy into bufferpool buffer %p", to_put);
+
+    if (!gst_video_frame_map (&src, &xvimagesink->info, buf, GST_MAP_READ))
+      goto invalid_buffer;
+
+    if (!gst_video_frame_map (&dest, &xvimagesink->info, to_put, GST_MAP_WRITE)) {
+      gst_video_frame_unmap (&src);
+      goto invalid_buffer;
     }
 
-    memcpy (xvimagesink->xvimage->xvimage->data,
-        GST_BUFFER_DATA (buf),
-        MIN (GST_BUFFER_SIZE (buf), xvimagesink->xvimage->size));
+    gst_video_frame_copy (&dest, &src);
 
-    if (!gst_xvimagesink_xvimage_put (xvimagesink, xvimagesink->xvimage))
-      goto no_window;
+    gst_video_frame_unmap (&dest);
+    gst_video_frame_unmap (&src);
   }
 
-  return GST_FLOW_OK;
+  if (!gst_xvimagesink_xvimage_put (xvimagesink, to_put))
+    goto no_window;
+
+done:
+  if (to_put != buf)
+    gst_buffer_unref (to_put);
+
+  return res;
 
   /* ERRORS */
-no_image:
+no_pool:
+  {
+    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
+        ("Internal error: can't allocate images"),
+        ("We don't have a bufferpool negotiated"));
+    return GST_FLOW_ERROR;
+  }
+no_buffer:
   {
     /* No image available. That's very bad ! */
     GST_WARNING_OBJECT (xvimagesink, "could not create image");
-    return GST_FLOW_ERROR;
+    return res;
+  }
+wrong_size:
+  {
+    GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
+        ("Failed to create output image buffer"),
+        ("XServer allocated buffer size did not match input buffer %"
+            G_GSIZE_FORMAT " - %" G_GSIZE_FORMAT, gst_buffer_get_size (to_put),
+            gst_buffer_get_size (buf)));
+    res = GST_FLOW_ERROR;
+    goto done;
+  }
+invalid_buffer:
+  {
+    /* No Window available to put our image into */
+    GST_WARNING_OBJECT (xvimagesink, "could map image");
+    res = GST_FLOW_OK;
+    goto done;
   }
 no_window:
   {
     /* No Window available to put our image into */
     GST_WARNING_OBJECT (xvimagesink, "could not output image - no window");
-    return GST_FLOW_ERROR;
+    res = GST_FLOW_ERROR;
+    goto done;
+  }
+activate_failed:
+  {
+    GST_ERROR_OBJECT (xvimagesink, "failed to activate bufferpool.");
+    res = GST_FLOW_ERROR;
+    goto done;
   }
 }
 
@@ -2457,292 +1940,88 @@ gst_xvimagesink_event (GstBaseSink * sink, GstEvent * event)
     return TRUE;
 }
 
-/* Buffer management */
-
-static GstCaps *
-gst_xvimage_sink_different_size_suggestion (GstXvImageSink * xvimagesink,
-    GstCaps * caps)
-{
-  GstCaps *intersection;
-  GstCaps *new_caps;
-  GstStructure *s;
-  gint width, height;
-  gint par_n = 1, par_d = 1;
-  gint dar_n, dar_d;
-  gint w, h;
-
-  new_caps = gst_caps_copy (caps);
-
-  s = gst_caps_get_structure (new_caps, 0);
-
-  gst_structure_get_int (s, "width", &width);
-  gst_structure_get_int (s, "height", &height);
-  gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_n, &par_d);
-
-  gst_structure_remove_field (s, "width");
-  gst_structure_remove_field (s, "height");
-  gst_structure_remove_field (s, "pixel-aspect-ratio");
-
-  intersection = gst_caps_intersect (xvimagesink->xcontext->caps, new_caps);
-  gst_caps_unref (new_caps);
-
-  if (gst_caps_is_empty (intersection))
-    return intersection;
-
-  s = gst_caps_get_structure (intersection, 0);
-
-  gst_util_fraction_multiply (width, height, par_n, par_d, &dar_n, &dar_d);
-
-  /* xvimagesink supports all PARs */
-
-  gst_structure_fixate_field_nearest_int (s, "width", width);
-  gst_structure_fixate_field_nearest_int (s, "height", height);
-  gst_structure_get_int (s, "width", &w);
-  gst_structure_get_int (s, "height", &h);
-
-  gst_util_fraction_multiply (h, w, dar_n, dar_d, &par_n, &par_d);
-  gst_structure_set (s, "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d,
-      NULL);
-
-  return intersection;
-}
-
-static GstFlowReturn
-gst_xvimagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
+static gboolean
+gst_xvimagesink_setup_allocation (GstBaseSink * bsink, GstQuery * query)
 {
-  GstFlowReturn ret = GST_FLOW_OK;
-  GstXvImageSink *xvimagesink;
-  GstXvImageBuffer *xvimage = NULL;
-  GstCaps *intersection = NULL;
-  GstStructure *structure = NULL;
-  gint width, height, image_format;
+  GstXvImageSink *xvimagesink = GST_XVIMAGESINK (bsink);
+  GstBufferPool *pool;
+  GstStructure *config;
+  GstCaps *caps;
+  guint size;
+  gboolean need_pool;
 
-  xvimagesink = GST_XVIMAGESINK (bsink);
+  gst_query_parse_allocation (query, &caps, &need_pool);
 
-  if (G_UNLIKELY (!caps))
+  if (caps == NULL)
     goto no_caps;
 
-  g_mutex_lock (xvimagesink->pool_lock);
-  if (G_UNLIKELY (xvimagesink->pool_invalid))
-    goto invalid;
-
-  if (G_LIKELY (xvimagesink->xcontext->last_caps &&
-          gst_caps_is_equal (caps, xvimagesink->xcontext->last_caps))) {
-    GST_LOG_OBJECT (xvimagesink,
-        "buffer alloc for same last_caps, reusing caps");
-    intersection = gst_caps_ref (caps);
-    image_format = xvimagesink->xcontext->last_format;
-    width = xvimagesink->xcontext->last_width;
-    height = xvimagesink->xcontext->last_height;
-
-    goto reuse_last_caps;
-  }
-
-  GST_DEBUG_OBJECT (xvimagesink, "buffer alloc requested size %d with caps %"
-      GST_PTR_FORMAT ", intersecting with our caps %" GST_PTR_FORMAT, size,
-      caps, xvimagesink->xcontext->caps);
-
-  /* Check the caps against our xcontext */
-  intersection = gst_caps_intersect (xvimagesink->xcontext->caps, caps);
-
-  GST_DEBUG_OBJECT (xvimagesink, "intersection in buffer alloc returned %"
-      GST_PTR_FORMAT, intersection);
-
-  if (gst_caps_is_empty (intersection)) {
-    GstCaps *new_caps;
-
-    gst_caps_unref (intersection);
-
-    /* So we don't support this kind of buffer, let's define one we'd like */
-    new_caps = gst_caps_copy (caps);
-
-    structure = gst_caps_get_structure (new_caps, 0);
-    if (!gst_structure_has_field (structure, "width") ||
-        !gst_structure_has_field (structure, "height")) {
-      gst_caps_unref (new_caps);
-      goto invalid;
-    }
-
-    /* Try different dimensions */
-    intersection =
-        gst_xvimage_sink_different_size_suggestion (xvimagesink, new_caps);
-
-    if (gst_caps_is_empty (intersection)) {
-      /* Try with different YUV formats first */
-      gst_structure_set_name (structure, "video/x-raw-yuv");
-
-      /* Remove format specific fields */
-      gst_structure_remove_field (structure, "format");
-      gst_structure_remove_field (structure, "endianness");
-      gst_structure_remove_field (structure, "depth");
-      gst_structure_remove_field (structure, "bpp");
-      gst_structure_remove_field (structure, "red_mask");
-      gst_structure_remove_field (structure, "green_mask");
-      gst_structure_remove_field (structure, "blue_mask");
-      gst_structure_remove_field (structure, "alpha_mask");
-
-      /* Reuse intersection with Xcontext */
-      intersection = gst_caps_intersect (xvimagesink->xcontext->caps, new_caps);
-    }
+  g_mutex_lock (xvimagesink->flow_lock);
+  if ((pool = xvimagesink->pool))
+    gst_object_ref (pool);
+  g_mutex_unlock (xvimagesink->flow_lock);
 
-    if (gst_caps_is_empty (intersection)) {
-      /* Try with different dimensions and YUV formats */
-      intersection =
-          gst_xvimage_sink_different_size_suggestion (xvimagesink, new_caps);
-    }
+  if (pool != NULL) {
+    const GstCaps *pcaps;
 
-    if (gst_caps_is_empty (intersection)) {
-      /* Now try with RGB */
-      gst_structure_set_name (structure, "video/x-raw-rgb");
-      /* And interset again */
-      gst_caps_unref (intersection);
-      intersection = gst_caps_intersect (xvimagesink->xcontext->caps, new_caps);
-    }
+    /* we had a pool, check caps */
+    GST_DEBUG_OBJECT (xvimagesink, "check existing pool caps");
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL);
 
-    if (gst_caps_is_empty (intersection)) {
-      /* Try with different dimensions and RGB formats */
-      intersection =
-          gst_xvimage_sink_different_size_suggestion (xvimagesink, new_caps);
+    if (!gst_caps_is_equal (caps, pcaps)) {
+      GST_DEBUG_OBJECT (xvimagesink, "pool has different caps");
+      /* different caps, we can't use this pool */
+      gst_object_unref (pool);
+      pool = NULL;
     }
-
-    /* Clean this copy */
-    gst_caps_unref (new_caps);
-
-    if (gst_caps_is_empty (intersection))
-      goto incompatible;
-  }
-
-  /* Ensure the returned caps are fixed */
-  gst_caps_truncate (intersection);
-
-  GST_DEBUG_OBJECT (xvimagesink, "allocating a buffer with caps %"
-      GST_PTR_FORMAT, intersection);
-  if (gst_caps_is_equal (intersection, caps)) {
-    /* Things work better if we return a buffer with the same caps ptr
-     * as was asked for when we can */
-    gst_caps_replace (&intersection, caps);
   }
+  if (pool == NULL && need_pool) {
+    GstVideoInfo info;
 
-  /* Get image format from caps */
-  image_format = gst_xvimagesink_get_format_from_caps (xvimagesink,
-      intersection);
+    GST_DEBUG_OBJECT (xvimagesink, "create new pool");
+    pool = gst_xvimage_buffer_pool_new (xvimagesink);
 
-  /* Get geometry from caps */
-  structure = gst_caps_get_structure (intersection, 0);
-  if (!gst_structure_get_int (structure, "width", &width) ||
-      !gst_structure_get_int (structure, "height", &height) ||
-      image_format == -1)
-    goto invalid_caps;
+    if (!gst_video_info_from_caps (&info, caps))
+      goto invalid_caps;
 
-  /* Store our caps and format as the last_caps to avoid expensive
-   * caps intersection next time */
-  gst_caps_replace (&xvimagesink->xcontext->last_caps, intersection);
-  xvimagesink->xcontext->last_format = image_format;
-  xvimagesink->xcontext->last_width = width;
-  xvimagesink->xcontext->last_height = height;
+    /* the normal size of a frame */
+    size = info.size;
 
-reuse_last_caps:
-
-  /* Walking through the pool cleaning unusable images and searching for a
-     suitable one */
-  while (xvimagesink->image_pool) {
-    xvimage = xvimagesink->image_pool->data;
-
-    if (xvimage) {
-      /* Removing from the pool */
-      xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool,
-          xvimagesink->image_pool);
-
-      /* We check for geometry or image format changes */
-      if ((xvimage->width != width) ||
-          (xvimage->height != height) || (xvimage->im_format != image_format)) {
-        /* This image is unusable. Destroying... */
-        gst_xvimage_buffer_free (xvimage);
-        xvimage = NULL;
-      } else {
-        /* We found a suitable image */
-        GST_LOG_OBJECT (xvimagesink, "found usable image in pool");
-        break;
-      }
-    }
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0);
+    if (!gst_buffer_pool_set_config (pool, config))
+      goto config_failed;
   }
+  /* we need at least 2 buffer because we hold on to the last one */
+  gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
 
-  if (!xvimage) {
-    /* We found no suitable image in the pool. Creating... */
-    GST_DEBUG_OBJECT (xvimagesink, "no usable image in pool, creating xvimage");
-    xvimage = gst_xvimagesink_xvimage_new (xvimagesink, intersection);
-  }
-  g_mutex_unlock (xvimagesink->pool_lock);
-
-  if (xvimage) {
-    /* Make sure the buffer is cleared of any previously used flags */
-    GST_MINI_OBJECT_CAST (xvimage)->flags = 0;
-    gst_buffer_set_caps (GST_BUFFER_CAST (xvimage), intersection);
-  }
+  /* we also support various metadata */
+  gst_query_add_allocation_meta (query, GST_META_API_VIDEO);
+  gst_query_add_allocation_meta (query, GST_META_API_VIDEO_CROP);
 
-  *buf = GST_BUFFER_CAST (xvimage);
+  gst_object_unref (pool);
 
-beach:
-  if (intersection) {
-    gst_caps_unref (intersection);
-  }
-
-  return ret;
+  return TRUE;
 
   /* ERRORS */
-invalid:
-  {
-    GST_DEBUG_OBJECT (xvimagesink, "the pool is flushing");
-    ret = GST_FLOW_WRONG_STATE;
-    g_mutex_unlock (xvimagesink->pool_lock);
-    goto beach;
-  }
-incompatible:
+no_caps:
   {
-    GST_WARNING_OBJECT (xvimagesink, "we were requested a buffer with "
-        "caps %" GST_PTR_FORMAT ", but our xcontext caps %" GST_PTR_FORMAT
-        " are completely incompatible with those caps", caps,
-        xvimagesink->xcontext->caps);
-    ret = GST_FLOW_NOT_NEGOTIATED;
-    g_mutex_unlock (xvimagesink->pool_lock);
-    goto beach;
+    GST_DEBUG_OBJECT (bsink, "no caps specified");
+    return FALSE;
   }
 invalid_caps:
   {
-    GST_WARNING_OBJECT (xvimagesink, "invalid caps for buffer allocation %"
-        GST_PTR_FORMAT, intersection);
-    ret = GST_FLOW_NOT_NEGOTIATED;
-    g_mutex_unlock (xvimagesink->pool_lock);
-    goto beach;
+    GST_DEBUG_OBJECT (bsink, "invalid caps specified");
+    return FALSE;
   }
-no_caps:
+config_failed:
   {
-    GST_WARNING_OBJECT (xvimagesink, "have no caps, doing fallback allocation");
-    *buf = NULL;
-    ret = GST_FLOW_OK;
-    goto beach;
+    GST_DEBUG_OBJECT (bsink, "failed setting config");
+    return FALSE;
   }
 }
 
 /* Interfaces stuff */
-
-static gboolean
-gst_xvimagesink_interface_supported (GstImplementsInterface * iface, GType type)
-{
-  if (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY ||
-      type == GST_TYPE_COLOR_BALANCE || type == GST_TYPE_PROPERTY_PROBE)
-    return TRUE;
-  else
-    return FALSE;
-}
-
-static void
-gst_xvimagesink_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = gst_xvimagesink_interface_supported;
-}
-
 static void
 gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
     GstStructure * structure)
@@ -2813,7 +2092,7 @@ gst_xvimagesink_navigation_init (GstNavigationInterface * iface)
 }
 
 static void
-gst_xvimagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
+gst_xvimagesink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
 {
   XID xwindow_id = id;
   GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@@ -2839,15 +2118,6 @@ gst_xvimagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
 
   gst_xvimagesink_update_colorbalance (xvimagesink);
 
-  /* Clear image pool as the images are unusable anyway */
-  gst_xvimagesink_imagepool_clear (xvimagesink);
-
-  /* Clear the xvimage */
-  if (xvimagesink->xvimage) {
-    gst_xvimage_buffer_free (xvimagesink->xvimage);
-    xvimagesink->xvimage = NULL;
-  }
-
   /* If a window is there already we destroy it */
   if (xvimagesink->xwindow) {
     gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
@@ -2902,16 +2172,17 @@ gst_xvimagesink_set_window_handle (GstXOverlay * overlay, guintptr id)
 }
 
 static void
-gst_xvimagesink_expose (GstXOverlay * overlay)
+gst_xvimagesink_expose (GstVideoOverlay * overlay)
 {
   GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
 
+  GST_DEBUG ("doing expose");
   gst_xvimagesink_xwindow_update_geometry (xvimagesink);
   gst_xvimagesink_xvimage_put (xvimagesink, NULL);
 }
 
 static void
-gst_xvimagesink_set_event_handling (GstXOverlay * overlay,
+gst_xvimagesink_set_event_handling (GstVideoOverlay * overlay,
     gboolean handle_events)
 {
   GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@@ -2947,7 +2218,7 @@ gst_xvimagesink_set_event_handling (GstXOverlay * overlay,
 }
 
 static void
-gst_xvimagesink_set_render_rectangle (GstXOverlay * overlay, gint x, gint y,
+gst_xvimagesink_set_render_rectangle (GstVideoOverlay * overlay, gint x, gint y,
     gint width, gint height)
 {
   GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
@@ -2969,7 +2240,7 @@ gst_xvimagesink_set_render_rectangle (GstXOverlay * overlay, gint x, gint y,
 }
 
 static void
-gst_xvimagesink_xoverlay_init (GstXOverlayClass * iface)
+gst_xvimagesink_video_overlay_init (GstVideoOverlayIface * iface)
 {
   iface->set_window_handle = gst_xvimagesink_set_window_handle;
   iface->expose = gst_xvimagesink_expose;
@@ -3282,7 +2553,7 @@ gst_xvimagesink_set_property (GObject * object, guint prop_id,
       xvimagesink->keep_aspect = g_value_get_boolean (value);
       break;
     case PROP_HANDLE_EVENTS:
-      gst_xvimagesink_set_event_handling (GST_X_OVERLAY (xvimagesink),
+      gst_xvimagesink_set_event_handling (GST_VIDEO_OVERLAY (xvimagesink),
           g_value_get_boolean (value));
       gst_xvimagesink_manage_event_thread (xvimagesink);
       break;
@@ -3411,32 +2682,28 @@ gst_xvimagesink_reset (GstXvImageSink * xvimagesink)
   xvimagesink->event_thread = NULL;
   GST_OBJECT_UNLOCK (xvimagesink);
 
-  /* invalidate the pool, current allocations continue, new buffer_alloc fails
-   * with wrong_state */
-  g_mutex_lock (xvimagesink->pool_lock);
-  xvimagesink->pool_invalid = TRUE;
-  g_mutex_unlock (xvimagesink->pool_lock);
-
   /* Wait for our event thread to finish before we clean up our stuff. */
   if (thread)
     g_thread_join (thread);
 
   if (xvimagesink->cur_image) {
-    gst_buffer_unref (GST_BUFFER_CAST (xvimagesink->cur_image));
+    gst_buffer_unref (xvimagesink->cur_image);
     xvimagesink->cur_image = NULL;
   }
-  if (xvimagesink->xvimage) {
-    gst_buffer_unref (GST_BUFFER_CAST (xvimagesink->xvimage));
-    xvimagesink->xvimage = NULL;
-  }
 
-  gst_xvimagesink_imagepool_clear (xvimagesink);
+  g_mutex_lock (xvimagesink->flow_lock);
+
+  if (xvimagesink->pool) {
+    gst_object_unref (xvimagesink->pool);
+    xvimagesink->pool = NULL;
+  }
 
   if (xvimagesink->xwindow) {
     gst_xvimagesink_xwindow_clear (xvimagesink, xvimagesink->xwindow);
     gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
     xvimagesink->xwindow = NULL;
   }
+  g_mutex_unlock (xvimagesink->flow_lock);
 
   xvimagesink->render_rect.x = xvimagesink->render_rect.y =
       xvimagesink->render_rect.w = xvimagesink->render_rect.h = 0;
@@ -3474,10 +2741,6 @@ gst_xvimagesink_finalize (GObject * object)
     g_mutex_free (xvimagesink->flow_lock);
     xvimagesink->flow_lock = NULL;
   }
-  if (xvimagesink->pool_lock) {
-    g_mutex_free (xvimagesink->pool_lock);
-    xvimagesink->pool_lock = NULL;
-  }
 
   g_free (xvimagesink->media_title);
 
@@ -3485,14 +2748,12 @@ gst_xvimagesink_finalize (GObject * object)
 }
 
 static void
-gst_xvimagesink_init (GstXvImageSink * xvimagesink,
-    GstXvImageSinkClass * xvimagesinkclass)
+gst_xvimagesink_init (GstXvImageSink * xvimagesink)
 {
   xvimagesink->display_name = NULL;
   xvimagesink->adaptor_no = 0;
   xvimagesink->xcontext = NULL;
   xvimagesink->xwindow = NULL;
-  xvimagesink->xvimage = NULL;
   xvimagesink->cur_image = NULL;
 
   xvimagesink->hue = xvimagesink->saturation = 0;
@@ -3507,8 +2768,7 @@ gst_xvimagesink_init (GstXvImageSink * xvimagesink,
   xvimagesink->x_lock = g_mutex_new ();
   xvimagesink->flow_lock = g_mutex_new ();
 
-  xvimagesink->image_pool = NULL;
-  xvimagesink->pool_lock = g_mutex_new ();
+  xvimagesink->pool = NULL;
 
   xvimagesink->synchronous = FALSE;
   xvimagesink->double_buffer = TRUE;
@@ -3528,19 +2788,6 @@ gst_xvimagesink_init (GstXvImageSink * xvimagesink,
 }
 
 static void
-gst_xvimagesink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "Video sink", "Sink/Video",
-      "A Xv based videosink", "Julien Moutte <julien@moutte.net>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_xvimagesink_sink_template_factory));
-}
-
-static void
 gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
 {
   GObjectClass *gobject_class;
@@ -3553,6 +2800,8 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
   gstbasesink_class = (GstBaseSinkClass *) klass;
   videosink_class = (GstVideoSinkClass *) klass;
 
+  parent_class = g_type_class_peek_parent (klass);
+
   gobject_class->set_property = gst_xvimagesink_set_property;
   gobject_class->get_property = gst_xvimagesink_get_property;
 
@@ -3685,90 +2934,22 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
 
   gobject_class->finalize = gst_xvimagesink_finalize;
 
+  gst_element_class_set_details_simple (gstelement_class,
+      "Video sink", "Sink/Video",
+      "A Xv based videosink", "Julien Moutte <julien@moutte.net>");
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_xvimagesink_sink_template_factory));
+
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_xvimagesink_change_state);
 
   gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_xvimagesink_getcaps);
   gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_xvimagesink_setcaps);
-  gstbasesink_class->buffer_alloc =
-      GST_DEBUG_FUNCPTR (gst_xvimagesink_buffer_alloc);
   gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_xvimagesink_get_times);
+  gstbasesink_class->setup_allocation =
+      GST_DEBUG_FUNCPTR (gst_xvimagesink_setup_allocation);
   gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_xvimagesink_event);
 
   videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_xvimagesink_show_frame);
 }
-
-/* ============================================================= */
-/*                                                               */
-/*                       Public Methods                          */
-/*                                                               */
-/* ============================================================= */
-
-/* =========================================== */
-/*                                             */
-/*          Object typing & Creation           */
-/*                                             */
-/* =========================================== */
-static void
-gst_xvimagesink_init_interfaces (GType type)
-{
-  static const GInterfaceInfo iface_info = {
-    (GInterfaceInitFunc) gst_xvimagesink_interface_init,
-    NULL,
-    NULL,
-  };
-  static const GInterfaceInfo navigation_info = {
-    (GInterfaceInitFunc) gst_xvimagesink_navigation_init,
-    NULL,
-    NULL,
-  };
-  static const GInterfaceInfo overlay_info = {
-    (GInterfaceInitFunc) gst_xvimagesink_xoverlay_init,
-    NULL,
-    NULL,
-  };
-  static const GInterfaceInfo colorbalance_info = {
-    (GInterfaceInitFunc) gst_xvimagesink_colorbalance_init,
-    NULL,
-    NULL,
-  };
-  static const GInterfaceInfo propertyprobe_info = {
-    (GInterfaceInitFunc) gst_xvimagesink_property_probe_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type,
-      GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
-  g_type_add_interface_static (type, GST_TYPE_NAVIGATION, &navigation_info);
-  g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &overlay_info);
-  g_type_add_interface_static (type, GST_TYPE_COLOR_BALANCE,
-      &colorbalance_info);
-  g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,
-      &propertyprobe_info);
-
-  /* register type and create class in a more safe place instead of at
-   * runtime since the type registration and class creation is not
-   * threadsafe. */
-  g_type_class_ref (gst_xvimage_buffer_get_type ());
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  if (!gst_element_register (plugin, "xvimagesink",
-          GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK))
-    return FALSE;
-
-  GST_DEBUG_CATEGORY_INIT (gst_debug_xvimagesink, "xvimagesink", 0,
-      "xvimagesink element");
-  GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    "xvimagesink",
-    "XFree86 video output plugin using Xv extension",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
index 0181018..635ab23 100644 (file)
 #include <math.h>
 #include <stdlib.h>
 
-G_BEGIN_DECLS
+/* Helper functions */
+#include <gst/video/video.h>
 
+G_BEGIN_DECLS
 #define GST_TYPE_XVIMAGESINK \
   (gst_xvimagesink_get_type())
 #define GST_XVIMAGESINK(obj) \
@@ -54,16 +56,15 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XVIMAGESINK))
 #define GST_IS_XVIMAGESINK_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XVIMAGESINK))
-
 typedef struct _GstXContext GstXContext;
 typedef struct _GstXWindow GstXWindow;
 typedef struct _GstXvImageFormat GstXvImageFormat;
-typedef struct _GstXvImageBuffer GstXvImageBuffer;
-typedef struct _GstXvImageBufferClass GstXvImageBufferClass;
 
 typedef struct _GstXvImageSink GstXvImageSink;
 typedef struct _GstXvImageSinkClass GstXvImageSinkClass;
 
+#include "xvimagepool.h"
+
 /*
  * GstXContext:
  * @disp: the X11 Display of this context
@@ -93,7 +94,8 @@ typedef struct _GstXvImageSinkClass GstXvImageSinkClass;
  * Structure used to store various informations collected/calculated for a
  * Display.
  */
-struct _GstXContext {
+struct _GstXContext
+{
   Display *disp;
 
   Screen *screen;
@@ -117,7 +119,7 @@ struct _GstXContext {
 
   XvPortID xv_port_id;
   guint nb_adaptors;
-  gchar ** adaptors;
+  gchar **adaptors;
   gint im_format;
 
   GList *formats_list;
@@ -143,7 +145,8 @@ struct _GstXContext {
  *
  * Structure used to store informations about a Window.
  */
-struct _GstXWindow {
+struct _GstXWindow
+{
   Window win;
   gint width, height;
   gboolean internal;
@@ -157,45 +160,19 @@ struct _GstXWindow {
  *
  * Structure storing image format to #GstCaps association.
  */
-struct _GstXvImageFormat {
+struct _GstXvImageFormat
+{
   gint format;
+  GstVideoFormat vformat;
   GstCaps *caps;
 };
 
-/**
- * GstXImageBuffer:
- * @xvimagesink: a reference to our #GstXvImageSink
- * @xvimage: the XvImage of this buffer
- * @width: the width in pixels of XvImage @xvimage
- * @height: the height in pixels of XvImage @xvimage
- * @im_format: the image format of XvImage @xvimage
- * @size: the size in bytes of XvImage @xvimage
- *
- * Subclass of #GstBuffer containing additional information about an XvImage.
- */
-struct _GstXvImageBuffer {
-  GstBuffer   buffer;
-
-  /* Reference to the xvimagesink we belong to */
-  GstXvImageSink *xvimagesink;
-
-  XvImage *xvimage;
-
-#ifdef HAVE_XSHM
-  XShmSegmentInfo SHMInfo;
-#endif /* HAVE_XSHM */
-
-  gint width, height, im_format;
-  size_t size;
-};
 
 /**
  * GstXvImageSink:
  * @display_name: the name of the Display we want to render to
  * @xcontext: our instance's #GstXContext
  * @xwindow: the #GstXWindow we are rendering to
- * @xvimage: internal #GstXvImage used to store incoming buffers and render when
- * not using the buffer_alloc optimization mechanism
  * @cur_image: a reference to the last #GstXvImage that was put to @xwindow. It
  * is used when Expose events are received to redraw the latest video frame
  * @event_thread: a thread listening for events on @xwindow and handling them
@@ -225,7 +202,8 @@ struct _GstXvImageBuffer {
  *
  * The #GstXvImageSink data structure.
  */
-struct _GstXvImageSink {
+struct _GstXvImageSink
+{
   /* Our element stuff */
   GstVideoSink videosink;
 
@@ -234,12 +212,14 @@ struct _GstXvImageSink {
 
   GstXContext *xcontext;
   GstXWindow *xwindow;
-  GstXvImageBuffer *xvimage;
-  GstXvImageBuffer *cur_image;
+  GstBuffer *cur_image;
 
   GThread *event_thread;
   gboolean running;
 
+  GstVideoInfo info;
+
+  /* Framerate numerator and denominator */
   gint fps_n;
   gint fps_d;
 
@@ -249,9 +229,8 @@ struct _GstXvImageSink {
   /* object-set pixel aspect ratio */
   GValue *par;
 
-  GMutex *pool_lock;
-  gboolean pool_invalid;
-  GSList *image_pool;
+  /* the buffer pool */
+  GstBufferPool *pool;
 
   gboolean synchronous;
   gboolean double_buffer;
@@ -269,21 +248,17 @@ struct _GstXvImageSink {
   /* size of incoming video, used as the size for XvImage */
   guint video_width, video_height;
 
-  /* display sizes, used for clipping the image */
-  gint disp_x, disp_y;
-  gint disp_width, disp_height;
-
   /* port attributes */
   gboolean autopaint_colorkey;
   gint colorkey;
-  
+
   gboolean draw_borders;
-  
+
   /* port features */
   gboolean have_autopaint_colorkey;
   gboolean have_colorkey;
   gboolean have_double_buffer;
-  
+
   /* stream metadata */
   gchar *media_title;
 
@@ -292,12 +267,12 @@ struct _GstXvImageSink {
   gboolean have_render_rect;
 };
 
-struct _GstXvImageSinkClass {
+struct _GstXvImageSinkClass
+{
   GstVideoSinkClass parent_class;
 };
 
-GType gst_xvimagesink_get_type(void);
+GType gst_xvimagesink_get_type (void);
 
 G_END_DECLS
-
 #endif /* __GST_XVIMAGESINK_H__ */
index 3280ba3..530d61a 100644 (file)
@@ -35,12 +35,6 @@ else
 check_alsa =
 endif
 
-if USE_GNOME_VFS
-check_gnomevfs = elements/gnomevfssink
-else
-check_gnomevfs =
-endif
-
 if USE_GIO
 check_gio = pipelines/gio
 else
@@ -106,36 +100,17 @@ else
 cxx_checks =
 endif
 
+# FIXME 0.11: convert elements/ffmpegcolorspace to videoconvert or remove
+
 check_PROGRAMS = \
        $(check_alsa) \
-       $(check_gnomevfs) \
        $(check_gio) \
        $(check_ogg) \
-       $(check_pango) \
        $(check_vorbis) \
-       $(check_theora) \
-       elements/adder  \
-       elements/appsink        \
-       elements/appsrc         \
        elements/audioconvert \
-       elements/audiorate \
-       elements/audioresample \
        elements/audiotestsrc \
        elements/decodebin \
-       elements/decodebin2 \
        $(check_encodebin) \
-       elements/ffmpegcolorspace \
-       elements/gdpdepay \
-       elements/gdppay \
-       elements/multifdsink \
-       elements/playbin \
-       elements/playbin2 \
-       elements/playbin2-compressed \
-       $(check_subparse) \
-       elements/videorate \
-       elements/videoscale \
-       elements/videotestsrc \
-       elements/volume \
        generic/clock-selection \
        generic/states \
        gst/typefindfunctions \
@@ -156,21 +131,44 @@ check_PROGRAMS = \
        libs/xmpwriter \
        $(cxx_checks) \
        $(check_orc) \
-       pipelines/simple-launch-lines \
-       pipelines/streamheader \
-       pipelines/basetime \
-       pipelines/capsfilter-renegotiation
+       pipelines/simple-launch-lines
 
 # TORTURE_TO_FIX = \
 #       elements/adder
 
-# ffmpegcolorspace takes too long, so disabled for now
+# videoconvert takes too long, so disabled for now
 VALGRIND_TO_FIX = \
-       elements/ffmpegcolorspace \
+       elements/videoconvert \
        libs/video
 
+# FIXME 0.11: these tests don't even build at the moment
+ZERO_11_TO_PORT = \
+       pipelines/streamheader \
+       pipelines/basetime \
+       pipelines/capsfilter-renegotiation \
+       elements/appsink            \
+       elements/appsrc             \
+       elements/audiorate          \
+       elements/audioresample      \
+       elements/gdpdepay           \
+       elements/gdppay             \
+       elements/multifdsink        \
+       elements/playbin            \
+       elements/playbin-compressed \
+       $(check_pango)              \
+       $(check_subparse)           \
+       elements/videorate          \
+       elements/videoscale         \
+       elements/videotestsrc       \
+       elements/volume
+
+# FIXME 0.11: these tests don't pass at the moment
+ZERO_11_TO_FIX = \
+       elements/adder         \
+       $(check_theora)
+
 # these tests don't even pass
-noinst_PROGRAMS = $(check_libvisual)
+noinst_PROGRAMS = $(check_libvisual) $(ZERO_11_TO_FIX)
 
 noinst_HEADERS = \
        libs/struct_arm.h     \
@@ -376,11 +374,8 @@ elements_gdppay_LDADD = $(GST_GDP_LIBS) $(LDADD)
 elements_playbin_LDADD = $(GST_BASE_LIBS) $(LDADD)
 elements_playbin_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
 
-elements_playbin2_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_playbin2_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
-elements_playbin2_compressed_LDADD = $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la $(GST_BASE_LIBS) $(LDADD)
-elements_playbin2_compressed_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+elements_playbin_compressed_LDADD = $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la $(GST_BASE_LIBS) $(LDADD)
+elements_playbin_compressed_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
 
 elements_decodebin_LDADD = $(GST_BASE_LIBS) $(LDADD)
 elements_decodebin_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
@@ -388,9 +383,6 @@ elements_decodebin_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
 elements_encodebin_LDADD = $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la $(GST_BASE_LIBS) $(LDADD)
 elements_encodebin_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
 
-elements_decodebin2_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_decodebin2_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
 elements_subparse_LDADD =  $(LDADD)
 elements_subparse_CFLAGS = $(CFLAGS) $(AM_CFLAGS)
 
index 80240a0..58b38ba 100644 (file)
@@ -8,11 +8,9 @@ audiorate
 audioresample
 audiotestsrc
 decodebin
-decodebin2
 encodebin
 gdpdepay
 gdppay
-gnomevfssink
 libvisual
 multifdsink
 videorate
@@ -21,10 +19,9 @@ volume
 vorbisdec
 typefindfunctions
 textoverlay
-ffmpegcolorspace
+videoconvert
 videoscale
 vorbistag
 playbin
-playbin2
-playbin2-compressed
+playbin-compressed
 subparse
index 32a085f..fa5c256 100644 (file)
@@ -740,6 +740,7 @@ handoff_buffer_cb (GstElement * fakesink, GstBuffer * buffer, GstPad * pad,
 /* check if clipping works as expected */
 GST_START_TEST (test_clip)
 {
+  GstSegment segment;
   GstElement *bin, *adder, *sink;
   GstBus *bus;
   GstPad *sinkpad;
@@ -747,7 +748,7 @@ GST_START_TEST (test_clip)
   GstFlowReturn ret;
   GstEvent *event;
   GstBuffer *buffer;
-  GstCaps *caps;
+//FIXME:  GstCaps *caps;
 
   GST_INFO ("preparing test");
 
@@ -780,22 +781,26 @@ GST_START_TEST (test_clip)
   fail_if (sinkpad == NULL, NULL);
 
   /* send segment to adder */
-  event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,
-      GST_SECOND, 2 * GST_SECOND, 0);
+  gst_segment_init (&segment, GST_FORMAT_TIME);
+  segment.start = GST_SECOND;
+  segment.stop = 2 * GST_SECOND;
+  segment.time = 0;
+  event = gst_event_new_segment (&segment);
   gst_pad_send_event (sinkpad, event);
 
-  caps = gst_caps_new_simple ("audio/x-raw-int",
+/*FIXME:  caps = gst_caps_new_simple ("audio/x-raw-int",
       "rate", G_TYPE_INT, 44100,
       "channels", G_TYPE_INT, 2,
       "endianness", G_TYPE_INT, G_BYTE_ORDER,
       "width", G_TYPE_INT, 16,
       "depth", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+*/
 
   /* should be clipped and ok */
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 0;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  gst_buffer_set_caps (buffer, caps);
+//FIXME:  gst_buffer_set_caps (buffer, caps);
   GST_DEBUG ("pushing buffer %p", buffer);
   ret = gst_pad_chain (sinkpad, buffer);
   fail_unless (ret == GST_FLOW_OK);
@@ -805,7 +810,7 @@ GST_START_TEST (test_clip)
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 900 * GST_MSECOND;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  gst_buffer_set_caps (buffer, caps);
+//FIXME:  gst_buffer_set_caps (buffer, caps);
   GST_DEBUG ("pushing buffer %p", buffer);
   ret = gst_pad_chain (sinkpad, buffer);
   fail_unless (ret == GST_FLOW_OK);
@@ -816,7 +821,7 @@ GST_START_TEST (test_clip)
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  gst_buffer_set_caps (buffer, caps);
+//FIXME:  gst_buffer_set_caps (buffer, caps);
   GST_DEBUG ("pushing buffer %p", buffer);
   ret = gst_pad_chain (sinkpad, buffer);
   fail_unless (ret == GST_FLOW_OK);
@@ -827,7 +832,7 @@ GST_START_TEST (test_clip)
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  gst_buffer_set_caps (buffer, caps);
+//FIXME:  gst_buffer_set_caps (buffer, caps);
   GST_DEBUG ("pushing buffer %p", buffer);
   ret = gst_pad_chain (sinkpad, buffer);
   fail_unless (ret == GST_FLOW_OK);
index 34982ef..c26cb08 100644 (file)
@@ -198,10 +198,12 @@ GST_END_TEST;
 static GstBufferList *mylist;
 static GstCaps *mycaps;
 
+static gint values[] = { 1, 2, 4 };
+
 static GstBufferList *
 create_buffer_list (void)
 {
-  GstBufferListIterator *it;
+  guint len;
   GstBuffer *buffer;
 
   mylist = gst_buffer_list_new ();
@@ -210,29 +212,23 @@ create_buffer_list (void)
   mycaps = gst_caps_from_string ("application/x-gst-check");
   fail_if (mycaps == NULL);
 
-  it = gst_buffer_list_iterate (mylist);
-  fail_if (it == NULL);
-
-  gst_buffer_list_iterator_add_group (it);
+  len = gst_buffer_list_len (mylist);
+  fail_if (len != 0);
 
   buffer = gst_buffer_new_and_alloc (sizeof (gint));
-  *(gint *) GST_BUFFER_DATA (buffer) = 1;
+  gst_buffer_fill (buffer, 0, &values[0], sizeof (gint));
   gst_buffer_set_caps (buffer, mycaps);
-  gst_buffer_list_iterator_add (it, buffer);
-
-  gst_buffer_list_iterator_add_group (it);
+  gst_buffer_list_add (mylist, buffer);
 
   buffer = gst_buffer_new_and_alloc (sizeof (gint));
-  *(gint *) GST_BUFFER_DATA (buffer) = 2;
+  gst_buffer_fill (buffer, 0, &values[1], sizeof (gint));
   gst_buffer_set_caps (buffer, mycaps);
-  gst_buffer_list_iterator_add (it, buffer);
+  gst_buffer_list_add (mylist, buffer);
 
   buffer = gst_buffer_new_and_alloc (sizeof (gint));
-  *(gint *) GST_BUFFER_DATA (buffer) = 4;
+  gst_buffer_fill (buffer, 0, &values[2], sizeof (gint));
   gst_buffer_set_caps (buffer, mycaps);
-  gst_buffer_list_iterator_add (it, buffer);
-
-  gst_buffer_list_iterator_free (it);
+  gst_buffer_list_add (mylist, buffer);
 
   return mylist;
 }
@@ -240,43 +236,36 @@ create_buffer_list (void)
 static void
 check_buffer_list (GstBufferList * list)
 {
-  GstBufferListIterator *it;
+  guint len;
   GstBuffer *buf;
   GstCaps *caps;
 
   fail_unless (list == mylist);
-  fail_unless (gst_buffer_list_n_groups (list) == 2);
+  fail_unless (gst_buffer_list_len (list) == 3);
 
-  it = gst_buffer_list_iterate (list);
-  fail_if (it == NULL);
+  len = gst_buffer_list_len (list);
 
-  fail_unless (gst_buffer_list_iterator_next_group (it));
-  fail_unless (gst_buffer_list_iterator_n_buffers (it) == 1);
-  buf = gst_buffer_list_iterator_next (it);
+  buf = gst_buffer_list_get (list, 0);
   fail_if (buf == NULL);
-  fail_unless (*(gint *) GST_BUFFER_DATA (buf) == 1);
+  gst_check_buffer_data (buf, &values[0], sizeof (gint));
   caps = gst_buffer_get_caps (buf);
   fail_unless (caps == mycaps);
   fail_unless (gst_caps_is_equal (caps, mycaps));
   gst_caps_unref (caps);
 
-  fail_unless (gst_buffer_list_iterator_next_group (it));
-  fail_unless (gst_buffer_list_iterator_n_buffers (it) == 2);
-  buf = gst_buffer_list_iterator_next (it);
+  buf = gst_buffer_list_get (list, 1);
   fail_if (buf == NULL);
-  fail_unless (*(gint *) GST_BUFFER_DATA (buf) == 2);
+  gst_check_buffer_data (buf, &values[1], sizeof (gint));
   caps = gst_buffer_get_caps (buf);
   fail_unless (caps == mycaps);
   gst_caps_unref (caps);
 
-  buf = gst_buffer_list_iterator_next (it);
+  buf = gst_buffer_list_get (list, 2);
   fail_if (buf == NULL);
-  fail_unless (*(gint *) GST_BUFFER_DATA (buf) == 4);
+  gst_check_buffer_data (buf, &values[2], sizeof (gint));
   caps = gst_buffer_get_caps (buf);
   fail_unless (caps == mycaps);
   gst_caps_unref (caps);
-
-  gst_buffer_list_iterator_free (it);
 }
 
 static GstFlowReturn
@@ -329,13 +318,16 @@ callback_function_buffer (GstAppSink * appsink, gpointer p_counter)
   /* buffer list has 3 buffers in two groups */
   switch (*p_int_counter) {
     case 0:
-      fail_unless_equals_int (GST_BUFFER_SIZE (buf), sizeof (gint));
-      fail_unless_equals_int ((((gint *) GST_BUFFER_DATA (buf))[0]), 1);
+      fail_unless_equals_int (gst_buffer_get_size (buf), sizeof (gint));
+      gst_check_buffer_data (buf, &values[0], sizeof (gint));
       break;
     case 1:
-      fail_unless_equals_int (GST_BUFFER_SIZE (buf), 2 * sizeof (gint));
-      fail_unless_equals_int ((((gint *) GST_BUFFER_DATA (buf))[0]), 2);
-      fail_unless_equals_int ((((gint *) GST_BUFFER_DATA (buf))[1]), 4);
+      fail_unless_equals_int (gst_buffer_get_size (buf), sizeof (gint));
+      gst_check_buffer_data (buf, &values[1], sizeof (gint));
+      break;
+    case 2:
+      fail_unless_equals_int (gst_buffer_get_size (buf), sizeof (gint));
+      gst_check_buffer_data (buf, &values[2], sizeof (gint));
       break;
     default:
       g_warn_if_reached ();
@@ -367,7 +359,7 @@ GST_START_TEST (test_buffer_list_fallback)
   list = create_buffer_list ();
   fail_unless (gst_pad_push_list (mysrcpad, list) == GST_FLOW_OK);
 
-  fail_unless_equals_int (counter, 2);
+  fail_unless_equals_int (counter, 3);
 
   ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
   cleanup_appsink (sink);
@@ -394,7 +386,7 @@ GST_START_TEST (test_buffer_list_fallback_signal)
   list = create_buffer_list ();
   fail_unless (gst_pad_push_list (mysrcpad, list) == GST_FLOW_OK);
 
-  fail_unless_equals_int (counter, 2);
+  fail_unless_equals_int (counter, 3);
 
   ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
   cleanup_appsink (sink);
index b5e292d..9911301 100644 (file)
@@ -93,15 +93,16 @@ setup_audioconvert (GstCaps * outcaps)
   /* this installs a getcaps func that will always return the caps we set
    * later */
   gst_pad_use_fixed_caps (mysinkpad);
+
+  gst_pad_set_active (mysrcpad, TRUE);
+  gst_pad_set_active (mysinkpad, TRUE);
+
   gst_pad_set_caps (mysinkpad, outcaps);
   gst_caps_unref (outcaps);
-  outcaps = gst_pad_get_negotiated_caps (mysinkpad);
+  outcaps = gst_pad_get_current_caps (mysinkpad);
   fail_unless (gst_caps_is_fixed (outcaps));
   gst_caps_unref (outcaps);
 
-  gst_pad_set_active (mysrcpad, TRUE);
-  gst_pad_set_active (mysinkpad, TRUE);
-
   return audioconvert;
 }
 
@@ -447,11 +448,11 @@ verify_convert (const gchar * which, void *in, int inlength,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
       "could not set to playing");
 
+  gst_pad_push_event (mysrcpad, gst_event_new_caps (incaps));
+
   GST_DEBUG ("Creating buffer of %d bytes", inlength);
   inbuffer = gst_buffer_new_and_alloc (inlength);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, inlength);
-  gst_buffer_set_caps (inbuffer, incaps);
-  ASSERT_CAPS_REFCOUNT (incaps, "incaps", 2);
+  gst_buffer_fill (inbuffer, 0, in, inlength);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
   /* pushing gives away my reference ... */
@@ -467,8 +468,10 @@ verify_convert (const gchar * which, void *in, int inlength,
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
 
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), outlength);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), outlength);
 
+  gst_check_buffer_data (outbuffer, out, outlength);
+#if 0
   if (memcmp (GST_BUFFER_DATA (outbuffer), out, outlength) != 0) {
     g_print ("\nInput data:\n");
     gst_util_dump_mem (in, inlength);
@@ -479,6 +482,7 @@ verify_convert (const gchar * which, void *in, int inlength,
   }
   fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, outlength) == 0,
       "failed converting %s", which);
+#endif
 
   /* make sure that the channel positions are not lost */
   {
@@ -486,7 +490,7 @@ verify_convert (const gchar * which, void *in, int inlength,
     gint out_chans;
 
     in_s = gst_caps_get_structure (incaps, 0);
-    out_s = gst_caps_get_structure (GST_BUFFER_CAPS (outbuffer), 0);
+    out_s = gst_caps_get_structure (gst_pad_get_current_caps (mysinkpad), 0);
     fail_unless (gst_structure_get_int (out_s, "channels", &out_chans));
 
     /* positions for 1 and 2 channels are implicit if not provided */
@@ -508,7 +512,6 @@ done:
   GST_DEBUG ("cleanup audioconvert");
   cleanup_audioconvert (audioconvert);
   GST_DEBUG ("cleanup, unref incaps");
-  ASSERT_CAPS_REFCOUNT (incaps, "incaps", 1);
   gst_caps_unref (incaps);
 }
 
@@ -1315,7 +1318,7 @@ GST_START_TEST (test_caps_negotiation)
   fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
       GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline to PAUSED");
 
-  caps1 = gst_pad_get_caps (ac3_src);
+  caps1 = gst_pad_get_caps (ac3_src, NULL);
   fail_if (caps1 == NULL, "gst_pad_get_caps returned NULL");
   GST_DEBUG ("Caps size 1 : %d", gst_caps_get_size (caps1));
 
@@ -1334,7 +1337,7 @@ GST_START_TEST (test_caps_negotiation)
   fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
       GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to PAUSED");
 
-  caps2 = gst_pad_get_caps (ac3_src);
+  caps2 = gst_pad_get_caps (ac3_src, NULL);
 
   fail_if (caps2 == NULL, "gst_pad_get_caps returned NULL");
   GST_DEBUG ("Caps size 2 : %d", gst_caps_get_size (caps2));
index 7845672..da45f87 100644 (file)
@@ -31,7 +31,7 @@ typedef GstElement TestInjector;
 typedef GstElementClass TestInjectorClass;
 
 GType test_injector_get_type (void);
-GST_BOILERPLATE (TestInjector, test_injector, GstElement, GST_TYPE_ELEMENT);
+G_DEFINE_TYPE (TestInjector, test_injector, GST_TYPE_ELEMENT);
 
 #define INJECTOR_CAPS \
   "audio/x-raw-float, "                                  \
@@ -58,9 +58,9 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_STATIC_CAPS (INJECTOR_CAPS));
 
 static void
-test_injector_base_init (gpointer g_class)
+test_injector_class_init (TestInjectorClass * klass)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&src_template));
@@ -68,12 +68,6 @@ test_injector_base_init (gpointer g_class)
       gst_static_pad_template_get (&sink_template));
 }
 
-static void
-test_injector_class_init (TestInjectorClass * klass)
-{
-  /* nothing to do here */
-}
-
 static GstFlowReturn
 test_injector_chain (GstPad * pad, GstBuffer * buf)
 {
@@ -146,7 +140,7 @@ test_injector_chain (GstPad * pad, GstBuffer * buf)
 }
 
 static void
-test_injector_init (TestInjector * injector, TestInjectorClass * klass)
+test_injector_init (TestInjector * injector)
 {
   GstPad *pad;
 
@@ -277,11 +271,12 @@ do_perfect_stream_test (guint rate, guint width, gdouble drop_probability,
     }
 
     /* check buffer size for sanity */
-    fail_unless_equals_int (GST_BUFFER_SIZE (buf) % (width / 8), 0);
+    fail_unless_equals_int (gst_buffer_get_size (buf) % (width / 8), 0);
 
     /* check there is actually as much data as there should be */
     num_samples = GST_BUFFER_OFFSET_END (buf) - GST_BUFFER_OFFSET (buf);
-    fail_unless_equals_int (GST_BUFFER_SIZE (buf), num_samples * (width / 8));
+    fail_unless_equals_int (gst_buffer_get_size (buf),
+        num_samples * (width / 8));
 
     next_time = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
     next_offset = GST_BUFFER_OFFSET_END (buf);
index 792661a..3681603 100644 (file)
@@ -181,9 +181,8 @@ test_perfect_stream_instance (int inrate, int outrate, int samples,
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
   guint64 offset = 0;
-
   int i, j;
-  gint16 *p;
+  gint16 *p, *data;
 
   audioresample = setup_audioresample (2, inrate, outrate, 16, FALSE);
   caps = gst_pad_get_negotiated_caps (mysrcpad);
@@ -204,7 +203,7 @@ test_perfect_stream_instance (int inrate, int outrate, int samples,
 
     gst_buffer_set_caps (inbuffer, caps);
 
-    p = (gint16 *) GST_BUFFER_DATA (inbuffer);
+    p = data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
 
     /* create a 16 bit signed ramp */
     for (i = 0; i < samples; ++i) {
@@ -213,6 +212,7 @@ test_perfect_stream_instance (int inrate, int outrate, int samples,
       *p = -32767 + i * (65535 / samples);
       ++p;
     }
+    gst_buffer_unmap (inbuffer, data, samples * 4);
 
     /* pushing gives away my reference ... */
     fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
@@ -267,7 +267,7 @@ test_discont_stream_instance (int inrate, int outrate, int samples,
   GstClockTime ints;
 
   int i, j;
-  gint16 *p;
+  gint16 *p, *data;
 
   GST_DEBUG ("inrate:%d outrate:%d samples:%d numbuffers:%d",
       inrate, outrate, samples, numbuffers);
@@ -292,8 +292,7 @@ test_discont_stream_instance (int inrate, int outrate, int samples,
 
     gst_buffer_set_caps (inbuffer, caps);
 
-    p = (gint16 *) GST_BUFFER_DATA (inbuffer);
-
+    p = data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
     /* create a 16 bit signed ramp */
     for (i = 0; i < samples; ++i) {
       *p = -32767 + i * (65535 / samples);
@@ -301,6 +300,7 @@ test_discont_stream_instance (int inrate, int outrate, int samples,
       *p = -32767 + i * (65535 / samples);
       ++p;
     }
+    gst_buffer_unmap (inbuffer, data, samples * 4);
 
     GST_DEBUG ("Sending Buffer time:%" G_GUINT64_FORMAT " duration:%"
         G_GINT64_FORMAT " discont:%d offset:%" G_GUINT64_FORMAT " offset_end:%"
@@ -357,6 +357,7 @@ GST_START_TEST (test_reuse)
   GstEvent *newseg;
   GstBuffer *inbuffer;
   GstCaps *caps;
+  guint8 *data;
 
   audioresample = setup_audioresample (1, 9343, 48000, 16, FALSE);
   caps = gst_pad_get_negotiated_caps (mysrcpad);
@@ -370,7 +371,9 @@ GST_START_TEST (test_reuse)
   fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
 
   inbuffer = gst_buffer_new_and_alloc (9343 * 4);
-  memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer));
+  data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
+  memset (data, 0, 9343 * 4);
+  gst_buffer_unmap (inbuffer, data, 9343 * 4);
   GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
   GST_BUFFER_TIMESTAMP (inbuffer) = 0;
   GST_BUFFER_OFFSET (inbuffer) = 0;
@@ -394,7 +397,9 @@ GST_START_TEST (test_reuse)
   fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
 
   inbuffer = gst_buffer_new_and_alloc (9343 * 4);
-  memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer));
+  data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
+  memset (data, 0, 9343 * 4);
+  gst_buffer_unmap (inbuffer, data, 9343 * 4);
   GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
   GST_BUFFER_TIMESTAMP (inbuffer) = 0;
   GST_BUFFER_OFFSET (inbuffer) = 0;
@@ -461,6 +466,7 @@ GST_START_TEST (test_shutdown)
 
 GST_END_TEST;
 
+#if 0
 static GstFlowReturn
 live_switch_alloc_only_48000 (GstPad * pad, guint64 offset,
     guint size, GstCaps * caps, GstBuffer ** buf)
@@ -486,6 +492,7 @@ live_switch_alloc_only_48000 (GstPad * pad, guint64 offset,
 
   return GST_FLOW_OK;
 }
+#endif
 
 static GstCaps *
 live_switch_get_sink_caps (GstPad * pad)
@@ -506,13 +513,18 @@ live_switch_push (int rate, GstCaps * caps)
   GstBuffer *inbuffer;
   GstCaps *desired;
   GList *l;
+  guint8 *data;
 
   desired = gst_caps_copy (caps);
   gst_caps_set_simple (desired, "rate", G_TYPE_INT, rate, NULL);
   gst_pad_set_caps (mysrcpad, desired);
 
+#if 0
   fail_unless (gst_pad_alloc_buffer_and_set_caps (mysrcpad,
           GST_BUFFER_OFFSET_NONE, rate * 4, desired, &inbuffer) == GST_FLOW_OK);
+#endif
+  inbuffer = gst_buffer_new_and_alloc (rate * 4);
+  gst_buffer_set_caps (inbuffer, desired);
 
   /* When the basetransform hits the non-configured case it always
    * returns a buffer with exactly the same caps as we requested so the actual
@@ -522,7 +534,10 @@ live_switch_push (int rate, GstCaps * caps)
       desired, GST_BUFFER_CAPS (inbuffer));
   fail_unless (gst_caps_is_equal (desired, GST_BUFFER_CAPS (inbuffer)));
 
-  memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer));
+  data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
+  memset (data, 0, rate * 4);
+  gst_buffer_unmap (inbuffer, data, rate * 4);
+
   GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
   GST_BUFFER_TIMESTAMP (inbuffer) = 0;
   GST_BUFFER_OFFSET (inbuffer) = 0;
@@ -557,7 +572,7 @@ GST_START_TEST (test_live_switch)
    * rate 48000- and can only allocate buffers for that rate, but if someone
    * tries to get a buffer with a rate higher then 48000 tries to renegotiate
    * */
-  gst_pad_set_bufferalloc_function (mysinkpad, live_switch_alloc_only_48000);
+  //gst_pad_set_bufferalloc_function (mysinkpad, live_switch_alloc_only_48000);
   gst_pad_set_getcaps_function (mysinkpad, live_switch_get_sink_caps);
 
   gst_pad_use_fixed_caps (mysrcpad);
@@ -775,7 +790,7 @@ fakesink_handoff_cb (GstElement * object, GstBuffer * buffer, GstPad * pad,
 
   ctx->out_buffer_count++;
   if (ctx->latency == GST_CLOCK_TIME_NONE) {
-    ctx->latency = 1000 - GST_BUFFER_SIZE (buffer) / 8;
+    ctx->latency = 1000 - gst_buffer_get_size (buffer) / 8;
   }
 
   /* Check if we have a perfectly timestampped stream */
@@ -787,10 +802,10 @@ fakesink_handoff_cb (GstElement * object, GstBuffer * buffer, GstPad * pad,
 
   /* Check if we have a perfectly offsetted stream */
   fail_unless (GST_BUFFER_OFFSET_END (buffer) ==
-      GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) / 8,
+      GST_BUFFER_OFFSET (buffer) + gst_buffer_get_size (buffer) / 8,
       "expected offset end %" G_GUINT64_FORMAT " got offset end %"
       G_GUINT64_FORMAT,
-      GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) / 8,
+      GST_BUFFER_OFFSET (buffer) + gst_buffer_get_size (buffer) / 8,
       GST_BUFFER_OFFSET_END (buffer));
   if (ctx->next_out_off != GST_BUFFER_OFFSET_NONE) {
     fail_unless (GST_BUFFER_OFFSET (buffer) == ctx->next_out_off,
index d5d327e..79cfe63 100644 (file)
@@ -44,20 +44,30 @@ static const gchar dummytext[] =
     "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox ";
 
 static void
-src_handoff_cb (GstElement * src, GstBuffer * buf, GstPad * pad, gpointer data)
+src_need_data_cb (GstElement * src, guint size, gpointer data)
 {
-  GST_BUFFER_DATA (buf) = (guint8 *) dummytext;
-  GST_BUFFER_SIZE (buf) = sizeof (dummytext);
+  GstBuffer *buf;
+  GstFlowReturn ret;
+
+  buf = gst_buffer_new ();
+  gst_buffer_take_memory (buf, 0,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) dummytext, NULL, sizeof (dummytext), 0,
+          sizeof (dummytext)));
+
   GST_BUFFER_OFFSET (buf) = 0;
-  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
+
+  g_signal_emit_by_name (src, "push-buffer", buf, &ret);
+
+  fail_unless (ret == GST_FLOW_OK);
 }
 
 static void
-decodebin_new_decoded_pad_cb (GstElement * decodebin, GstPad * pad,
+decodebin_pad_added_cb (GstElement * decodebin, GstPad * pad,
     gboolean last, gboolean * p_flag)
 {
   /* we should not be reached */
-  fail_unless (decodebin == NULL, "new-decoded-pad should not be emitted");
+  fail_unless (decodebin == NULL, "pad-added should not be emitted");
 }
 
 /* make sure that decodebin errors out instead of creating a new decoded pad
@@ -70,19 +80,18 @@ GST_START_TEST (test_text_plain_streams)
   pipe = gst_pipeline_new (NULL);
   fail_unless (pipe != NULL, "failed to create pipeline");
 
-  src = gst_element_factory_make ("fakesrc", "src");
-  fail_unless (src != NULL, "Failed to create fakesrc element");
+  src = gst_element_factory_make ("appsrc", "src");
+  fail_unless (src != NULL, "Failed to create appsrc element");
 
-  g_object_set (src, "signal-handoffs", TRUE, NULL);
+  g_object_set (src, "emit-signals", TRUE, NULL);
   g_object_set (src, "num-buffers", 1, NULL);
-  g_object_set (src, "can-activate-pull", FALSE, NULL);
-  g_signal_connect (src, "handoff", G_CALLBACK (src_handoff_cb), NULL);
+  g_signal_connect (src, "need-data", G_CALLBACK (src_need_data_cb), NULL);
 
   decodebin = gst_element_factory_make ("decodebin", "decodebin");
   fail_unless (decodebin != NULL, "Failed to create decodebin element");
 
-  g_signal_connect (decodebin, "new-decoded-pad",
-      G_CALLBACK (decodebin_new_decoded_pad_cb), NULL);
+  g_signal_connect (decodebin, "pad-added",
+      G_CALLBACK (decodebin_pad_added_cb), NULL);
 
   fail_unless (gst_bin_add (GST_BIN (pipe), src));
   fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
@@ -107,12 +116,14 @@ GST_START_TEST (test_text_plain_streams)
 GST_END_TEST;
 
 static void
-new_decoded_pad_plug_fakesink_cb (GstElement * decodebin, GstPad * srcpad,
+pad_added_plug_fakesink_cb (GstElement * decodebin, GstPad * srcpad,
     gboolean last, GstElement * pipeline)
 {
   GstElement *sink;
   GstPad *sinkpad;
 
+  GST_LOG ("Linking fakesink");
+
   sink = gst_element_factory_make ("fakesink", "sink");
   fail_unless (sink != NULL, "Failed to create fakesink element");
 
@@ -138,8 +149,8 @@ GST_START_TEST (test_reuse_without_decoders)
   decodebin = gst_element_factory_make ("decodebin", "decodebin");
   fail_unless (decodebin != NULL, "Failed to create decodebin element");
 
-  g_signal_connect (decodebin, "new-decoded-pad",
-      G_CALLBACK (new_decoded_pad_plug_fakesink_cb), pipe);
+  g_signal_connect (decodebin, "pad-added",
+      G_CALLBACK (pad_added_plug_fakesink_cb), pipe);
 
   fail_unless (gst_bin_add (GST_BIN (pipe), src));
   fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
@@ -159,10 +170,11 @@ GST_START_TEST (test_reuse_without_decoders)
   fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
 
   /* reset */
-  gst_element_set_state (pipe, GST_STATE_NULL);
+  gst_element_set_state (pipe, GST_STATE_READY);
 
   sink = gst_bin_get_by_name (GST_BIN (pipe), "sink");
   gst_bin_remove (GST_BIN (pipe), sink);
+  gst_element_set_state (sink, GST_STATE_NULL);
   gst_object_unref (sink);
 
   GST_LOG ("second try");
@@ -210,13 +222,13 @@ static gboolean test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse,
 static GstFlowReturn test_mpeg_audio_parse_parse_frame (GstBaseParse * parse,
     GstBaseParseFrame * frame);
 
-GST_BOILERPLATE (TestMpegAudioParse, test_mpeg_audio_parse, GstBaseParse,
-    GST_TYPE_BASE_PARSE);
+G_DEFINE_TYPE (TestMpegAudioParse, test_mpeg_audio_parse, GST_TYPE_BASE_PARSE);
 
 static void
-test_mpeg_audio_parse_base_init (gpointer klass)
+test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass);
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&sink_template));
@@ -226,12 +238,6 @@ test_mpeg_audio_parse_base_init (gpointer klass)
   gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser",
       "Codec/Parser/Audio", "Pretends to parse mpeg1 audio stream",
       "Foo Bar <foo@bar.com>");
-}
-
-static void
-test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
-{
-  GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass);
 
   parse_class->start = test_mpeg_audio_parse_start;
   parse_class->stop = test_mpeg_audio_parse_stop;
@@ -242,8 +248,7 @@ test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
 static gint num_parse_instances = 0;
 
 static void
-test_mpeg_audio_parse_init (TestMpegAudioParse * mp3parse,
-    TestMpegAudioParseClass * klass)
+test_mpeg_audio_parse_init (TestMpegAudioParse * mp3parse)
 {
   /* catch decodebin plugging parsers in a loop early */
   fail_unless (++num_parse_instances < 10);
@@ -266,7 +271,9 @@ static gboolean
 test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse,
     GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
 {
-  const guint8 *data = GST_BUFFER_DATA (frame->buffer);
+  guint8 data[2];
+
+  gst_buffer_extract (frame->buffer, 0, data, 2);
 
   if ((GST_READ_UINT16_BE (data) & 0xffe0) == 0xffe0) {
     /* this framesize is hard-coded for ../test.mp3 */
@@ -288,7 +295,6 @@ test_mpeg_audio_parse_parse_frame (GstBaseParse * parse,
     caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1,
         "mpegaudioversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3,
         "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, NULL);
-    gst_buffer_set_caps (frame->buffer, caps);
     gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
     gst_caps_unref (caps);
   }
diff --git a/tests/check/elements/decodebin2.c b/tests/check/elements/decodebin2.c
deleted file mode 100644 (file)
index 8eb4798..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-/* GStreamer unit tests for decodebin2
- *
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- * Copyright (C) 2011 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gstbaseparse.h>
-#include <unistd.h>
-
-static const gchar dummytext[] =
-    "Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
-    "Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick "
-    "Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog "
-    "Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy "
-    "Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a "
-    "Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps "
-    "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox "
-    "jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
-    "Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick "
-    "Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog "
-    "Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy "
-    "Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a "
-    "Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps "
-    "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox ";
-
-static void
-src_handoff_cb (GstElement * src, GstBuffer * buf, GstPad * pad, gpointer data)
-{
-  GST_BUFFER_DATA (buf) = (guint8 *) dummytext;
-  GST_BUFFER_SIZE (buf) = sizeof (dummytext);
-  GST_BUFFER_OFFSET (buf) = 0;
-  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
-}
-
-static void
-decodebin_new_decoded_pad_cb (GstElement * decodebin, GstPad * pad,
-    gboolean last, gboolean * p_flag)
-{
-  /* we should not be reached */
-  fail_unless (decodebin == NULL, "new-decoded-pad should not be emitted");
-}
-
-/* make sure that decodebin errors out instead of creating a new decoded pad
- * if the entire stream is a plain text file */
-GST_START_TEST (test_text_plain_streams)
-{
-  GstElement *pipe, *src, *decodebin;
-  GstMessage *msg;
-
-  pipe = gst_pipeline_new (NULL);
-  fail_unless (pipe != NULL, "failed to create pipeline");
-
-  src = gst_element_factory_make ("fakesrc", "src");
-  fail_unless (src != NULL, "Failed to create fakesrc element");
-
-  g_object_set (src, "signal-handoffs", TRUE, NULL);
-  g_object_set (src, "num-buffers", 1, NULL);
-  g_object_set (src, "can-activate-pull", FALSE, NULL);
-  g_signal_connect (src, "handoff", G_CALLBACK (src_handoff_cb), NULL);
-
-  decodebin = gst_element_factory_make ("decodebin2", "decodebin");
-  fail_unless (decodebin != NULL, "Failed to create decodebin element");
-
-  g_signal_connect (decodebin, "new-decoded-pad",
-      G_CALLBACK (decodebin_new_decoded_pad_cb), NULL);
-
-  fail_unless (gst_bin_add (GST_BIN (pipe), src));
-  fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
-  fail_unless (gst_element_link (src, decodebin), "can't link src<->decodebin");
-
-  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  /* it's push-based, so should be async */
-  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-
-  /* it should error out at some point */
-  msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, -1);
-  fail_unless (msg != NULL);
-  fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
-  gst_message_unref (msg);
-
-  gst_element_set_state (pipe, GST_STATE_NULL);
-  gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-
-static void
-new_decoded_pad_plug_fakesink_cb (GstElement * decodebin, GstPad * srcpad,
-    gboolean last, GstElement * pipeline)
-{
-  GstElement *sink;
-  GstPad *sinkpad;
-
-  GST_LOG ("Linking fakesink");
-
-  sink = gst_element_factory_make ("fakesink", "sink");
-  fail_unless (sink != NULL, "Failed to create fakesink element");
-
-  gst_bin_add (GST_BIN (pipeline), sink);
-
-  sinkpad = gst_element_get_static_pad (sink, "sink");
-  fail_unless_equals_int (gst_pad_link (srcpad, sinkpad), GST_PAD_LINK_OK);
-  gst_object_unref (sinkpad);
-
-  gst_element_set_state (sink, GST_STATE_PLAYING);
-}
-
-GST_START_TEST (test_reuse_without_decoders)
-{
-  GstElement *pipe, *src, *decodebin, *sink;
-
-  pipe = gst_pipeline_new (NULL);
-  fail_unless (pipe != NULL, "failed to create pipeline");
-
-  src = gst_element_factory_make ("audiotestsrc", "src");
-  fail_unless (src != NULL, "Failed to create audiotestsrc element");
-
-  decodebin = gst_element_factory_make ("decodebin2", "decodebin");
-  fail_unless (decodebin != NULL, "Failed to create decodebin element");
-
-  g_signal_connect (decodebin, "new-decoded-pad",
-      G_CALLBACK (new_decoded_pad_plug_fakesink_cb), pipe);
-
-  fail_unless (gst_bin_add (GST_BIN (pipe), src));
-  fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
-  fail_unless (gst_element_link (src, decodebin), "can't link src<->decodebin");
-
-  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  /* it's push-based, so should be async */
-  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-
-  /* wait for state change to complete */
-  fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
-
-  /* there shouldn't be any errors */
-  fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
-
-  /* reset */
-  gst_element_set_state (pipe, GST_STATE_READY);
-
-  sink = gst_bin_get_by_name (GST_BIN (pipe), "sink");
-  gst_bin_remove (GST_BIN (pipe), sink);
-  gst_element_set_state (sink, GST_STATE_NULL);
-  gst_object_unref (sink);
-
-  GST_LOG ("second try");
-
-  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  /* it's push-based, so should be async */
-  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-
-  /* wait for state change to complete */
-  fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
-
-  /* there shouldn't be any errors */
-  fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
-
-  gst_element_set_state (pipe, GST_STATE_NULL);
-  gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-
-/* Fake mp3 parser for test */
-typedef GstBaseParse TestMpegAudioParse;
-typedef GstBaseParseClass TestMpegAudioParseClass;
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/mpeg, mpegversion=1, layer=[1,3], parsed=(b)true")
-    );
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/mpeg, mpegversion=1, parsed=(bool) { false, true }")
-    );
-
-static GType test_mpeg_audio_parse_get_type (void);
-static gboolean test_mpeg_audio_parse_start (GstBaseParse * parse);
-static gboolean test_mpeg_audio_parse_stop (GstBaseParse * parse);
-static gboolean test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse,
-    GstBaseParseFrame * frame, guint * size, gint * skipsize);
-static GstFlowReturn test_mpeg_audio_parse_parse_frame (GstBaseParse * parse,
-    GstBaseParseFrame * frame);
-
-GST_BOILERPLATE (TestMpegAudioParse, test_mpeg_audio_parse, GstBaseParse,
-    GST_TYPE_BASE_PARSE);
-
-static void
-test_mpeg_audio_parse_base_init (gpointer klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_template));
-
-  gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser",
-      "Codec/Parser/Audio", "Pretends to parse mpeg1 audio stream",
-      "Foo Bar <foo@bar.com>");
-}
-
-static void
-test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
-{
-  GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass);
-
-  parse_class->start = test_mpeg_audio_parse_start;
-  parse_class->stop = test_mpeg_audio_parse_stop;
-  parse_class->check_valid_frame = test_mpeg_audio_parse_check_valid_frame;
-  parse_class->parse_frame = test_mpeg_audio_parse_parse_frame;
-}
-
-static gint num_parse_instances = 0;
-
-static void
-test_mpeg_audio_parse_init (TestMpegAudioParse * mp3parse,
-    TestMpegAudioParseClass * klass)
-{
-  /* catch decodebin plugging parsers in a loop early */
-  fail_unless (++num_parse_instances < 10);
-}
-
-static gboolean
-test_mpeg_audio_parse_start (GstBaseParse * parse)
-{
-  gst_base_parse_set_min_frame_size (parse, 6);
-  return TRUE;
-}
-
-static gboolean
-test_mpeg_audio_parse_stop (GstBaseParse * parse)
-{
-  return TRUE;
-}
-
-static gboolean
-test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse,
-    GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
-{
-  const guint8 *data = GST_BUFFER_DATA (frame->buffer);
-
-  if ((GST_READ_UINT16_BE (data) & 0xffe0) == 0xffe0) {
-    /* this framesize is hard-coded for ../test.mp3 */
-    *framesize = 1045;
-    return TRUE;
-  } else {
-    *skipsize = 1;
-    return FALSE;
-  }
-}
-
-static GstFlowReturn
-test_mpeg_audio_parse_parse_frame (GstBaseParse * parse,
-    GstBaseParseFrame * frame)
-{
-  if (GST_BUFFER_OFFSET (frame->buffer) == 0) {
-    GstCaps *caps;
-
-    caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1,
-        "mpegaudioversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3,
-        "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, NULL);
-    gst_buffer_set_caps (frame->buffer, caps);
-    gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
-    gst_caps_unref (caps);
-  }
-  return GST_FLOW_OK;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "testmpegaudioparse", GST_RANK_NONE,
-      test_mpeg_audio_parse_get_type ());
-}
-
-GST_START_TEST (test_mp3_parser_loop)
-{
-  GstStateChangeReturn sret;
-  GstPluginFeature *feature;
-  GstMessage *msg;
-  GstElement *pipe, *src, *dec;
-  gchar *path;
-
-  num_parse_instances = 0;
-
-  gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR,
-      "fakemp3parse", "fakemp3parse", plugin_init, VERSION, "LGPL",
-      "gst-plugins-base", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
-
-  feature = gst_default_registry_find_feature ("testmpegaudioparse",
-      GST_TYPE_ELEMENT_FACTORY);
-
-  gst_plugin_feature_set_rank (feature, GST_RANK_PRIMARY + 100);
-
-  pipe = gst_pipeline_new (NULL);
-
-  src = gst_element_factory_make ("filesrc", NULL);
-  fail_unless (src != NULL);
-
-  path = g_build_filename (GST_TEST_FILES_PATH, "test.mp3", NULL);
-  g_object_set (src, "location", path, NULL);
-  g_free (path);
-
-  dec = gst_element_factory_make ("decodebin2", NULL);
-  fail_unless (dec != NULL);
-
-  gst_bin_add_many (GST_BIN (pipe), src, dec, NULL);
-  gst_element_link_many (src, dec, NULL);
-
-  sret = gst_element_set_state (pipe, GST_STATE_PLAYING);
-  fail_unless_equals_int (sret, GST_STATE_CHANGE_ASYNC);
-
-  /* wait for unlinked error */
-  msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe),
-      GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR);
-  gst_message_unref (msg);
-
-  gst_element_set_state (pipe, GST_STATE_NULL);
-  gst_object_unref (pipe);
-
-  /* make sure out parser got plugged at all though */
-  fail_unless_equals_int (num_parse_instances, 1);
-
-  /* don't want to interfere with any other of the other tests */
-  gst_plugin_feature_set_rank (feature, GST_RANK_NONE);
-  gst_object_unref (feature);
-}
-
-GST_END_TEST;
-
-static Suite *
-decodebin2_suite (void)
-{
-  Suite *s = suite_create ("decodebin2");
-  TCase *tc_chain = tcase_create ("general");
-
-  suite_add_tcase (s, tc_chain);
-  tcase_add_test (tc_chain, test_text_plain_streams);
-  tcase_add_test (tc_chain, test_reuse_without_decoders);
-  tcase_add_test (tc_chain, test_mp3_parser_loop);
-
-  return s;
-}
-
-GST_CHECK_MAIN (decodebin2);
index 8721a8c..a4bbfab 100644 (file)
@@ -1,6 +1,6 @@
 /* GStreamer
  *
- * unit test for ffmpegcolorspace
+ * unit test for videoconvert
  *
  * Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
  *
 
 #include <gst/check/gstcheck.h>
 
-typedef struct _RGBFormat
-{
-  const gchar *nick;
-  guint bpp, depth;
-  guint32 red_mask, green_mask, blue_mask, alpha_mask;
-  guint endianness;
-} RGBFormat;
-
 typedef struct _RGBConversion
 {
-  RGBFormat from_fmt;
-  RGBFormat to_fmt;
+  const gchar *from_fmt;
+  const gchar *to_fmt;
   GstCaps *from_caps;
   GstCaps *to_caps;
 } RGBConversion;
 
 static GstCaps *
-rgb_format_to_caps (RGBFormat * fmt)
+rgb_format_to_caps (const gchar * fmt)
 {
   GstCaps *caps;
 
   g_assert (fmt != NULL);
-  g_assert (fmt->endianness != 0);
-
-  caps = gst_caps_new_simple ("video/x-raw-rgb",
-      "bpp", G_TYPE_INT, fmt->bpp,
-      "depth", G_TYPE_INT, fmt->depth,
-      "red_mask", G_TYPE_INT, fmt->red_mask,
-      "green_mask", G_TYPE_INT, fmt->green_mask,
-      "blue_mask", G_TYPE_INT, fmt->blue_mask,
+
+  caps = gst_caps_new_simple ("video/x-raw",
+      "format", G_TYPE_STRING, fmt,
       "width", G_TYPE_INT, 16, "height", G_TYPE_INT, 16,
-      "endianness", G_TYPE_INT, fmt->endianness,
       "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
 
-  fail_unless (fmt->alpha_mask == 0 || fmt->bpp == 32);
-
-  if (fmt->alpha_mask != 0) {
-    gst_structure_set (gst_caps_get_structure (caps, 0),
-        "alpha_mask", G_TYPE_INT, fmt->alpha_mask, NULL);
-  }
-
   return caps;
 }
 
 static GList *
 create_rgb_conversions (void)
 {
-  const RGBFormat rgb_formats[] = {
-    {
-        "RGBA", 32, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff, 0}, {
-        "ARGB", 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, 0}, {
-        "BGRA", 32, 32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff, 0}, {
-        "ABGR", 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, 0}, {
-        "RGBx", 32, 24, 0xff000000, 0x00ff0000, 0x0000ff00, 0x00000000, 0}, {
-        "xRGB", 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, 0}, {
-        "BGRx", 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0x00000000, 0}, {
-        "xBGR", 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, 0}, {
-        "RGB ", 24, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, 0}, {
-        "BGR ", 24, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, 0}, {
-        "RGB565", 16, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000, 0}, {
-        "xRGB1555", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000, 0}
-  };
-  const struct
-  {
-    guint from_endianness, to_endianness;
-  } end_arr[4] = {
-    {
-    G_LITTLE_ENDIAN, G_LITTLE_ENDIAN}, {
-    G_BIG_ENDIAN, G_LITTLE_ENDIAN}, {
-    G_LITTLE_ENDIAN, G_BIG_ENDIAN}, {
-    G_BIG_ENDIAN, G_BIG_ENDIAN}
+  const gchar *rgb_formats[] = {
+    "RGBA",
+    "ARGB",
+    "BGRA",
+    "ABGR",
+    "RGBx",
+    "xRGB",
+    "BGRx",
+    "xBGR",
+    "RGB",
+    "BGR",
+    "RGB15",
+    "BGR15",
+    "RGB16",
+    "BGR16"
   };
   GList *conversions = NULL;
   guint from_fmt, to_fmt;
@@ -117,10 +87,8 @@ create_rgb_conversions (void)
         conversion = g_new0 (RGBConversion, 1);
         conversion->from_fmt = rgb_formats[from_fmt];
         conversion->to_fmt = rgb_formats[to_fmt];
-        conversion->from_fmt.endianness = end_arr[i].from_endianness;
-        conversion->to_fmt.endianness = end_arr[i].to_endianness;
-        conversion->from_caps = rgb_format_to_caps (&conversion->from_fmt);
-        conversion->to_caps = rgb_format_to_caps (&conversion->to_fmt);
+        conversion->from_caps = rgb_format_to_caps (conversion->from_fmt);
+        conversion->to_caps = rgb_format_to_caps (conversion->to_fmt);
         conversions = g_list_prepend (conversions, conversion);
       }
     }
@@ -153,6 +121,7 @@ right_shift_colour (guint32 mask, guint32 pixel)
   return pixel;
 }
 
+#if 0
 static guint8
 fix_expected_colour (guint32 col_mask, guint8 col_expected)
 {
@@ -237,6 +206,7 @@ check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
 //  FIXME: fix alpha check
 //  fail_unless (a_mask == 0 || alpha != 0);      /* better than nothing */
 }
+#endif
 
 static void
 got_buf_cb (GstElement * sink, GstBuffer * new_buf, GstPad * pad,
@@ -264,9 +234,9 @@ GST_START_TEST (test_rgb_to_rgb)
     "black", 2, 0x00, 0x00, 0x00}
   };
   GstElement *pipeline, *src, *filter1, *csp, *filter2, *sink;
-  const GstCaps *template_caps;
+  GstCaps *template_caps;
   GstBuffer *buf = NULL;
-  GstPad *srcpad;
+  GstPad *srcpad, *csppad;
   GList *conversions, *l;
   gint p;
 
@@ -276,7 +246,7 @@ GST_START_TEST (test_rgb_to_rgb)
   pipeline = gst_pipeline_new ("pipeline");
   src = gst_check_setup_element ("videotestsrc");
   filter1 = gst_check_setup_element ("capsfilter");
-  csp = gst_check_setup_element ("ffmpegcolorspace");
+  csp = gst_check_setup_element ("videoconvert");
   filter2 = gst_element_factory_make ("capsfilter", "to_filter");
   sink = gst_check_setup_element ("fakesink");
 
@@ -291,6 +261,8 @@ GST_START_TEST (test_rgb_to_rgb)
   template_caps = gst_pad_get_pad_template_caps (srcpad);
   gst_object_unref (srcpad);
 
+  csppad = gst_element_get_static_pad (csp, "src");
+
   g_object_set (sink, "signal-handoffs", TRUE, NULL);
   g_signal_connect (sink, "preroll-handoff", G_CALLBACK (got_buf_cb), &buf);
 
@@ -311,8 +283,12 @@ GST_START_TEST (test_rgb_to_rgb)
     /* caps are supported, let's run some tests then ... */
     for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
       GstStateChangeReturn state_ret;
-      RGBFormat *from = &conv->from_fmt;
-      RGBFormat *to = &conv->to_fmt;
+      const gchar *from = conv->from_fmt;
+      const gchar *to = conv->to_fmt;
+#if 0
+      guint8 *data;
+      gsize size;
+#endif
 
       /* trick compiler into thinking from is used, might throw warning
        * otherwise if the debugging system is disabled */
@@ -322,18 +298,13 @@ GST_START_TEST (test_rgb_to_rgb)
 
       g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
 
-      GST_INFO ("%5s %u/%u %08x %08x %08x %08x %u => "
-          "%5s %u/%u %08x %08x %08x %08x %u, pattern=%s",
-          from->nick, from->bpp, from->depth, from->red_mask,
-          from->green_mask, from->blue_mask, from->alpha_mask,
-          from->endianness, to->nick, to->bpp, to->depth, to->red_mask,
-          to->green_mask, to->blue_mask, to->alpha_mask, to->endianness,
-          test_patterns[p].pattern_name);
+      GST_INFO ("%5s => %5s, pattern=%s",
+          from, to, test_patterns[p].pattern_name);
 
       /* now get videotestsrc to produce a buffer with the given caps */
       g_object_set (filter1, "caps", conv->from_caps, NULL);
 
-      /* ... and force ffmpegcolorspace to convert to our target caps */
+      /* ... and force videoconvert to convert to our target caps */
       g_object_set (filter2, "caps", conv->to_caps, NULL);
 
       state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
@@ -348,7 +319,7 @@ GST_START_TEST (test_rgb_to_rgb)
         fail_unless (err != NULL);
         if (msg->src == GST_OBJECT_CAST (src) &&
             err->code == GST_STREAM_ERROR_FORMAT) {
-          GST_DEBUG ("ffmpegcolorspace does not support this conversion");
+          GST_DEBUG ("videoconvert does not support this conversion");
           gst_message_unref (msg);
           g_error_free (err);
           continue;
@@ -368,41 +339,36 @@ GST_START_TEST (test_rgb_to_rgb)
 
       /* check buffer caps */
       {
+        GstCaps *caps;
         GstStructure *s;
-        gint v;
-
-        fail_unless (GST_BUFFER_CAPS (buf) != NULL);
-        s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
-        fail_unless (gst_structure_get_int (s, "bpp", &v));
-        fail_unless_equals_int (v, to->bpp);
-        fail_unless (gst_structure_get_int (s, "depth", &v));
-        fail_unless_equals_int (v, to->depth);
-        fail_unless (gst_structure_get_int (s, "red_mask", &v));
-        fail_unless_equals_int (v, to->red_mask);
-        fail_unless (gst_structure_get_int (s, "green_mask", &v));
-        fail_unless_equals_int (v, to->green_mask);
-        fail_unless (gst_structure_get_int (s, "blue_mask", &v));
-        fail_unless_equals_int (v, to->blue_mask);
-        /* there mustn't be an alpha_mask if there's no alpha component */
-        if (to->depth == 32) {
-          fail_unless (gst_structure_get_int (s, "alpha_mask", &v));
-          fail_unless_equals_int (v, to->alpha_mask);
-        } else {
-          fail_unless (gst_structure_get_value (s, "alpha_mask") == NULL);
-        }
+        const gchar *fmt;
+
+        g_object_get (csppad, "caps", &caps, NULL);
+
+        fail_unless (caps != NULL);
+        s = gst_caps_get_structure (caps, 0);
+        fmt = gst_structure_get_string (s, "format");
+        fail_unless (fmt != NULL);
+        fail_unless (!strcmp (fmt, to));
       }
 
+#if 0
       /* now check the top-left pixel */
-      check_rgb_buf (GST_BUFFER_DATA (buf), to->red_mask,
+      data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+      check_rgb_buf (data, to->red_mask,
           to->green_mask, to->blue_mask, to->alpha_mask,
           test_patterns[p].r_expected, test_patterns[p].g_expected,
           test_patterns[p].b_expected, to->endianness, to->bpp, to->depth);
+      gst_buffer_unmap (buf, data, size);
+#endif
 
       gst_buffer_unref (buf);
       buf = NULL;
     }
   }
 
+  gst_caps_unref (template_caps);
+
   g_list_foreach (conversions, (GFunc) rgb_conversion_free, NULL);
   g_list_free (conversions);
 
@@ -413,9 +379,9 @@ GST_START_TEST (test_rgb_to_rgb)
 GST_END_TEST;
 
 static Suite *
-ffmpegcolorspace_suite (void)
+videoconvert_suite (void)
 {
-  Suite *s = suite_create ("ffmpegcolorspace");
+  Suite *s = suite_create ("videoconvert");
   TCase *tc_chain = tcase_create ("general");
 
   suite_add_tcase (s, tc_chain);
@@ -436,4 +402,4 @@ ffmpegcolorspace_suite (void)
   return s;
 }
 
-GST_CHECK_MAIN (ffmpegcolorspace);
+GST_CHECK_MAIN (videoconvert);
index 3ee83c8..6a1a9f1 100644 (file)
@@ -94,14 +94,15 @@ cleanup_gdpdepay (GstElement * gdpdepay)
 }
 
 static void
-gdpdepay_push_per_byte (const gchar * reason, guint8 * bytes, guint length)
+gdpdepay_push_per_byte (const gchar * reason, const guint8 * bytes,
+    guint length)
 {
   int i;
   GstBuffer *inbuffer;
 
   for (i = 0; i < length; ++i) {
     inbuffer = gst_buffer_new_and_alloc (1);
-    GST_BUFFER_DATA (inbuffer)[0] = bytes[i];
+    gst_buffer_fill (inbuffer, 0, &bytes[i], 1);
     fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK,
         "%s: failed pushing byte buffer", reason);
   }
@@ -148,13 +149,13 @@ GST_START_TEST (test_audio_per_byte)
   g_free (payload);
 
   buffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (buffer), "f00d", 4);
+  gst_buffer_fill (buffer, 0, "f00d", 4);
   GST_BUFFER_TIMESTAMP (buffer) = GST_SECOND;
   GST_BUFFER_DURATION (buffer) = GST_SECOND / 10;
   fail_unless (pk->header_from_buffer (buffer, 0, &len, &header));
   gdpdepay_push_per_byte ("buffer header", header, len);
   fail_unless_equals_int (g_list_length (buffers), 0);
-  gdpdepay_push_per_byte ("buffer payload", GST_BUFFER_DATA (buffer),
+  gdpdepay_push_per_byte ("buffer payload", (const guint8 *) "f00d",
       gst_dp_header_payload_length (header));
   g_free (header);
   gst_buffer_unref (buffer);
@@ -214,21 +215,20 @@ GST_START_TEST (test_audio_in_one_buffer)
           &caps_payload));
 
   buffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (buffer), "f00d", 4);
+  gst_buffer_fill (buffer, 0, "f00d", 4);
   fail_unless (pk->header_from_buffer (buffer, 0, &header_len, &buf_header));
 
   payload_len = gst_dp_header_payload_length (caps_header);
 
   inbuffer = gst_buffer_new_and_alloc (2 * GST_DP_HEADER_LENGTH +
-      payload_len + GST_BUFFER_SIZE (buffer));
-  memcpy (GST_BUFFER_DATA (inbuffer), caps_header, GST_DP_HEADER_LENGTH);
+      payload_len + gst_buffer_get_size (buffer));
+  gst_buffer_fill (inbuffer, 0, caps_header, GST_DP_HEADER_LENGTH);
   i = GST_DP_HEADER_LENGTH;
-  memcpy (GST_BUFFER_DATA (inbuffer) + i, caps_payload, payload_len);
+  gst_buffer_fill (inbuffer, i, caps_payload, payload_len);
   i += payload_len;
-  memcpy (GST_BUFFER_DATA (inbuffer) + i, buf_header, GST_DP_HEADER_LENGTH);
+  gst_buffer_fill (inbuffer, i, buf_header, GST_DP_HEADER_LENGTH);
   i += GST_DP_HEADER_LENGTH;
-  memcpy (GST_BUFFER_DATA (inbuffer) + i, GST_BUFFER_DATA (buffer),
-      GST_BUFFER_SIZE (buffer));
+  gst_buffer_fill (inbuffer, i, "f00d", 4);
 
   gst_caps_unref (caps);
   gst_buffer_unref (buffer);
@@ -287,7 +287,8 @@ GST_START_TEST (test_streamheader)
   GstPad *srcpad;
   GstElement *gdpdepay;
   GstBuffer *buffer, *inbuffer, *outbuffer, *shbuffer;
-  guint8 *caps_header, *caps_payload, *buf_header;
+  guint8 *caps_header, *caps_payload, *buf_header, *data;
+  gsize size;
   guint header_len, payload_len;
   guint i;
   GstStructure *structure;
@@ -315,7 +316,7 @@ GST_START_TEST (test_streamheader)
   caps = gst_caps_from_string ("application/x-gst-test-streamheader");
   structure = gst_caps_get_structure (caps, 0);
   buffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (buffer), "f00d", 4);
+  gst_buffer_fill (buffer, 0, "f00d", 4);
   GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
   g_value_init (&array, GST_TYPE_ARRAY);
   g_value_init (&value, GST_TYPE_BUFFER);
@@ -338,16 +339,17 @@ GST_START_TEST (test_streamheader)
 
   payload_len = gst_dp_header_payload_length (caps_header);
 
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
   inbuffer = gst_buffer_new_and_alloc (2 * GST_DP_HEADER_LENGTH +
-      payload_len + GST_BUFFER_SIZE (buffer));
-  memcpy (GST_BUFFER_DATA (inbuffer), caps_header, GST_DP_HEADER_LENGTH);
+      payload_len + size);
+  gst_buffer_fill (inbuffer, 0, caps_header, GST_DP_HEADER_LENGTH);
   i = GST_DP_HEADER_LENGTH;
-  memcpy (GST_BUFFER_DATA (inbuffer) + i, caps_payload, payload_len);
+  gst_buffer_fill (inbuffer, i, caps_payload, payload_len);
   i += payload_len;
-  memcpy (GST_BUFFER_DATA (inbuffer) + i, buf_header, GST_DP_HEADER_LENGTH);
+  gst_buffer_fill (inbuffer, i, buf_header, GST_DP_HEADER_LENGTH);
   i += GST_DP_HEADER_LENGTH;
-  memcpy (GST_BUFFER_DATA (inbuffer) + i, GST_BUFFER_DATA (buffer),
-      GST_BUFFER_SIZE (buffer));
+  gst_buffer_fill (inbuffer, i, data, size);
+  gst_buffer_unmap (buffer, data, size);
 
   gst_caps_unref (caps);
   gst_buffer_unref (buffer);
index 13117a6..05391f1 100644 (file)
@@ -142,7 +142,7 @@ GST_START_TEST (test_audio)
   buffers = g_list_remove (buffers, outbuffer);
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
   length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* the third buffer is the GDP buffer for our pushed buffer */
@@ -150,7 +150,7 @@ GST_START_TEST (test_audio)
   buffers = g_list_remove (buffers, outbuffer);
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* second buffer */
@@ -170,7 +170,7 @@ GST_START_TEST (test_audio)
 
   /* the third output buffer is data */
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* a third buffer without caps set explicitly; should work */
@@ -189,7 +189,7 @@ GST_START_TEST (test_audio)
 
   /* the fourth output buffer is data */
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
 
@@ -263,7 +263,7 @@ GST_START_TEST (test_streamheader)
 
   GST_DEBUG ("first buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), "head", 4);
+  gst_buffer_fill (inbuffer, 0, "head", 4);
   caps = gst_caps_from_string ("application/x-gst-test-streamheader");
   structure = gst_caps_get_structure (caps, 0);
   GST_BUFFER_FLAG_SET (inbuffer, GST_BUFFER_FLAG_IN_CAPS);
@@ -316,7 +316,7 @@ GST_START_TEST (test_streamheader)
   buffers = g_list_remove (buffers, outbuffer);
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
   length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* the third buffer is the GDP buffer for our pushed buffer */
@@ -324,7 +324,7 @@ GST_START_TEST (test_streamheader)
   buffers = g_list_remove (buffers, outbuffer);
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* second buffer */
@@ -344,7 +344,7 @@ GST_START_TEST (test_streamheader)
 
   /* the third output buffer is data */
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* a third buffer without caps set explicitly; should work */
@@ -363,7 +363,7 @@ GST_START_TEST (test_streamheader)
 
   /* the fourth output buffer is data */
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
 
@@ -464,6 +464,8 @@ GST_START_TEST (test_crc)
   GstEvent *event;
   gchar *caps_string;
   gint length;
+  guint8 *data;
+  gsize size;
   guint16 crc_calculated, crc_read;
 
   gdppay = setup_gdppay ();
@@ -503,16 +505,19 @@ GST_START_TEST (test_crc)
 
   /* verify the header checksum */
   /* CRC's start at 58 in the header */
-  crc_calculated = gst_dp_crc (GST_BUFFER_DATA (outbuffer), 58);
-  crc_read = GST_READ_UINT16_BE (GST_BUFFER_DATA (outbuffer) + 58);
+  outbuffer = gst_buffer_make_writable (outbuffer);
+  data = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READWRITE);
+  crc_calculated = gst_dp_crc (data, 58);
+  crc_read = GST_READ_UINT16_BE (data + 58);
   fail_unless_equals_int (crc_calculated, crc_read);
 
   /* change a byte in the header and verify that the checksum now fails */
-  GST_BUFFER_DATA (outbuffer)[0] = 0xff;
-  crc_calculated = gst_dp_crc (GST_BUFFER_DATA (outbuffer), 58);
+  data[0] = 0xff;
+  crc_calculated = gst_dp_crc (data, 58);
   fail_if (crc_calculated == crc_read,
       "Introducing a byte error in the header should make the checksum fail");
 
+  gst_buffer_unmap (outbuffer, data, size);
   gst_buffer_unref (outbuffer);
 
   /* second buffer is the serialized caps;
@@ -521,7 +526,7 @@ GST_START_TEST (test_crc)
   buffers = g_list_remove (buffers, outbuffer);
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
   length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   /* the third buffer is the GDP buffer for our pushed buffer */
@@ -529,7 +534,7 @@ GST_START_TEST (test_crc)
   buffers = g_list_remove (buffers, outbuffer);
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
   length = GST_DP_HEADER_LENGTH + 4;
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
 
   fail_unless (gst_element_set_state (gdppay,
diff --git a/tests/check/elements/gnomevfssink.c b/tests/check/elements/gnomevfssink.c
deleted file mode 100644 (file)
index f0cf64d..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/* GStreamer unit test for the gnomevfssink element
- *
- * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>             /* for close() */
-#endif
-
-#include <gst/check/gstcheck.h>
-
-static GstPad *mysrcpad;
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS_ANY);
-
-static GstElement *
-setup_gnomevfssink (void)
-{
-  GstElement *gnomevfssink;
-
-  GST_DEBUG ("setup_gnomevfssink");
-  gnomevfssink = gst_check_setup_element ("gnomevfssink");
-  mysrcpad = gst_check_setup_src_pad (gnomevfssink, &srctemplate, NULL);
-  gst_pad_set_active (mysrcpad, TRUE);
-  return gnomevfssink;
-}
-
-static void
-cleanup_gnomevfssink (GstElement * gnomevfssink)
-{
-  gst_pad_set_active (mysrcpad, FALSE);
-  gst_check_teardown_src_pad (gnomevfssink);
-  gst_check_teardown_element (gnomevfssink);
-}
-
-#if 0
-/* this queries via the element vfunc, which is currently not implemented */
-#define CHECK_QUERY_POSITION(gnomevfssink,format,position)                  \
-    G_STMT_START {                                                       \
-      GstFormat fmt = format;                                            \
-      gint64 pos;                                                        \
-      fail_unless (gst_element_query_position (gnomevfssink, &fmt, &pos));   \
-      fail_unless_equals_int (pos, position);                            \
-    } G_STMT_END
-#else
-#define CHECK_QUERY_POSITION(gnomevfssink,format,position)               \
-    G_STMT_START {                                                       \
-      GstFormat fmt = format;                                            \
-      GstPad *pad;                                                       \
-      gint64 pos;                                                        \
-      pad = gst_element_get_static_pad (gnomevfssink, "sink");           \
-      fail_unless (gst_pad_query_position (pad, &fmt, &pos));            \
-      fail_unless_equals_int (pos, position);                            \
-      gst_object_unref (pad);                                            \
-    } G_STMT_END
-#endif
-
-#define PUSH_BYTES(num_bytes)                                             \
-    G_STMT_START {                                                        \
-      GstBuffer *buf = gst_buffer_new_and_alloc(num_bytes);               \
-      GRand *rand = g_rand_new_with_seed (num_bytes);                     \
-      guint i;                                                            \
-      for (i = 0; i < num_bytes; ++i)                                     \
-        GST_BUFFER_DATA(buf)[i] = (g_rand_int (rand) >> 24) & 0xff;       \
-      fail_unless_equals_int (gst_pad_push (mysrcpad, buf), GST_FLOW_OK); \
-      g_rand_free (rand);                                                 \
-    } G_STMT_END
-
-/* TODO: we don't check that the data is actually written to the right
- * position after a seek */
-GST_START_TEST (test_seeking)
-{
-  const gchar *tmpdir;
-  GstElement *gnomevfssink;
-  gchar *tmp_fn;
-  gint fd;
-
-  tmpdir = g_get_tmp_dir ();
-  if (tmpdir == NULL)
-    return;
-
-  /* this is just silly, but gcc warns if we try to use tpmnam() */
-  tmp_fn =
-      g_build_filename (tmpdir, "gstreamer-gnomevfssink-test-XXXXXX", NULL);
-  fd = g_mkstemp (tmp_fn);
-  if (fd < 0) {
-    GST_ERROR ("can't create temp file %s: %s", tmp_fn, g_strerror (errno));
-    g_free (tmp_fn);
-    return;
-  }
-  /* don't want the file, just a filename (hence silly, see above) */
-  close (fd);
-  g_remove (tmp_fn);
-
-  gnomevfssink = setup_gnomevfssink ();
-
-  GST_LOG ("using temp file '%s'", tmp_fn);
-  g_object_set (gnomevfssink, "location", tmp_fn, NULL);
-
-  fail_unless_equals_int (gst_element_set_state (gnomevfssink,
-          GST_STATE_PLAYING), GST_STATE_CHANGE_ASYNC);
-
-#if 0
-  /* Test that gnomevfssink is seekable with a file fd */
-  /* gnomevfssink doesn't implement seekable query at the moment */
-  GstQuery *seeking_query;
-  gboolean seekable;
-
-  fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES))
-      != NULL);
-  fail_unless (gst_element_query (gnomevfssink, seeking_query) == TRUE);
-  gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL);
-  fail_unless (seekable == TRUE);
-  gst_query_unref (seeking_query);
-#endif
-
-  fail_unless (gst_pad_push_event (mysrcpad,
-          gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0)));
-
-  CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 0);
-
-  /* push buffer with size 0 and NULL data */
-  PUSH_BYTES (0);
-  CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 0);
-
-  PUSH_BYTES (1);
-  CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 1);
-
-  PUSH_BYTES (99);
-  CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 100);
-
-  PUSH_BYTES (8800);
-  CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 8900);
-
-  if (gst_pad_push_event (mysrcpad,
-          gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 8800, -1,
-              0))) {
-    GST_LOG ("seek ok");
-    /* make sure that that new position is reported immediately */
-    CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 8800);
-    PUSH_BYTES (1);
-    CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 8801);
-    PUSH_BYTES (9256);
-    CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 18057);
-  } else {
-    GST_INFO ("seeking not supported for tempfile?!");
-  }
-
-  fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
-
-  fail_unless_equals_int (gst_element_set_state (gnomevfssink, GST_STATE_NULL),
-      GST_STATE_CHANGE_SUCCESS);
-
-  /* cleanup */
-  cleanup_gnomevfssink (gnomevfssink);
-
-  /* check that we wrote data to the right position after the seek */
-  {
-    gchar *data = NULL;
-    gsize len;
-
-    fail_unless (g_file_get_contents (tmp_fn, &data, &len, NULL),
-        "Failed to read in newly-created file '%s'", tmp_fn);
-    fail_unless_equals_int (len, 18057);
-    {
-      /* we wrote 9256 bytes at position 8801 */
-      GRand *rand = g_rand_new_with_seed (9256);
-      guint i;
-
-      for (i = 0; i < 9256; ++i) {
-        guint8 byte_written = *(((guint8 *) data) + 8801 + i);
-
-        fail_unless_equals_int (byte_written, g_rand_int (rand) >> 24);
-      }
-      g_rand_free (rand);
-    }
-    g_free (data);
-  }
-
-  /* remove file */
-  g_remove (tmp_fn);
-  g_free (tmp_fn);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_coverage)
-{
-  GstElement *gnomevfssink;
-  gchar *location;
-  GstBus *bus;
-  GstMessage *message;
-
-  gnomevfssink = setup_gnomevfssink ();
-  bus = gst_bus_new ();
-
-  gst_element_set_bus (gnomevfssink, bus);
-
-  g_object_set (gnomevfssink, "location", "/i/do/not/exist", NULL);
-  g_object_get (gnomevfssink, "location", &location, NULL);
-  fail_unless_equals_string (location, "/i/do/not/exist");
-  g_free (location);
-
-  fail_unless_equals_int (gst_element_set_state (gnomevfssink,
-          GST_STATE_PLAYING), GST_STATE_CHANGE_FAILURE);
-
-  /* a state change and an error */
-  fail_if ((message = gst_bus_pop (bus)) == NULL);
-  fail_unless_message_error (message, RESOURCE, OPEN_WRITE);
-  gst_message_unref (message);
-
-  g_object_set (gnomevfssink, "location", NULL, NULL);
-  g_object_get (gnomevfssink, "location", &location, NULL);
-  fail_if (location);
-
-  /* cleanup */
-  gst_element_set_bus (gnomevfssink, NULL);
-  gst_object_unref (GST_OBJECT (bus));
-  cleanup_gnomevfssink (gnomevfssink);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_uri_interface)
-{
-  GstElement *gnomevfssink;
-  gchar *location;
-  GstBus *bus;
-
-  gnomevfssink = setup_gnomevfssink ();
-  bus = gst_bus_new ();
-
-  gst_element_set_bus (gnomevfssink, bus);
-
-  g_object_set (G_OBJECT (gnomevfssink), "location", "/i/do/not/exist", NULL);
-  g_object_get (G_OBJECT (gnomevfssink), "location", &location, NULL);
-  fail_unless_equals_string (location, "/i/do/not/exist");
-  g_free (location);
-
-  location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (gnomevfssink));
-  fail_unless_equals_string (location, "file://%2Fi%2Fdo%2Fnot%2Fexist");
-
-  /* should accept file:///foo/bar URIs */
-  fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (gnomevfssink),
-          "file:///foo/bar"));
-  location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (gnomevfssink));
-  fail_unless_equals_string (location, "file://%2Ffoo%2Fbar");
-  g_object_get (G_OBJECT (gnomevfssink), "location", &location, NULL);
-  fail_unless_equals_string (location, "/foo/bar");
-  g_free (location);
-
-  /* should accept file://localhost/foo/bar URIs */
-  fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (gnomevfssink),
-          "file://localhost/foo/baz"));
-  location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (gnomevfssink));
-  fail_unless_equals_string (location, "file://%2Ffoo%2Fbaz");
-  g_object_get (G_OBJECT (gnomevfssink), "location", &location, NULL);
-  fail_unless_equals_string (location, "/foo/baz");
-  g_free (location);
-
-  /* should fail with other hostnames */
-  fail_if (gst_uri_handler_set_uri (GST_URI_HANDLER (gnomevfssink),
-          "file://hostname/foo/foo"));
-
-  /* cleanup */
-  gst_element_set_bus (gnomevfssink, NULL);
-  gst_object_unref (GST_OBJECT (bus));
-  cleanup_gnomevfssink (gnomevfssink);
-}
-
-GST_END_TEST;
-
-static Suite *
-gnomevfssink_suite (void)
-{
-  Suite *s = suite_create ("gnomevfssink");
-  TCase *tc_chain = tcase_create ("general");
-
-  suite_add_tcase (s, tc_chain);
-
-  /* FIXME: these two tests fail right now because of uri/location stuff */
-  if (0) {
-    tcase_add_test (tc_chain, test_coverage);
-    tcase_add_test (tc_chain, test_uri_interface);
-  }
-  tcase_add_test (tc_chain, test_seeking);
-
-  return s;
-}
-
-GST_CHECK_MAIN (gnomevfssink);
index 0f95006..f2f37d7 100644 (file)
@@ -23,7 +23,7 @@
 static gboolean
 filter_func (GstPluginFeature * feature, gpointer user_data)
 {
-  return (g_str_has_prefix (GST_PLUGIN_FEATURE_NAME (feature), "libvisual_"));
+  return (g_str_has_prefix (GST_OBJECT_NAME (feature), "libvisual_"));
 }
 
 static void
@@ -43,7 +43,7 @@ test_shutdown_for_factory (const gchar * factory_name)
   vis = gst_check_setup_element (factory_name);
 
   cf = gst_check_setup_element ("capsfilter");
-  caps = gst_caps_new_simple ("video/x-raw-rgb", "width", G_TYPE_INT, 320,
+  caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 320,
       "height", G_TYPE_INT, 240, "framerate", GST_TYPE_FRACTION, 15, 1, NULL);
   g_object_set (cf, "caps", caps, NULL);
   gst_caps_unref (caps);
@@ -88,7 +88,7 @@ GST_START_TEST (test_shutdown)
       return;
     }
     for (l = list; l != NULL; l = l->next) {
-      test_shutdown_for_factory (GST_PLUGIN_FEATURE_NAME (l->data));
+      test_shutdown_for_factory (GST_OBJECT_NAME (l->data));
     }
     gst_plugin_feature_list_free (list);
   } else {
index 4eb6e9e..e70402f 100644 (file)
@@ -121,7 +121,7 @@ GST_START_TEST (test_add_client)
   buffer = gst_buffer_new_and_alloc (4);
   gst_buffer_set_caps (buffer, caps);
   ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
-  memcpy (GST_BUFFER_DATA (buffer), "dead", 4);
+  gst_buffer_fill (buffer, 0, "dead", 4);
   fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
 
   GST_DEBUG ("reading");
@@ -176,10 +176,10 @@ gst_multifdsink_create_streamheader (const gchar * data1,
    * buffers */
   *hbuf1 = gst_buffer_new_and_alloc (size1);
   GST_BUFFER_FLAG_SET (*hbuf1, GST_BUFFER_FLAG_IN_CAPS);
-  memcpy (GST_BUFFER_DATA (*hbuf1), data1, size1);
+  gst_buffer_fill (*hbuf1, 0, data1, size1);
   *hbuf2 = gst_buffer_new_and_alloc (size2);
   GST_BUFFER_FLAG_SET (*hbuf2, GST_BUFFER_FLAG_IN_CAPS);
-  memcpy (GST_BUFFER_DATA (*hbuf2), data2, size2);
+  gst_buffer_fill (*hbuf2, 0, data2, size2);
 
   g_value_init (&array, GST_TYPE_ARRAY);
 
@@ -265,7 +265,7 @@ GST_START_TEST (test_streamheader)
   /* push a non-IN_CAPS buffer, this should trigger the client receiving the
    * first three buffers */
   buf = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (buf), "f00d", 4);
+  gst_buffer_fill (buf, 0, "f00d", 4);
   gst_pad_push (mysrcpad, buf);
 
   fail_unless_read ("first client", pfd1[0], 4, "babe");
@@ -281,7 +281,7 @@ GST_START_TEST (test_streamheader)
   /* now push another buffer, which will trigger streamheader for second
    * client */
   buf = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (buf), "deaf", 4);
+  gst_buffer_fill (buf, 0, "deaf", 4);
   gst_pad_push (mysrcpad, buf);
 
   fail_unless_read ("first client", pfd1[0], 4, "deaf");
@@ -360,7 +360,7 @@ GST_START_TEST (test_change_streamheader)
 
   /* now push a buffer and read */
   buf = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (buf), "f00d", 4);
+  gst_buffer_fill (buf, 0, "f00d", 4);
   gst_pad_push (mysrcpad, buf);
 
   fail_unless_read ("change: first client", pfd1[0], 5, "first");
@@ -400,7 +400,7 @@ GST_START_TEST (test_change_streamheader)
   /* now push another buffer, which will trigger streamheader for second
    * client, but should also send new streamheaders to first client */
   buf = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (buf), "deadbabe", 8);
+  gst_buffer_fill (buf, 0, "deadbabe", 8);
   gst_pad_push (mysrcpad, buf);
 
   fail_unless_read ("first client", pfd1[0], 6, "second");
@@ -469,8 +469,9 @@ GST_START_TEST (test_burst_client_bytes)
     gst_buffer_set_caps (buffer, caps);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
 
     fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
   }
@@ -494,8 +495,9 @@ GST_START_TEST (test_burst_client_bytes)
     gst_buffer_set_caps (buffer, caps);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
 
     fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
   }
@@ -586,8 +588,9 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
       GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
 
     fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
   }
@@ -612,8 +615,9 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
 
     fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
   }
@@ -701,8 +705,9 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
       GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
 
     fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
   }
@@ -727,8 +732,9 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
 
     fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
   }
@@ -813,8 +819,9 @@ GST_START_TEST (test_client_next_keyframe)
     gst_buffer_set_caps (buffer, caps);
 
     /* copy some id */
-    data = (gchar *) GST_BUFFER_DATA (buffer);
+    data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
     g_snprintf (data, 16, "deadbee%08x", i);
+    gst_buffer_unmap (buffer, data, 16);
     if (i > 0)
       GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
similarity index 99%
rename from tests/check/elements/playbin2-compressed.c
rename to tests/check/elements/playbin-compressed.c
index 5f3c544..d6fdf1b 100644 (file)
@@ -1,4 +1,4 @@
-/* GStreamer unit tests for playbin2 compressed stream support
+/* GStreamer unit tests for playbin compressed stream support
  *
  * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
  * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
@@ -380,7 +380,7 @@ gst_video_codec_sink_base_init (gpointer klass)
 {
   static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
       GST_PAD_SINK, GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("video/x-raw-yuv; video/x-compressed")
+      GST_STATIC_CAPS ("video/x-raw; video/x-compressed")
       );
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
@@ -398,12 +398,12 @@ gst_video_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
 
   s = gst_caps_get_structure (caps, 0);
 
-  if (gst_structure_has_name (s, "video/x-raw-yuv")) {
+  if (gst_structure_has_name (s, "video/x-raw")) {
     sink->raw = TRUE;
   } else if (gst_structure_has_name (s, "video/x-compressed")) {
     sink->raw = FALSE;
   } else {
-    fail_unless (gst_structure_has_name (s, "video/x-raw-yuv")
+    fail_unless (gst_structure_has_name (s, "video/x-raw")
         || gst_structure_has_name (s, "video/x-compressed"));
     return FALSE;
   }
@@ -464,7 +464,7 @@ gst_codec_demuxer_base_init (gpointer klass)
   static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src_%d",
       GST_PAD_SRC, GST_PAD_SOMETIMES,
       GST_STATIC_CAPS ("audio/x-raw-int; audio/x-compressed; "
-          "video/x-raw-yuv; video/x-compressed")
+          "video/x-raw; video/x-compressed")
       );
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
@@ -577,7 +577,7 @@ gst_codec_demuxer_setup_pad (GstCodecDemuxer * demux, GstPad ** pad,
     }
 
     if (g_str_equal (streaminfo, "raw-video")) {
-      caps = gst_caps_new_simple ("video/x-raw-yuv",
+      caps = gst_caps_new_simple ("video/x-raw",
           "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
           "width", G_TYPE_INT, 320,
           "height", G_TYPE_INT, 240,
@@ -647,7 +647,7 @@ create_playbin (const gchar * uri, gboolean set_sink)
 {
   GstElement *playbin, *sink;
 
-  playbin = gst_element_factory_make ("playbin2", "playbin2");
+  playbin = gst_element_factory_make ("playbin", "playbin");
   fail_unless (playbin != NULL, "Failed to create playbin element");
 
   if (set_sink) {
@@ -692,8 +692,8 @@ GST_START_TEST (test_raw_single_video_stream_manual_sink)
 
   playbin =
       create_playbin
-      ("caps:video/x-raw-yuv, "
-      "format=(fourcc)I420, "
+      ("caps:video/x-raw, "
+      "format=(string)I420, "
       "width=(int)320, "
       "height=(int)240, "
       "framerate=(fraction)0/1, " "pixel-aspect-ratio=(fraction)1/1", TRUE);
@@ -2474,9 +2474,9 @@ GST_END_TEST;
 #endif
 
 static Suite *
-playbin2_compressed_suite (void)
+playbin_compressed_suite (void)
 {
-  Suite *s = suite_create ("playbin2-compressed");
+  Suite *s = suite_create ("playbin_compressed");
   TCase *tc_chain = tcase_create ("general");
 
   suite_add_tcase (s, tc_chain);
@@ -2528,4 +2528,4 @@ playbin2_compressed_suite (void)
   return s;
 }
 
-GST_CHECK_MAIN (playbin2_compressed);
+GST_CHECK_MAIN (playbin_compressed);
index 08aace6..22a413f 100644 (file)
 static GType gst_red_video_src_get_type (void);
 static GType gst_codec_src_get_type (void);
 
-#define DEFINE_TEST(func) \
-    static void func (void);                            \
-    \
-    GST_START_TEST(func ## _decodebin1)                  \
-    { g_unsetenv("USE_DECODEBIN2"); func(); }            \
-    GST_END_TEST;                                        \
-    \
-    GST_START_TEST(func ## _decodebin2)                  \
-    { g_setenv("USE_DECODEBIN2", "1", TRUE); func(); }   \
-    GST_END_TEST;
-
-DEFINE_TEST (test_sink_usage_video_only_stream);
-
 /* make sure the audio sink is not touched for video-only streams */
-static void
-test_sink_usage_video_only_stream (void)
+GST_START_TEST (test_sink_usage_video_only_stream)
 {
   GstElement *playbin, *fakevideosink, *fakeaudiosink;
   GstState cur_state, pending_state;
+  GstElement *source;
+  GstBuffer *last_frame;
+  gint nstreams;
 
   fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
           gst_red_video_src_get_type ()));
@@ -83,24 +72,31 @@ test_sink_usage_video_only_stream (void)
   fail_unless_equals_int (cur_state, GST_STATE_NULL);
   fail_unless_equals_int (pending_state, GST_STATE_VOID_PENDING);
 
-  {
-    GValueArray *stream_info = NULL;
+  g_object_get (playbin, "n-video", &nstreams, NULL);
+  fail_unless_equals_int (nstreams, 1);
 
-    g_object_get (playbin, "stream-info-value-array", &stream_info, NULL);
-    fail_unless (stream_info != NULL);
-    fail_unless_equals_int (stream_info->n_values, 1);
-    g_value_array_free (stream_info);
-  }
+  g_object_get (playbin, "n-audio", &nstreams, NULL);
+  fail_unless_equals_int (nstreams, 0);
+
+  g_object_get (playbin, "n-text", &nstreams, NULL);
+  fail_unless_equals_int (nstreams, 0);
+
+  g_object_get (playbin, "source", &source, NULL);
+  fail_unless (G_TYPE_FROM_INSTANCE (source) == gst_red_video_src_get_type ());
+  gst_object_unref (source);
+
+  g_object_get (playbin, "frame", &last_frame, NULL);
+  fail_unless (GST_IS_BUFFER (last_frame));
+  gst_buffer_unref (last_frame);
 
   gst_element_set_state (playbin, GST_STATE_NULL);
   gst_object_unref (playbin);
 }
 
-/* this tests async error handling when setting up the subbin */
-DEFINE_TEST (test_suburi_error_unknowntype);
+GST_END_TEST;
 
-static void
-test_suburi_error_unknowntype (void)
+/* this tests async error handling when setting up the subbin */
+GST_START_TEST (test_suburi_error_unknowntype)
 {
   GstElement *playbin, *fakesink;
 
@@ -132,10 +128,9 @@ test_suburi_error_unknowntype (void)
   gst_object_unref (playbin);
 }
 
-DEFINE_TEST (test_suburi_error_invalidfile);
+GST_END_TEST;
 
-static void
-test_suburi_error_invalidfile (void)
+GST_START_TEST (test_suburi_error_invalidfile)
 {
   GstElement *playbin, *fakesink;
 
@@ -166,10 +161,9 @@ test_suburi_error_invalidfile (void)
   gst_object_unref (playbin);
 }
 
-DEFINE_TEST (test_suburi_error_wrongproto);
+GST_END_TEST;
 
-static void
-test_suburi_error_wrongproto (void)
+GST_START_TEST (test_suburi_error_wrongproto)
 {
   GstElement *playbin, *fakesink;
 
@@ -200,6 +194,8 @@ test_suburi_error_wrongproto (void)
   gst_object_unref (playbin);
 }
 
+GST_END_TEST;
+
 static GstElement *
 create_playbin (const gchar * uri)
 {
@@ -226,10 +222,7 @@ create_playbin (const gchar * uri)
   return playbin;
 }
 
-DEFINE_TEST (test_missing_urisource_handler);
-
-static void
-test_missing_urisource_handler (void)
+GST_START_TEST (test_missing_urisource_handler)
 {
   GstStructure *s;
   GstMessage *msg;
@@ -250,8 +243,8 @@ test_missing_urisource_handler (void)
 
   msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  s = (GstStructure *) gst_message_get_structure (msg);
+  fail_unless (s != NULL);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "detail"),
@@ -278,10 +271,9 @@ test_missing_urisource_handler (void)
   gst_object_unref (playbin);
 }
 
-DEFINE_TEST (test_missing_suburisource_handler);
+GST_END_TEST;
 
-static void
-test_missing_suburisource_handler (void)
+GST_START_TEST (test_missing_suburisource_handler)
 {
   GstStructure *s;
   GstMessage *msg;
@@ -304,8 +296,8 @@ test_missing_suburisource_handler (void)
 
   msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  s = (GstStructure *) gst_message_get_structure (msg);
+  fail_unless (s != NULL);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "detail"), "cookie");
@@ -313,11 +305,11 @@ test_missing_suburisource_handler (void)
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
   gst_message_unref (msg);
 
-  msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
+  msg = gst_bus_poll (bus, GST_MESSAGE_WARNING, -1);
+  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_WARNING);
 
-  /* make sure the error is a CORE MISSING_PLUGIN one */
-  gst_message_parse_error (msg, &err, NULL);
+  /* make sure the *warning* is a CORE MISSING_PLUGIN one */
+  gst_message_parse_warning (msg, &err, NULL);
   fail_unless (err != NULL);
   fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
       "%s instead of core-error-quark", g_quark_to_string (err->domain));
@@ -325,24 +317,37 @@ test_missing_suburisource_handler (void)
       "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
   g_error_free (err);
   gst_message_unref (msg);
+
+  msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
+  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
+
+  /* make sure the error is a RESOURCE NOT_FOUND one */
+  gst_message_parse_error (msg, &err, NULL);
+  fail_unless (err != NULL);
+  fail_unless (err->domain == GST_RESOURCE_ERROR,
+      "error has wrong error domain " "%s instead of resource-error-quark",
+      g_quark_to_string (err->domain));
+  fail_unless (err->code == GST_RESOURCE_ERROR_NOT_FOUND,
+      "error has wrong " "code %u instead of GST_RESOURCE_ERROR_NOT_FOUND",
+      err->code);
+  g_error_free (err);
+  gst_message_unref (msg);
+
   gst_object_unref (bus);
 
   gst_element_set_state (playbin, GST_STATE_NULL);
   gst_object_unref (playbin);
 }
 
-DEFINE_TEST (test_missing_primary_decoder);
+GST_END_TEST;
 
-static void
-test_missing_primary_decoder (void)
+GST_START_TEST (test_missing_primary_decoder)
 {
   GstStructure *s;
   GstMessage *msg;
   GstElement *playbin;
   GError *err = NULL;
   GstBus *bus;
-  gchar *use_decodebin2 = getenv ("USE_DECODEBIN2");
-  gboolean decodebin2 = use_decodebin2 != NULL && *use_decodebin2 == '1';
 
   fail_unless (gst_element_register (NULL, "codecsrc", GST_RANK_PRIMARY,
           gst_codec_src_get_type ()));
@@ -360,41 +365,148 @@ test_missing_primary_decoder (void)
 
   msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  s = (GstStructure *) gst_message_get_structure (msg);
+  fail_unless (s != NULL);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
   fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
   gst_message_unref (msg);
 
+  msg = gst_bus_poll (bus, GST_MESSAGE_WARNING, -1);
+  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_WARNING);
+
+  /* make sure the *warning* is a STREAM CODEC_NOT_FOUND one */
+  gst_message_parse_warning (msg, &err, NULL);
+  fail_unless (err != NULL);
+  fail_unless (err->domain == GST_STREAM_ERROR, "error has wrong error domain "
+      "%s instead of stream-error-quark", g_quark_to_string (err->domain));
+  fail_unless (err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND, "error has wrong "
+      "code %u instead of GST_STREAM_ERROR_CODEC_NOT_FOUND", err->code);
+  g_error_free (err);
+  gst_message_unref (msg);
+
   msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
 
-  /* make sure the error is a STREAM CODEC_NOT_FOUND one */
+  /* make sure the error is a CORE MISSING_PLUGIN one */
   gst_message_parse_error (msg, &err, NULL);
   fail_unless (err != NULL);
-  if (decodebin2) {
-    fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
-        "%s instead of core-error-quark", g_quark_to_string (err->domain));
-    fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
-        "code %u instead of GST_RESOURCE_ERROR_MISSING_PLUGIN", err->code);
-  } else {
-    fail_unless (err->domain == GST_STREAM_ERROR,
-        "error has wrong error domain " "%s instead of stream-error-quark",
-        g_quark_to_string (err->domain));
-    fail_unless (err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND,
-        "error has wrong "
-        "code %u instead of GST_STREAM_ERROR_CODEC_NOT_FOUND", err->code);
-  }
+  fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
+      "%s instead of core-error-quark", g_quark_to_string (err->domain));
+  fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
+      "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
   g_error_free (err);
   gst_message_unref (msg);
+
   gst_object_unref (bus);
 
   gst_element_set_state (playbin, GST_STATE_NULL);
   gst_object_unref (playbin);
 }
 
+GST_END_TEST;
+
+GST_START_TEST (test_refcount)
+{
+  GstElement *playbin, *audiosink, *videosink, *vis;
+
+  fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
+          gst_red_video_src_get_type ()));
+
+  playbin = gst_element_factory_make ("playbin", NULL);
+  audiosink = gst_element_factory_make ("fakesink", "myaudiosink");
+  videosink = gst_element_factory_make ("fakesink", "myvideosink");
+  vis = gst_element_factory_make ("identity", "myvis");
+
+  /* ref because we need them after we unref playbin */
+  gst_object_ref (audiosink);
+  gst_object_ref (videosink);
+  gst_object_ref (vis);
+
+  /* Sinks have floating ref only, setting the properties takes ownership. */
+  g_object_set (playbin,
+      "audio-sink", audiosink,
+      "video-sink", videosink,
+      "vis-plugin", vis, "flags", 0x01 | 0x02 | 0x08, NULL);
+
+  g_object_set (playbin, "uri", "redvideo://", NULL);
+  //"uri", "file:///home/wim/data/cdda.ogg", NULL);
+
+  ASSERT_OBJECT_REFCOUNT (playbin, "playbin", 1);
+
+  /* we have two refs now, one from ourselves and one from playbin */
+  ASSERT_OBJECT_REFCOUNT (audiosink, "myaudiosink", 2);
+  ASSERT_OBJECT_REFCOUNT (videosink, "myvideosink", 2);
+  ASSERT_OBJECT_REFCOUNT (vis, "myvis", 2);
+
+  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
+      GST_STATE_CHANGE_ASYNC);
+  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
+          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
+  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
+      GST_STATE_CHANGE_SUCCESS);
+
+  ASSERT_OBJECT_REFCOUNT (playbin, "playbin", 1);
+  /* refcount of our elements is undefined, playbin might keep additional refs
+   * because it cached the elements in bins */
+  gst_object_unref (playbin);
+
+  /* now we are back to our refs */
+  ASSERT_OBJECT_REFCOUNT (audiosink, "myaudiosink", 1);
+  ASSERT_OBJECT_REFCOUNT (videosink, "myvideosink", 1);
+  ASSERT_OBJECT_REFCOUNT (vis, "myvis", 1);
+
+  gst_object_unref (audiosink);
+  gst_object_unref (videosink);
+  gst_object_unref (vis);
+}
+
+GST_END_TEST;
+
+static void
+source_setup (GstElement * playbin, GstElement * source, GstElement ** p_src)
+{
+  GST_LOG ("source-setup called, source = %s", G_OBJECT_TYPE_NAME (source));
+  *p_src = gst_object_ref (source);
+  GST_LOG ("here");
+}
+
+GST_START_TEST (test_source_setup)
+{
+  GstElement *playbin, *videosink;
+  GstElement *src = NULL;
+
+  if (!gst_default_registry_check_feature_version ("redvideosrc", 0, 10, 0)) {
+    fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
+            gst_red_video_src_get_type ()));
+  }
+
+  playbin = gst_element_factory_make ("playbin", NULL);
+  g_object_set (playbin, "uri", "redvideo://", NULL);
+
+  videosink = gst_element_factory_make ("fakesink", "myvideosink");
+  g_object_set (playbin, "video-sink", videosink, NULL);
+
+  g_signal_connect (playbin, "source-setup", G_CALLBACK (source_setup), &src);
+
+  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
+      GST_STATE_CHANGE_ASYNC);
+  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
+          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
+
+  fail_unless (src != NULL);
+  fail_unless (G_OBJECT_TYPE (src) == gst_red_video_src_get_type ());
+
+  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
+      GST_STATE_CHANGE_SUCCESS);
+
+  gst_object_unref (playbin);
+  gst_object_unref (src);
+}
+
+GST_END_TEST;
+
 /*** redvideo:// source ***/
 
 static GstURIType
@@ -447,60 +559,60 @@ gst_red_video_src_init_type (GType type)
 typedef GstPushSrc GstRedVideoSrc;
 typedef GstPushSrcClass GstRedVideoSrcClass;
 
-GST_BOILERPLATE_FULL (GstRedVideoSrc, gst_red_video_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_red_video_src_init_type);
-
-static void
-gst_red_video_src_base_init (gpointer klass)
-{
-  static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
-      GST_PAD_SRC, GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
-      );
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-  gst_element_class_set_details_simple (element_class,
-      "Red Video Src", "Source/Video", "yep", "me");
-}
+G_DEFINE_TYPE_WITH_CODE (GstRedVideoSrc, gst_red_video_src,
+    GST_TYPE_PUSH_SRC, gst_red_video_src_init_type (g_define_type_id));
 
 static GstFlowReturn
 gst_red_video_src_create (GstPushSrc * src, GstBuffer ** p_buf)
 {
   GstBuffer *buf;
-  GstCaps *caps;
   guint8 *data;
   guint w = 64, h = 64;
   guint size;
 
   size = w * h * 3 / 2;
   buf = gst_buffer_new_and_alloc (size);
-  data = GST_BUFFER_DATA (buf);
+  data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
   memset (data, 76, w * h);
   memset (data + (w * h), 85, (w * h) / 4);
   memset (data + (w * h) + ((w * h) / 4), 255, (w * h) / 4);
-
-  caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
-      GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
-      G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
-  gst_buffer_set_caps (buf, caps);
-  gst_caps_unref (caps);
+  gst_buffer_unmap (buf, data, size);
 
   *p_buf = buf;
   return GST_FLOW_OK;
 }
 
+static GstCaps *
+gst_red_video_src_get_caps (GstBaseSrc * src, GstCaps * filter)
+{
+  guint w = 64, h = 64;
+  return gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
+      GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
+      G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
+}
+
 static void
 gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
 {
   GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
+  GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
+  static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
+      GST_PAD_SRC, GST_PAD_ALWAYS,
+      GST_STATIC_CAPS ("video/x-raw, format=(string)I420")
+      );
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_templ));
+  gst_element_class_set_details_simple (element_class,
+      "Red Video Src", "Source/Video", "yep", "me");
 
   pushsrc_class->create = gst_red_video_src_create;
+  basesrc_class->get_caps = gst_red_video_src_get_caps;
 }
 
 static void
-gst_red_video_src_init (GstRedVideoSrc * src, GstRedVideoSrcClass * klass)
+gst_red_video_src_init (GstRedVideoSrc * src)
 {
 }
 
@@ -559,51 +671,52 @@ gst_codec_src_init_type (GType type)
 typedef GstPushSrc GstCodecSrc;
 typedef GstPushSrcClass GstCodecSrcClass;
 
-GST_BOILERPLATE_FULL (GstCodecSrc, gst_codec_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_codec_src_init_type);
-
-static void
-gst_codec_src_base_init (gpointer klass)
-{
-  static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
-      GST_PAD_SRC, GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("application/x-codec")
-      );
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-  gst_element_class_set_details_simple (element_class,
-      "Codec Src", "Source/Video", "yep", "me");
-}
+G_DEFINE_TYPE_WITH_CODE (GstCodecSrc, gst_codec_src,
+    GST_TYPE_PUSH_SRC, gst_codec_src_init_type (g_define_type_id));
 
 static GstFlowReturn
 gst_codec_src_create (GstPushSrc * src, GstBuffer ** p_buf)
 {
   GstBuffer *buf;
-  GstCaps *caps;
+  guint8 *data;
 
   buf = gst_buffer_new_and_alloc (20);
-  memset (GST_BUFFER_DATA (buf), 0, GST_BUFFER_SIZE (buf));
-
-  caps = gst_caps_new_simple ("application/x-codec", NULL);
-  gst_buffer_set_caps (buf, caps);
-  gst_caps_unref (caps);
+  data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
+  memset (data, 0, 20);
+  gst_buffer_unmap (buf, data, 20);
 
   *p_buf = buf;
   return GST_FLOW_OK;
 }
 
+static GstCaps *
+gst_codec_src_get_caps (GstBaseSrc * src, GstCaps * filter)
+{
+  return gst_caps_new_simple ("application/x-codec", NULL);
+}
+
 static void
 gst_codec_src_class_init (GstCodecSrcClass * klass)
 {
   GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
+  GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
+  static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
+      GST_PAD_SRC, GST_PAD_ALWAYS,
+      GST_STATIC_CAPS ("application/x-codec")
+      );
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_templ));
+  gst_element_class_set_details_simple (element_class,
+      "Codec Src", "Source/Video", "yep", "me");
 
   pushsrc_class->create = gst_codec_src_create;
+  basesrc_class->get_caps = gst_codec_src_get_caps;
 }
 
 static void
-gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
+gst_codec_src_init (GstCodecSrc * src)
 {
 }
 
@@ -619,23 +732,15 @@ playbin_suite (void)
   suite_add_tcase (s, tc_chain);
 
 #ifndef GST_DISABLE_REGISTRY
-  /* with the old decodebin */
-  tcase_add_test (tc_chain, test_sink_usage_video_only_stream_decodebin1);
-  tcase_add_test (tc_chain, test_suburi_error_wrongproto_decodebin1);
-  tcase_add_test (tc_chain, test_suburi_error_invalidfile_decodebin1);
-  tcase_add_test (tc_chain, test_suburi_error_unknowntype_decodebin1);
-  tcase_add_test (tc_chain, test_missing_urisource_handler_decodebin1);
-  tcase_add_test (tc_chain, test_missing_suburisource_handler_decodebin1);
-  tcase_add_test (tc_chain, test_missing_primary_decoder_decodebin1);
-
-  /* and again with decodebin2 */
-  tcase_add_test (tc_chain, test_missing_primary_decoder_decodebin2);
-  tcase_add_test (tc_chain, test_sink_usage_video_only_stream_decodebin2);
-  tcase_add_test (tc_chain, test_suburi_error_wrongproto_decodebin2);
-  tcase_add_test (tc_chain, test_suburi_error_invalidfile_decodebin2);
-  tcase_add_test (tc_chain, test_suburi_error_unknowntype_decodebin2);
-  tcase_add_test (tc_chain, test_missing_urisource_handler_decodebin2);
-  tcase_add_test (tc_chain, test_missing_suburisource_handler_decodebin2);
+  tcase_add_test (tc_chain, test_sink_usage_video_only_stream);
+  tcase_add_test (tc_chain, test_suburi_error_wrongproto);
+  tcase_add_test (tc_chain, test_suburi_error_invalidfile);
+  tcase_add_test (tc_chain, test_suburi_error_unknowntype);
+  tcase_add_test (tc_chain, test_missing_urisource_handler);
+  tcase_add_test (tc_chain, test_missing_suburisource_handler);
+  tcase_add_test (tc_chain, test_missing_primary_decoder);
+  tcase_add_test (tc_chain, test_refcount);
+  tcase_add_test (tc_chain, test_source_setup);
 
   /* one day we might also want to have the following checks:
    * tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal);
diff --git a/tests/check/elements/playbin2.c b/tests/check/elements/playbin2.c
deleted file mode 100644 (file)
index aef9272..0000000
+++ /dev/null
@@ -1,754 +0,0 @@
-/* GStreamer unit tests for playbin2
- *
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gstpushsrc.h>
-#include <unistd.h>
-
-#ifndef GST_DISABLE_REGISTRY
-
-static GType gst_red_video_src_get_type (void);
-static GType gst_codec_src_get_type (void);
-
-/* make sure the audio sink is not touched for video-only streams */
-GST_START_TEST (test_sink_usage_video_only_stream)
-{
-  GstElement *playbin, *fakevideosink, *fakeaudiosink;
-  GstState cur_state, pending_state;
-  GstElement *source;
-  GstBuffer *last_frame;
-  gint nstreams;
-
-  fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
-          gst_red_video_src_get_type ()));
-
-  playbin = gst_element_factory_make ("playbin2", "playbin2");
-  fail_unless (playbin != NULL, "Failed to create playbin element");
-
-  fakevideosink = gst_element_factory_make ("fakesink", "fakevideosink");
-  fail_unless (fakevideosink != NULL, "Failed to create fakevideosink element");
-
-  fakeaudiosink = gst_element_factory_make ("fakesink", "fakeaudiosink");
-  fail_unless (fakeaudiosink != NULL, "Failed to create fakeaudiosink element");
-
-  /* video-only stream, audiosink will error out in null => ready if used */
-  g_object_set (fakeaudiosink, "state-error", 1, NULL);
-
-  g_object_set (playbin, "video-sink", fakevideosink, NULL);
-  g_object_set (playbin, "audio-sink", fakeaudiosink, NULL);
-
-  g_object_set (playbin, "uri", "redvideo://", NULL);
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
-
-  fail_unless_equals_int (gst_element_get_state (fakeaudiosink, &cur_state,
-          &pending_state, 0), GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (cur_state, GST_STATE_NULL);
-  fail_unless_equals_int (pending_state, GST_STATE_VOID_PENDING);
-
-  g_object_get (playbin, "n-video", &nstreams, NULL);
-  fail_unless_equals_int (nstreams, 1);
-
-  g_object_get (playbin, "n-audio", &nstreams, NULL);
-  fail_unless_equals_int (nstreams, 0);
-
-  g_object_get (playbin, "n-text", &nstreams, NULL);
-  fail_unless_equals_int (nstreams, 0);
-
-  g_object_get (playbin, "source", &source, NULL);
-  fail_unless (G_TYPE_FROM_INSTANCE (source) == gst_red_video_src_get_type ());
-  gst_object_unref (source);
-
-  g_object_get (playbin, "frame", &last_frame, NULL);
-  fail_unless (GST_IS_BUFFER (last_frame));
-  gst_buffer_unref (last_frame);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-/* this tests async error handling when setting up the subbin */
-GST_START_TEST (test_suburi_error_unknowntype)
-{
-  GstElement *playbin, *fakesink;
-
-  fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
-          gst_red_video_src_get_type ()));
-
-  playbin = gst_element_factory_make ("playbin2", "playbin2");
-  fail_unless (playbin != NULL, "Failed to create playbin element");
-
-  fakesink = gst_element_factory_make ("fakesink", "fakesink");
-  fail_unless (fakesink != NULL, "Failed to create fakesink element");
-  ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
-  g_object_set (playbin, "video-sink", fakesink, NULL);
-
-  /* suburi file format unknown: playbin should just ignore the suburi and
-   * preroll normally (if /dev/zero does not exist, this test should behave
-   * the same as test_suburi_error_invalidfile() */
-  g_object_set (playbin, "uri", "redvideo://", NULL);
-  g_object_set (playbin, "suburi", "file:///dev/zero", NULL);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_suburi_error_invalidfile)
-{
-  GstElement *playbin, *fakesink;
-
-  fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
-          gst_red_video_src_get_type ()));
-
-  playbin = gst_element_factory_make ("playbin2", "playbin2");
-  fail_unless (playbin != NULL, "Failed to create playbin element");
-
-  fakesink = gst_element_factory_make ("fakesink", "fakesink");
-  fail_unless (fakesink != NULL, "Failed to create fakesink element");
-  ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
-  g_object_set (playbin, "video-sink", fakesink, NULL);
-
-  /* suburi file does not exist: playbin should just ignore the suburi and
-   * preroll normally */
-  g_object_set (playbin, "uri", "redvideo://", NULL);
-  g_object_set (playbin, "suburi", "file:///foo/bar/803129999/32x9ax1", NULL);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_suburi_error_wrongproto)
-{
-  GstElement *playbin, *fakesink;
-
-  fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
-          gst_red_video_src_get_type ()));
-
-  playbin = gst_element_factory_make ("playbin2", "playbin2");
-  fail_unless (playbin != NULL, "Failed to create playbin element");
-
-  fakesink = gst_element_factory_make ("fakesink", "fakesink");
-  fail_unless (fakesink != NULL, "Failed to create fakesink element");
-  ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
-  g_object_set (playbin, "video-sink", fakesink, NULL);
-
-  /* wrong protocol for suburi: playbin should just ignore the suburi and
-   * preroll normally */
-  g_object_set (playbin, "uri", "redvideo://", NULL);
-  g_object_set (playbin, "suburi", "nosuchproto://foo.bar:80", NULL);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-static GstElement *
-create_playbin (const gchar * uri)
-{
-  GstElement *playbin, *fakesink1, *fakesink2;
-
-  playbin = gst_element_factory_make ("playbin2", "playbin2");
-  fail_unless (playbin != NULL, "Failed to create playbin element");
-
-  fakesink1 = gst_element_factory_make ("fakesink", NULL);
-  fail_unless (fakesink1 != NULL, "Failed to create fakesink element #1");
-
-  fakesink2 = gst_element_factory_make ("fakesink", NULL);
-  fail_unless (fakesink2 != NULL, "Failed to create fakesink element #2");
-
-  /* make them behave like normal sinks, even if not needed for the test */
-  g_object_set (fakesink1, "sync", TRUE, NULL);
-  g_object_set (fakesink2, "sync", TRUE, NULL);
-
-  g_object_set (playbin, "video-sink", fakesink1, NULL);
-  g_object_set (playbin, "audio-sink", fakesink2, NULL);
-
-  g_object_set (playbin, "uri", uri, NULL);
-
-  return playbin;
-}
-
-GST_START_TEST (test_missing_urisource_handler)
-{
-  GstStructure *s;
-  GstMessage *msg;
-  GstElement *playbin;
-  GError *err = NULL;
-  GstBus *bus;
-
-  playbin = create_playbin ("chocchipcookie://withahint.of/cinnamon");
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_FAILURE);
-
-  /* there should be at least a missing-plugin message on the bus now and an
-   * error message; the missing-plugin message should be first */
-  bus = gst_element_get_bus (playbin);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
-  fail_unless (gst_structure_has_name (s, "missing-plugin"));
-  fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
-  fail_unless_equals_string (gst_structure_get_string (s, "detail"),
-      "chocchipcookie");
-  fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
-  fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
-  gst_message_unref (msg);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
-  /* make sure the error is a CORE MISSING_PLUGIN one */
-  gst_message_parse_error (msg, &err, NULL);
-  fail_unless (err != NULL);
-  fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
-      "%s instead of core-error-quark", g_quark_to_string (err->domain));
-  fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
-      "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
-  g_error_free (err);
-  gst_message_unref (msg);
-  gst_object_unref (bus);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_missing_suburisource_handler)
-{
-  GstStructure *s;
-  GstMessage *msg;
-  GstElement *playbin;
-  GError *err = NULL;
-  GstBus *bus;
-
-  playbin = create_playbin ("file:///does/not/exis.t");
-
-  g_object_set (playbin, "suburi", "cookie://withahint.of/cinnamon", NULL);
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_FAILURE);
-
-  /* there should be at least a missing-plugin message on the bus now and an
-   * error message; the missing-plugin message should be first */
-  bus = gst_element_get_bus (playbin);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
-  fail_unless (gst_structure_has_name (s, "missing-plugin"));
-  fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
-  fail_unless_equals_string (gst_structure_get_string (s, "detail"), "cookie");
-  fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
-  fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
-  gst_message_unref (msg);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_WARNING, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_WARNING);
-
-  /* make sure the *warning* is a CORE MISSING_PLUGIN one */
-  gst_message_parse_warning (msg, &err, NULL);
-  fail_unless (err != NULL);
-  fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
-      "%s instead of core-error-quark", g_quark_to_string (err->domain));
-  fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
-      "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
-  g_error_free (err);
-  gst_message_unref (msg);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
-  /* make sure the error is a RESOURCE NOT_FOUND one */
-  gst_message_parse_error (msg, &err, NULL);
-  fail_unless (err != NULL);
-  fail_unless (err->domain == GST_RESOURCE_ERROR,
-      "error has wrong error domain " "%s instead of resource-error-quark",
-      g_quark_to_string (err->domain));
-  fail_unless (err->code == GST_RESOURCE_ERROR_NOT_FOUND,
-      "error has wrong " "code %u instead of GST_RESOURCE_ERROR_NOT_FOUND",
-      err->code);
-  g_error_free (err);
-  gst_message_unref (msg);
-
-  gst_object_unref (bus);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_missing_primary_decoder)
-{
-  GstStructure *s;
-  GstMessage *msg;
-  GstElement *playbin;
-  GError *err = NULL;
-  GstBus *bus;
-
-  fail_unless (gst_element_register (NULL, "codecsrc", GST_RANK_PRIMARY,
-          gst_codec_src_get_type ()));
-
-  playbin = create_playbin ("codec://");
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
-      GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-
-  /* there should soon be at least a missing-plugin message on the bus and an
-   * error message; the missing-plugin message should be first */
-  bus = gst_element_get_bus (playbin);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
-  fail_unless (gst_structure_has_name (s, "missing-plugin"));
-  fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
-  fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
-  fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
-  gst_message_unref (msg);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_WARNING, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_WARNING);
-
-  /* make sure the *warning* is a STREAM CODEC_NOT_FOUND one */
-  gst_message_parse_warning (msg, &err, NULL);
-  fail_unless (err != NULL);
-  fail_unless (err->domain == GST_STREAM_ERROR, "error has wrong error domain "
-      "%s instead of stream-error-quark", g_quark_to_string (err->domain));
-  fail_unless (err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND, "error has wrong "
-      "code %u instead of GST_STREAM_ERROR_CODEC_NOT_FOUND", err->code);
-  g_error_free (err);
-  gst_message_unref (msg);
-
-  msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
-  /* make sure the error is a CORE MISSING_PLUGIN one */
-  gst_message_parse_error (msg, &err, NULL);
-  fail_unless (err != NULL);
-  fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
-      "%s instead of core-error-quark", g_quark_to_string (err->domain));
-  fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
-      "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
-  g_error_free (err);
-  gst_message_unref (msg);
-
-  gst_object_unref (bus);
-
-  gst_element_set_state (playbin, GST_STATE_NULL);
-  gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_refcount)
-{
-  GstElement *playbin, *audiosink, *videosink, *vis;
-
-  fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
-          gst_red_video_src_get_type ()));
-
-  playbin = gst_element_factory_make ("playbin2", NULL);
-  audiosink = gst_element_factory_make ("fakesink", "myaudiosink");
-  videosink = gst_element_factory_make ("fakesink", "myvideosink");
-  vis = gst_element_factory_make ("identity", "myvis");
-
-  /* ref because we need them after we unref playbin2 */
-  gst_object_ref (audiosink);
-  gst_object_ref (videosink);
-  gst_object_ref (vis);
-
-  /* Sinks have floating ref only, setting the properties takes ownership. */
-  g_object_set (playbin,
-      "audio-sink", audiosink,
-      "video-sink", videosink,
-      "vis-plugin", vis, "flags", 0x01 | 0x02 | 0x08, NULL);
-
-  g_object_set (playbin, "uri", "redvideo://", NULL);
-  //"uri", "file:///home/wim/data/cdda.ogg", NULL);
-
-  ASSERT_OBJECT_REFCOUNT (playbin, "playbin", 1);
-
-  /* we have two refs now, one from ourselves and one from playbin2 */
-  ASSERT_OBJECT_REFCOUNT (audiosink, "myaudiosink", 2);
-  ASSERT_OBJECT_REFCOUNT (videosink, "myvideosink", 2);
-  ASSERT_OBJECT_REFCOUNT (vis, "myvis", 2);
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
-          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
-      GST_STATE_CHANGE_SUCCESS);
-
-  ASSERT_OBJECT_REFCOUNT (playbin, "playbin", 1);
-  /* refcount of our elements is undefined, playbin2 might keep additional refs
-   * because it cached the elements in bins */
-  gst_object_unref (playbin);
-
-  /* now we are back to our refs */
-  ASSERT_OBJECT_REFCOUNT (audiosink, "myaudiosink", 1);
-  ASSERT_OBJECT_REFCOUNT (videosink, "myvideosink", 1);
-  ASSERT_OBJECT_REFCOUNT (vis, "myvis", 1);
-
-  gst_object_unref (audiosink);
-  gst_object_unref (videosink);
-  gst_object_unref (vis);
-}
-
-GST_END_TEST;
-
-static void
-source_setup (GstElement * playbin, GstElement * source, GstElement ** p_src)
-{
-  GST_LOG ("source-setup called, source = %s", G_OBJECT_TYPE_NAME (source));
-  *p_src = gst_object_ref (source);
-  GST_LOG ("here");
-}
-
-GST_START_TEST (test_source_setup)
-{
-  GstElement *playbin, *videosink;
-  GstElement *src = NULL;
-
-  if (!gst_default_registry_check_feature_version ("redvideosrc", 0, 10, 0)) {
-    fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
-            gst_red_video_src_get_type ()));
-  }
-
-  playbin = gst_element_factory_make ("playbin2", NULL);
-  g_object_set (playbin, "uri", "redvideo://", NULL);
-
-  videosink = gst_element_factory_make ("fakesink", "myvideosink");
-  g_object_set (playbin, "video-sink", videosink, NULL);
-
-  g_signal_connect (playbin, "source-setup", G_CALLBACK (source_setup), &src);
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
-      GST_STATE_CHANGE_ASYNC);
-  fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
-          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
-
-  fail_unless (src != NULL);
-  fail_unless (G_OBJECT_TYPE (src) == gst_red_video_src_get_type ());
-
-  fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
-      GST_STATE_CHANGE_SUCCESS);
-
-  gst_object_unref (playbin);
-  gst_object_unref (src);
-}
-
-GST_END_TEST;
-
-/*** redvideo:// source ***/
-
-static GstURIType
-gst_red_video_src_uri_get_type (void)
-{
-  return GST_URI_SRC;
-}
-
-static gchar **
-gst_red_video_src_uri_get_protocols (void)
-{
-  static gchar *protocols[] = { (char *) "redvideo", NULL };
-
-  return protocols;
-}
-
-static const gchar *
-gst_red_video_src_uri_get_uri (GstURIHandler * handler)
-{
-  return "redvideo://";
-}
-
-static gboolean
-gst_red_video_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
-  return (uri != NULL && g_str_has_prefix (uri, "redvideo:"));
-}
-
-static void
-gst_red_video_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
-  GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
-  iface->get_type = gst_red_video_src_uri_get_type;
-  iface->get_protocols = gst_red_video_src_uri_get_protocols;
-  iface->get_uri = gst_red_video_src_uri_get_uri;
-  iface->set_uri = gst_red_video_src_uri_set_uri;
-}
-
-static void
-gst_red_video_src_init_type (GType type)
-{
-  static const GInterfaceInfo uri_hdlr_info = {
-    gst_red_video_src_uri_handler_init, NULL, NULL
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-typedef GstPushSrc GstRedVideoSrc;
-typedef GstPushSrcClass GstRedVideoSrcClass;
-
-GST_BOILERPLATE_FULL (GstRedVideoSrc, gst_red_video_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_red_video_src_init_type);
-
-static void
-gst_red_video_src_base_init (gpointer klass)
-{
-  static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
-      GST_PAD_SRC, GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
-      );
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-  gst_element_class_set_details_simple (element_class,
-      "Red Video Src", "Source/Video", "yep", "me");
-}
-
-static GstFlowReturn
-gst_red_video_src_create (GstPushSrc * src, GstBuffer ** p_buf)
-{
-  GstBuffer *buf;
-  GstCaps *caps;
-  guint8 *data;
-  guint w = 64, h = 64;
-  guint size;
-
-  size = w * h * 3 / 2;
-  buf = gst_buffer_new_and_alloc (size);
-  data = GST_BUFFER_DATA (buf);
-  memset (data, 76, w * h);
-  memset (data + (w * h), 85, (w * h) / 4);
-  memset (data + (w * h) + ((w * h) / 4), 255, (w * h) / 4);
-
-  caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
-      GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
-      G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
-  gst_buffer_set_caps (buf, caps);
-  gst_caps_unref (caps);
-
-  *p_buf = buf;
-  return GST_FLOW_OK;
-}
-
-static void
-gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
-{
-  GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
-  pushsrc_class->create = gst_red_video_src_create;
-}
-
-static void
-gst_red_video_src_init (GstRedVideoSrc * src, GstRedVideoSrcClass * klass)
-{
-}
-
-/*** codec:// source ***/
-
-static GstURIType
-gst_codec_src_uri_get_type (void)
-{
-  return GST_URI_SRC;
-}
-
-static gchar **
-gst_codec_src_uri_get_protocols (void)
-{
-  static gchar *protocols[] = { (char *) "codec", NULL };
-
-  return protocols;
-}
-
-static const gchar *
-gst_codec_src_uri_get_uri (GstURIHandler * handler)
-{
-  return "codec://";
-}
-
-static gboolean
-gst_codec_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
-  return (uri != NULL && g_str_has_prefix (uri, "codec:"));
-}
-
-static void
-gst_codec_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
-  GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
-  iface->get_type = gst_codec_src_uri_get_type;
-  iface->get_protocols = gst_codec_src_uri_get_protocols;
-  iface->get_uri = gst_codec_src_uri_get_uri;
-  iface->set_uri = gst_codec_src_uri_set_uri;
-}
-
-static void
-gst_codec_src_init_type (GType type)
-{
-  static const GInterfaceInfo uri_hdlr_info = {
-    gst_codec_src_uri_handler_init, NULL, NULL
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-#undef parent_class
-#define parent_class codec_src_parent_class
-
-typedef GstPushSrc GstCodecSrc;
-typedef GstPushSrcClass GstCodecSrcClass;
-
-GST_BOILERPLATE_FULL (GstCodecSrc, gst_codec_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_codec_src_init_type);
-
-static void
-gst_codec_src_base_init (gpointer klass)
-{
-  static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
-      GST_PAD_SRC, GST_PAD_ALWAYS,
-      GST_STATIC_CAPS ("application/x-codec")
-      );
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-  gst_element_class_set_details_simple (element_class,
-      "Codec Src", "Source/Video", "yep", "me");
-}
-
-static GstFlowReturn
-gst_codec_src_create (GstPushSrc * src, GstBuffer ** p_buf)
-{
-  GstBuffer *buf;
-  GstCaps *caps;
-
-  buf = gst_buffer_new_and_alloc (20);
-  memset (GST_BUFFER_DATA (buf), 0, GST_BUFFER_SIZE (buf));
-
-  caps = gst_caps_new_simple ("application/x-codec", NULL);
-  gst_buffer_set_caps (buf, caps);
-  gst_caps_unref (caps);
-
-  *p_buf = buf;
-  return GST_FLOW_OK;
-}
-
-static void
-gst_codec_src_class_init (GstCodecSrcClass * klass)
-{
-  GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
-  pushsrc_class->create = gst_codec_src_create;
-}
-
-static void
-gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
-{
-}
-
-#endif /* GST_DISABLE_REGISTRY */
-
-
-static Suite *
-playbin2_suite (void)
-{
-  Suite *s = suite_create ("playbin2");
-  TCase *tc_chain = tcase_create ("general");
-
-  suite_add_tcase (s, tc_chain);
-
-#ifndef GST_DISABLE_REGISTRY
-  tcase_add_test (tc_chain, test_sink_usage_video_only_stream);
-  tcase_add_test (tc_chain, test_suburi_error_wrongproto);
-  tcase_add_test (tc_chain, test_suburi_error_invalidfile);
-  tcase_add_test (tc_chain, test_suburi_error_unknowntype);
-  tcase_add_test (tc_chain, test_missing_urisource_handler);
-  tcase_add_test (tc_chain, test_missing_suburisource_handler);
-  tcase_add_test (tc_chain, test_missing_primary_decoder);
-  tcase_add_test (tc_chain, test_refcount);
-  tcase_add_test (tc_chain, test_source_setup);
-
-  /* one day we might also want to have the following checks:
-   * tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal);
-   * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_fatal);
-   * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_with_preroll);
-   */
-#endif
-
-  return s;
-}
-
-GST_CHECK_MAIN (playbin2);
index 884140b..8f1c4ed 100644 (file)
@@ -43,11 +43,14 @@ static GstBuffer *
 buffer_from_static_string (const gchar * s)
 {
   GstBuffer *buf;
+  gsize len;
+
+  len = strlen (s);
 
   buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) s;
-  GST_BUFFER_SIZE (buf) = strlen (s);
-  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
+  gst_buffer_take_memory (buf,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) s, NULL, len, 0, len));
 
   return buf;
 }
@@ -209,7 +212,7 @@ test_srt_do_test (SubParseInputChunk * input, guint start_idx, guint num)
     const GstStructure *buffer_caps_struct;
     GstBuffer *buf;
     gchar *out;
-    guint out_size;
+    gsize out_size;
 
     buf = g_list_nth_data (buffers, n - start_idx);
     fail_unless (buf != NULL);
@@ -218,16 +221,20 @@ test_srt_do_test (SubParseInputChunk * input, guint start_idx, guint num)
     fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (buf), input[n].from_ts);
     fail_unless_equals_uint64 (GST_BUFFER_DURATION (buf),
         input[n].to_ts - input[n].from_ts);
-    out = (gchar *) GST_BUFFER_DATA (buf);
-    out_size = GST_BUFFER_SIZE (buf);
-    /* shouldn't have trailing newline characters */
-    fail_if (out_size > 0 && out[out_size - 1] == '\n');
-    /* shouldn't include NUL-terminator in data size */
-    fail_if (out_size > 0 && out[out_size - 1] == '\0');
-    /* but should still have a  NUL-terminator behind the declared data */
-    fail_unless_equals_int (out[out_size], '\0');
-    /* make sure out string matches expected string */
-    fail_unless_equals_string (out, input[n].out);
+
+    out = gst_buffer_map (buf, &out_size, NULL, GST_MAP_READ);
+    /* can be NULL */
+    if (out != NULL) {
+      /* shouldn't have trailing newline characters */
+      fail_if (out_size > 0 && out[out_size - 1] == '\n');
+      /* shouldn't include NUL-terminator in data size */
+      fail_if (out_size > 0 && out[out_size - 1] == '\0');
+      /* but should still have a  NUL-terminator behind the declared data */
+      fail_unless_equals_int (out[out_size], '\0');
+      /* make sure out string matches expected string */
+      fail_unless_equals_string (out, input[n].out);
+    }
+    gst_buffer_unmap (buf, out, out_size);
     /* check caps */
     fail_unless (GST_BUFFER_CAPS (buf) != NULL);
     buffer_caps_struct = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
@@ -288,7 +295,7 @@ do_test (SubParseInputChunk * input, guint num, const gchar * media_type)
     const GstStructure *buffer_caps_struct;
     GstBuffer *buf;
     gchar *out;
-    guint out_size;
+    gsize out_size;
 
     buf = g_list_nth_data (buffers, n);
     fail_unless (buf != NULL);
@@ -305,16 +312,19 @@ do_test (SubParseInputChunk * input, guint num, const gchar * media_type)
           input[n].to_ts - input[n].from_ts);
     }
 
-    out = (gchar *) GST_BUFFER_DATA (buf);
-    out_size = GST_BUFFER_SIZE (buf);
-    /* shouldn't have trailing newline characters */
-    fail_if (out_size > 0 && out[out_size - 1] == '\n');
-    /* shouldn't include NUL-terminator in data size */
-    fail_if (out_size > 0 && out[out_size - 1] == '\0');
-    /* but should still have a  NUL-terminator behind the declared data */
-    fail_unless_equals_int (out[out_size], '\0');
-    /* make sure out string matches expected string */
-    fail_unless_equals_string (out, input[n].out);
+    out = gst_buffer_map (buf, &out_size, NULL, GST_MAP_READ);
+    /* can be NULL */
+    if (out != NULL) {
+      /* shouldn't have trailing newline characters */
+      fail_if (out_size > 0 && out[out_size - 1] == '\n');
+      /* shouldn't include NUL-terminator in data size */
+      fail_if (out_size > 0 && out[out_size - 1] == '\0');
+      /* but should still have a  NUL-terminator behind the declared data */
+      fail_unless_equals_int (out[out_size], '\0');
+      /* make sure out string matches expected string */
+      fail_unless_equals_string (out, input[n].out);
+    }
+    gst_buffer_unmap (buf, out, out_size);
     /* check caps */
     fail_unless (GST_BUFFER_CAPS (buf) != NULL);
     buffer_caps_struct = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
index 3c970b2..815c918 100644 (file)
 static GstPad *myvideosrcpad, *mytextsrcpad, *mysinkpad;
 
 #define VIDEO_CAPS_STRING               \
-    "video/x-raw-yuv, "                 \
-    "format = (fourcc) I420, "          \
+    "video/x-raw, "                 \
+    "format = (string) I420, "          \
     "framerate = (fraction) 1/1, "      \
     "width = (int) 240, "               \
     "height = (int) 120"
 
 #define VIDEO_CAPS_TEMPLATE_STRING      \
-    "video/x-raw-yuv, "                 \
-    "format = (fourcc) I420"
+    "video/x-raw, "                 \
+    "format = (string) I420"
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -164,6 +164,8 @@ buffer_is_all_black (GstBuffer * buf)
 {
   GstStructure *s;
   gint x, y, w, h;
+  guint8 *data;
+  gsize size;
 
   fail_unless (buf != NULL);
   fail_unless (GST_BUFFER_CAPS (buf) != NULL);
@@ -172,16 +174,18 @@ buffer_is_all_black (GstBuffer * buf)
   fail_unless (gst_structure_get_int (s, "width", &w));
   fail_unless (gst_structure_get_int (s, "height", &h));
 
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
   for (y = 0; y < h; ++y) {
-    guint8 *data = GST_BUFFER_DATA (buf) + (y * GST_ROUND_UP_4 (w));
+    guint8 *ptr = data + (y * GST_ROUND_UP_4 (w));
 
     for (x = 0; x < w; ++x) {
-      if (data[x] != 0x00) {
+      if (ptr[x] != 0x00) {
         GST_LOG ("non-black pixel at (x,y) %d,%d", x, y);
         return FALSE;
       }
     }
   }
+  gst_buffer_unmap (buf, data, size);
 
   return TRUE;
 }
@@ -193,6 +197,7 @@ create_black_buffer (const gchar * caps_string)
   GstBuffer *buffer;
   GstCaps *caps;
   gint w, h, size;
+  guint8 *data;
 
   fail_unless (caps_string != NULL);
 
@@ -207,9 +212,12 @@ create_black_buffer (const gchar * caps_string)
   GST_LOG ("creating buffer (%dx%d)", w, h);
   size = I420_SIZE (w, h);
   buffer = gst_buffer_new_and_alloc (size);
+
+  data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
   /* we're only checking the Y plane later, so just zero it all out,
    * even if it's not the blackest black there is */
-  memset (GST_BUFFER_DATA (buffer), 0, size);
+  memset (data, 0, size);
+  gst_buffer_unmap (buffer, data, size);
 
   gst_buffer_set_caps (buffer, caps);
   gst_caps_unref (caps);
@@ -232,7 +240,7 @@ create_text_buffer (const gchar * txt, GstClockTime ts, GstClockTime duration)
   txt_len = strlen (txt);
 
   buffer = gst_buffer_new_and_alloc (txt_len);
-  memcpy (GST_BUFFER_DATA (buffer), txt, txt_len);
+  gst_buffer_fill (buffer, 0, txt, txt_len);
 
   GST_BUFFER_TIMESTAMP (buffer) = ts;
   GST_BUFFER_DURATION (buffer) = duration;
@@ -375,8 +383,8 @@ GST_START_TEST (test_video_passthrough)
   /* pushing gives away one of the two references we have ... */
   fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
 
-  /* should be the parent for a new subbuffer for the stamp fix-up */
-  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
+  /* should be a new buffer for the stamp fix-up */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_unless (GST_BUFFER_CAST (buffers->data) != inbuffer);
   fail_unless (GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (buffers->data)) ==
@@ -525,7 +533,7 @@ GST_START_TEST (test_video_waits_for_text)
   fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)));
 
   /* now, another video buffer */
-  inbuffer = gst_buffer_make_metadata_writable (inbuffer);
+  inbuffer = gst_buffer_make_writable (inbuffer);
   GST_BUFFER_TIMESTAMP (inbuffer) = GST_SECOND;
   GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 2;
 
@@ -545,7 +553,7 @@ GST_START_TEST (test_video_waits_for_text)
       FALSE);
 
   /* a third video buffer */
-  inbuffer = gst_buffer_make_metadata_writable (inbuffer);
+  inbuffer = gst_buffer_make_writable (inbuffer);
   GST_BUFFER_TIMESTAMP (inbuffer) = 30 * GST_SECOND;
   GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 2;
 
@@ -573,7 +581,7 @@ GST_START_TEST (test_video_waits_for_text)
               next->data)));
 
   /* a fourth video buffer */
-  inbuffer = gst_buffer_make_metadata_writable (inbuffer);
+  inbuffer = gst_buffer_make_writable (inbuffer);
   GST_BUFFER_TIMESTAMP (inbuffer) = 35 * GST_SECOND;
   GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
 
index 69eb3c6..47c4d1c 100644 (file)
@@ -31,34 +31,34 @@ static GstPad *mysrcpad, *mysinkpad;
 
 
 #define VIDEO_CAPS_TEMPLATE_STRING     \
-    "video/x-raw-yuv"
+    "video/x-raw"
 
 #define VIDEO_CAPS_STRING               \
-    "video/x-raw-yuv, "                 \
+    "video/x-raw, "                 \
     "width = (int) 320, "               \
     "height = (int) 240, "              \
     "framerate = (fraction) 25/1 , "    \
-    "format = (fourcc) I420"
+    "format = (string) I420"
 
 #define VIDEO_CAPS_NO_FRAMERATE_STRING  \
-    "video/x-raw-yuv, "                 \
+    "video/x-raw, "                 \
     "width = (int) 320, "               \
     "height = (int) 240, "              \
-    "format = (fourcc) I420"
+    "format = (string) I420"
 
 #define VIDEO_CAPS_NEWSIZE_STRING       \
-    "video/x-raw-yuv, "                 \
+    "video/x-raw, "                 \
     "width = (int) 240, "               \
     "height = (int) 120, "              \
     "framerate = (fraction) 25/1 , "   \
-    "format = (fourcc) I420"
+    "format = (string) I420"
 
 #define VIDEO_CAPS_UNUSUAL_FRAMERATE    \
-    "video/x-raw-yuv, "                 \
+    "video/x-raw, "                 \
     "width = (int) 240, "               \
     "height = (int) 120, "              \
     "framerate = (fraction) 999/7 , "  \
-    "format = (fourcc) I420, "          \
+    "format = (string) I420, "          \
     "color-matrix=(string)sdtv"
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
@@ -142,6 +142,26 @@ cleanup_videorate (GstElement * videorate)
   gst_check_teardown_element (videorate);
 }
 
+static void
+buffer_memset (GstBuffer * buffer, gint val, gsize size)
+{
+  guint8 *data;
+
+  data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
+  memset (data, val, size);
+  gst_buffer_unmap (buffer, data, size);
+}
+
+static guint8
+buffer_get_byte (GstBuffer * buffer, gint offset)
+{
+  guint8 res;
+
+  gst_buffer_extract (buffer, offset, &res, 1);
+
+  return res;
+}
+
 GST_START_TEST (test_one)
 {
   GstElement *videorate;
@@ -154,7 +174,7 @@ GST_START_TEST (test_one)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memset (GST_BUFFER_DATA (inbuffer), 0, 4);
+  buffer_memset (inbuffer, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (inbuffer, caps);
   GST_BUFFER_TIMESTAMP (inbuffer) = 0;
@@ -196,7 +216,7 @@ GST_START_TEST (test_more)
      streams */
   GST_BUFFER_OFFSET (first) = g_rand_int (rand);
   GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
-  memset (GST_BUFFER_DATA (first), 1, 4);
+  buffer_memset (first, 1, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (first, caps);
   gst_caps_unref (caps);
@@ -215,7 +235,7 @@ GST_START_TEST (test_more)
   GST_BUFFER_TIMESTAMP (second) = GST_SECOND * 3 / 50;
   GST_BUFFER_OFFSET (first) = g_rand_int (rand);
   GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
-  memset (GST_BUFFER_DATA (second), 2, 4);
+  buffer_memset (second, 2, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (second, caps);
   gst_caps_unref (caps);
@@ -230,7 +250,7 @@ GST_START_TEST (test_more)
   /* ... and the first one is pushed out, with timestamp 0 */
   fail_unless_equals_int (g_list_length (buffers), 1);
   assert_videorate_stats (videorate, "second buffer", 2, 1, 0, 0);
-  ASSERT_BUFFER_REFCOUNT (first, "first", 2);
+  ASSERT_BUFFER_REFCOUNT (first, "first", 1);
 
   outbuffer = buffers->data;
   fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (outbuffer), 0);
@@ -240,7 +260,7 @@ GST_START_TEST (test_more)
   GST_BUFFER_TIMESTAMP (third) = GST_SECOND * 12 / 50;
   GST_BUFFER_OFFSET (first) = g_rand_int (rand);
   GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
-  memset (GST_BUFFER_DATA (third), 3, 4);
+  buffer_memset (third, 3, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (third, caps);
   gst_caps_unref (caps);
@@ -258,33 +278,33 @@ GST_START_TEST (test_more)
   /* check timestamp and source correctness */
   l = buffers;
   fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data), 0);
-  fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 1);
+  fail_unless_equals_int (buffer_get_byte (l->data, 0), 1);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 0);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 1);
 
   l = g_list_next (l);
   fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data), GST_SECOND / 25);
-  fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 2);
+  fail_unless_equals_int (buffer_get_byte (l->data, 0), 2);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 1);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 2);
 
   l = g_list_next (l);
   fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data),
       GST_SECOND * 2 / 25);
-  fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 2);
+  fail_unless_equals_int (buffer_get_byte (l->data, 0), 2);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 2);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 3);
 
   l = g_list_next (l);
   fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data),
       GST_SECOND * 3 / 25);
-  fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 2);
+  fail_unless_equals_int (buffer_get_byte (l->data, 0), 2);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 3);
   fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 4);
 
   fail_unless_equals_int (g_list_length (buffers), 4);
   /* one held by us, three held by each output frame taken from the second */
-  ASSERT_BUFFER_REFCOUNT (second, "second", 4);
+  ASSERT_BUFFER_REFCOUNT (second, "second", 1);
 
   /* now send EOS */
   fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
@@ -320,7 +340,7 @@ GST_START_TEST (test_wrong_order_from_zero)
   /* first buffer */
   first = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (first) = GST_SECOND;
-  memset (GST_BUFFER_DATA (first), 0, 4);
+  buffer_memset (first, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (first, caps);
   gst_caps_unref (caps);
@@ -338,7 +358,7 @@ GST_START_TEST (test_wrong_order_from_zero)
   /* second buffer */
   second = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (second) = 0;
-  memset (GST_BUFFER_DATA (second), 0, 4);
+  buffer_memset (second, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (second, caps);
   gst_caps_unref (caps);
@@ -358,7 +378,7 @@ GST_START_TEST (test_wrong_order_from_zero)
   /* third buffer */
   third = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND;
-  memset (GST_BUFFER_DATA (third), 0, 4);
+  buffer_memset (third, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (third, caps);
   gst_caps_unref (caps);
@@ -373,7 +393,7 @@ GST_START_TEST (test_wrong_order_from_zero)
   /* and now the first one should be pushed once and dupped 24 + 13 times, to
    * reach the half point between 1 s (first) and 2 s (third) */
   fail_unless_equals_int (g_list_length (buffers), 38);
-  ASSERT_BUFFER_REFCOUNT (first, "first", 39);
+  ASSERT_BUFFER_REFCOUNT (first, "first", 1);
   ASSERT_BUFFER_REFCOUNT (second, "second", 1);
   ASSERT_BUFFER_REFCOUNT (third, "third", 2);
   assert_videorate_stats (videorate, "third", 3, 38, 1, 37);
@@ -409,7 +429,7 @@ GST_START_TEST (test_wrong_order)
   /* first buffer */
   first = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (first) = 0;
-  memset (GST_BUFFER_DATA (first), 0, 4);
+  buffer_memset (first, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (first, caps);
   gst_caps_unref (caps);
@@ -427,7 +447,7 @@ GST_START_TEST (test_wrong_order)
   /* second buffer */
   second = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (second) = GST_SECOND;
-  memset (GST_BUFFER_DATA (second), 0, 4);
+  buffer_memset (second, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (second, caps);
   gst_caps_unref (caps);
@@ -441,12 +461,12 @@ GST_START_TEST (test_wrong_order)
   /* and it created 13 output buffers as copies of the first frame */
   fail_unless_equals_int (g_list_length (buffers), 13);
   assert_videorate_stats (videorate, "second", 2, 13, 0, 12);
-  ASSERT_BUFFER_REFCOUNT (first, "first", 14);
+  ASSERT_BUFFER_REFCOUNT (first, "first", 1);
 
   /* third buffer */
   third = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND;
-  memset (GST_BUFFER_DATA (third), 0, 4);
+  buffer_memset (third, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (third, caps);
   gst_caps_unref (caps);
@@ -460,15 +480,15 @@ GST_START_TEST (test_wrong_order)
 
   /* submitting a frame with 2 seconds triggers output of 25 more frames */
   fail_unless_equals_int (g_list_length (buffers), 38);
-  ASSERT_BUFFER_REFCOUNT (first, "first", 14);
-  ASSERT_BUFFER_REFCOUNT (second, "second", 26);
+  ASSERT_BUFFER_REFCOUNT (first, "first", 1);
+  ASSERT_BUFFER_REFCOUNT (second, "second", 1);
   /* three frames submitted; two of them output as is, and 36 duplicated */
   assert_videorate_stats (videorate, "third", 3, 38, 0, 36);
 
   /* fourth buffer */
   fourth = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (fourth) = 0;
-  memset (GST_BUFFER_DATA (fourth), 0, 4);
+  buffer_memset (fourth, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (fourth, caps);
   gst_caps_unref (caps);
@@ -481,8 +501,8 @@ GST_START_TEST (test_wrong_order)
   ASSERT_BUFFER_REFCOUNT (fourth, "fourth", 1);
 
   fail_unless_equals_int (g_list_length (buffers), 38);
-  ASSERT_BUFFER_REFCOUNT (first, "first", 14);
-  ASSERT_BUFFER_REFCOUNT (second, "second", 26);
+  ASSERT_BUFFER_REFCOUNT (first, "first", 1);
+  ASSERT_BUFFER_REFCOUNT (second, "second", 1);
   assert_videorate_stats (videorate, "fourth", 4, 38, 1, 36);
 
   /* verify last buffer */
@@ -516,7 +536,7 @@ GST_START_TEST (test_no_framerate)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memset (GST_BUFFER_DATA (inbuffer), 0, 4);
+  buffer_memset (inbuffer, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_NO_FRAMERATE_STRING);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -564,7 +584,7 @@ GST_START_TEST (test_changing_size)
   fail_unless (gst_pad_push_event (mysrcpad, newsegment) == TRUE);
 
   first = gst_buffer_new_and_alloc (4);
-  memset (GST_BUFFER_DATA (first), 0, 4);
+  buffer_memset (first, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   GST_BUFFER_TIMESTAMP (first) = 0;
   gst_buffer_set_caps (first, caps);
@@ -575,7 +595,7 @@ GST_START_TEST (test_changing_size)
   /* second buffer */
   second = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (second) = GST_SECOND / 25;
-  memset (GST_BUFFER_DATA (second), 0, 4);
+  buffer_memset (second, 0, 4);
   gst_buffer_set_caps (second, caps);
 
   fail_unless (gst_pad_push (mysrcpad, second) == GST_FLOW_OK);
@@ -588,7 +608,7 @@ GST_START_TEST (test_changing_size)
   /* third buffer with new size */
   third = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND / 25;
-  memset (GST_BUFFER_DATA (third), 0, 4);
+  buffer_memset (third, 0, 4);
   caps_newsize = gst_caps_from_string (VIDEO_CAPS_NEWSIZE_STRING);
   gst_buffer_set_caps (third, caps_newsize);
 
@@ -603,7 +623,7 @@ GST_START_TEST (test_changing_size)
   /* fourth buffer with original size */
   fourth = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (fourth) = 3 * GST_SECOND / 25;
-  memset (GST_BUFFER_DATA (fourth), 0, 4);
+  buffer_memset (fourth, 0, 4);
   gst_buffer_set_caps (fourth, caps);
 
   fail_unless (gst_pad_push (mysrcpad, fourth) == GST_FLOW_OK);
@@ -612,7 +632,7 @@ GST_START_TEST (test_changing_size)
   /* fifth buffer with original size */
   fifth = gst_buffer_new_and_alloc (4);
   GST_BUFFER_TIMESTAMP (fifth) = 4 * GST_SECOND / 25;
-  memset (GST_BUFFER_DATA (fifth), 0, 4);
+  buffer_memset (fifth, 0, 4);
   gst_buffer_set_caps (fifth, caps);
 
   fail_unless (gst_pad_push (mysrcpad, fifth) == GST_FLOW_OK);
@@ -643,7 +663,7 @@ GST_START_TEST (test_non_ok_flow)
       "could not set to playing");
 
   buf = gst_buffer_new_and_alloc (4);
-  memset (GST_BUFFER_DATA (buf), 0, 4);
+  buffer_memset (buf, 0, 4);
   caps = gst_caps_from_string (VIDEO_CAPS_STRING);
   gst_buffer_set_caps (buf, caps);
   gst_caps_unref (caps);
@@ -666,7 +686,7 @@ GST_START_TEST (test_non_ok_flow)
   gst_pad_set_active (mysinkpad, FALSE);
 
   /* push buffer on deactivated pad */
-  fail_unless (gst_buffer_is_metadata_writable (buf));
+  fail_unless (gst_buffer_is_writable (buf));
   GST_BUFFER_TIMESTAMP (buf) = ts;
 
   /* pushing gives away our reference */
index 276261f..83a5c32 100644 (file)
@@ -54,6 +54,7 @@ videoscale_get_allowed_caps (void)
     gst_caps_append_structure (ret[i], gst_structure_copy (s));
   }
 
+  gst_caps_unref (caps);
   gst_object_unref (scale);
 
   return ret;
@@ -93,14 +94,14 @@ run_test (const GstCaps * caps, gint src_width, gint src_height,
     GCallback sink_handoff, gpointer sink_handoff_user_data)
 {
   GstElement *pipeline;
-  GstElement *src, *ffmpegcolorspace, *capsfilter1, *identity, *scale,
+  GstElement *src, *videoconvert, *capsfilter1, *identity, *scale,
       *capsfilter2, *sink;
   GstMessage *msg;
   GstBus *bus;
   GstCaps *copy;
   guint n_buffers = 0;
 
-  /* skip formats that ffmpegcolorspace can't handle */
+  /* skip formats that videoconvert can't handle */
   if (caps_are_64bpp (caps))
     return;
 
@@ -111,8 +112,8 @@ run_test (const GstCaps * caps, gint src_width, gint src_height,
   fail_unless (src != NULL);
   g_object_set (G_OBJECT (src), "num-buffers", 1, NULL);
 
-  ffmpegcolorspace = gst_element_factory_make ("ffmpegcolorspace", "csp");
-  fail_unless (ffmpegcolorspace != NULL);
+  videoconvert = gst_element_factory_make ("videoconvert", "csp");
+  fail_unless (videoconvert != NULL);
 
   capsfilter1 = gst_element_factory_make ("capsfilter", "filter1");
   fail_unless (capsfilter1 != NULL);
@@ -151,12 +152,12 @@ run_test (const GstCaps * caps, gint src_width, gint src_height,
         sink_handoff_user_data);
   }
 
-  gst_bin_add_many (GST_BIN (pipeline), src, ffmpegcolorspace, capsfilter1,
+  gst_bin_add_many (GST_BIN (pipeline), src, videoconvert, capsfilter1,
       identity, scale, capsfilter2, sink, NULL);
 
-  fail_unless (gst_element_link_pads_full (src, "src", ffmpegcolorspace, "sink",
+  fail_unless (gst_element_link_pads_full (src, "src", videoconvert, "sink",
           LINK_CHECK_FLAGS));
-  fail_unless (gst_element_link_pads_full (ffmpegcolorspace, "src", capsfilter1,
+  fail_unless (gst_element_link_pads_full (videoconvert, "src", capsfilter1,
           "sink", LINK_CHECK_FLAGS));
   fail_unless (gst_element_link_pads_full (capsfilter1, "src", identity, "sink",
           LINK_CHECK_FLAGS));
@@ -220,7 +221,7 @@ GST_START_TEST (test_passthrough)
     GstCaps *caps = *p;
 
     for (method = 0; method < 3; method++) {
-      /* skip formats that ffmpegcolorspace can't handle */
+      /* skip formats that videoconvert can't handle */
       if (caps_are_64bpp (caps))
         continue;
 
@@ -240,9 +241,15 @@ GST_START_TEST (test_passthrough)
           l1 = l1->next, l2 = l2->next) {
         GstBuffer *a = l1->data;
         GstBuffer *b = l2->data;
+        gsize sa, sb;
+        guint8 *pa, *pb;
 
-        fail_unless_equals_int (GST_BUFFER_SIZE (a), GST_BUFFER_SIZE (b));
-        fail_unless (GST_BUFFER_DATA (a) == GST_BUFFER_DATA (b));
+        pa = gst_buffer_map (a, &sa, NULL, GST_MAP_READ);
+        pb = gst_buffer_map (b, &sb, NULL, GST_MAP_READ);
+        fail_unless_equals_int (sa, sb);
+        fail_unless (pa == pb);
+        gst_buffer_unmap (b, pb, sb);
+        gst_buffer_unmap (a, pa, sa);
 
         gst_buffer_unref (a);
         gst_buffer_unref (b);
@@ -491,44 +498,42 @@ _test_negotiation (const gchar * src_templ, const gchar * sink_templ,
 GST_START_TEST (test_negotiation)
 {
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=720,height=576,pixel-aspect-ratio=16/15",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=768,height=576",
-      768, 576, 1, 1);
+      ("video/x-raw,format=(string)AYUV,width=720,height=576,pixel-aspect-ratio=16/15",
+      "video/x-raw,format=(string)AYUV,width=768,height=576", 768, 576, 1, 1);
 
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=320,height=240",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=640,height=320",
-      640, 320, 2, 3);
+      ("video/x-raw,format=(string)AYUV,width=320,height=240",
+      "video/x-raw,format=(string)AYUV,width=640,height=320", 640, 320, 2, 3);
 
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=320,height=240",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=640,height=320,pixel-aspect-ratio=[0/1, 1/1]",
+      ("video/x-raw,format=(string)AYUV,width=320,height=240",
+      "video/x-raw,format=(string)AYUV,width=640,height=320,pixel-aspect-ratio=[0/1, 1/1]",
       640, 320, 2, 3);
 
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=[1, 2048],height=[1, 2048],pixel-aspect-ratio=1/1",
+      ("video/x-raw,format=(string)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
+      "video/x-raw,format=(string)AYUV,width=[1, 2048],height=[1, 2048],pixel-aspect-ratio=1/1",
       1536, 2048, 1, 1);
 
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=[1, 2048],height=[1, 2048]",
+      ("video/x-raw,format=(string)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
+      "video/x-raw,format=(string)AYUV,width=[1, 2048],height=[1, 2048]",
       1920, 2048, 4, 5);
 
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=[1, 2048],height=[1, 2048]",
+      ("video/x-raw,format=(string)AYUV,width=1920,height=2560",
+      "video/x-raw,format=(string)AYUV,width=[1, 2048],height=[1, 2048]",
       1920, 2048, 4, 5);
 
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=1200,height=[1, 2048],pixel-aspect-ratio=1/1",
+      ("video/x-raw,format=(string)AYUV,width=1920,height=2560",
+      "video/x-raw,format=(string)AYUV,width=1200,height=[1, 2048],pixel-aspect-ratio=1/1",
       1200, 1600, 1, 1);
 
   /* Doesn't keep DAR but must be possible! */
   _test_negotiation
-      ("video/x-raw-yuv,format=(fourcc)AYUV,width=320,height=240,pixel-aspect-ratio=1/1",
-      "video/x-raw-yuv,format=(fourcc)AYUV,width=200,height=200,pixel-aspect-ratio=1/2",
+      ("video/x-raw,format=(string)AYUV,width=320,height=240,pixel-aspect-ratio=1/1",
+      "video/x-raw,format=(string)AYUV,width=200,height=200,pixel-aspect-ratio=1/2",
       200, 200, 1, 2);
 }
 
@@ -562,14 +567,15 @@ struct _GstTestReverseNegotiationSinkClass
 
 GType gst_test_reverse_negotiation_sink_get_type (void);
 
-GST_BOILERPLATE (GstTestReverseNegotiationSink,
-    gst_test_reverse_negotiation_sink, GstBaseSink, GST_TYPE_BASE_SINK);
+G_DEFINE_TYPE (GstTestReverseNegotiationSink,
+    gst_test_reverse_negotiation_sink, GST_TYPE_BASE_SINK);
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB));
 
+#if 0
 static GstFlowReturn
 gst_test_reverse_negotiation_sink_buffer_alloc (GstBaseSink * bsink,
     guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf)
@@ -603,6 +609,7 @@ gst_test_reverse_negotiation_sink_buffer_alloc (GstBaseSink * bsink,
 
   return GST_FLOW_OK;
 }
+#endif
 
 static GstFlowReturn
 gst_test_reverse_negotiation_sink_render (GstBaseSink * bsink,
@@ -620,7 +627,7 @@ gst_test_reverse_negotiation_sink_render (GstBaseSink * bsink,
   sink->nbuffers++;
 
   /* The third buffer is still in the old size
-   * because the ffmpegcolorspaces can't convert
+   * because the videoconverts can't convert
    * the frame sizes
    */
   if (sink->nbuffers > 3) {
@@ -634,9 +641,14 @@ gst_test_reverse_negotiation_sink_render (GstBaseSink * bsink,
 }
 
 static void
-gst_test_reverse_negotiation_sink_base_init (gpointer g_class)
+gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
+    * klass)
 {
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  GstElementClass *gstelement_class;
+  GstBaseSinkClass *gstbase_sink_class;
+
+  gstelement_class = GST_ELEMENT_CLASS (klass);
+  gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
 
   gst_element_class_set_details_simple (gstelement_class,
       "Test Reverse Negotiation Sink",
@@ -644,25 +656,17 @@ gst_test_reverse_negotiation_sink_base_init (gpointer g_class)
       "Some test sink", "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&sinktemplate));
-}
-
-static void
-gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
-    * klass)
-{
-  GstBaseSinkClass *gstbase_sink_class;
-
-  gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
 
+#if 0
   gstbase_sink_class->buffer_alloc =
       GST_DEBUG_FUNCPTR (gst_test_reverse_negotiation_sink_buffer_alloc);
+#endif
   gstbase_sink_class->render =
       GST_DEBUG_FUNCPTR (gst_test_reverse_negotiation_sink_render);
 }
 
 static void
-gst_test_reverse_negotiation_sink_init (GstTestReverseNegotiationSink * sink,
-    GstTestReverseNegotiationSinkClass * g_class)
+gst_test_reverse_negotiation_sink_init (GstTestReverseNegotiationSink * sink)
 {
   sink->nbuffers = 0;
 }
@@ -711,13 +715,13 @@ GST_START_TEST (test_reverse_negotiation)
   fail_unless (src != NULL);
   g_object_set (G_OBJECT (src), "num-buffers", 8, NULL);
 
-  csp1 = gst_element_factory_make ("ffmpegcolorspace", "csp1");
+  csp1 = gst_element_factory_make ("videoconvert", "csp1");
   fail_unless (csp1 != NULL);
 
   scale = gst_element_factory_make ("videoscale", "scale");
   fail_unless (scale != NULL);
 
-  csp2 = gst_element_factory_make ("ffmpegcolorspace", "csp2");
+  csp2 = gst_element_factory_make ("videoconvert", "csp2");
   fail_unless (csp2 != NULL);
 
   sink = g_object_new (GST_TYPE_TEST_REVERSE_NEGOTIATION_SINK, NULL);
@@ -776,7 +780,7 @@ GST_START_TEST (test_basetransform_negotiation)
 
   g_object_set (src, "num-buffers", 3, NULL);
 
-  caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
+  caps = gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
       GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
       "height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
       "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
@@ -784,7 +788,7 @@ GST_START_TEST (test_basetransform_negotiation)
   gst_caps_unref (caps);
 
   /* same caps, just different pixel-aspect-ratio */
-  caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
+  caps = gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
       GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
       "height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
       "pixel-aspect-ratio", GST_TYPE_FRACTION, 12, 11, NULL);
index 635ca32..a1a0c68 100644 (file)
@@ -41,7 +41,7 @@ static GstPad *mysinkpad;
 
 #define CAPS_TEMPLATE_STRING            \
     "video/x-raw-yuv, "                 \
-    "format = (fourcc) UYVY, "          \
+    "format = (string) UYVY, "          \
     "width = (int) [ 1,  MAX ], "       \
     "height = (int) [ 1,  MAX ], "      \
     "framerate = (fraction) [ 0/1, MAX ]"
@@ -261,7 +261,7 @@ GST_START_TEST (test_rgb_formats)
     "xRGB1555", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000}
   };
   GstElement *pipeline, *src, *filter, *sink;
-  const GstCaps *template_caps;
+  GstCaps *template_caps;
   GstBuffer *buf = NULL;
   GstPad *srcpad;
   gint p, i, e;
@@ -322,6 +322,8 @@ GST_START_TEST (test_rgb_formats)
         /* caps are supported, let's run some tests then ... */
         for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
           GstStateChangeReturn state_ret;
+          guint8 *data;
+          gsize size;
 
           g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
 
@@ -375,11 +377,13 @@ GST_START_TEST (test_rgb_formats)
 
 
           /* now check the first pixel */
-          check_rgb_buf (GST_BUFFER_DATA (buf), rgb_formats[i].red_mask,
+          data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+          check_rgb_buf (data, rgb_formats[i].red_mask,
               rgb_formats[i].green_mask, rgb_formats[i].blue_mask,
               rgb_formats[i].alpha_mask, test_patterns[p].r_expected,
               test_patterns[p].g_expected, test_patterns[p].b_expected,
               endianness, rgb_formats[i].bpp, rgb_formats[i].depth);
+          gst_buffer_unmap (buf, data, size);
 
           gst_buffer_unref (buf);
           buf = NULL;
@@ -392,6 +396,7 @@ GST_START_TEST (test_rgb_formats)
       gst_caps_unref (caps);
     }
   }
+  gst_caps_unref (template_caps);
 
   gst_object_unref (pipeline);
 }
index 3d2e146..00bbee1 100644 (file)
@@ -185,6 +185,7 @@ GST_START_TEST (test_unity_s8)
   GstCaps *caps;
   gint8 in[2] = { 64, -16 };
   gint8 *res;
+  gsize size;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -192,7 +193,7 @@ GST_START_TEST (test_unity_s8)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (2);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
+  gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -205,9 +206,10 @@ GST_START_TEST (test_unity_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint8 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
+  fail_unless (memcmp (res, in, 2) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -224,6 +226,7 @@ GST_START_TEST (test_half_s8)
   gint8 in[2] = { 64, -16 };
   gint8 out[2] = { 32, -8 };
   gint8 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -232,8 +235,7 @@ GST_START_TEST (test_half_s8)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (2);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -251,10 +253,11 @@ GST_START_TEST (test_half_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint8 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
+  fail_unless (memcmp (res, out, 2) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -271,6 +274,7 @@ GST_START_TEST (test_double_s8)
   gint8 in[2] = { 64, -16 };
   gint8 out[2] = { 127, -32 };  /* notice the clamped sample */
   gint8 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -279,8 +283,7 @@ GST_START_TEST (test_double_s8)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (2);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -298,10 +301,11 @@ GST_START_TEST (test_double_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint8 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
+  fail_unless (memcmp (res, out, 2) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -365,6 +369,7 @@ GST_START_TEST (test_mute_s8)
   gint8 in[2] = { 64, -16 };
   gint8 out[2] = { 0, 0 };
   gint8 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -373,8 +378,7 @@ GST_START_TEST (test_mute_s8)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (2);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -392,10 +396,11 @@ GST_START_TEST (test_mute_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint8 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
+  fail_unless (memcmp (res, out, 2) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -410,6 +415,7 @@ GST_START_TEST (test_unity_s16)
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
   gint16 *res;
+  gsize size;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -417,7 +423,7 @@ GST_START_TEST (test_unity_s16)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -430,9 +436,10 @@ GST_START_TEST (test_unity_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+  fail_unless (memcmp (res, in, 4) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -449,6 +456,7 @@ GST_START_TEST (test_half_s16)
   gint16 in[2] = { 16384, -256 };
   gint16 out[2] = { 8192, -128 };
   gint16 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -457,8 +465,7 @@ GST_START_TEST (test_half_s16)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -476,10 +483,11 @@ GST_START_TEST (test_half_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
+  fail_unless (memcmp (res, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -496,6 +504,7 @@ GST_START_TEST (test_double_s16)
   gint16 in[2] = { 16384, -256 };
   gint16 out[2] = { 32767, -512 };      /* notice the clamped sample */
   gint16 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -504,8 +513,7 @@ GST_START_TEST (test_double_s16)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -523,10 +531,11 @@ GST_START_TEST (test_double_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
+  fail_unless (memcmp (res, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -591,6 +600,7 @@ GST_START_TEST (test_mute_s16)
   gint16 in[2] = { 16384, -256 };
   gint16 out[2] = { 0, 0 };
   gint16 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -599,8 +609,7 @@ GST_START_TEST (test_mute_s16)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -618,10 +627,11 @@ GST_START_TEST (test_mute_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
+  fail_unless (memcmp (res, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -646,7 +656,7 @@ GST_START_TEST (test_unity_s24)
   guint8 in[6];
   guint8 *res;
   gint32 res_32[2];
-
+  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -657,7 +667,7 @@ GST_START_TEST (test_unity_s24)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (6);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
+  gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -670,14 +680,15 @@ GST_START_TEST (test_unity_s24)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
 
   res_32[0] = get_unaligned_i24 (res);
   res_32[1] = get_unaligned_i24 ((res + 3));
 
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in_32[0], in_32[1], res_32[0],
       res_32[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
+  fail_unless (memcmp (res, in, 6) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -696,6 +707,7 @@ GST_START_TEST (test_half_s24)
   guint8 *res;
   gint32 res_32[2];
   gint32 out_32[2] = { 2097152, -2048 };
+  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -707,8 +719,7 @@ GST_START_TEST (test_half_s24)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (6);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -726,7 +737,7 @@ GST_START_TEST (test_half_s24)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
 
   res_32[0] = get_unaligned_i24 (res);
   res_32[1] = get_unaligned_i24 ((res + 3));
@@ -734,6 +745,7 @@ GST_START_TEST (test_half_s24)
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
       res_32[0], res_32[1]);
   fail_unless (memcmp (res_32, out_32, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -752,6 +764,7 @@ GST_START_TEST (test_double_s24)
   guint8 *res;
   gint32 res_32[2];
   gint32 out_32[2] = { 8388607, -8192 };        /* notice the clamped sample */
+  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -763,8 +776,7 @@ GST_START_TEST (test_double_s24)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (6);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -782,7 +794,7 @@ GST_START_TEST (test_double_s24)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
 
   res_32[0] = get_unaligned_i24 (res);
   res_32[1] = get_unaligned_i24 ((res + 3));
@@ -790,6 +802,7 @@ GST_START_TEST (test_double_s24)
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
       res_32[0], res_32[1]);
   fail_unless (memcmp (res_32, out_32, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -864,6 +877,7 @@ GST_START_TEST (test_mute_s24)
   guint8 *res;
   gint32 res_32[2];
   gint32 out_32[2] = { 0, 0 };  /* notice the clamped sample */
+  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -875,8 +889,7 @@ GST_START_TEST (test_mute_s24)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (6);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -895,7 +908,7 @@ GST_START_TEST (test_mute_s24)
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
 
-  res = GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
 
   res_32[0] = get_unaligned_i24 (res);
   res_32[1] = get_unaligned_i24 ((res + 3));
@@ -903,6 +916,7 @@ GST_START_TEST (test_mute_s24)
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
       res_32[0], res_32[1]);
   fail_unless (memcmp (res_32, out_32, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -917,6 +931,7 @@ GST_START_TEST (test_unity_s32)
   GstCaps *caps;
   gint32 in[2] = { 1073741824, -65536 };
   gint32 *res;
+  gsize size;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -924,7 +939,7 @@ GST_START_TEST (test_unity_s32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -937,9 +952,10 @@ GST_START_TEST (test_unity_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint32 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  fail_unless (memcmp (res, in, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -956,6 +972,7 @@ GST_START_TEST (test_half_s32)
   gint32 in[2] = { 1073741824, -65536 };
   gint32 out[2] = { 536870912, -32768 };
   gint32 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -964,8 +981,7 @@ GST_START_TEST (test_half_s32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -983,10 +999,11 @@ GST_START_TEST (test_half_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint32 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
+  fail_unless (memcmp (res, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1003,6 +1020,7 @@ GST_START_TEST (test_double_s32)
   gint32 in[2] = { 1073741824, -65536 };
   gint32 out[2] = { 2147483647, -131072 };      /* notice the clamped sample */
   gint32 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -1011,8 +1029,7 @@ GST_START_TEST (test_double_s32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1030,10 +1047,11 @@ GST_START_TEST (test_double_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint32 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
+  fail_unless (memcmp (res, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1097,6 +1115,7 @@ GST_START_TEST (test_mute_s32)
   gint32 in[2] = { 1073741824, -65536 };
   gint32 out[2] = { 0, 0 };
   gint32 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -1105,8 +1124,7 @@ GST_START_TEST (test_mute_s32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1124,10 +1142,11 @@ GST_START_TEST (test_mute_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint32 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
+  fail_unless (memcmp (res, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1142,6 +1161,7 @@ GST_START_TEST (test_unity_f32)
   GstCaps *caps;
   gfloat in[2] = { 0.75, -0.25 };
   gfloat *res;
+  gsize size;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -1149,7 +1169,7 @@ GST_START_TEST (test_unity_f32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1162,7 +1182,7 @@ GST_START_TEST (test_unity_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gfloat *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", in[0], in[1], res[0],
       res[1]);
   fail_unless_equals_float (res[0], in[0]);
@@ -1183,6 +1203,7 @@ GST_START_TEST (test_half_f32)
   gfloat in[2] = { 0.75, -0.25 };
   gfloat out[2] = { 0.375, -0.125 };
   gfloat *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -1191,8 +1212,7 @@ GST_START_TEST (test_half_f32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1210,11 +1230,12 @@ GST_START_TEST (test_half_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gfloat *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1231,6 +1252,7 @@ GST_START_TEST (test_double_f32)
   gfloat in[2] = { 0.75, -0.25 };
   gfloat out[2] = { 1.5, -0.5 };        /* nothing is clamped */
   gfloat *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -1239,8 +1261,7 @@ GST_START_TEST (test_double_f32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1258,11 +1279,12 @@ GST_START_TEST (test_double_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gfloat *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1328,6 +1350,7 @@ GST_START_TEST (test_mute_f32)
   gfloat in[2] = { 0.75, -0.25 };
   gfloat out[2] = { 0, 0 };
   gfloat *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -1336,8 +1359,7 @@ GST_START_TEST (test_mute_f32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1355,11 +1377,12 @@ GST_START_TEST (test_mute_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gfloat *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1374,6 +1397,7 @@ GST_START_TEST (test_unity_f64)
   GstCaps *caps;
   gdouble in[2] = { 0.75, -0.25 };
   gdouble *res;
+  gsize size;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -1381,7 +1405,7 @@ GST_START_TEST (test_unity_f64)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (16);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
+  gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1394,7 +1418,7 @@ GST_START_TEST (test_unity_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", in[0], in[1], res[0],
       res[1]);
   fail_unless_equals_float (res[0], in[0]);
@@ -1415,6 +1439,7 @@ GST_START_TEST (test_half_f64)
   gdouble in[2] = { 0.75, -0.25 };
   gdouble out[2] = { 0.375, -0.125 };
   gdouble *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -1423,8 +1448,7 @@ GST_START_TEST (test_half_f64)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (16);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1442,11 +1466,12 @@ GST_START_TEST (test_half_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1463,6 +1488,7 @@ GST_START_TEST (test_double_f64)
   gdouble in[2] = { 0.75, -0.25 };
   gdouble out[2] = { 1.5, -0.5 };       /* nothing is clamped */
   gdouble *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -1471,8 +1497,7 @@ GST_START_TEST (test_double_f64)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (16);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1490,11 +1515,12 @@ GST_START_TEST (test_double_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1560,6 +1586,7 @@ GST_START_TEST (test_mute_f64)
   gdouble in[2] = { 0.75, -0.25 };
   gdouble out[2] = { 0, 0 };
   gdouble *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -1568,8 +1595,7 @@ GST_START_TEST (test_mute_f64)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (16);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
+  gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1587,11 +1613,12 @@ GST_START_TEST (test_mute_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1616,7 +1643,7 @@ GST_START_TEST (test_wrong_caps)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_WRONG_CAPS_STRING);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1653,6 +1680,7 @@ GST_START_TEST (test_passthrough)
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
   gint16 *res;
+  gsize size;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 1.0, NULL);
@@ -1661,7 +1689,7 @@ GST_START_TEST (test_passthrough)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
   gst_buffer_set_caps (inbuffer, caps);
   gst_caps_unref (caps);
@@ -1674,9 +1702,10 @@ GST_START_TEST (test_passthrough)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+  fail_unless (memcmp (res, in, 4) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1730,6 +1759,7 @@ GST_START_TEST (test_controller_processing)
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
   gint16 *res;
+  gsize size;
 
   volume = setup_volume ();
 
@@ -1748,7 +1778,7 @@ GST_START_TEST (test_controller_processing)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (4);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
+  gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
   gst_buffer_set_caps (inbuffer, caps);
   GST_BUFFER_TIMESTAMP (inbuffer) = 0;
@@ -1762,9 +1792,10 @@ GST_START_TEST (test_controller_processing)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+  fail_unless (memcmp (res, in, 4) == 0);
+  gst_buffer_unmap (outbuffer, res, size);
 
   g_object_unref (c);
 
index 29e3cd5..ecdc329 100644 (file)
@@ -147,7 +147,7 @@ GST_START_TEST (test_identification_header)
   bus = gst_bus_new ();
 
   inbuffer = gst_buffer_new_and_alloc (30);
-  memcpy (GST_BUFFER_DATA (inbuffer), identification_header, 30);
+  gst_buffer_fill (inbuffer, 0, identification_header, 30);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   gst_buffer_ref (inbuffer);
 
@@ -161,7 +161,7 @@ GST_START_TEST (test_identification_header)
   fail_if ((message = gst_bus_pop (bus)) != NULL);
 
   inbuffer = gst_buffer_new_and_alloc (sizeof (comment_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), comment_header, sizeof (comment_header));
+  gst_buffer_fill (inbuffer, 0, comment_header, sizeof (comment_header));
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   gst_buffer_ref (inbuffer);
 
@@ -214,7 +214,7 @@ _create_codebook_header_buffer (void)
   vorbis_analysis_headerout (&vd, &vc, &header, &header_comm, &header_code);
 
   buffer = gst_buffer_new_and_alloc (header_code.bytes);
-  memcpy (GST_BUFFER_DATA (buffer), header_code.packet, header_code.bytes);
+  gst_buffer_fill (buffer, 0, header_code.packet, header_code.bytes);
 
   return buffer;
 }
@@ -236,7 +236,7 @@ _create_audio_buffer (void)
   vorbis_bitrate_addblock (&vb);
   vorbis_bitrate_flushpacket (&vd, &packet);
   buffer = gst_buffer_new_and_alloc (packet.bytes);
-  memcpy (GST_BUFFER_DATA (buffer), packet.packet, packet.bytes);
+  gst_buffer_fill (buffer, 0, packet.packet, packet.bytes);
 
   vorbis_comment_clear (&vc);
   vorbis_block_clear (&vb);
@@ -260,7 +260,7 @@ GST_START_TEST (test_empty_vorbis_packet)
   bus = gst_bus_new ();
 
   inbuffer = gst_buffer_new_and_alloc (30);
-  memcpy (GST_BUFFER_DATA (inbuffer), identification_header, 30);
+  gst_buffer_fill (inbuffer, 0, identification_header, 30);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   gst_buffer_ref (inbuffer);
 
@@ -275,7 +275,7 @@ GST_START_TEST (test_empty_vorbis_packet)
   fail_if ((message = gst_bus_pop (bus)) != NULL);
 
   inbuffer = gst_buffer_new_and_alloc (sizeof (comment_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), comment_header, sizeof (comment_header));
+  gst_buffer_fill (inbuffer, 0, comment_header, sizeof (comment_header));
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   gst_buffer_ref (inbuffer);
 
index bb05236..9601625 100644 (file)
@@ -118,17 +118,19 @@ cleanup_vorbistag (GstElement * vorbistag)
 }
 
 
-static gboolean
-buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
+static GstProbeReturn
+buffer_probe (GstPad * pad, GstProbeType type, GstBuffer * buffer,
+    gpointer unused)
 {
   g_async_queue_push (pending_buffers, gst_buffer_ref (buffer));
-  return TRUE;
+  return GST_PROBE_OK;
 }
 
 static void
 start_pipeline (GstElement * element)
 {
-  id = gst_pad_add_buffer_probe (mysinkpad, G_CALLBACK (buffer_probe), NULL);
+  id = gst_pad_add_probe (mysinkpad, GST_PROBE_TYPE_BUFFER,
+      (GstPadProbeCallback) buffer_probe, NULL, NULL);
 
   pending_buffers = g_async_queue_new ();
   gst_element_set_state (element, GST_STATE_PLAYING);
@@ -148,7 +150,7 @@ stop_pipeline (GstElement * element)
   while ((buf = g_async_queue_try_pop (pending_buffers)))
     gst_buffer_unref (buf);
 
-  gst_pad_remove_buffer_probe (mysinkpad, (guint) id);
+  gst_pad_remove_probe (mysinkpad, id);
   id = 0;
 
   gst_element_set_state (element, GST_STATE_NULL);
@@ -160,6 +162,18 @@ stop_pipeline (GstElement * element)
   pending_buffers = NULL;
 }
 
+static void
+compare_buffer (GstBuffer * buf, const guint8 * data, gsize size)
+{
+  guint8 *bdata;
+  gsize bsize;
+
+  bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  fail_unless_equals_int (bsize, size);
+  fail_unless_equals_int (memcmp (bdata, data, size), 0);
+  gst_buffer_unmap (buf, bdata, bsize);
+}
+
 static vorbis_comment vc;
 static vorbis_dsp_state vd;
 static vorbis_info vi;
@@ -182,7 +196,7 @@ _create_codebook_header_buffer (void)
   vorbis_analysis_headerout (&vd, &vc, &header, &header_comm, &header_code);
 
   buffer = gst_buffer_new_and_alloc (header_code.bytes);
-  memcpy (GST_BUFFER_DATA (buffer), header_code.packet, header_code.bytes);
+  gst_buffer_fill (buffer, 0, header_code.packet, header_code.bytes);
 
   return buffer;
 }
@@ -201,7 +215,7 @@ _create_audio_buffer (void)
   vorbis_bitrate_addblock (&vb);
   vorbis_bitrate_flushpacket (&vd, &packet);
   buffer = gst_buffer_new_and_alloc (packet.bytes);
-  memcpy (GST_BUFFER_DATA (buffer), packet.packet, packet.bytes);
+  gst_buffer_fill (buffer, 0, packet.packet, packet.bytes);
 
   vorbis_comment_clear (&vc);
   vorbis_block_clear (&vb);
@@ -232,13 +246,13 @@ GST_START_TEST (test_empty_tags_set)
 
   /* send identification header */
   inbuffer = gst_buffer_new_and_alloc (sizeof (identification_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), identification_header,
+  gst_buffer_fill (inbuffer, 0, identification_header,
       sizeof (identification_header));
   fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
 
   /* send empty comment buffer */
   inbuffer = gst_buffer_new_and_alloc (sizeof (empty_comment_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), empty_comment_header,
+  gst_buffer_fill (inbuffer, 0, empty_comment_header,
       sizeof (empty_comment_header));
   fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
 
@@ -251,18 +265,14 @@ GST_START_TEST (test_empty_tags_set)
 
   /* check identification header is unchanged */
   outbuffer = get_buffer ();
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
+  compare_buffer (outbuffer, identification_header,
       sizeof (identification_header));
-  fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
-          identification_header, sizeof (identification_header)), 0);
   gst_buffer_unref (outbuffer);
 
   /* check comment header is correct */
   outbuffer = get_buffer ();
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
+  compare_buffer (outbuffer, title_comment_header,
       sizeof (title_comment_header));
-  fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
-          title_comment_header, sizeof (title_comment_header)), 0);
   gst_buffer_unref (outbuffer);
 
   stop_pipeline (vorbistag);
@@ -291,13 +301,13 @@ GST_START_TEST (test_filled_tags_unset)
 
   /* send identification header */
   inbuffer = gst_buffer_new_and_alloc (sizeof (identification_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), identification_header,
+  gst_buffer_fill (inbuffer, 0, identification_header,
       sizeof (identification_header));
   fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
 
   /* send empty comment buffer */
   inbuffer = gst_buffer_new_and_alloc (sizeof (title_comment_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), title_comment_header,
+  gst_buffer_fill (inbuffer, 0, title_comment_header,
       sizeof (title_comment_header));
   fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
 
@@ -310,18 +320,14 @@ GST_START_TEST (test_filled_tags_unset)
 
   /* check identification header is unchanged */
   outbuffer = get_buffer ();
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
+  compare_buffer (outbuffer, identification_header,
       sizeof (identification_header));
-  fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
-          identification_header, sizeof (identification_header)), 0);
   gst_buffer_unref (outbuffer);
 
   /* check comment header is correct */
   outbuffer = get_buffer ();
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
+  compare_buffer (outbuffer, empty_comment_header,
       sizeof (empty_comment_header));
-  fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
-          empty_comment_header, sizeof (empty_comment_header)), 0);
   gst_buffer_unref (outbuffer);
 
   stop_pipeline (vorbistag);
@@ -351,13 +357,13 @@ GST_START_TEST (test_filled_tags_change)
 
   /* send identification header */
   inbuffer = gst_buffer_new_and_alloc (sizeof (identification_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), identification_header,
+  gst_buffer_fill (inbuffer, 0, identification_header,
       sizeof (identification_header));
   fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
 
   /* send empty comment buffer */
   inbuffer = gst_buffer_new_and_alloc (sizeof (artist_comment_header));
-  memcpy (GST_BUFFER_DATA (inbuffer), artist_comment_header,
+  gst_buffer_fill (inbuffer, 0, artist_comment_header,
       sizeof (artist_comment_header));
   fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
 
@@ -370,18 +376,14 @@ GST_START_TEST (test_filled_tags_change)
 
   /* check identification header is unchanged */
   outbuffer = get_buffer ();
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
+  compare_buffer (outbuffer, identification_header,
       sizeof (identification_header));
-  fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
-          identification_header, sizeof (identification_header)), 0);
   gst_buffer_unref (outbuffer);
 
   /* check comment header is correct */
   outbuffer = get_buffer ();
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
+  compare_buffer (outbuffer, title_comment_header,
       sizeof (title_comment_header));
-  fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
-          title_comment_header, sizeof (title_comment_header)), 0);
   gst_buffer_unref (outbuffer);
 
   stop_pipeline (vorbistag);
index c53c671..c9d8a33 100644 (file)
@@ -62,8 +62,11 @@ GST_START_TEST (test_quicktime_mpeg4video)
   GstCaps *caps = NULL;
 
   buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) qt_redirect_396042;
-  GST_BUFFER_SIZE (buf) = sizeof (qt_redirect_396042);
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) qt_redirect_396042, NULL,
+          sizeof (qt_redirect_396042), 0, sizeof (qt_redirect_396042)));
+
   GST_BUFFER_OFFSET (buf) = 0;
 
   caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
@@ -89,8 +92,11 @@ GST_START_TEST (test_broken_flac_in_ogg)
   GstCaps *caps = NULL;
 
   buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) flac_id_packet;
-  GST_BUFFER_SIZE (buf) = sizeof (flac_id_packet);
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) flac_id_packet, NULL,
+          sizeof (flac_id_packet), 0, sizeof (flac_id_packet)));
+
   GST_BUFFER_OFFSET (buf) = 0;
 
   caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
@@ -123,8 +129,10 @@ typefind_test_file (const gchar * filename)
   }
 
   buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) data;
-  GST_BUFFER_SIZE (buf) = data_len;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) data, NULL, data_len, 0, data_len));
+
   GST_BUFFER_OFFSET (buf) = 0;
 
   caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
@@ -222,11 +230,14 @@ GST_START_TEST (test_ac3)
   GstBuffer *buf;
   GstCaps *caps = NULL;
   guint bsid;
+  guint8 *data;
 
   for (bsid = 0; bsid < 32; bsid++) {
     buf = gst_buffer_new_and_alloc ((256 + 640) * 2);
-    make_ac3_packet (GST_BUFFER_DATA (buf), 256 * 2, bsid);
-    make_ac3_packet (GST_BUFFER_DATA (buf) + 256 * 2, 640 * 2, bsid);
+    data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
+    make_ac3_packet (data, 256 * 2, bsid);
+    make_ac3_packet (data + 256 * 2, 640 * 2, bsid);
+    gst_buffer_unmap (buf, data, (256 + 640) * 2);
 
     caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
     if (bsid <= 8) {
@@ -281,11 +292,14 @@ GST_START_TEST (test_eac3)
   GstBuffer *buf;
   GstCaps *caps = NULL;
   guint bsid;
+  guint8 *data;
 
   for (bsid = 0; bsid <= 32; bsid++) {
     buf = gst_buffer_new_and_alloc (558 + 384);
-    make_eac3_packet (GST_BUFFER_DATA (buf), 558, bsid);
-    make_eac3_packet (GST_BUFFER_DATA (buf) + 558, 384, bsid);
+    data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
+    make_eac3_packet (data, 558, bsid);
+    make_eac3_packet (data + 558, 384, bsid);
+    gst_buffer_unmap (buf, data, 558 + 384);
 
     caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
     if (bsid > 10 && bsid <= 16) {
@@ -335,8 +349,10 @@ GST_START_TEST (test_random_data)
     data[i] = g_random_int () & 0xff;
 
   buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = (guint8 *) data;
-  GST_BUFFER_SIZE (buf) = TEST_RANDOM_DATA_SIZE;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          data, NULL, TEST_RANDOM_DATA_SIZE, 0, TEST_RANDOM_DATA_SIZE));
+
   GST_BUFFER_OFFSET (buf) = 0;
 
   caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
index f5fab57..ec76451 100644 (file)
@@ -127,22 +127,21 @@ GST_END_TEST;
 GST_START_TEST (test_buffer_clipping_time)
 {
   GstSegment s;
-
   GstBuffer *buf;
-
   GstBuffer *ret;
-
-  guint8 *data;
+  guint8 *data, *sdata;
+  gsize ssize;
 
   /* Clip start and end */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_TIME);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 4 * GST_SECOND,
-      8 * GST_SECOND, 4 * GST_SECOND);
+  s.start = 4 * GST_SECOND;
+  s.stop = 8 * GST_SECOND;
+  s.time = 4 * GST_SECOND;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -156,20 +155,23 @@ GST_START_TEST (test_buffer_clipping_time)
   fail_unless (GST_BUFFER_DURATION (ret) == 4 * GST_SECOND);
   fail_unless (GST_BUFFER_OFFSET (ret) == 400);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == 800);
-  fail_unless (GST_BUFFER_DATA (ret) == data + 200);
-  fail_unless (GST_BUFFER_SIZE (ret) == 400);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data + 200);
+  fail_unless (ssize == 400);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
   /* Clip only start */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_TIME);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 4 * GST_SECOND,
-      12 * GST_SECOND, 4 * GST_SECOND);
+  s.start = 4 * GST_SECOND;
+  s.stop = 12 * GST_SECOND;
+  s.time = 4 * GST_SECOND;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -183,20 +185,23 @@ GST_START_TEST (test_buffer_clipping_time)
   fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
   fail_unless (GST_BUFFER_OFFSET (ret) == 400);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == 1200);
-  fail_unless (GST_BUFFER_DATA (ret) == data + 200);
-  fail_unless (GST_BUFFER_SIZE (ret) == 800);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data + 200);
+  fail_unless (ssize == 800);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
   /* Clip only stop */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_TIME);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 2 * GST_SECOND,
-      10 * GST_SECOND, 2 * GST_SECOND);
+  s.start = 2 * GST_SECOND;
+  s.stop = 10 * GST_SECOND;
+  s.time = 2 * GST_SECOND;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -210,20 +215,23 @@ GST_START_TEST (test_buffer_clipping_time)
   fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
   fail_unless (GST_BUFFER_OFFSET (ret) == 200);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == 1000);
-  fail_unless (GST_BUFFER_DATA (ret) == data);
-  fail_unless (GST_BUFFER_SIZE (ret) == 800);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data);
+  fail_unless (ssize == 800);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
   /* Buffer outside segment */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_TIME);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 12 * GST_SECOND,
-      20 * GST_SECOND, 12 * GST_SECOND);
+  s.start = 12 * GST_SECOND;
+  s.stop = 20 * GST_SECOND;
+  s.time = 12 * GST_SECOND;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -236,12 +244,13 @@ GST_START_TEST (test_buffer_clipping_time)
   /* Clip start and end but don't touch duration and offset_end */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_TIME);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 4 * GST_SECOND,
-      8 * GST_SECOND, 4 * GST_SECOND);
+  s.start = 4 * GST_SECOND;
+  s.stop = 8 * GST_SECOND;
+  s.time = 4 * GST_SECOND;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
@@ -255,8 +264,10 @@ GST_START_TEST (test_buffer_clipping_time)
   fail_unless (GST_BUFFER_DURATION (ret) == GST_CLOCK_TIME_NONE);
   fail_unless (GST_BUFFER_OFFSET (ret) == 400);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == GST_BUFFER_OFFSET_NONE);
-  fail_unless (GST_BUFFER_DATA (ret) == data + 200);
-  fail_unless (GST_BUFFER_SIZE (ret) == 400);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data + 200);
+  fail_unless (ssize == 400);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
@@ -266,12 +277,13 @@ GST_START_TEST (test_buffer_clipping_time)
    */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_TIME);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 0 * GST_SECOND,
-      10 * GST_SECOND, 0 * GST_SECOND);
+  s.start = 0 * GST_SECOND;
+  s.stop = 10 * GST_SECOND;
+  s.time = 0 * GST_SECOND;
 
   GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
   GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
@@ -289,11 +301,13 @@ GST_START_TEST (test_buffer_clipping_time)
    */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_PERCENT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_PERCENT, 0, 10, 0);
+  s.start = 0;
+  s.stop = 10;
+  s.time = 0;
 
   GST_BUFFER_TIMESTAMP (buf) = 0 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 0;
@@ -311,22 +325,21 @@ GST_END_TEST;
 GST_START_TEST (test_buffer_clipping_samples)
 {
   GstSegment s;
-
   GstBuffer *buf;
-
   GstBuffer *ret;
-
-  guint8 *data;
+  guint8 *data, *sdata;
+  gsize ssize;
 
   /* Clip start and end */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_DEFAULT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 400,
-      800, 400);
+  s.start = 400;
+  s.stop = 800;
+  s.time = 400;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -340,20 +353,23 @@ GST_START_TEST (test_buffer_clipping_samples)
   fail_unless (GST_BUFFER_DURATION (ret) == 4 * GST_SECOND);
   fail_unless (GST_BUFFER_OFFSET (ret) == 400);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == 800);
-  fail_unless (GST_BUFFER_DATA (ret) == data + 200);
-  fail_unless (GST_BUFFER_SIZE (ret) == 400);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data + 200);
+  fail_unless (ssize == 400);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
   /* Clip only start */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_DEFAULT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 400,
-      1200, 400);
+  s.start = 400;
+  s.stop = 1200;
+  s.time = 400;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -367,20 +383,23 @@ GST_START_TEST (test_buffer_clipping_samples)
   fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
   fail_unless (GST_BUFFER_OFFSET (ret) == 400);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == 1200);
-  fail_unless (GST_BUFFER_DATA (ret) == data + 200);
-  fail_unless (GST_BUFFER_SIZE (ret) == 800);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data + 200);
+  fail_unless (ssize == 800);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
   /* Clip only stop */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_DEFAULT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 200,
-      1000, 200);
+  s.start = 200;
+  s.stop = 1000;
+  s.time = 200;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -394,20 +413,23 @@ GST_START_TEST (test_buffer_clipping_samples)
   fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
   fail_unless (GST_BUFFER_OFFSET (ret) == 200);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == 1000);
-  fail_unless (GST_BUFFER_DATA (ret) == data);
-  fail_unless (GST_BUFFER_SIZE (ret) == 800);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data);
+  fail_unless (ssize == 800);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
   /* Buffer outside segment */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_DEFAULT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 1200,
-      2000, 1200);
+  s.start = 1200;
+  s.stop = 2000;
+  s.time = 1200;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
@@ -420,12 +442,13 @@ GST_START_TEST (test_buffer_clipping_samples)
   /* Clip start and end but don't touch duration and offset_end */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_DEFAULT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 400,
-      800, 400);
+  s.start = 400;
+  s.stop = 800;
+  s.time = 400;
 
   GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
@@ -439,8 +462,10 @@ GST_START_TEST (test_buffer_clipping_samples)
   fail_unless (GST_BUFFER_DURATION (ret) == GST_CLOCK_TIME_NONE);
   fail_unless (GST_BUFFER_OFFSET (ret) == 400);
   fail_unless (GST_BUFFER_OFFSET_END (ret) == GST_BUFFER_OFFSET_NONE);
-  fail_unless (GST_BUFFER_DATA (ret) == data + 200);
-  fail_unless (GST_BUFFER_SIZE (ret) == 400);
+  sdata = gst_buffer_map (ret, &ssize, NULL, GST_MAP_READ);
+  fail_unless (sdata == data + 200);
+  fail_unless (ssize == 400);
+  gst_buffer_unmap (ret, sdata, ssize);
 
   gst_buffer_unref (ret);
 
@@ -450,11 +475,13 @@ GST_START_TEST (test_buffer_clipping_samples)
    */
   buf = gst_buffer_new ();
   data = (guint8 *) g_malloc (1000);
-  GST_BUFFER_SIZE (buf) = 1000;
-  GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+  gst_buffer_take_memory (buf, -1,
+      gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000));
 
   gst_segment_init (&s, GST_FORMAT_DEFAULT);
-  gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 0, 10, 0);
+  s.start = 0;
+  s.stop = 10;
+  s.time = 0;
 
   GST_BUFFER_TIMESTAMP (buf) = 0 * GST_SECOND;
   GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
index 8747c9a..1c60c11 100644 (file)
@@ -183,8 +183,7 @@ struct _GstCdFooSrcClass
 };
 
 GType gst_cd_foo_src_get_type (void);
-GST_BOILERPLATE (GstCdFooSrc, gst_cd_foo_src, GstCddaBaseSrc,
-    GST_TYPE_CDDA_BASE_SRC);
+G_DEFINE_TYPE (GstCdFooSrc, gst_cd_foo_src, GST_TYPE_CDDA_BASE_SRC);
 
 static GstBuffer *gst_cd_foo_src_read_sector (GstCddaBaseSrc * src,
     gint sector);
@@ -193,17 +192,7 @@ static gboolean gst_cd_foo_src_open (GstCddaBaseSrc * src,
 static void gst_cd_foo_src_close (GstCddaBaseSrc * src);
 
 static void
-gst_cd_foo_src_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details_simple (element_class,
-      "CD Audio (cdda) Source, FooBar", "Source/File",
-      "Read audio from CD", "Foo Bar <foo@bar.com>");
-}
-
-static void
-gst_cd_foo_src_init (GstCdFooSrc * src, GstCdFooSrcClass * klass)
+gst_cd_foo_src_init (GstCdFooSrc * src)
 {
   src->cur_disc = 0;
 }
@@ -212,6 +201,11 @@ static void
 gst_cd_foo_src_class_init (GstCdFooSrcClass * klass)
 {
   GstCddaBaseSrcClass *cddabasesrc_class = GST_CDDA_BASE_SRC_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  gst_element_class_set_details_simple (element_class,
+      "CD Audio (cdda) Source, FooBar", "Source/File",
+      "Read audio from CD", "Foo Bar <foo@bar.com>");
 
   cddabasesrc_class->open = gst_cd_foo_src_open;
   cddabasesrc_class->close = gst_cd_foo_src_close;
@@ -260,9 +254,12 @@ static GstBuffer *
 gst_cd_foo_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector)
 {
   GstBuffer *buf;
+  guint8 *data;
 
   buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW);
-  memset (GST_BUFFER_DATA (buf), 0, CD_FRAMESIZE_RAW);
+  data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
+  memset (data, 0, CD_FRAMESIZE_RAW);
+  gst_buffer_unmap (buf, data, CD_FRAMESIZE_RAW);
 
   return buf;
 }
index aa80624..fdcd482 100644 (file)
@@ -24,7 +24,6 @@
 #include <gst/gst.h>
 #include <gst/check/gstcheck.h>
 
-#include <gst/app/gstappbuffer.h>
 #include <gst/app/gstapp-marshal.h>
 #include <gst/app/gstappsink.h>
 #include <gst/app/gstappsrc.h>
@@ -65,7 +64,7 @@
 #include <gst/interfaces/tuner.h>
 #include <gst/interfaces/tunernorm.h>
 #include <gst/interfaces/videoorientation.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 #include <gst/netbuffer/gstnetbuffer.h>
 
index 2bce3a1..5c4135d 100644 (file)
@@ -23,7 +23,6 @@
 #include <config.h>
 #include <gst/check/gstcheck.h>
 
-#include <gst/app/gstappbuffer.h>
 #include <gst/app/gstappsrc.h>
 #include <gst/app/gstappsink.h>
 #include <gst/audio/audio.h>
@@ -46,7 +45,7 @@
 #include <gst/interfaces/streamvolume.h>
 #include <gst/interfaces/tuner.h>
 #include <gst/interfaces/videoorientation.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 #include <gst/netbuffer/gstnetbuffer.h>
 #include <gst/pbutils/pbutils.h>
 #include <gst/riff/riff-media.h>
 #endif
 #endif
 
+/* disabled for 0.11 */
+#undef HAVE_ABI_SIZES
+#define HAVE_ABI_SIZES FALSE
+
 GST_START_TEST (test_ABI)
 {
   gst_check_abi_list (list, HAVE_ABI_SIZES);
index 2dfd284..0028f58 100644 (file)
@@ -32,6 +32,8 @@
 
 #define TEST_ELEMENT_TYPE (test_element_get_type())
 
+/* FIXME 0.11: possibly remove mixer interface entirely, or simplify, or
+ * radically change */
 typedef struct TestElement TestElement;
 typedef struct TestElementClass TestElementClass;
 
@@ -48,10 +50,9 @@ struct TestElementClass
 GType test_element_get_type (void);
 
 static void init_interface (GType type);
-static void gst_implements_interface_init (GstImplementsInterfaceClass * klass);
 
-GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
-    init_interface);
+G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
+    init_interface (g_define_type_id));
 
 static void
 test_element_mixer_interface_init (GstMixerClass * klass)
@@ -67,45 +68,17 @@ init_interface (GType type)
     NULL,
     NULL,
   };
-  static const GInterfaceInfo implements_iface_info = {
-    (GInterfaceInitFunc) gst_implements_interface_init,
-    NULL,
-    NULL,
-  };
 
-  g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
-      &implements_iface_info);
   g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
 }
 
 static void
-test_element_base_init (gpointer klass)
-{
-}
-
-static void
 test_element_class_init (TestElementClass * klass)
 {
 }
 
-static gboolean
-test_element_interface_supported (GstImplementsInterface * ifacE,
-    GType interface_type)
-{
-  if (interface_type == GST_TYPE_MIXER)
-    return TRUE;
-
-  return FALSE;
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = test_element_interface_supported;
-}
-
 static void
-test_element_init (TestElement * this, TestElementClass * klass)
+test_element_init (TestElement * this)
 {
 }
 
index 1f143a3..893ed0b 100644 (file)
@@ -57,8 +57,8 @@ static void init_interface (GType type);
 static void nav_send_event (GstNavigation * navigation,
     GstStructure * structure);
 
-GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
-    init_interface);
+G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
+    init_interface (g_define_type_id));
 
 static void
 test_element_navigation_interface_init (GstNavigationInterface * klass)
@@ -80,17 +80,12 @@ init_interface (GType type)
 }
 
 static void
-test_element_base_init (gpointer klass)
-{
-}
-
-static void
 test_element_class_init (TestElementClass * klass)
 {
 }
 
 static void
-test_element_init (TestElement * this, TestElementClass * klass)
+test_element_init (TestElement * this)
 {
 }
 
index 3236a0f..5485439 100644 (file)
@@ -29,7 +29,7 @@
 
 GST_START_TEST (test_netbuffer_copy)
 {
-  GstNetBuffer *netbuf, *copy;
+  GstBuffer *netbuf, *copy;
   guint8 ipv6_addr[16] = { 0xff, 0x11, 0xee, 0x22, 0xdd, 0x33, 0xcc,
     0x44, 0xbb, 0x55, 0xaa, 0x66, 0x00, 0x77, 0x99, 0x88
   };
@@ -38,44 +38,88 @@ GST_START_TEST (test_netbuffer_copy)
   guint16 ipv6_port = 3490;
   guint16 ipv4_port = 5678;
   guint16 port;
+  GstMetaNetAddress *meta, *cmeta;
+  gsize len;
+  guint8 *data1, *data2;
+  gsize size1, size2;
 
-  netbuf = gst_netbuffer_new ();
+  netbuf = gst_buffer_new ();
   fail_unless (netbuf != NULL, "failed to create net buffer");
+  meta = gst_buffer_add_meta_net_address (netbuf);
 
-  gst_netaddress_set_ip4_address (&netbuf->from, ipv4_addr, ipv4_port);
-  gst_netaddress_set_ip6_address (&netbuf->to, ipv6_addr, ipv6_port);
+  gst_netaddress_set_ip4_address (&meta->naddr, ipv4_addr, ipv4_port);
+
+  len = strlen (DATA_STRING);
+  gst_buffer_take_memory (netbuf, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) DATA_STRING, NULL, len, 0, len));
 
-  GST_BUFFER_DATA (netbuf) = (guint8 *) DATA_STRING;
-  GST_BUFFER_SIZE (netbuf) = strlen (DATA_STRING);
   GST_BUFFER_FLAG_SET (netbuf, GST_BUFFER_FLAG_DISCONT);
-  GST_BUFFER_FLAG_SET (netbuf, GST_BUFFER_FLAG_READONLY);
 
-  copy = (GstNetBuffer *) gst_buffer_copy (GST_BUFFER_CAST (netbuf));
+  copy = gst_buffer_copy (netbuf);
   fail_unless (copy != NULL, "failed to copy net buffer");
-  fail_unless (GST_IS_NETBUFFER (copy), "copied buffer is not a GstNetBuffer!");
+
+  cmeta = gst_buffer_get_meta_net_address (copy);
+  fail_unless (cmeta != NULL, "copied buffer is not a GstNetBuffer!");
 
   fail_unless_equals_int (GST_MINI_OBJECT_REFCOUNT_VALUE (copy), 1);
 
-  fail_unless_equals_int (GST_BUFFER_SIZE (copy), GST_BUFFER_SIZE (netbuf));
-  fail_unless (memcmp (GST_BUFFER_DATA (copy), GST_BUFFER_DATA (netbuf),
-          GST_BUFFER_SIZE (copy)) == 0);
+  data1 = gst_buffer_map (netbuf, &size1, NULL, GST_MAP_READ);
+  data2 = gst_buffer_map (copy, &size2, NULL, GST_MAP_READ);
+  fail_unless_equals_int (size1, size2);
+  fail_unless (memcmp (data1, data2, size1) == 0);
+  gst_buffer_unmap (copy, data2, size2);
+  gst_buffer_unmap (netbuf, data1, size1);
 
-  fail_if (GST_BUFFER_FLAG_IS_SET (copy, GST_BUFFER_FLAG_READONLY));
   fail_unless (GST_BUFFER_FLAG_IS_SET (copy, GST_BUFFER_FLAG_DISCONT));
 
-  fail_unless (gst_netaddress_get_ip4_address (&copy->from, &ipv4_copy, &port));
+  fail_unless (gst_netaddress_get_ip4_address (&cmeta->naddr, &ipv4_copy,
+          &port));
   fail_unless (ipv4_copy == ipv4_addr,
       "Copied buffer has wrong IPV4 from address");
   fail_unless (port == ipv4_port, "Copied buffer has wrong IPV4 from port");
+  gst_buffer_unref (netbuf);
+  gst_buffer_unref (copy);
+
+  netbuf = gst_buffer_new ();
+  fail_unless (netbuf != NULL, "failed to create net buffer");
+  meta = gst_buffer_add_meta_net_address (netbuf);
+
+  gst_netaddress_set_ip6_address (&meta->naddr, ipv6_addr, ipv6_port);
+
+  len = strlen (DATA_STRING);
+  gst_buffer_take_memory (netbuf, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          (gpointer) DATA_STRING, NULL, len, 0, len));
+
+  GST_BUFFER_FLAG_SET (netbuf, GST_BUFFER_FLAG_DISCONT);
+
+  copy = gst_buffer_copy (netbuf);
+  fail_unless (copy != NULL, "failed to copy net buffer");
+
+  cmeta = gst_buffer_get_meta_net_address (copy);
+  fail_unless (cmeta != NULL, "copied buffer is not a GstNetBuffer!");
+
+  fail_unless_equals_int (GST_MINI_OBJECT_REFCOUNT_VALUE (copy), 1);
+
+  data1 = gst_buffer_map (netbuf, &size1, NULL, GST_MAP_READ);
+  data2 = gst_buffer_map (copy, &size2, NULL, GST_MAP_READ);
+  fail_unless_equals_int (size1, size2);
+  fail_unless (memcmp (data1, data2, size1) == 0);
+  gst_buffer_unmap (copy, data2, size2);
+  gst_buffer_unmap (netbuf, data1, size1);
+
+  fail_unless (GST_BUFFER_FLAG_IS_SET (copy, GST_BUFFER_FLAG_DISCONT));
 
-  fail_unless (gst_netaddress_get_ip6_address (&copy->to, ipv6_copy, &port));
+  fail_unless (gst_netaddress_get_ip6_address (&cmeta->naddr, ipv6_copy,
+          &port));
   fail_unless (memcmp (ipv6_copy, ipv6_addr, 16) == 0,
       "Copied buffer has wrong IPv6 destination address");
   fail_unless (port == ipv6_port,
       "Copied buffer has wrong IPv6 destination port");
+  gst_buffer_unref (netbuf);
+  gst_buffer_unref (copy);
 
-  gst_buffer_unref (GST_BUFFER_CAST (netbuf));
-  gst_buffer_unref (GST_BUFFER_CAST (copy));
 }
 
 GST_END_TEST;
index 144d9a6..c31567f 100644 (file)
@@ -60,8 +60,8 @@ missing_msg_check_getters (GstMessage * msg)
 
 GST_START_TEST (test_pb_utils_post_missing_messages)
 {
+  const GstStructure *s;
   GstElement *pipeline;
-  GstStructure *s;
   GstMessage *msg;
   GstCaps *caps;
   GstBus *bus;
@@ -95,8 +95,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_uri_source_message_new (pipeline, "http");
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
@@ -109,8 +109,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_uri_sink_message_new (pipeline, "smb");
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisink");
@@ -123,8 +123,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_uri_source_message_new (pipeline, "chchck");
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
@@ -137,8 +137,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_uri_sink_message_new (pipeline, "chchck");
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisink");
@@ -151,8 +151,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_element_message_new (pipeline, "foobar");
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "element");
@@ -168,8 +168,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_decoder_message_new (pipeline, caps);
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
@@ -181,8 +181,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_encoder_message_new (pipeline, caps);
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "encoder");
@@ -198,8 +198,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_decoder_message_new (pipeline, caps);
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
@@ -213,8 +213,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
   msg = gst_missing_encoder_message_new (pipeline, caps);
   fail_unless (msg != NULL);
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
-  fail_unless (msg->structure != NULL);
-  s = msg->structure;
+  fail_unless (gst_message_get_structure (msg) != NULL);
+  s = gst_message_get_structure (msg);
   fail_unless (gst_structure_has_name (s, "missing-plugin"));
   fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
   fail_unless_equals_string (gst_structure_get_string (s, "type"), "encoder");
@@ -271,7 +271,7 @@ static const gchar *caps_strings[] = {
   "video/x-h261", "video/x-huffyuv", "video/x-intel-h263", "video/x-jpeg",
   "video/x-mjpeg", "video/x-mjpeg-b", "video/mpegts", "video/x-mng",
   "video/x-mszh", "video/x-msvideocodec", "video/x-mve", "video/x-nut",
-  "video/x-nuv", "video/x-qdrw", "video/x-raw-gray", "video/x-smc",
+  "video/x-nuv", "video/x-qdrw", "video/x-raw", "video/x-smc",
   "video/x-smoke", "video/x-tarkin", "video/x-theora", "video/x-rle",
   "video/x-ultimotion", "video/x-vcd", "video/x-vmnc", "video/x-vp3",
   "video/x-vp5", "video/x-vp6", "video/x-vp6-flash", "video/x-vp7",
@@ -383,8 +383,8 @@ static const gchar *caps_strings[] = {
   "audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2",
   "audio/x-raw-float, rate=(int)22050, channels=(int)2, endianness=(int)1234, width=(int)32",
   /* raw video */
-  "video/x-raw-rgb, bpp=(int)16, endianness=(int)1234, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)320, height=(int)240, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1",
-  "video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1",
+  "video/x-raw, format=(string)RGB16, width=(int)320, height=(int)240, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1",
+  "video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1",
   /* and a made-up format */
   "video/x-tpm"
 };
@@ -623,7 +623,7 @@ GST_START_TEST (test_pb_utils_installer_details)
   /* uri source */
   detail1 = gst_missing_uri_source_installer_detail_new ("http");
   fail_unless (detail1 != NULL);
-  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
+  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.11|"));
   fail_unless (g_str_has_suffix (detail1, "|urisource-http"));
   msg = gst_missing_uri_source_message_new (el, "http");
   fail_unless (msg != NULL);
@@ -637,7 +637,7 @@ GST_START_TEST (test_pb_utils_installer_details)
   /* uri sink */
   detail1 = gst_missing_uri_sink_installer_detail_new ("http");
   fail_unless (detail1 != NULL);
-  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
+  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.11|"));
   fail_unless (g_str_has_suffix (detail1, "|urisink-http"));
   msg = gst_missing_uri_sink_message_new (el, "http");
   fail_unless (msg != NULL);
@@ -651,7 +651,7 @@ GST_START_TEST (test_pb_utils_installer_details)
   /* element */
   detail1 = gst_missing_element_installer_detail_new ("deinterlace");
   fail_unless (detail1 != NULL);
-  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
+  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.11|"));
   fail_unless (g_str_has_suffix (detail1, "|element-deinterlace"));
   msg = gst_missing_element_message_new (el, "deinterlace");
   fail_unless (msg != NULL);
@@ -667,7 +667,7 @@ GST_START_TEST (test_pb_utils_installer_details)
       2, "channels", G_TYPE_INT, 6, NULL);
   detail1 = gst_missing_decoder_installer_detail_new (caps);
   fail_unless (detail1 != NULL);
-  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
+  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.11|"));
   fail_unless (g_str_has_suffix (detail1,
           "|decoder-audio/x-spiffy, spiffyversion=(int)2"));
   msg = gst_missing_decoder_message_new (el, caps);
@@ -684,7 +684,7 @@ GST_START_TEST (test_pb_utils_installer_details)
   caps = gst_caps_new_simple ("audio/x-spiffy", "spiffyversion", G_TYPE_INT,
       2, "channels", G_TYPE_INT, 6, NULL);
   detail1 = gst_missing_encoder_installer_detail_new (caps);
-  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
+  fail_unless (g_str_has_prefix (detail1, "gstreamer|0.11|"));
   fail_unless (g_str_has_suffix (detail1,
           "|encoder-audio/x-spiffy, spiffyversion=(int)2"));
   fail_unless (detail1 != NULL);
index 285a58e..334d55c 100644 (file)
@@ -239,8 +239,7 @@ create_saveload_target (const gchar * targetname)
 
   caps = gst_caps_from_string ("video/x-glitter,sparkling=True");
   caps2 =
-      gst_caps_from_string
-      ("video/x-raw-yuv,width=640,height=480,framerate=15/1");
+      gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=15/1");
   sprof = (GstEncodingProfile *)
       gst_encoding_video_profile_new (caps, "seriously glittery", caps2, 0);
   gst_encoding_video_profile_set_variableframerate ((GstEncodingVideoProfile *)
@@ -289,7 +288,8 @@ GST_START_TEST (test_saving_profile)
   fail_unless (gst_encoding_target_save (orig, NULL));
 
   /* Check we can load it */
-  profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
+  profile_file_name =
+      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
       "encoding-profiles", "herding", "myponytarget2.gep", NULL);
   GST_DEBUG ("Loading target from '%s'", profile_file_name);
   loaded = gst_encoding_target_load_from_file (profile_file_name, NULL);
@@ -375,8 +375,7 @@ test_individual_target (GstEncodingTarget * target)
   GST_DEBUG ("Checking the container profile has the video//x-glitter stream");
   tmpcaps = gst_caps_from_string ("video/x-glitter,sparkling=True");
   tmpcaps2 =
-      gst_caps_from_string
-      ("video/x-raw-yuv,width=640,height=480,framerate=15/1");
+      gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=15/1");
   sprof2 = (GstEncodingProfile *)
       gst_encoding_video_profile_new (tmpcaps, "seriously glittery", tmpcaps2,
       0);
@@ -396,7 +395,7 @@ GST_START_TEST (test_loading_profile)
   GstEncodingProfile *profile;
   GstCaps *tmpcaps;
   GValue strvalue = { 0, };
-  GValue miniobjectvalue = { 0, };
+  GValue objectvalue = { 0, };
 
   /* Test loading using short method and all arguments */
   target = gst_encoding_target_load ("myponytarget", "herding", NULL);
@@ -411,7 +410,8 @@ GST_START_TEST (test_loading_profile)
   gst_encoding_target_unref (target);
 
   /* Test loading using fully specified path */
-  profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
+  profile_file_name =
+      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
       "encoding-profiles", "herding", "myponytarget.gep", NULL);
 
   GST_DEBUG ("Loading target from '%s'", profile_file_name);
@@ -442,13 +442,13 @@ GST_START_TEST (test_loading_profile)
 
   /* For my next trick, I will need the assistance of a GValue */
   g_value_init (&strvalue, G_TYPE_STRING);
-  g_value_init (&miniobjectvalue, GST_TYPE_ENCODING_PROFILE);
+  g_value_init (&objectvalue, GST_TYPE_ENCODING_PROFILE);
   g_value_set_static_string (&strvalue, "myponytarget/pony");
-  fail_unless (g_value_transform (&strvalue, &miniobjectvalue));
-  profile = (GstEncodingProfile *) gst_value_dup_mini_object (&miniobjectvalue);
+  fail_unless (g_value_transform (&strvalue, &objectvalue));
+  profile = (GstEncodingProfile *) g_value_dup_object (&objectvalue);
   fail_if (profile == NULL);
   g_value_unset (&strvalue);
-  g_value_unset (&miniobjectvalue);
+  g_value_unset (&objectvalue);
   tmpcaps = gst_caps_from_string ("animal/x-pony");
   CHECK_PROFILE (profile, "pony", "I don't want a description !", tmpcaps, NULL,
       0, 0);
@@ -489,7 +489,7 @@ GST_START_TEST (test_target_list)
   /* If tmp is NULL, it means we iterated the whole list without finding
    * our target */
   fail_if (tmp == NULL);
-  g_list_foreach (targets, (GFunc) gst_mini_object_unref, NULL);
+  g_list_foreach (targets, (GFunc) g_object_unref, NULL);
   g_list_free (targets);
 
   /* Try getting all available targets without a specified category */
@@ -503,7 +503,7 @@ GST_START_TEST (test_target_list)
   /* If tmp is NULL, it means we iterated the whole list without finding
    * our target */
   fail_if (tmp == NULL);
-  g_list_foreach (targets, (GFunc) gst_mini_object_unref, NULL);
+  g_list_foreach (targets, (GFunc) g_object_unref, NULL);
   g_list_free (targets);
 }
 
@@ -534,7 +534,7 @@ parent=pony\n\
 type=video\n\
 preset=seriously glittery\n\
 format=video/x-glitter,sparkling=True\n\
-restriction=video/x-raw-yuv,width=640,height=480,framerate=15/1\n\
+restriction=video/x-raw,width=640,height=480,framerate=15/1\n\
 presence=0\n\
 variableframerate=true\n\
 ";
@@ -544,11 +544,13 @@ remove_profile_file (void)
 {
   gchar *profile_file_name;
 
-  profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
+  profile_file_name =
+      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
       "encoding-profiles", "herding", "myponytarget.gep", NULL);
   g_unlink (profile_file_name);
   g_free (profile_file_name);
-  profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
+  profile_file_name =
+      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
       "encoding-profiles", "herding", "myponytarget2.gep", NULL);
   g_unlink (profile_file_name);
   g_free (profile_file_name);
@@ -562,10 +564,10 @@ create_profile_file (void)
   GError *error = NULL;
 
   profile_dir =
-      g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
       "encoding-profiles", "herding", NULL);
   profile_file_name =
-      g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
       "encoding-profiles", "herding", "myponytarget.gep", NULL);
   g_mkdir_with_parents (profile_dir, S_IRUSR | S_IWUSR | S_IXUSR);
   if (!g_file_set_contents (profile_file_name, profile_string,
@@ -597,7 +599,7 @@ profile_suite (void)
   gchar *gst_dir;
 
   /* cehck if we can create profiles */
-  gst_dir = g_build_filename (g_get_home_dir (), ".gstreamer-0.10", NULL);
+  gst_dir = g_build_filename (g_get_user_data_dir (), "gstreamer-0.11", NULL);
   can_write = (g_access (gst_dir, R_OK | W_OK | X_OK) == 0);
   g_free (gst_dir);
 
index 68c4535..16603be 100644 (file)
@@ -34,99 +34,109 @@ GST_START_TEST (test_rtp_buffer)
 {
   GstBuffer *buf;
   guint8 *data;
+  gsize size;
+  GstRTPBuffer rtp = { NULL, };
 
   /* check GstRTPHeader structure alignment and packing */
   buf = gst_rtp_buffer_new_allocate (16, 4, 0);
   fail_unless (buf != NULL);
-  fail_unless_equals_int (GST_BUFFER_SIZE (buf), RTP_HEADER_LEN + 16 + 4);
-  data = GST_BUFFER_DATA (buf);
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  fail_unless_equals_int (size, RTP_HEADER_LEN + 16 + 4);
+
+  gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
 
   /* check defaults */
-  fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2);
-  fail_unless (gst_rtp_buffer_get_padding (buf) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
-  fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
-  fail_unless (gst_rtp_buffer_get_marker (buf) == FALSE);
-  fail_unless (gst_rtp_buffer_get_payload_type (buf) == 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_version (&rtp), 2);
+  fail_unless (gst_rtp_buffer_get_padding (&rtp) == FALSE);
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == FALSE);
+  fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (&rtp), 0);
+  fail_unless (gst_rtp_buffer_get_marker (&rtp) == FALSE);
+  fail_unless (gst_rtp_buffer_get_payload_type (&rtp) == 0);
   fail_unless_equals_int (GST_READ_UINT16_BE (data), 0x8000);
 
   /* check version in bitfield */
-  gst_rtp_buffer_set_version (buf, 3);
-  fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 3);
+  gst_rtp_buffer_set_version (&rtp, 3);
+  fail_unless_equals_int (gst_rtp_buffer_get_version (&rtp), 3);
   fail_unless_equals_int ((data[0] & 0xC0) >> 6, 3);
-  gst_rtp_buffer_set_version (buf, 2);
-  fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2);
+  gst_rtp_buffer_set_version (&rtp, 2);
+  fail_unless_equals_int (gst_rtp_buffer_get_version (&rtp), 2);
   fail_unless_equals_int ((data[0] & 0xC0) >> 6, 2);
 
   /* check padding bit */
-  gst_rtp_buffer_set_padding (buf, TRUE);
-  fail_unless (gst_rtp_buffer_get_padding (buf) == TRUE);
+  gst_rtp_buffer_set_padding (&rtp, TRUE);
+  fail_unless (gst_rtp_buffer_get_padding (&rtp) == TRUE);
   fail_unless_equals_int ((data[0] & 0x20) >> 5, 1);
-  gst_rtp_buffer_set_padding (buf, FALSE);
-  fail_unless (gst_rtp_buffer_get_padding (buf) == FALSE);
+  gst_rtp_buffer_set_padding (&rtp, FALSE);
+  fail_unless (gst_rtp_buffer_get_padding (&rtp) == FALSE);
   fail_unless_equals_int ((data[0] & 0x20) >> 5, 0);
 
   /* check marker bit */
-  gst_rtp_buffer_set_marker (buf, TRUE);
-  fail_unless (gst_rtp_buffer_get_marker (buf) == TRUE);
+  gst_rtp_buffer_set_marker (&rtp, TRUE);
+  fail_unless (gst_rtp_buffer_get_marker (&rtp) == TRUE);
   fail_unless_equals_int ((data[1] & 0x80) >> 7, 1);
-  gst_rtp_buffer_set_marker (buf, FALSE);
-  fail_unless (gst_rtp_buffer_get_marker (buf) == FALSE);
+  gst_rtp_buffer_set_marker (&rtp, FALSE);
+  fail_unless (gst_rtp_buffer_get_marker (&rtp) == FALSE);
   fail_unless_equals_int ((data[1] & 0x80) >> 7, 0);
 
   /* check sequence offset */
-  gst_rtp_buffer_set_seq (buf, 0xF2C9);
-  fail_unless_equals_int (gst_rtp_buffer_get_seq (buf), 0xF2C9);
+  gst_rtp_buffer_set_seq (&rtp, 0xF2C9);
+  fail_unless_equals_int (gst_rtp_buffer_get_seq (&rtp), 0xF2C9);
   fail_unless_equals_int (GST_READ_UINT16_BE (data + 2), 0xF2C9);
-  gst_rtp_buffer_set_seq (buf, 0);
-  fail_unless_equals_int (gst_rtp_buffer_get_seq (buf), 0);
+  gst_rtp_buffer_set_seq (&rtp, 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_seq (&rtp), 0);
   fail_unless_equals_int (GST_READ_UINT16_BE (data + 2), 0);
 
   /* check timestamp offset */
-  gst_rtp_buffer_set_timestamp (buf, 432191);
+  gst_rtp_buffer_set_timestamp (&rtp, 432191);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 4), 432191);
-  fail_unless_equals_int (gst_rtp_buffer_get_timestamp (buf), 432191);
-  gst_rtp_buffer_set_timestamp (buf, 0);
-  fail_unless_equals_int (gst_rtp_buffer_get_timestamp (buf), 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_timestamp (&rtp), 432191);
+  gst_rtp_buffer_set_timestamp (&rtp, 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_timestamp (&rtp), 0);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 4), 0);
 
   /* check ssrc offset */
-  gst_rtp_buffer_set_ssrc (buf, 0xf04043C2);
-  fail_unless_equals_int (gst_rtp_buffer_get_ssrc (buf), (gint) 0xf04043c2);
+  gst_rtp_buffer_set_ssrc (&rtp, 0xf04043C2);
+  fail_unless_equals_int (gst_rtp_buffer_get_ssrc (&rtp), (gint) 0xf04043c2);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 4 + 4), (gint) 0xf04043c2);
-  gst_rtp_buffer_set_ssrc (buf, 0);
-  fail_unless_equals_int (gst_rtp_buffer_get_ssrc (buf), 0);
+  gst_rtp_buffer_set_ssrc (&rtp, 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_ssrc (&rtp), 0);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 4 + 4), 0);
 
   /* check csrc bits */
-  fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
-  ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (buf, 0));
+  fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (&rtp), 0);
+  ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (&rtp, 0));
   fail_unless_equals_int (data[0] & 0xf, 0);
+
+  gst_rtp_buffer_unmap (&rtp);
+  gst_buffer_unmap (buf, data, size);
   gst_buffer_unref (buf);
 
   /* and again, this time with CSRCs */
   buf = gst_rtp_buffer_new_allocate (16, 4, 3);
   fail_unless (buf != NULL);
-  fail_unless_equals_int (GST_BUFFER_SIZE (buf),
-      RTP_HEADER_LEN + 16 + 4 + 4 * 3);
+  data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+  fail_unless_equals_int (size, RTP_HEADER_LEN + 16 + 4 + 4 * 3);
 
-  data = GST_BUFFER_DATA (buf);
+  gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
 
-  fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 3);
-  ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (buf, 3));
+  fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (&rtp), 3);
+  ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (&rtp, 3));
   fail_unless_equals_int (data[0] & 0xf, 3);
-  fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 0), 0);
-  fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 1), 0);
-  fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 2), 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_csrc (&rtp, 0), 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_csrc (&rtp, 1), 0);
+  fail_unless_equals_int (gst_rtp_buffer_get_csrc (&rtp, 2), 0);
 
   data += RTP_HEADER_LEN;       /* skip the other header stuff */
-  gst_rtp_buffer_set_csrc (buf, 0, 0xf7c0);
+  gst_rtp_buffer_set_csrc (&rtp, 0, 0xf7c0);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 0 * 4), 0xf7c0);
-  gst_rtp_buffer_set_csrc (buf, 1, 0xf7c1);
+  gst_rtp_buffer_set_csrc (&rtp, 1, 0xf7c1);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 1 * 4), 0xf7c1);
-  gst_rtp_buffer_set_csrc (buf, 2, 0xf7c2);
+  gst_rtp_buffer_set_csrc (&rtp, 2, 0xf7c2);
   fail_unless_equals_int (GST_READ_UINT32_BE (data + 2 * 4), 0xf7c2);
-  ASSERT_CRITICAL (gst_rtp_buffer_set_csrc (buf, 3, 0xf123));
+  ASSERT_CRITICAL (gst_rtp_buffer_set_csrc (&rtp, 3, 0xf123));
+
+  gst_rtp_buffer_unmap (&rtp);
+  gst_buffer_unmap (buf, data, size);
   gst_buffer_unref (buf);
 }
 
@@ -143,15 +153,15 @@ GST_START_TEST (test_rtp_buffer_validate_corrupt)
     0xb0, 0x97, 0x63, 0x08, 0x10, 0x4b, 0x43, 0x85, 0x37, 0x2c
   };
 
-  buf = gst_buffer_new ();
-  GST_BUFFER_DATA (buf) = corrupt_rtp_packet;
-  GST_BUFFER_SIZE (buf) = sizeof (corrupt_rtp_packet);
+  buf = gst_buffer_new_and_alloc (sizeof (corrupt_rtp_packet));
+  gst_buffer_fill (buf, 0, corrupt_rtp_packet, sizeof (corrupt_rtp_packet));
   fail_if (gst_rtp_buffer_validate (buf));
   gst_buffer_unref (buf);
 }
 
 GST_END_TEST;
 
+#if 0
 GST_START_TEST (test_rtp_buffer_list)
 {
   GstBuffer *rtp_header;
@@ -203,6 +213,7 @@ GST_START_TEST (test_rtp_buffer_list)
 }
 
 GST_END_TEST;
+#endif
 
 GST_START_TEST (test_rtp_buffer_set_extension_data)
 {
@@ -213,158 +224,185 @@ GST_START_TEST (test_rtp_buffer_set_extension_data)
   guint8 misc_data[4] = { 1, 2, 3, 4 };
   gpointer pointer;
   guint8 appbits;
+  gsize bsize;
+  GstRTPBuffer rtp = { NULL, };
 
   /* check GstRTPHeader structure alignment and packing */
   buf = gst_rtp_buffer_new_allocate (4, 0, 0);
-  data = GST_BUFFER_DATA (buf);
+  data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+
+  gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
 
   /* should be impossible to set the extension data */
-  ASSERT_WARNING (fail_unless (gst_rtp_buffer_set_extension_data (buf, 0,
+  ASSERT_WARNING (fail_unless (gst_rtp_buffer_set_extension_data (&rtp, 0,
               4) == FALSE));
-  fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == FALSE);
 
   /* should be possible to set the extension data */
-  fail_unless (gst_rtp_buffer_set_extension_data (buf, 270, 0) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension (buf) == TRUE);
-  gst_rtp_buffer_get_extension_data (buf, &bits, &pointer, &size);
+  fail_unless (gst_rtp_buffer_set_extension_data (&rtp, 270, 0) == TRUE);
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == TRUE);
+  gst_rtp_buffer_get_extension_data (&rtp, &bits, &pointer, &size);
   fail_unless (bits == 270);
   fail_unless (size == 0);
-  fail_unless (pointer == GST_BUFFER_DATA (buf) + 16);
-  pointer = gst_rtp_buffer_get_payload (buf);
-  fail_unless (pointer == GST_BUFFER_DATA (buf) + 16);
+  fail_unless (pointer == data + 16);
+  pointer = gst_rtp_buffer_get_payload (&rtp);
+  fail_unless (pointer == data + 16);
+
+  gst_buffer_unmap (buf, data, bsize);
+  gst_rtp_buffer_unmap (&rtp);
   gst_buffer_unref (buf);
 
   buf = gst_rtp_buffer_new_allocate (20, 0, 0);
-  data = GST_BUFFER_DATA (buf);
-  fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
-  fail_unless (gst_rtp_buffer_set_extension_data (buf, 333, 2) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension (buf) == TRUE);
-  gst_rtp_buffer_get_extension_data (buf, &bits, &pointer, &size);
+  data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
+
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == FALSE);
+  fail_unless (gst_rtp_buffer_set_extension_data (&rtp, 333, 2) == TRUE);
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == TRUE);
+  gst_rtp_buffer_get_extension_data (&rtp, &bits, &pointer, &size);
   fail_unless (bits == 333);
   fail_unless (size == 2);
-  fail_unless (pointer == GST_BUFFER_DATA (buf) + 16);
-  pointer = gst_rtp_buffer_get_payload (buf);
-  fail_unless (pointer == GST_BUFFER_DATA (buf) + 24);
+  fail_unless (pointer == data + 16);
+  pointer = gst_rtp_buffer_get_payload (&rtp);
+  fail_unless (pointer == data + 24);
+
+  gst_buffer_unmap (buf, data, bsize);
+  gst_rtp_buffer_unmap (&rtp);
   gst_buffer_unref (buf);
 
   /* Test header extensions with a one byte header */
   buf = gst_rtp_buffer_new_allocate (20, 0, 0);
-  fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
+  data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
 
-  fail_unless (gst_rtp_buffer_add_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == FALSE);
+
+  fail_unless (gst_rtp_buffer_add_extension_onebyte_header (&rtp, 5,
           misc_data, 2) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension_data (buf, &bits, &pointer, &size));
+  fail_unless (gst_rtp_buffer_get_extension_data (&rtp, &bits, &pointer,
+          &size));
   fail_unless (bits == 0xBEDE);
   fail_unless (size == 1);
   data = (guint8 *) pointer;
   fail_unless (data[0] == ((5 << 4) | 1));
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 2,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 2,
           1, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           1, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
 
-  fail_unless (gst_rtp_buffer_add_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_add_extension_onebyte_header (&rtp, 5,
           misc_data, 4) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           1, &pointer, &size) == TRUE);
   fail_unless (size == 4);
   fail_unless (memcmp (pointer, misc_data, 4) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           2, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 2,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 2,
           1, &pointer, &size) == FALSE);
 
-  fail_unless (gst_rtp_buffer_add_extension_onebyte_header (buf, 6,
+  fail_unless (gst_rtp_buffer_add_extension_onebyte_header (&rtp, 6,
           misc_data, 2) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           1, &pointer, &size) == TRUE);
   fail_unless (size == 4);
   fail_unless (memcmp (pointer, misc_data, 4) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           3, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 2,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 2,
           1, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 6,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 6,
           2, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (buf, 5,
+  fail_unless (gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
+
+  gst_buffer_unmap (buf, data, bsize);
+  gst_rtp_buffer_unmap (&rtp);
   gst_buffer_unref (buf);
 
   /* Test header extensions with a two bytes header */
   buf = gst_rtp_buffer_new_allocate (20, 0, 0);
-  fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
+  data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+  gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
+
+  fail_unless (gst_rtp_buffer_get_extension (&rtp) == FALSE);
 
-  fail_unless (gst_rtp_buffer_add_extension_twobytes_header (buf, 0, 5,
+  fail_unless (gst_rtp_buffer_add_extension_twobytes_header (&rtp, 0, 5,
           misc_data, 2) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension_data (buf, &bits, &pointer, &size));
+  fail_unless (gst_rtp_buffer_get_extension_data (&rtp, &bits, &pointer,
+          &size));
   fail_unless (bits == 0x100 << 4);
   fail_unless (size == 1);
   data = (guint8 *) pointer;
   fail_unless (data[0] == 5);
   fail_unless (data[1] == 2);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 2,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 2,
           0, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           1, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
 
-  fail_unless (gst_rtp_buffer_add_extension_twobytes_header (buf, 0, 5,
+  fail_unless (gst_rtp_buffer_add_extension_twobytes_header (&rtp, 0, 5,
           misc_data, 4) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           1, &pointer, &size) == TRUE);
   fail_unless (size == 4);
   fail_unless (memcmp (pointer, misc_data, 4) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           2, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 2,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 2,
           0, &pointer, &size) == FALSE);
 
-  fail_unless (gst_rtp_buffer_add_extension_twobytes_header (buf, 0, 6,
+  fail_unless (gst_rtp_buffer_add_extension_twobytes_header (&rtp, 0, 6,
           misc_data, 2) == TRUE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           1, &pointer, &size) == TRUE);
   fail_unless (size == 4);
   fail_unless (memcmp (pointer, misc_data, 4) == 0);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           2, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 2,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 2,
           0, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 6,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 6,
           1, &pointer, &size) == FALSE);
-  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (buf, &appbits, 5,
+  fail_unless (gst_rtp_buffer_get_extension_twobytes_header (&rtp, &appbits, 5,
           0, &pointer, &size) == TRUE);
   fail_unless (size == 2);
   fail_unless (memcmp (pointer, misc_data, 2) == 0);
+
+  gst_buffer_unmap (buf, data, bsize);
+  gst_rtp_buffer_unmap (&rtp);
   gst_buffer_unref (buf);
 }
 
 GST_END_TEST;
 
+#if 0
 GST_START_TEST (test_rtp_buffer_list_set_extension)
 {
   GstBufferList *list;
@@ -544,6 +582,7 @@ GST_START_TEST (test_rtp_buffer_list_set_extension)
 }
 
 GST_END_TEST;
+#endif
 
 GST_START_TEST (test_rtp_seqnum_compare)
 {
@@ -635,17 +674,20 @@ GST_START_TEST (test_rtcp_buffer)
 {
   GstBuffer *buf;
   GstRTCPPacket packet;
+  GstRTCPBuffer rtcp = { NULL, };
 
   buf = gst_rtcp_buffer_new (1400);
   fail_unless (buf != NULL);
-  fail_unless_equals_int (GST_BUFFER_SIZE (buf), 1400);
+  fail_unless_equals_int (gst_buffer_get_size (buf), 1400);
+
+  gst_rtcp_buffer_map (buf, GST_MAP_READWRITE, &rtcp);
 
-  fail_unless (gst_rtcp_buffer_get_first_packet (buf, &packet) == FALSE);
-  fail_unless (gst_rtcp_buffer_get_packet_count (buf) == 0);
   fail_unless (gst_rtcp_buffer_validate (buf) == FALSE);
+  fail_unless (gst_rtcp_buffer_get_first_packet (&rtcp, &packet) == FALSE);
+  fail_unless (gst_rtcp_buffer_get_packet_count (&rtcp) == 0);
 
   /* add an SR packet */
-  fail_unless (gst_rtcp_buffer_add_packet (buf, GST_RTCP_TYPE_SR,
+  fail_unless (gst_rtcp_buffer_add_packet (&rtcp, GST_RTCP_TYPE_SR,
           &packet) == TRUE);
 
   fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
@@ -673,7 +715,7 @@ GST_START_TEST (test_rtcp_buffer)
   }
 
   /* go to first packet, this should be the packet we just added */
-  fail_unless (gst_rtcp_buffer_get_first_packet (buf, &packet) == TRUE);
+  fail_unless (gst_rtcp_buffer_get_first_packet (&rtcp, &packet) == TRUE);
 
   fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
   fail_unless (gst_rtcp_packet_get_count (&packet) == 0);
@@ -683,14 +725,14 @@ GST_START_TEST (test_rtcp_buffer)
   fail_unless (gst_rtcp_packet_move_to_next (&packet) == FALSE);
 
   /* add some SDES */
-  fail_unless (gst_rtcp_buffer_add_packet (buf, GST_RTCP_TYPE_SDES,
+  fail_unless (gst_rtcp_buffer_add_packet (&rtcp, GST_RTCP_TYPE_SDES,
           &packet) == TRUE);
   fail_unless (gst_rtcp_packet_sdes_add_item (&packet, 0xff658743) == TRUE);
   fail_unless (gst_rtcp_packet_sdes_add_entry (&packet, GST_RTCP_SDES_CNAME,
           sizeof ("test@foo.bar"), (guint8 *) "test@foo.bar") == TRUE);
 
   /* add some BYE */
-  fail_unless (gst_rtcp_buffer_add_packet (buf, GST_RTCP_TYPE_BYE,
+  fail_unless (gst_rtcp_buffer_add_packet (&rtcp, GST_RTCP_TYPE_BYE,
           &packet) == TRUE);
   fail_unless (gst_rtcp_packet_bye_add_ssrc (&packet, 0x5613212f) == TRUE);
   fail_unless (gst_rtcp_packet_bye_add_ssrc (&packet, 0x00112233) == TRUE);
@@ -702,7 +744,7 @@ GST_START_TEST (test_rtcp_buffer)
   fail_unless (gst_rtcp_packet_get_length (&packet) == 2);
 
   /* move to SDES */
-  fail_unless (gst_rtcp_buffer_get_first_packet (buf, &packet) == TRUE);
+  fail_unless (gst_rtcp_buffer_get_first_packet (&rtcp, &packet) == TRUE);
   fail_unless (gst_rtcp_packet_move_to_next (&packet) == TRUE);
 
   fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
@@ -720,7 +762,7 @@ GST_START_TEST (test_rtcp_buffer)
   fail_unless (gst_rtcp_packet_get_length (&packet) == 2);
 
   /* close and validate */
-  gst_rtcp_buffer_end (buf);
+  gst_rtcp_buffer_unmap (&rtcp);
   fail_unless (gst_rtcp_buffer_validate (buf) == TRUE);
   gst_buffer_unref (buf);
 }
@@ -737,12 +779,12 @@ rtp_suite (void)
   tcase_add_test (tc_chain, test_rtp_buffer);
   tcase_add_test (tc_chain, test_rtp_buffer_validate_corrupt);
   tcase_add_test (tc_chain, test_rtp_buffer_set_extension_data);
-  tcase_add_test (tc_chain, test_rtp_buffer_list_set_extension);
+  //tcase_add_test (tc_chain, test_rtp_buffer_list_set_extension);
   tcase_add_test (tc_chain, test_rtp_seqnum_compare);
 
   tcase_add_test (tc_chain, test_rtcp_buffer);
 
-  tcase_add_test (tc_chain, test_rtp_buffer_list);
+  //tcase_add_test (tc_chain, test_rtp_buffer_list);
 
   return s;
 }
index 6f504ad..bbedd28 100644 (file)
@@ -1,7 +1,5 @@
 
 GstCheckABIStruct list[] = {
-  {"GstAppBufferClass", sizeof (GstAppBufferClass), 16},
-  {"GstAppBuffer", sizeof (GstAppBuffer), 88},
   {"GstAppSinkCallbacks", sizeof (GstAppSinkCallbacks), 28},
   {"GstAppSinkClass", sizeof (GstAppSinkClass), 404},
   {"GstAppSink", sizeof (GstAppSink), 404},
@@ -49,8 +47,6 @@ GstCheckABIStruct list[] = {
   {"GstMixerTrack", sizeof (GstMixerTrack), 32},
   {"GstNavigationInterface", sizeof (GstNavigationInterface), 28},
   {"GstNetAddress", sizeof (GstNetAddress), 40},
-  {"GstNetBufferClass", sizeof (GstNetBufferClass), 32},
-  {"GstNetBuffer", sizeof (GstNetBuffer), 176},
   {"GstPropertyProbeInterface", sizeof (GstPropertyProbeInterface), 44},
   {"gst_riff_acid", sizeof (gst_riff_acid), 24},
   {"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
index 3029e56..9f18dfb 100644 (file)
@@ -1,7 +1,5 @@
 
 GstCheckABIStruct list[] = {
-  {"GstAppBufferClass", sizeof (GstAppBufferClass), 32},
-  {"GstAppBuffer", sizeof (GstAppBuffer), 136},
   {"GstAppSinkCallbacks", sizeof (GstAppSinkCallbacks), 56},
   {"GstAppSinkClass", sizeof (GstAppSinkClass), 800},
   {"GstAppSink", sizeof (GstAppSink), 640},
@@ -49,8 +47,6 @@ GstCheckABIStruct list[] = {
   {"GstMixerTrack", sizeof (GstMixerTrack), 48},
   {"GstNavigationInterface", sizeof (GstNavigationInterface), 56},
   {"GstNetAddress", sizeof (GstNetAddress), 56},
-  {"GstNetBufferClass", sizeof (GstNetBufferClass), 64},
-  {"GstNetBuffer", sizeof (GstNetBuffer), 264},
   {"GstPropertyProbeInterface", sizeof (GstPropertyProbeInterface), 88},
   {"gst_riff_acid", sizeof (gst_riff_acid), 24},
   {"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
@@ -95,6 +91,6 @@ GstCheckABIStruct list[] = {
   {"GstVideoRectangle", sizeof (GstVideoRectangle), 16},
   {"GstVideoSinkClass", sizeof (GstVideoSinkClass), 760},
   {"GstVideoSink", sizeof (GstVideoSink), 640},
-  {"GstXOverlayClass", sizeof (GstXOverlayClass), 64},
+  {"GstVideoOverlayIface", sizeof (GstVideoOverlayIface), 64},
   {NULL, 0, 0}
 };
index 5b53e89..5ad4d2a 100644 (file)
@@ -408,6 +408,8 @@ GST_START_TEST (test_vorbis_tags)
   /* now, while we still have a taglist, test _to_vorbiscomment_buffer() */
   {
     GstBuffer *buf1, *buf2;
+    guint8 *data1, *data2;
+    gsize size1, size2;
 
     ASSERT_CRITICAL (gst_tag_list_to_vorbiscomment_buffer (NULL,
             (const guint8 *) "x", 1, "x"));
@@ -419,8 +421,13 @@ GST_START_TEST (test_vorbis_tags)
         (const guint8 *) "foo", 3, NULL);
     fail_unless (buf2 != NULL);
 
-    fail_unless (memcmp (GST_BUFFER_DATA (buf1), GST_BUFFER_DATA (buf2) + 3,
-            GST_BUFFER_SIZE (buf1)) == 0);
+    data1 = gst_buffer_map (buf1, &size1, NULL, GST_MAP_READ);
+    data2 = gst_buffer_map (buf2, &size2, NULL, GST_MAP_READ);
+
+    fail_unless (memcmp (data1, data2 + 3, size1) == 0);
+
+    gst_buffer_unmap (buf2, data2, size2);
+    gst_buffer_unmap (buf1, data1, size1);
 
     gst_buffer_unref (buf1);
     gst_buffer_unref (buf2);
@@ -438,8 +445,10 @@ GST_START_TEST (test_vorbis_tags)
     gchar *vendor = NULL;
 
     buf = gst_buffer_new ();
-    GST_BUFFER_DATA (buf) = (guint8 *) speex_comments_buf1;
-    GST_BUFFER_SIZE (buf) = sizeof (speex_comments_buf1);
+    gst_buffer_take_memory (buf, -1,
+        gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+            (gpointer) speex_comments_buf1, NULL,
+            sizeof (speex_comments_buf1), 0, sizeof (speex_comments_buf1)));
 
     /* make sure it doesn't memcmp over the end of the buffer */
     fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf,
@@ -481,8 +490,10 @@ GST_START_TEST (test_vorbis_tags)
     gchar *vendor = NULL;
 
     buf = gst_buffer_new ();
-    GST_BUFFER_DATA (buf) = (guint8 *) vorbis_comments_buf;
-    GST_BUFFER_SIZE (buf) = sizeof (vorbis_comments_buf);
+    gst_buffer_take_memory (buf, -1,
+        gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+            (gpointer) vorbis_comments_buf, NULL,
+            sizeof (vorbis_comments_buf), 0, sizeof (vorbis_comments_buf)));
 
     /* make sure it doesn't memcmp over the end of the buffer */
     fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf,
@@ -941,7 +952,7 @@ GST_START_TEST (test_xmp_formatting)
   GstTagList *list;
   GstBuffer *buf;
   const gchar *text;
-  guint len;
+  gsize len;
 
   /* test data */
   list = gst_tag_list_new_full (GST_TAG_TITLE, "test title",
@@ -951,8 +962,7 @@ GST_START_TEST (test_xmp_formatting)
   buf = gst_tag_list_to_xmp_buffer (list, FALSE);
   fail_unless (buf != NULL);
 
-  text = (const gchar *) GST_BUFFER_DATA (buf);
-  len = GST_BUFFER_SIZE (buf);
+  text = gst_buffer_map (buf, &len, NULL, GST_MAP_READ);
 
   /* check the content */
   fail_unless (g_strrstr_len (text, len, "<?xpacket begin") == text);
@@ -961,6 +971,7 @@ GST_START_TEST (test_xmp_formatting)
   fail_unless (g_strrstr_len (text, len, ">keyword1<") != NULL);
   fail_unless (g_strrstr_len (text, len, ">keyword2<") != NULL);
   fail_unless (g_strrstr_len (text, len, "<?xpacket end") != NULL);
+  gst_buffer_unmap (buf, (gpointer) text, len);
 
   gst_buffer_unref (buf);
   gst_tag_list_free (list);
@@ -999,16 +1010,18 @@ GST_START_TEST (test_xmp_parsing)
   };
 
   /* test data */
-  buf = gst_buffer_new ();
-
   i = 0;
   while (test_data[i].xmp_data) {
+    gsize len;
+
     GST_DEBUG ("trying test-data %u", i);
 
     text = g_strconcat (xmp_header, test_data[i].xmp_data, xmp_footer, NULL);
-    GST_BUFFER_DATA (buf) = (guint8 *) text;
-    GST_BUFFER_SIZE (buf) = strlen (text) + 1;
 
+    buf = gst_buffer_new ();
+    len = strlen (text) + 1;
+    gst_buffer_take_memory (buf, -1,
+        gst_memory_new_wrapped (0, text, NULL, len, 0, len));
 
     list = gst_tag_list_from_xmp_buffer (buf);
     if (test_data[i].result_size >= 0) {
@@ -1029,11 +1042,10 @@ GST_START_TEST (test_xmp_parsing)
     if (list)
       gst_tag_list_free (list);
 
+    gst_buffer_unref (buf);
     g_free (text);
     i++;
   }
-
-  gst_buffer_unref (buf);
 }
 
 GST_END_TEST;
@@ -1454,6 +1466,7 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
   GstBuffer *buf = NULL;
   gint i;
   GstTagList *taglist;
+  guint8 *data;
 
   gst_tag_register_musicbrainz_tags ();
 
@@ -1764,8 +1777,10 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
 
   g_value_init (&value, GST_TYPE_BUFFER);
   buf = gst_buffer_new_and_alloc (1024);
+  data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
   for (i = 0; i < 1024; i++)
-    GST_BUFFER_DATA (buf)[i] = i % 255;
+    data[i] = i % 255;
+  gst_buffer_unmap (buf, data, 1024);
   gst_value_set_buffer (&value, buf);
   gst_buffer_unref (buf);
   do_simple_exif_tag_serialization_deserialization (GST_TAG_APPLICATION_DATA,
index a10ac64..f3735d2 100644 (file)
@@ -358,11 +358,49 @@ video_format_is_packed (GstVideoFormat fmt)
   return FALSE;
 }
 
+GST_START_TEST (test_video_formats_all)
+{
+  GstStructure *s;
+  const GValue *val, *list_val;
+  GstCaps *caps;
+  guint num, n, num_formats;
+
+  num_formats = 100;
+  fail_unless (gst_video_format_to_string (num_formats) == NULL);
+  while (gst_video_format_to_string (num_formats) == NULL)
+    --num_formats;
+  GST_INFO ("number of known video formats: %d", num_formats);
+
+  caps = gst_caps_from_string ("video/x-raw, format=" GST_VIDEO_FORMATS_ALL);
+  s = gst_caps_get_structure (caps, 0);
+  val = gst_structure_get_value (s, "format");
+  fail_unless (val != NULL);
+  fail_unless (GST_VALUE_HOLDS_LIST (val));
+  num = gst_value_list_get_size (val);
+  fail_unless (num > 0);
+  for (n = 0; n < num; ++n) {
+    const gchar *fmt_str;
+
+    list_val = gst_value_list_get_value (val, n);
+    fail_unless (G_VALUE_HOLDS_STRING (list_val));
+    fmt_str = g_value_get_string (list_val);
+    GST_INFO ("format: %s", fmt_str);
+    fail_if (gst_video_format_from_string (fmt_str) ==
+        GST_VIDEO_FORMAT_UNKNOWN);
+  }
+  fail_unless_equals_int (num, num_formats);
+
+  gst_caps_unref (caps);
+}
+
+GST_END_TEST;
+
 GST_START_TEST (test_video_formats)
 {
   guint i;
 
   for (i = 0; i < G_N_ELEMENTS (fourcc_list); ++i) {
+    const GstVideoFormatInfo *vf_info;
     GstVideoFormat fmt;
     const gchar *s;
     guint32 fourcc;
@@ -375,49 +413,58 @@ GST_START_TEST (test_video_formats)
     if (fmt == GST_VIDEO_FORMAT_UNKNOWN)
       continue;
 
-    GST_INFO ("Fourcc %s, packed=%d", fourcc_list[i].fourcc,
+    vf_info = gst_video_format_get_info (fmt);
+    fail_unless (vf_info != NULL);
+
+    fail_unless_equals_int (GST_VIDEO_FORMAT_INFO_FORMAT (vf_info), fmt);
+
+    GST_INFO ("Fourcc %s, packed=%", fourcc_list[i].fourcc,
         gst_video_format_is_packed (fmt));
 
-    fail_unless (gst_video_format_is_yuv (fmt));
+    fail_unless (GST_VIDEO_FORMAT_INFO_IS_YUV (vf_info));
 
     /* use any non-NULL pointer so we can compare against NULL */
     {
       paintinfo paintinfo = { 0, };
       fourcc_list[i].paint_setup (&paintinfo, (unsigned char *) s);
       if (paintinfo.ap != NULL) {
-        fail_unless (gst_video_format_has_alpha (fmt));
+        fail_unless (GST_VIDEO_FORMAT_INFO_HAS_ALPHA (vf_info));
       } else {
-        fail_if (gst_video_format_has_alpha (fmt));
+        fail_if (GST_VIDEO_FORMAT_INFO_HAS_ALPHA (vf_info));
       }
     }
 
     for (w = 1; w <= 65; ++w) {
       for (h = 1; h <= 65; ++h) {
+        GstVideoInfo vinfo;
         paintinfo paintinfo = { 0, };
         guint off0, off1, off2, off3;
         guint size;
 
         GST_LOG ("%s, %dx%d", fourcc_list[i].fourcc, w, h);
 
+        gst_video_info_init (&vinfo);
+        gst_video_info_set_format (&vinfo, fmt, w, h);
+
         paintinfo.width = w;
         paintinfo.height = h;
         fourcc_list[i].paint_setup (&paintinfo, NULL);
-        fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 0, w),
+        fail_unless_equals_int (GST_VIDEO_INFO_COMP_STRIDE (&vinfo, 0),
             paintinfo.ystride);
         if (!gst_video_format_is_packed (fmt)
-            && !gst_video_format_is_gray (fmt)) {
+            && !GST_VIDEO_FORMAT_INFO_IS_GRAY (vf_info)) {
           /* planar */
-          fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 1, w),
+          fail_unless_equals_int (GST_VIDEO_INFO_COMP_STRIDE (&vinfo, 1),
               paintinfo.ustride);
-          fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 2, w),
+          fail_unless_equals_int (GST_VIDEO_INFO_COMP_STRIDE (&vinfo, 2),
               paintinfo.vstride);
           /* check component_width * height against offsets/size somehow? */
         }
 
-        size = gst_video_format_get_size (fmt, w, h);
-        off0 = gst_video_format_get_component_offset (fmt, 0, w, h);
-        off1 = gst_video_format_get_component_offset (fmt, 1, w, h);
-        off2 = gst_video_format_get_component_offset (fmt, 2, w, h);
+        size = GST_VIDEO_INFO_SIZE (&vinfo);
+        off0 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 0);
+        off1 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 1);
+        off2 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 2);
 
         fail_unless_equals_int (size, (unsigned long) paintinfo.endptr);
         fail_unless_equals_int (off0, (unsigned long) paintinfo.yp);
@@ -425,7 +472,7 @@ GST_START_TEST (test_video_formats)
         fail_unless_equals_int (off2, (unsigned long) paintinfo.vp);
 
         /* should be 0 if there's no alpha component */
-        off3 = gst_video_format_get_component_offset (fmt, 3, w, h);
+        off3 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 3);
         fail_unless_equals_int (off3, (unsigned long) paintinfo.ap);
 
         /* some gstvideo checks ... (FIXME: fails for Y41B and Y42B; not sure
@@ -434,12 +481,12 @@ GST_START_TEST (test_video_formats)
             && fmt != GST_VIDEO_FORMAT_Y800) {
           guint cs0, cs1, cs2, cs3;
 
-          cs0 = gst_video_format_get_component_width (fmt, 0, w) *
-              gst_video_format_get_component_height (fmt, 0, h);
-          cs1 = gst_video_format_get_component_width (fmt, 1, w) *
-              gst_video_format_get_component_height (fmt, 1, h);
-          cs2 = gst_video_format_get_component_width (fmt, 2, w) *
-              gst_video_format_get_component_height (fmt, 2, h);
+          cs0 = GST_VIDEO_INFO_COMP_WIDTH (&vinfo, 0) *
+              GST_VIDEO_INFO_COMP_HEIGHT (&vinfo, 0);
+          cs1 = GST_VIDEO_INFO_COMP_WIDTH (&vinfo, 1) *
+              GST_VIDEO_INFO_COMP_HEIGHT (&vinfo, 1);
+          cs2 = GST_VIDEO_INFO_COMP_WIDTH (&vinfo, 2) *
+              GST_VIDEO_INFO_COMP_HEIGHT (&vinfo, 2);
 
           /* GST_LOG ("cs0=%d,cs1=%d,cs2=%d,off0=%d,off1=%d,off2=%d,size=%d",
              cs0, cs1, cs2, off0, off1, off2, size); */
@@ -447,9 +494,9 @@ GST_START_TEST (test_video_formats)
           if (!gst_video_format_is_packed (fmt))
             fail_unless (cs0 <= off1);
 
-          if (gst_video_format_has_alpha (fmt)) {
-            cs3 = gst_video_format_get_component_width (fmt, 3, w) *
-                gst_video_format_get_component_height (fmt, 3, h);
+          if (GST_VIDEO_FORMAT_INFO_HAS_ALPHA (vinfo.finfo)) {
+            cs3 = GST_VIDEO_INFO_COMP_WIDTH (&vinfo, 3) *
+                GST_VIDEO_INFO_COMP_HEIGHT (&vinfo, 2);
             fail_unless (cs3 < size);
             /* U/V/alpha shouldn't take up more space than the Y component */
             fail_if (cs1 > cs0, "cs1 (%d) should be <= cs0 (%d)", cs1, cs0);
@@ -478,11 +525,17 @@ GST_END_TEST;
 
 GST_START_TEST (test_video_formats_rgb)
 {
+  GstVideoInfo vinfo;
   gint width, height, framerate_n, framerate_d, par_n, par_d;
-  GstCaps *caps =
-      gst_video_format_new_caps (GST_VIDEO_FORMAT_RGB, 800, 600, 0, 1, 1, 1);
+  GstCaps *caps;
   GstStructure *structure;
 
+  gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_RGB, 800, 600);
+  vinfo.par_n = 1;
+  vinfo.par_d = 1;
+  vinfo.fps_n = 0;
+  vinfo.fps_d = 1;
+  caps = gst_video_info_to_caps (&vinfo);
   structure = gst_caps_get_structure (caps, 0);
 
   fail_unless (gst_structure_get_int (structure, "width", &width));
@@ -504,15 +557,6 @@ GST_START_TEST (test_video_formats_rgb)
 
 GST_END_TEST;
 
-GST_START_TEST (test_video_template_caps)
-{
-  GstCaps *caps = gst_video_format_new_template_caps (GST_VIDEO_FORMAT_RGB);
-  gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-
 GST_START_TEST (test_dar_calc)
 {
   guint display_ratio_n, display_ratio_d;
@@ -546,27 +590,26 @@ GST_START_TEST (test_parse_caps_rgb)
   } formats[] = {
     /* 24 bit */
     {
-    GST_VIDEO_CAPS_RGB, GST_VIDEO_FORMAT_RGB}, {
-    GST_VIDEO_CAPS_BGR, GST_VIDEO_FORMAT_BGR},
+    GST_VIDEO_CAPS_MAKE ("RGB"), GST_VIDEO_FORMAT_RGB}, {
+    GST_VIDEO_CAPS_MAKE ("BGR"), GST_VIDEO_FORMAT_BGR},
         /* 32 bit (no alpha) */
     {
-    GST_VIDEO_CAPS_RGBx, GST_VIDEO_FORMAT_RGBx}, {
-    GST_VIDEO_CAPS_xRGB, GST_VIDEO_FORMAT_xRGB}, {
-    GST_VIDEO_CAPS_BGRx, GST_VIDEO_FORMAT_BGRx}, {
-    GST_VIDEO_CAPS_xBGR, GST_VIDEO_FORMAT_xBGR},
+    GST_VIDEO_CAPS_MAKE ("RGBx"), GST_VIDEO_FORMAT_RGBx}, {
+    GST_VIDEO_CAPS_MAKE ("xRGB"), GST_VIDEO_FORMAT_xRGB}, {
+    GST_VIDEO_CAPS_MAKE ("BGRx"), GST_VIDEO_FORMAT_BGRx}, {
+    GST_VIDEO_CAPS_MAKE ("xBGR"), GST_VIDEO_FORMAT_xBGR},
         /* 32 bit (with alpha) */
     {
-    GST_VIDEO_CAPS_RGBA, GST_VIDEO_FORMAT_RGBA}, {
-    GST_VIDEO_CAPS_ARGB, GST_VIDEO_FORMAT_ARGB}, {
-    GST_VIDEO_CAPS_BGRA, GST_VIDEO_FORMAT_BGRA}, {
-    GST_VIDEO_CAPS_ABGR, GST_VIDEO_FORMAT_ABGR}
+    GST_VIDEO_CAPS_MAKE ("RGBA"), GST_VIDEO_FORMAT_RGBA}, {
+    GST_VIDEO_CAPS_MAKE ("ARGB"), GST_VIDEO_FORMAT_ARGB}, {
+    GST_VIDEO_CAPS_MAKE ("BGRA"), GST_VIDEO_FORMAT_BGRA}, {
+    GST_VIDEO_CAPS_MAKE ("ABGR"), GST_VIDEO_FORMAT_ABGR}
   };
   gint i;
 
   for (i = 0; i < G_N_ELEMENTS (formats); ++i) {
-    GstVideoFormat fmt = GST_VIDEO_FORMAT_UNKNOWN;
+    GstVideoInfo vinfo;
     GstCaps *caps, *caps2;
-    int w = -1, h = -1;
 
     caps = gst_caps_from_string (formats[i].tmpl_caps_string);
     gst_caps_set_simple (caps, "width", G_TYPE_INT, 2 * (i + 1), "height",
@@ -576,13 +619,14 @@ GST_START_TEST (test_parse_caps_rgb)
 
     GST_DEBUG ("testing caps: %" GST_PTR_FORMAT, caps);
 
-    fail_unless (gst_video_format_parse_caps (caps, &fmt, &w, &h));
-    fail_unless_equals_int (fmt, formats[i].fmt);
-    fail_unless_equals_int (w, 2 * (i + 1));
-    fail_unless_equals_int (h, i + 1);
+    gst_video_info_init (&vinfo);
+    fail_unless (gst_video_info_from_caps (&vinfo, caps));
+    fail_unless_equals_int (GST_VIDEO_INFO_FORMAT (&vinfo), formats[i].fmt);
+    fail_unless_equals_int (GST_VIDEO_INFO_WIDTH (&vinfo), 2 * (i + 1));
+    fail_unless_equals_int (GST_VIDEO_INFO_HEIGHT (&vinfo), i + 1);
 
     /* make sure they're serialised back correctly */
-    caps2 = gst_video_format_new_caps (fmt, w, h, 15, 1, 1, 1);
+    caps2 = gst_video_info_to_caps (&vinfo);
     fail_unless (caps != NULL);
     fail_unless (gst_caps_is_equal (caps, caps2));
 
@@ -621,6 +665,7 @@ GST_END_TEST;
 
 GST_START_TEST (test_convert_frame)
 {
+  GstVideoInfo vinfo;
   GstCaps *from_caps, *to_caps;
   GstBuffer *from_buffer, *to_buffer;
   GError *error = NULL;
@@ -628,38 +673,48 @@ GST_START_TEST (test_convert_frame)
   guint8 *data;
 
   from_buffer = gst_buffer_new_and_alloc (640 * 480 * 4);
-  data = GST_BUFFER_DATA (from_buffer);
 
+  data = gst_buffer_map (from_buffer, NULL, NULL, GST_MAP_WRITE);
   for (i = 0; i < 640 * 480; i++) {
     data[4 * i + 0] = 0;        /* x */
     data[4 * i + 1] = 255;      /* R */
     data[4 * i + 2] = 0;        /* G */
     data[4 * i + 3] = 0;        /* B */
   }
-  from_caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB,
-      640, 480, 25, 1, 1, 1);
-  gst_buffer_set_caps (from_buffer, from_caps);
+  gst_buffer_unmap (from_buffer, data, 640 * 480 * 4);
+
+  gst_video_info_init (&vinfo);
+  gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 640, 480);
+  vinfo.fps_n = 25;
+  vinfo.fps_d = 1;
+  vinfo.par_n = 1;
+  vinfo.par_d = 1;
+  from_caps = gst_video_info_to_caps (&vinfo);
 
   to_caps =
       gst_caps_from_string
       ("something/that, does=(string)not, exist=(boolean)FALSE");
 
   to_buffer =
-      gst_video_convert_frame (from_buffer, to_caps, GST_CLOCK_TIME_NONE,
-      &error);
+      gst_video_convert_frame (from_buffer, from_caps, to_caps,
+      GST_CLOCK_TIME_NONE, &error);
   fail_if (to_buffer != NULL);
   fail_unless (error != NULL);
   g_error_free (error);
   error = NULL;
 
   gst_caps_unref (to_caps);
-  to_caps =
-      gst_video_format_new_caps (GST_VIDEO_FORMAT_I420, 240, 320, 25, 1, 1, 2);
+  gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 240, 320);
+  vinfo.fps_n = 25;
+  vinfo.fps_d = 1;
+  vinfo.par_n = 1;
+  vinfo.par_d = 2;
+  to_caps = gst_video_info_to_caps (&vinfo);
+
   to_buffer =
-      gst_video_convert_frame (from_buffer, to_caps, GST_CLOCK_TIME_NONE,
-      &error);
+      gst_video_convert_frame (from_buffer, from_caps, to_caps,
+      GST_CLOCK_TIME_NONE, &error);
   fail_unless (to_buffer != NULL);
-  fail_unless (gst_caps_can_intersect (to_caps, GST_BUFFER_CAPS (to_buffer)));
   fail_unless (error == NULL);
 
   gst_buffer_unref (from_buffer);
@@ -689,6 +744,7 @@ convert_frame_async_callback (GstBuffer * buf, GError * err,
 
 GST_START_TEST (test_convert_frame_async)
 {
+  GstVideoInfo vinfo;
   GstCaps *from_caps, *to_caps;
   GstBuffer *from_buffer;
   gint i;
@@ -697,17 +753,23 @@ GST_START_TEST (test_convert_frame_async)
   ConvertFrameContext cf_data = { NULL, NULL, NULL };
 
   from_buffer = gst_buffer_new_and_alloc (640 * 480 * 4);
-  data = GST_BUFFER_DATA (from_buffer);
 
+  data = gst_buffer_map (from_buffer, NULL, NULL, GST_MAP_WRITE);
   for (i = 0; i < 640 * 480; i++) {
     data[4 * i + 0] = 0;        /* x */
     data[4 * i + 1] = 255;      /* R */
     data[4 * i + 2] = 0;        /* G */
     data[4 * i + 3] = 0;        /* B */
   }
-  from_caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB,
-      640, 480, 25, 1, 1, 1);
-  gst_buffer_set_caps (from_buffer, from_caps);
+  gst_buffer_unmap (from_buffer, data, 640 * 480 * 4);
+
+  gst_video_info_init (&vinfo);
+  gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 640, 470);
+  vinfo.par_n = 1;
+  vinfo.par_d = 1;
+  vinfo.fps_n = 25;
+  vinfo.fps_d = 1;
+  from_caps = gst_video_info_to_caps (&vinfo);
 
   to_caps =
       gst_caps_from_string
@@ -715,7 +777,8 @@ GST_START_TEST (test_convert_frame_async)
 
   loop = cf_data.loop = g_main_loop_new (NULL, FALSE);
 
-  gst_video_convert_frame_async (from_buffer, to_caps, GST_CLOCK_TIME_NONE,
+  gst_video_convert_frame_async (from_buffer, from_caps, to_caps,
+      GST_CLOCK_TIME_NONE,
       (GstVideoConvertFrameCallback) convert_frame_async_callback, &cf_data,
       NULL);
 
@@ -727,15 +790,19 @@ GST_START_TEST (test_convert_frame_async)
   cf_data.error = NULL;
 
   gst_caps_unref (to_caps);
-  to_caps =
-      gst_video_format_new_caps (GST_VIDEO_FORMAT_I420, 240, 320, 25, 1, 1, 2);
-  gst_video_convert_frame_async (from_buffer, to_caps, GST_CLOCK_TIME_NONE,
+  gst_video_info_init (&vinfo);
+  gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_I420, 240, 320);
+  vinfo.par_n = 1;
+  vinfo.par_d = 2;
+  vinfo.fps_n = 25;
+  vinfo.fps_d = 1;
+  to_caps = gst_video_info_to_caps (&vinfo);
+  gst_video_convert_frame_async (from_buffer, from_caps, to_caps,
+      GST_CLOCK_TIME_NONE,
       (GstVideoConvertFrameCallback) convert_frame_async_callback, &cf_data,
       NULL);
   g_main_loop_run (loop);
   fail_unless (cf_data.buffer != NULL);
-  fail_unless (gst_caps_can_intersect (to_caps,
-          GST_BUFFER_CAPS (cf_data.buffer)));
   fail_unless (cf_data.error == NULL);
 
   gst_buffer_unref (from_buffer);
@@ -750,20 +817,17 @@ GST_END_TEST;
 
 GST_START_TEST (test_video_size_from_caps)
 {
-  gint size;
-  guint32 fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
-  GstCaps *caps = gst_caps_new_simple ("video/x-raw-yuv",
-      "format", GST_TYPE_FOURCC, fourcc,
+  GstVideoInfo vinfo;
+  GstCaps *caps;
+
+  caps = gst_caps_new_simple ("video/x-raw",
+      "format", G_TYPE_STRING, "YV12",
       "width", G_TYPE_INT, 640,
-      "height", G_TYPE_INT, 480,
-      "framerate", GST_TYPE_FRACTION, 25, 1,
-      NULL);
+      "height", G_TYPE_INT, 480, "framerate", GST_TYPE_FRACTION, 25, 1, NULL);
 
-  fail_unless (gst_video_get_size_from_caps (caps, &size));
-  fail_unless (size ==
-      gst_video_format_get_size (gst_video_format_from_fourcc (fourcc), 640,
-          480));
-  fail_unless (size == (640 * 480 * 12 / 8));
+  gst_video_info_init (&vinfo);
+  fail_unless (gst_video_info_from_caps (&vinfo, caps));
+  fail_unless (GST_VIDEO_INFO_SIZE (&vinfo) == (640 * 480 * 12 / 8));
 
   gst_caps_unref (caps);
 }
@@ -779,7 +843,7 @@ video_suite (void)
   suite_add_tcase (s, tc_chain);
   tcase_add_test (tc_chain, test_video_formats);
   tcase_add_test (tc_chain, test_video_formats_rgb);
-  tcase_add_test (tc_chain, test_video_template_caps);
+  tcase_add_test (tc_chain, test_video_formats_all);
   tcase_add_test (tc_chain, test_dar_calc);
   tcase_add_test (tc_chain, test_parse_caps_rgb);
   tcase_add_test (tc_chain, test_events);
index 99b84ae..49fd1e7 100644 (file)
@@ -50,8 +50,8 @@ GType test_element_get_type (void);
 
 static void init_interface (GType type);
 
-GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
-    init_interface);
+G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
+    init_interface (g_define_type_id));
 
 static void
 init_interface (GType type)
@@ -67,17 +67,12 @@ init_interface (GType type)
 }
 
 static void
-test_element_base_init (gpointer klass)
-{
-}
-
-static void
 test_element_class_init (TestElementClass * klass)
 {
 }
 
 static void
-test_element_init (TestElement * this, TestElementClass * klass)
+test_element_init (TestElement * this)
 {
 }
 
@@ -143,11 +138,22 @@ tag_list_equals (GstTagList * taglist, GstTagList * taglist2)
 static gboolean
 gst_buffer_equals (GstBuffer * buf_a, GstBuffer * buf_b)
 {
-  if (GST_BUFFER_SIZE (buf_a) != GST_BUFFER_SIZE (buf_b))
-    return FALSE;
+  gboolean res;
+  gpointer data1, data2;
+  gsize size1, size2;
+
+  data1 = gst_buffer_map (buf_a, &size1, NULL, GST_MAP_READ);
+  data2 = gst_buffer_map (buf_b, &size2, NULL, GST_MAP_READ);
+
+  if (size1 == size2) {
+    res = memcmp (data1, data2, size1) == 0;
+  } else {
+    res = FALSE;
+  }
+  gst_buffer_unmap (buf_a, data1, size1);
+  gst_buffer_unmap (buf_b, data2, size2);
 
-  return memcmp (GST_BUFFER_DATA (buf_a), GST_BUFFER_DATA (buf_b),
-      GST_BUFFER_SIZE (buf_a)) == 0;
+  return res;
 }
 
 static GstTagList *
index f18a713..3a8de0d 100644 (file)
 
 #include <gst/check/gstcheck.h>
 
-#define FIRST_CAPS  "video/x-raw-yuv,width=(int)480,height=(int)320"
-#define SECOND_CAPS "video/x-raw-yuv,width=(int)120,height=(int)100"
-#define THIRD_CAPS  "video/x-raw-yuv,width=(int)[10,50],height=(int)[100,200]"
-#define FOURTH_CAPS "video/x-raw-rgb,width=(int)300,height=(int)[25,75];" \
-                    "video/x-raw-yuv,width=(int)[30,40]," \
-                    "height=(int)[100,200],format=(fourcc)YUY2"
+#define FIRST_CAPS  "video/x-raw,width=(int)480,height=(int)320"
+#define SECOND_CAPS "video/x-raw,width=(int)120,height=(int)100"
+#define THIRD_CAPS  "video/x-raw,width=(int)[10,50],height=(int)[100,200]"
+#define FOURTH_CAPS "video/x-raw,width=(int)300,height=(int)[25,75];" \
+                    "video/x-raw,width=(int)[30,40]," \
+                    "height=(int)[100,200],format=(string)YUY2"
 
 int buffer_count = 0;
 GstCaps *current_caps = NULL;
@@ -88,7 +88,10 @@ buffer_probe (GstPad * pad, GstMiniObject * obj, gpointer data)
   return TRUE;
 }
 
-GST_START_TEST (test_capsfilter_renegotiation)
+/* launch line is a pipeline that must have a capsfilter named 'cf' that
+ * will be used to trigger the renegotiation */
+static void
+run_capsfilter_renegotiation (const gchar * launch_line)
 {
   GstElement *capsfilter;
   GstElement *sink;
@@ -103,8 +106,7 @@ GST_START_TEST (test_capsfilter_renegotiation)
     gst_caps_unref (current_caps);
   current_caps = NULL;
 
-  pipeline = gst_parse_launch ("videotestsrc num-buffers=200 ! capsfilter "
-      "caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink", NULL);
+  pipeline = gst_parse_launch (launch_line, NULL);
   g_assert (pipeline);
 
   capsfilter = gst_bin_get_by_name (GST_BIN (pipeline), "cf");
@@ -126,18 +128,30 @@ GST_START_TEST (test_capsfilter_renegotiation)
       GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
 
   g_assert (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS);
-
   g_assert (caps_change == 4);
 
   gst_element_set_state (pipeline, GST_STATE_NULL);
 
   if (current_caps)
     gst_caps_unref (current_caps);
+  current_caps = NULL;
   gst_message_unref (msg);
   g_object_unref (bus);
   g_object_unref (G_OBJECT (pipeline));
 }
 
+GST_START_TEST (test_capsfilter_renegotiation)
+{
+  run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=true"
+      " ! capsfilter caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink");
+  run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=false"
+      " ! capsfilter caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink");
+  run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=false"
+      " ! capsfilter caps=\"video/x-raw, format=(string)I420, width=(int)100, height=(int)100\" "
+      " ! videoconvert ! videoscale ! capsfilter caps=\"" FIRST_CAPS
+      "\" name=cf " " ! fakesink name=sink");
+}
+
 GST_END_TEST;
 
 static Suite *
index ee14110..10b9213 100644 (file)
@@ -68,7 +68,6 @@ GST_START_TEST (test_memory_stream)
   guint8 *in_data;
   guint8 *out_data;
   gint i;
-  GstFormat fmt = GST_FORMAT_BYTES;
   gint64 duration;
   guint bus_watch = 0;
 
@@ -110,7 +109,7 @@ GST_START_TEST (test_memory_stream)
   gst_element_set_state (bin, GST_STATE_PAUSED);
   gst_element_get_state (bin, NULL, NULL, -1);
 
-  fail_unless (gst_element_query_duration (bin, &fmt, &duration));
+  fail_unless (gst_element_query_duration (bin, GST_FORMAT_BYTES, &duration));
   fail_unless_equals_int (duration, 512);
 
   gst_element_set_state (bin, GST_STATE_PLAYING);
@@ -130,7 +129,7 @@ GST_START_TEST (test_memory_stream)
   gst_element_set_state (bin, GST_STATE_PAUSED);
   gst_element_get_state (bin, NULL, NULL, -1);
 
-  fail_unless (gst_element_query_duration (bin, &fmt, &duration));
+  fail_unless (gst_element_query_duration (bin, GST_FORMAT_BYTES, &duration));
   fail_unless_equals_int (duration, 512);
 
   gst_element_set_state (bin, GST_STATE_PLAYING);
index 81056ca..6b072bc 100644 (file)
@@ -157,21 +157,20 @@ check_chain_final_state (gpointer key, ChainState * state, gpointer data)
   return TRUE;
 }
 
-static gboolean
-eos_buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
+static GstProbeReturn
+eos_buffer_probe (GstPad * pad, GstProbeType type, GstBuffer * buffer,
+    gpointer unused)
 {
   gint ret;
   gint size;
-  guint8 *data;
   gchar *oggbuffer;
   ChainState *state = NULL;
   gboolean has_video = FALSE;
 
-  size = GST_BUFFER_SIZE (buffer);
-  data = GST_BUFFER_DATA (buffer);
+  size = gst_buffer_get_size (buffer);
 
   oggbuffer = ogg_sync_buffer (&oggsync, size);
-  memcpy (oggbuffer, data, size);
+  gst_buffer_extract (buffer, 0, oggbuffer, size);
   ogg_sync_wrote (&oggsync, size);
 
   do {
@@ -197,7 +196,7 @@ eos_buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
     }
   }
 
-  return TRUE;
+  return GST_PROBE_OK;
 }
 
 static void
@@ -210,7 +209,8 @@ start_pipeline (GstElement * bin, GstPad * pad)
   eos_chain_states =
       g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
   probe_id =
-      gst_pad_add_buffer_probe (pad, G_CALLBACK (eos_buffer_probe), NULL);
+      gst_pad_add_probe (pad, GST_PROBE_TYPE_BUFFER,
+      (GstPadProbeCallback) eos_buffer_probe, NULL, NULL);
 
   ret = gst_element_set_state (bin, GST_STATE_PLAYING);
   fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not start test pipeline");
@@ -232,7 +232,7 @@ stop_pipeline (GstElement * bin, GstPad * pad)
     fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not stop test pipeline");
   }
 
-  gst_pad_remove_buffer_probe (pad, (guint) probe_id);
+  gst_pad_remove_probe (pad, probe_id);
   ogg_sync_clear (&oggsync);
 
   /* check end conditions, such as EOS flags */
@@ -292,7 +292,7 @@ test_pipeline (const char *pipeline)
     GstStructure *s;
     GstCaps *muxcaps;
 
-    muxcaps = gst_pad_get_negotiated_caps (sinkpad);
+    muxcaps = gst_pad_get_current_caps (sinkpad);
     fail_unless (muxcaps != NULL);
     s = gst_caps_get_structure (muxcaps, 0);
     fail_unless (gst_structure_has_name (s, "application/ogg"));
@@ -350,7 +350,7 @@ GST_END_TEST;
 GST_START_TEST (test_theora)
 {
   test_pipeline
-      ("videotestsrc num-buffers=5 ! ffmpegcolorspace ! theoraenc ! oggmux");
+      ("videotestsrc num-buffers=5 ! videoconvert ! theoraenc ! oggmux");
 }
 
 GST_END_TEST;
@@ -360,7 +360,7 @@ GST_END_TEST;
 GST_START_TEST (test_theora_vorbis)
 {
   test_pipeline
-      ("videotestsrc num-buffers=10 ! ffmpegcolorspace ! theoraenc ! queue ! oggmux name=mux "
+      ("videotestsrc num-buffers=10 ! videoconvert ! theoraenc ! queue ! oggmux name=mux "
       "audiotestsrc num-buffers=2 ! audioconvert ! vorbisenc ! queue ! mux.");
 }
 
@@ -369,7 +369,7 @@ GST_END_TEST;
 GST_START_TEST (test_vorbis_theora)
 {
   test_pipeline
-      ("videotestsrc num-buffers=2 ! ffmpegcolorspace ! theoraenc ! queue ! oggmux name=mux "
+      ("videotestsrc num-buffers=2 ! videoconvert ! theoraenc ! queue ! oggmux name=mux "
       "audiotestsrc num-buffers=10 ! audioconvert ! vorbisenc ! queue ! mux.");
 }
 
index ab636d9..a21cd62 100644 (file)
@@ -122,7 +122,7 @@ GST_START_TEST (test_element_negotiation)
 
 #ifdef HAVE_LIBVISUAL
   s = "audiotestsrc num-buffers=30 ! tee name=t ! alsasink t. ! audioconvert ! "
-      "libvisual_lv_scope ! ffmpegcolorspace ! xvimagesink";
+      "libvisual_lv_scope ! videoconvert ! xvimagesink";
   run_pipeline (setup_pipeline (s), s,
       GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
       GST_MESSAGE_UNKNOWN);
@@ -140,17 +140,17 @@ GST_START_TEST (test_basetransform_based)
 
   /* Check that videoscale can pick a height given only a width */
   s = "videotestsrc num-buffers=2 ! "
-      "video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! "
-      "videoscale ! video/x-raw-yuv,width=640 ! fakesink";
+      "video/x-raw,format=(string)I420,width=320,height=240 ! "
+      "videoscale ! video/x-raw,width=640 ! fakesink";
   run_pipeline (setup_pipeline (s), s,
       GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
       GST_MESSAGE_UNKNOWN);
 
-  /* Test that ffmpegcolorspace can pick an output format that isn't
+  /* Test that videoconvert can pick an output format that isn't
    * passthrough without completely specified output caps */
   s = "videotestsrc num-buffers=2 ! "
-      "video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! "
-      "ffmpegcolorspace ! video/x-raw-rgb ! fakesink";
+      "video/x-raw,format=(string)I420,width=320,height=240 ! "
+      "videoconvert ! video/x-raw,format=(string)RGB ! fakesink";
   run_pipeline (setup_pipeline (s), s,
       GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
       GST_MESSAGE_UNKNOWN);
@@ -172,30 +172,28 @@ GST_START_TEST (test_basetransform_based)
       GST_MESSAGE_UNKNOWN);
 
   /* Check that videoscale doesn't claim to be able to transform input in
-   * formats it can't handle for a given scaling method; ffmpegcolorspace
+   * formats it can't handle for a given scaling method; videoconvert
    * should then make sure a format that can be handled is chosen (4-tap
    * scaling is not implemented for RGB and packed yuv currently) */
-  s = "videotestsrc num-buffers=2 ! video/x-raw-rgb,width=64,height=64 ! "
-      "ffmpegcolorspace ! videoscale method=4-tap ! ffmpegcolorspace ! "
-      "video/x-raw-rgb,width=32,height=32,framerate=(fraction)30/1,"
-      "pixel-aspect-ratio=(fraction)1/1,bpp=(int)24,depth=(int)24,"
-      "red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255,"
-      "endianness=(int)4321 ! fakesink";
+  s = "videotestsrc num-buffers=2 ! video/x-raw,format=(string)ARGB64 ! "
+      "videoconvert ! videoscale method=4-tap ! videoconvert ! "
+      "video/x-raw,format=(string)RGB, width=32,height=32,framerate=(fraction)30/1,"
+      "pixel-aspect-ratio=(fraction)1/1 ! fakesink";
   run_pipeline (setup_pipeline (s), s,
       GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
       GST_MESSAGE_UNKNOWN);
-  s = "videotestsrc num-buffers=2 ! video/x-raw-yuv,format=(fourcc)AYUV,"
-      "width=64,height=64 ! ffmpegcolorspace ! videoscale method=4-tap ! "
-      "ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)AYUV,width=32,"
+  s = "videotestsrc num-buffers=2 ! video/x-raw,format=(string)AYUV,"
+      "width=64,height=64 ! videoconvert ! videoscale method=4-tap ! "
+      "videoconvert ! video/x-raw,format=(string)AYUV,width=32,"
       "height=32 ! fakesink";
   run_pipeline (setup_pipeline (s), s,
       GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
       GST_MESSAGE_UNKNOWN);
   /* make sure nothing funny happens in passthrough mode (we don't check that
    * passthrough mode is chosen though) */
-  s = "videotestsrc num-buffers=2 ! video/x-raw-yuv,format=(fourcc)I420,"
-      "width=64,height=64 ! ffmpegcolorspace ! videoscale method=4-tap ! "
-      "ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)I420,width=32,"
+  s = "videotestsrc num-buffers=2 ! video/x-raw,format=(string)I420,"
+      "width=64,height=64 ! videoconvert ! videoscale method=4-tap ! "
+      "videoconvert ! video/x-raw,format=(string)I420,width=32,"
       "height=32 ! fakesink";
   run_pipeline (setup_pipeline (s), s,
       GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
index c3872ad..e32ba33 100644 (file)
@@ -122,6 +122,11 @@ static int n_in_caps = 0;
 static gboolean
 buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
 {
+  guint8 *data;
+  gsize size;
+
+  data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+
   if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
     GstCaps *caps;
     GstStructure *s;
@@ -143,22 +148,27 @@ buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
 
     for (i = 0; i < 3; ++i) {
       GValue *val;
+      guint8 *data2;
+      gsize size2;
 
       val = &g_array_index (buffers, GValue, i);
       buf = g_value_peek_pointer (val);
       fail_unless (GST_IS_BUFFER (buf));
-      if (GST_BUFFER_SIZE (buf) == GST_BUFFER_SIZE (buffer)) {
-        if (memcmp (GST_BUFFER_DATA (buf), GST_BUFFER_DATA (buffer),
-                GST_BUFFER_SIZE (buffer)) == 0) {
+
+      data2 = gst_buffer_map (buf, &size2, NULL, GST_MAP_READ);
+      if (size2 == size) {
+        if (memcmp (data2, data, size) == 0) {
           found = TRUE;
         }
       }
+      gst_buffer_unmap (buf, data2, size2);
     }
     fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps",
         buffer);
 
     gst_caps_unref (caps);
   }
+  gst_buffer_unmap (buffer, data, size);
 
   return TRUE;
 }
index 3b101d0..88eb373 100644 (file)
@@ -135,7 +135,7 @@ GST_START_TEST (test_granulepos_offset)
   GError *error = NULL;
 
   pipe_str = g_strdup_printf ("videotestsrc timestamp-offset=%" G_GUINT64_FORMAT
-      " num-buffers=10 ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
+      " num-buffers=10 ! video/x-raw,format=(string)I420,framerate=10/1"
       " ! theoraenc ! fakesink name=fs0", TIMESTAMP_OFFSET);
 
   bin = gst_parse_launch (pipe_str, &error);
@@ -228,7 +228,7 @@ GST_START_TEST (test_continuity)
   GError *error = NULL;
 
   pipe_str = g_strdup_printf ("videotestsrc num-buffers=10"
-      " ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
+      " ! video/x-raw,format=(string)I420,framerate=10/1"
       " ! theoraenc ! fakesink name=fs0");
 
   bin = gst_parse_launch (pipe_str, &error);
@@ -308,10 +308,16 @@ GST_START_TEST (test_continuity)
 
 GST_END_TEST;
 
-static gboolean
-drop_second_data_buffer (GstPad * droppad, GstBuffer * buffer, gpointer unused)
+static GstProbeReturn
+drop_second_data_buffer (GstPad * droppad, GstProbeType probe_type,
+    gpointer probe_obj, gpointer unused)
 {
-  return !(GST_BUFFER_OFFSET (buffer) == 1);
+  GstBuffer *buffer = probe_obj;
+
+  if (GST_BUFFER_OFFSET (buffer) == 1)
+    return GST_PROBE_DROP;
+  else
+    return GST_PROBE_OK;
 }
 
 GST_START_TEST (test_discontinuity)
@@ -324,7 +330,7 @@ GST_START_TEST (test_discontinuity)
   guint drop_id;
 
   pipe_str = g_strdup_printf ("videotestsrc num-buffers=10"
-      " ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
+      " ! video/x-raw,format=(string)I420,framerate=10/1"
       " ! theoraenc ! fakesink name=fs0");
 
   bin = gst_parse_launch (pipe_str, &error);
@@ -355,8 +361,8 @@ GST_START_TEST (test_discontinuity)
     gst_object_unref (sink);
   }
 
-  drop_id = gst_pad_add_buffer_probe (droppad,
-      G_CALLBACK (drop_second_data_buffer), NULL);
+  drop_id = gst_pad_add_probe (droppad, GST_PROBE_TYPE_BUFFER,
+      drop_second_data_buffer, NULL, NULL);
   gst_buffer_straw_start_pipeline (bin, pad);
 
   /* header packets should have timestamp == NONE, granulepos 0 */
@@ -413,7 +419,7 @@ GST_START_TEST (test_discontinuity)
   }
 
   gst_buffer_straw_stop_pipeline (bin, pad);
-  gst_pad_remove_buffer_probe (droppad, drop_id);
+  gst_pad_remove_probe (droppad, drop_id);
 
   gst_object_unref (droppad);
   gst_object_unref (pad);
index b207dff..b079d63 100644 (file)
@@ -261,10 +261,18 @@ GST_START_TEST (test_timestamps)
 
 GST_END_TEST;
 
-static gboolean
-drop_second_data_buffer (GstPad * droppad, GstBuffer * buffer, gpointer unused)
+static GstProbeReturn
+drop_second_data_buffer (GstPad * droppad, GstProbeType type,
+    GstBuffer * buffer, gpointer unused)
 {
-  return !(GST_BUFFER_OFFSET (buffer) == 1024);
+  GstProbeReturn res = GST_PROBE_OK;
+
+  if (GST_BUFFER_OFFSET (buffer) == 1024)
+    res = GST_PROBE_DROP;
+
+  GST_DEBUG ("dropping %d", res);
+
+  return res;
 }
 
 GST_START_TEST (test_discontinuity)
@@ -307,8 +315,8 @@ GST_START_TEST (test_discontinuity)
     gst_object_unref (sink);
   }
 
-  drop_id = gst_pad_add_buffer_probe (droppad,
-      G_CALLBACK (drop_second_data_buffer), NULL);
+  drop_id = gst_pad_add_probe (droppad, GST_PROBE_TYPE_BUFFER,
+      (GstPadProbeCallback) drop_second_data_buffer, NULL, NULL);
   gst_buffer_straw_start_pipeline (bin, pad);
 
   /* check header packets */
@@ -356,16 +364,16 @@ GST_START_TEST (test_discontinuity)
      * samples (because of the overlap/add), so it won't increment the 
      * granulepos, which should be 2048 after the discontinuity.
      */
+    fail_unless (GST_BUFFER_IS_DISCONT (buffer),
+        "expected discontinuous buffer");
     fail_unless (GST_BUFFER_OFFSET_END (buffer) == 2048,
         "expected granulepos after gap: %" G_GUINT64_FORMAT,
         GST_BUFFER_OFFSET_END (buffer));
-    fail_unless (GST_BUFFER_IS_DISCONT (buffer),
-        "expected discontinuous buffer");
     gst_buffer_unref (buffer);
   }
 
   gst_buffer_straw_stop_pipeline (bin, pad);
-  gst_pad_remove_buffer_probe (droppad, drop_id);
+  gst_pad_remove_probe (droppad, drop_id);
 
   gst_object_unref (droppad);
   gst_object_unref (pad);
index 14795db..317f851 100644 (file)
@@ -8,8 +8,8 @@ if USE_GIO
 GIO_SUBDIRS = gio
 endif
 
-SUBDIRS = app audio dynamic $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec volume v4l encoding
+SUBDIRS = app audio dynamic $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec volume encoding
 
-DIST_SUBDIRS = app audio dynamic gio overlay seek snapshot playrec volume v4l encoding
+DIST_SUBDIRS = app audio dynamic gio overlay seek snapshot playrec volume encoding
 
 include $(top_srcdir)/common/parallel-subdirs.mak
index a92dfb5..9772e8a 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <gst/app/gstappsrc.h>
 #include <gst/app/gstappsink.h>
-#include <gst/app/gstappbuffer.h>
 
 /* these are the caps we are going to pass through the appsink and appsrc */
 const gchar *audio_caps =
@@ -23,7 +22,6 @@ static void
 on_new_buffer_from_source (GstElement * elt, ProgramData * data)
 {
   guint size;
-  gpointer raw_buffer;
   GstBuffer *app_buffer, *buffer;
   GstElement *source;
 
@@ -32,15 +30,11 @@ on_new_buffer_from_source (GstElement * elt, ProgramData * data)
 
   /* turn it into an app buffer, it's not really needed, we could simply push
    * the retrieved buffer from appsink into appsrc just fine.  */
-  size = GST_BUFFER_SIZE (buffer);
+  size = gst_buffer_get_size (buffer);
   g_print ("Pushing a buffer of size %d\n", size);
-  raw_buffer = g_malloc0 (size);
-  memcpy (raw_buffer, GST_BUFFER_DATA (buffer), size);
-  app_buffer = gst_app_buffer_new (raw_buffer, size, g_free, raw_buffer);
+  app_buffer = gst_buffer_new_and_alloc (size);
 
-  /* newer basesrc will set caps for use automatically but it does not really
-   * hurt to set it on the buffer again */
-  gst_buffer_set_caps (app_buffer, GST_BUFFER_CAPS (buffer));
+  gst_buffer_copy_into (app_buffer, buffer, GST_BUFFER_COPY_MEMORY, 0, size);
 
   /* we don't need the appsink buffer anymore */
   gst_buffer_unref (buffer);
index af5d7a7..deb20ef 100644 (file)
@@ -83,8 +83,10 @@ feed_data (GstElement * appsrc, guint size, App * app)
   if (app->offset + size > app->length)
     size = app->length - app->offset;
 
-  GST_BUFFER_DATA (buffer) = app->data + app->offset;
-  GST_BUFFER_SIZE (buffer) = size;
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          app->data, NULL, app->length, app->offset, size));
+
   /* we need to set an offset for random access */
   GST_BUFFER_OFFSET (buffer) = app->offset;
   GST_BUFFER_OFFSET_END (buffer) = app->offset + size;
index 9421f9b..0da6e76 100644 (file)
@@ -89,8 +89,9 @@ feed_data (GstElement * appsrc, guint size, App * app)
   if (app->offset + len > app->length)
     len = app->length - app->offset;
 
-  GST_BUFFER_DATA (buffer) = app->data + app->offset;
-  GST_BUFFER_SIZE (buffer) = len;
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          app->data, NULL, app->length, app->offset, len));
 
   GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
       app->offset, len);
index d14e143..75ecf77 100644 (file)
@@ -96,8 +96,9 @@ read_data (App * app)
   if (app->offset + len > app->length)
     len = app->length - app->offset;
 
-  GST_BUFFER_DATA (buffer) = app->data + app->offset;
-  GST_BUFFER_SIZE (buffer) = len;
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          app->data, NULL, app->length, app->offset, len));
 
   GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
       app->offset, len);
index a80e4d1..b92259e 100644 (file)
@@ -96,8 +96,9 @@ feed_data (GstElement * appsrc, guint size, App * app)
   if (app->offset + len > app->length)
     len = app->length - app->offset;
 
-  GST_BUFFER_DATA (buffer) = app->data + app->offset;
-  GST_BUFFER_SIZE (buffer) = len;
+  gst_buffer_take_memory (buffer, -1,
+      gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+          app->data, NULL, app->length, app->offset, len));
 
   GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
       app->offset, len);
index c7aa4b6..5468a66 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <gst/gst.h>
 #include <gst/app/gstappsrc.h>
-#include <gst/app/gstappbuffer.h>
 #include <gst/app/gstappsink.h>
 
 #include <stdio.h>
@@ -25,8 +24,6 @@ struct _App
 
 App s_app;
 
-static void dont_eat_my_chicken_wings (void *priv);
-
 int
 main (int argc, char *argv[])
 {
@@ -59,11 +56,12 @@ main (int argc, char *argv[])
     GstBuffer *buf;
     void *data;
 
-    data = malloc (100);
+    buf = gst_buffer_new_and_alloc (100);
+    data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
     memset (data, i, 100);
+    gst_buffer_unmap (buf, data, 100);
 
-    buf = gst_app_buffer_new (data, 100, dont_eat_my_chicken_wings, data);
-    printf ("%d: creating buffer for pointer %p, %p\n", i, data, buf);
+    printf ("%d: pushing buffer for pointer %p, %p\n", i, data, buf);
     gst_app_src_push_buffer (GST_APP_SRC (app->src), buf);
   }
 
@@ -86,10 +84,3 @@ main (int argc, char *argv[])
 
   return 0;
 }
-
-static void
-dont_eat_my_chicken_wings (void *priv)
-{
-  printf ("freeing buffer for pointer %p\n", priv);
-  free (priv);
-}
index e0cc5ef..49d7266 100644 (file)
@@ -4,4 +4,3 @@ testchannels_SOURCES = testchannels.c
 testchannels_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
 testchannels_LDADD = $(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
                      $(GST_LIBS)
-
index 66ad0be..5d23630 100644 (file)
@@ -149,7 +149,7 @@ perform_step (gpointer pstep)
       g_print ("creating bin1\n");
       bin1 =
           create_stream
-          ("( v4l2src ! ffmpegcolorspace ! timeoverlay ! queue ! xvimagesink name=v4llive )");
+          ("( v4l2src ! videoconvert ! timeoverlay ! queue ! xvimagesink name=v4llive )");
       pause_play_stream (bin1, 0);
       g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (1));
       break;
@@ -172,7 +172,7 @@ perform_step (gpointer pstep)
       g_print ("creating bin4\n");
       bin4 =
           create_stream
-          ("( videotestsrc ! timeoverlay ! ffmpegcolorspace ! ximagesink name=vtnonlive )");
+          ("( videotestsrc ! timeoverlay ! videoconvert ! ximagesink name=vtnonlive )");
       pause_play_stream (bin4, 0);
       g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (4));
       break;
@@ -181,7 +181,7 @@ perform_step (gpointer pstep)
       g_print ("creating bin5\n");
       bin5 =
           create_stream
-          ("( videotestsrc is-live=1 ! timeoverlay ! ffmpegcolorspace ! ximagesink name=vtlive )");
+          ("( videotestsrc is-live=1 ! timeoverlay ! videoconvert ! ximagesink name=vtlive )");
       pause_play_stream (bin5, 0);
       g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (5));
       break;
index 89674ce..497aa63 100644 (file)
@@ -225,7 +225,7 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstElement * encodebin)
     GstCaps *caps;
 
     /* Ask encodebin for a compatible pad */
-    caps = gst_pad_get_caps (pad);
+    caps = gst_pad_get_caps (pad, NULL);
     g_signal_emit_by_name (encodebin, "request-pad", caps, &sinkpad);
     if (caps)
       gst_caps_unref (caps);
index 0a8e202..cf34f55 100644 (file)
@@ -57,8 +57,7 @@ message_handler (GstBus * bus, GstMessage * message, gpointer user_data)
       if (strcmp (name, "not-mounted") == 0) {
         GMountOperation *mop = gtk_mount_operation_new (NULL);
         GFile *file =
-            G_FILE (g_value_get_object (gst_structure_get_value
-                (message->structure, "file")));
+            G_FILE (g_value_get_object (gst_structure_get_value (s, "file")));
 
         g_print ("not-mounted\n");
         gst_element_set_state (pipeline, GST_STATE_NULL);
index c8795e7..8857100 100644 (file)
@@ -1,5 +1,5 @@
-gtk-xoverlay
-qt-xoverlay
-qtgv-xoverlay
+gtk-videooverlay
+qt-videooverlay
+qtgv-videooverlay
 moc_*.cpp
 
index 55dbb02..31615b4 100644 (file)
@@ -3,41 +3,43 @@ EXAMPLES =
 if USE_X
 
 if HAVE_GTK_X11
-EXAMPLES += gtk-xoverlay
+EXAMPLES += gtk-videooverlay
 
-gtk_xoverlay_SOURCES = gtk-xoverlay.c
-gtk_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
-gtk_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
+gtk_videooverlay_SOURCES = gtk-videooverlay.c
+gtk_videooverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
+gtk_videooverlay_LDADD = \
+       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
+       $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS)
 endif
 
 if HAVE_QT
-EXAMPLES += qt-xoverlay
-
-qt_xoverlay_SOURCES = qt-xoverlay.cpp
-qt_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
-qt_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
+EXAMPLES += qt-videooverlay
 
+qt_videooverlay_SOURCES = qt-videooverlay.cpp
+qt_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
+qt_videooverlay_LDADD = \
+       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
+       $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS)
 endif
 
 if HAVE_QT_GV
-EXAMPLES += qtgv-xoverlay
+EXAMPLES += qtgv-videooverlay
 
-qtgv_xoverlay_SOURCES = qtgv-xoverlay.cpp qtgv-xoverlay.h
-qtgv_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
-qtgv_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
+qtgv_videooverlay_SOURCES = qtgv-videooverlay.cpp qtgv-videooverlay.h
+qtgv_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
+qtgv_videooverlay_LDADD = \
+       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
+       $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS)
 
 # qt moc support, according to http://qtnode.net/wiki/Qt_with_autotools
 
-nodist_qtgv_xoverlay_SOURCES = moc_qtgv-xoverlay.cpp
+nodist_qtgv_videooverlay_SOURCES = moc_qtgv-videooverlay.cpp
 
 moc_%.cpp:%.h
        $(AM_V_GEN)$(QT4_MOC) $< -o $@
 
-EXTRA_DIST = $(nodist_qtgv_xoverlay_SOURCES:moc_%.cpp=%.h)
-CLEANFILES = $(nodist_qtgv_xoverlay_SOURCES)
+EXTRA_DIST = $(nodist_qtgv_videooverlay_SOURCES:moc_%.cpp=%.h)
+CLEANFILES = $(nodist_qtgv_videooverlay_SOURCES)
 
 endif
 
similarity index 95%
rename from tests/examples/overlay/gtk-xoverlay.c
rename to tests/examples/overlay/gtk-videooverlay.c
index c05685c..427aaa7 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
  *
- * gtk-xoverlay: demonstrate overlay handling using gtk
+ * gtk-videooverlay: demonstrate overlay handling using gtk
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -28,7 +28,7 @@
 #include <gtk/gtk.h>
 
 #include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 #include <string.h>
 
@@ -134,7 +134,7 @@ main (int argc, char **argv)
 
   video_window_xwindow = gtk_widget_get_window (video_window);
   embed_xid = GDK_WINDOW_XID (video_window_xwindow);
-  gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid);
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
 
   /* run the pipeline */
 
similarity index 96%
rename from tests/examples/overlay/qt-xoverlay.cpp
rename to tests/examples/overlay/qt-videooverlay.cpp
index aa483a7..e102280 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 #include <QApplication>
 #include <QTimer>
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
   window.show();
   
   WId xwinid = window.winId();
-  gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
 
   /* run the pipeline */
 
similarity index 92%
rename from tests/examples/overlay/qtgv-xoverlay.cpp
rename to tests/examples/overlay/qtgv-videooverlay.cpp
index 58af85b..fea8c52 100644 (file)
 #include "config.h"
 #endif
 
-#include "qtgv-xoverlay.h"
+#include "qtgv-videooverlay.h"
 
 #include <QApplication>
 #include <QTimer>
 
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 SinkPipeline::SinkPipeline(QGraphicsView *parent) : QObject(parent)
 {
@@ -90,10 +90,10 @@ void SinkPipeline::startPipeline()
   GstStateChangeReturn sret;
 
   /* we know what the video sink is in this case (xvimagesink), so we can
-   * just set it directly here now (instead of waiting for a prepare-xwindow-id
-   * element message in a sync bus handler and setting it there) */
-
-  gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
+   * just set it directly here now (instead of waiting for a
+   * prepare-window-handle element message in a sync bus handler and setting
+   * it there) */
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
 
   sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
   if (sret == GST_STATE_CHANGE_FAILURE) {
index ec74cc8..3329d56 100644 (file)
@@ -45,7 +45,7 @@
 #ifdef HAVE_X
 #include <gdk/gdkx.h>
 #endif
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 GST_DEBUG_CATEGORY_STATIC (seek_debug);
 #define GST_CAT_DEFAULT (seek_debug)
@@ -66,9 +66,7 @@ gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
 #endif
 
 /* configuration */
-
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
+#define SOURCE "filesrc"
 
 #define ASINK "alsasink"
 //#define ASINK "osssink"
@@ -485,7 +483,7 @@ make_theora_pipeline (const gchar * location)
   src = gst_element_factory_make_or_warn (SOURCE, "src");
   demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
   decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
-  convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
+  convert = gst_element_factory_make_or_warn ("videoconvert", "convert");
   videosink = gst_element_factory_make_or_warn (VSINK, "sink");
 
   g_object_set (G_OBJECT (src), "location", location, NULL);
@@ -567,8 +565,7 @@ make_vorbis_theora_pipeline (const gchar * location)
   video_bin = gst_bin_new ("v_decoder_bin");
   v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
   v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
-  v_convert =
-      gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
+  v_convert = gst_element_factory_make_or_warn ("videoconvert", "v_convert");
   v_scale = gst_element_factory_make_or_warn ("videoscale", "v_scale");
   videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
 
@@ -647,8 +644,7 @@ make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
   video_bin = gst_bin_new ("v_decoder_bin");
   v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
   v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
-  v_convert =
-      gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
+  v_convert = gst_element_factory_make_or_warn ("videoconvert", "v_convert");
   videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
 
   gst_bin_add (GST_BIN (video_bin), v_queue);
@@ -828,7 +824,7 @@ make_mpeg_pipeline (const gchar * location)
   video_bin = gst_bin_new ("v_decoder_bin");
   v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
   v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
-  v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
+  v_filter = gst_element_factory_make_or_warn ("videoconvert", "v_filter");
   videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
 
   gst_bin_add (GST_BIN (video_bin), v_decoder);
@@ -906,7 +902,7 @@ make_mpegnt_pipeline (const gchar * location)
 
   video_bin = gst_bin_new ("v_decoder_bin");
   v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
-  v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
+  v_filter = gst_element_factory_make_or_warn ("videoconvert", "v_filter");
   videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
   gst_element_link_many (v_decoder, v_filter, videosink, NULL);
 
@@ -1079,7 +1075,7 @@ query_rates (void)
 
       format = seek_formats[i].format;
 
-      if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format,
+      if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, format,
               &value)) {
         g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
       } else {
@@ -1110,8 +1106,8 @@ query_positions_elems (void)
 
       format = seek_formats[i].format;
 
-      if (gst_element_query_position (element, &format, &position) &&
-          gst_element_query_duration (element, &format, &total)) {
+      if (gst_element_query_position (element, format, &position) &&
+          gst_element_query_duration (element, format, &total)) {
         g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
             seek_formats[i].name, position, total);
       } else {
@@ -1142,8 +1138,8 @@ query_positions_pads (void)
 
       format = seek_formats[i].format;
 
-      if (gst_pad_query_position (pad, &format, &position) &&
-          gst_pad_query_duration (pad, &format, &total)) {
+      if (gst_pad_query_position (pad, format, &position) &&
+          gst_pad_query_duration (pad, format, &total)) {
         g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
             seek_formats[i].name, position, total);
       } else {
@@ -1231,24 +1227,19 @@ update_fill (gpointer data)
 static gboolean
 update_scale (gpointer data)
 {
-  GstFormat format = GST_FORMAT_TIME;
-
-  //position = 0;
-  //duration = 0;
-
   if (elem_seek) {
     if (seekable_elements) {
       GstElement *element = GST_ELEMENT (seekable_elements->data);
 
-      gst_element_query_position (element, &format, &position);
-      gst_element_query_duration (element, &format, &duration);
+      gst_element_query_position (element, GST_FORMAT_TIME, &position);
+      gst_element_query_duration (element, GST_FORMAT_TIME, &duration);
     }
   } else {
     if (seekable_pads) {
       GstPad *pad = GST_PAD (seekable_pads->data);
 
-      gst_pad_query_position (pad, &format, &position);
-      gst_pad_query_duration (pad, &format, &duration);
+      gst_pad_query_position (pad, GST_FORMAT_TIME, &position);
+      gst_pad_query_duration (pad, GST_FORMAT_TIME, &duration);
     }
   }
 
@@ -2044,12 +2035,18 @@ shot_cb (GtkButton * button, gpointer data)
     gint width, height;
     GdkPixbuf *pixbuf;
     GError *error = NULL;
+    gsize size;
+    guint8 *data;
 
     /* get the snapshot buffer format now. We set the caps on the appsink so
      * that it can only be an rgb buffer. The only thing we have not specified
      * on the caps is the height, which is dependant on the pixel-aspect-ratio
      * of the source material */
+#if 0
     caps = GST_BUFFER_CAPS (buffer);
+#endif
+    /* FIXME, get the caps on the buffer somehow */
+    caps = NULL;
     if (!caps) {
       g_warning ("could not get snapshot format\n");
       goto done;
@@ -2066,12 +2063,17 @@ shot_cb (GtkButton * button, gpointer data)
 
     /* create pixmap from buffer and save, gstreamer video buffers have a stride
      * that is rounded up to the nearest multiple of 4 */
-    pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
+    data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+    pixbuf = gdk_pixbuf_new_from_data (data,
         GDK_COLORSPACE_RGB, FALSE, 8, width, height,
         GST_ROUND_UP_4 (width * 3), NULL, NULL);
 
     /* save the pixbuf */
     gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
+    gst_buffer_unmap (buffer, data, size);
+
+    /* save the pixbuf */
+    gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
 
   done:
     gst_buffer_unref (buffer);
@@ -2436,7 +2438,7 @@ msg_clock_lost (GstBus * bus, GstMessage * message, GstPipeline * data)
 
 static gulong embed_xid = 0;
 
-/* We set the xid here in response to the prepare-xwindow-id message via a
+/* We set the xid here in response to the prepare-window-handle message via a
  * bus sync handler because we don't know the actual videosink used from the
  * start (as we don't know the pipeline, or bin elements such as autovideosink
  * or gconfvideosink may be used which create the actual videosink only once
@@ -2444,26 +2446,28 @@ static gulong embed_xid = 0;
 static GstBusSyncReply
 bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
 {
-  if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) &&
-      gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
-    GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
+  GstElement *element;
 
-    g_print ("got prepare-xwindow-id, setting XID %lu\n", embed_xid);
+  if (!gst_is_video_overlay_prepare_window_handle_message (message))
+    return GST_BUS_PASS;
 
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
-            "force-aspect-ratio")) {
-      g_object_set (element, "force-aspect-ratio", TRUE, NULL);
-    }
+  element = GST_ELEMENT (GST_MESSAGE_SRC (message));
 
-    /* Should have been initialised from main thread before (can't use
-     * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
-     * be called from a streaming thread and GDK_WINDOW_XID maps to more than
-     * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
-     * shouldn't be done from a non-GUI thread without explicit locking).  */
-    g_assert (embed_xid != 0);
+  g_print ("got prepare-window-handle, setting XID %lu\n", embed_xid);
 
-    gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid);
+  if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
+          "force-aspect-ratio")) {
+    g_object_set (element, "force-aspect-ratio", TRUE, NULL);
   }
+
+  /* Should have been initialised from main thread before (can't use
+   * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
+   * be called from a streaming thread and GDK_WINDOW_XID maps to more than
+   * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
+   * shouldn't be done from a non-GUI thread without explicit locking).  */
+  g_assert (embed_xid != 0);
+
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (element), embed_xid);
   return GST_BUS_PASS;
 }
 #endif
@@ -2496,7 +2500,7 @@ realize_cb (GtkWidget * widget, gpointer data)
     /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
      * as well */
     if (!gdk_window_ensure_native (window))
-      g_error ("Couldn't create native window needed for GstXOverlay!");
+      g_error ("Couldn't create native window needed for GstVideoOverlay!");
   }
 #endif
 
@@ -2539,7 +2543,7 @@ connect_bus_signals (GstElement * pipeline)
   GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
 
 #ifdef HAVE_X
-  /* handle prepare-xwindow-id element message synchronously */
+  /* handle prepare-window-handle element message synchronously */
   gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler,
       pipeline);
 #endif
index c9a02f4..f399cb4 100644 (file)
@@ -21,8 +21,7 @@ static guint update_id = 0;
 static guint changed_id = 0;
 static guint schanged_id = 0;
 
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
+#define SOURCE "filesrc"
 #define ASINK "alsasink"
 //#define ASINK "osssink"
 #define VSINK "xvimagesink"
@@ -146,15 +145,11 @@ format_value (GtkScale * scale, gdouble value)
 static gboolean
 update_scale (gpointer data)
 {
-  GstFormat format;
-
   position = 0;
   duration = 0;
 
-  format = GST_FORMAT_TIME;
-
-  gst_element_query_position (pipeline, &format, &position);
-  gst_element_query_duration (pipeline, &format, &duration);
+  gst_element_query_position (pipeline, GST_FORMAT_TIME, &position);
+  gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration);
 
   if (position >= duration)
     duration = position;
index d79209c..8f53685 100644 (file)
@@ -39,7 +39,7 @@
 #include <gdk/gdkwin32.h>
 #endif
 
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 #if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1)
 #define gtk_combo_box_text_new gtk_combo_box_new_text
@@ -84,8 +84,6 @@ static gchar *opt_videosink_str;        /* NULL */
 
 #define N_GRAD 1000.0
 
-static GList *seekable_pads = NULL;
-static GList *rate_pads = NULL;
 static GList *seekable_elements = NULL;
 
 static gboolean accurate_seek = FALSE;
@@ -106,7 +104,6 @@ static GtkAdjustment *adjustment;
 static GtkWidget *hscale, *statusbar;
 static guint status_id = 0;
 static gboolean stats = FALSE;
-static gboolean elem_seek = FALSE;
 static gboolean verbose = FALSE;
 
 static gboolean is_live = FALSE;
@@ -172,744 +169,6 @@ gst_element_factory_make_or_warn (const gchar * type, const gchar * name)
 }
 
 static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
-  gchar *padname;
-  dyn_link *connect = (dyn_link *) data;
-
-  padname = gst_pad_get_name (newpad);
-
-  if (connect->padname == NULL || !strcmp (padname, connect->padname)) {
-    if (connect->bin)
-      gst_bin_add (GST_BIN (pipeline), connect->bin);
-    gst_pad_link (newpad, connect->target);
-
-    //seekable_pads = g_list_prepend (seekable_pads, newpad);
-    rate_pads = g_list_prepend (rate_pads, newpad);
-  }
-  g_free (padname);
-}
-
-static void
-setup_dynamic_link (GstElement * element, const gchar * padname,
-    GstPad * target, GstElement * bin)
-{
-  dyn_link *connect;
-
-  connect = g_new0 (dyn_link, 1);
-  connect->padname = g_strdup (padname);
-  connect->target = target;
-  connect->bin = bin;
-
-  g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
-      connect);
-}
-
-static GstElement *
-make_mod_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *decoder, *audiosink;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  decoder = gst_element_factory_make_or_warn ("modplug", "decoder");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "sink");
-  //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), decoder);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-
-  gst_element_link (src, decoder);
-  gst_element_link (decoder, audiosink);
-
-  seekable = gst_element_get_static_pad (decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_dv_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *demux, *decoder, *audiosink, *videosink;
-  GstElement *a_queue, *v_queue;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  demux = gst_element_factory_make_or_warn ("dvdemux", "demuxer");
-  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
-  decoder = gst_element_factory_make_or_warn ("ffdec_dvvideo", "decoder");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "v_sink");
-  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
-  audiosink = gst_element_factory_make_or_warn ("alsasink", "a_sink");
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_bin_add (GST_BIN (pipeline), a_queue);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-  gst_bin_add (GST_BIN (pipeline), v_queue);
-  gst_bin_add (GST_BIN (pipeline), decoder);
-  gst_bin_add (GST_BIN (pipeline), videosink);
-
-  gst_element_link (src, demux);
-  gst_element_link (a_queue, audiosink);
-  gst_element_link (v_queue, decoder);
-  gst_element_link (decoder, videosink);
-
-  setup_dynamic_link (demux, "video", gst_element_get_static_pad (v_queue,
-          "sink"), NULL);
-  setup_dynamic_link (demux, "audio", gst_element_get_static_pad (a_queue,
-          "sink"), NULL);
-
-  seekable = gst_element_get_static_pad (decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-
-  return pipeline;
-}
-
-static GstElement *
-make_wav_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *decoder, *audiosink;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "sink");
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), decoder);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-
-  gst_element_link (src, decoder);
-
-  setup_dynamic_link (decoder, "src", gst_element_get_static_pad (audiosink,
-          "sink"), NULL);
-
-  seekable_elements = g_list_prepend (seekable_elements, audiosink);
-
-  /* force element seeking on this pipeline */
-  elem_seek = TRUE;
-
-  return pipeline;
-}
-
-static GstElement *
-make_flac_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *decoder, *audiosink;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  decoder = gst_element_factory_make_or_warn ("flacdec", "decoder");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "sink");
-  g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), decoder);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-
-  gst_element_link (src, decoder);
-  gst_element_link (decoder, audiosink);
-
-  seekable = gst_element_get_static_pad (decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_sid_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *decoder, *audiosink;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  decoder = gst_element_factory_make_or_warn ("siddec", "decoder");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "sink");
-  //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), decoder);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-
-  gst_element_link (src, decoder);
-  gst_element_link (decoder, audiosink);
-
-  seekable = gst_element_get_static_pad (decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_parse_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *parser, *fakesink;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  parser = gst_element_factory_make_or_warn ("mpegparse", "parse");
-  fakesink = gst_element_factory_make_or_warn ("fakesink", "sink");
-  g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
-  g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), parser);
-  gst_bin_add (GST_BIN (pipeline), fakesink);
-
-  gst_element_link (src, parser);
-  gst_element_link (parser, fakesink);
-
-  seekable = gst_element_get_static_pad (parser, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (parser, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_vorbis_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *audio_bin;
-  GstElement *src, *demux, *decoder, *convert, *audiosink;
-  GstPad *pad, *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
-  decoder = gst_element_factory_make_or_warn ("vorbisdec", "decoder");
-  convert = gst_element_factory_make_or_warn ("audioconvert", "convert");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "sink");
-  g_object_set (G_OBJECT (audiosink), "sync", TRUE, NULL);
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  audio_bin = gst_bin_new ("a_decoder_bin");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_bin_add (GST_BIN (audio_bin), decoder);
-  gst_bin_add (GST_BIN (audio_bin), convert);
-  gst_bin_add (GST_BIN (audio_bin), audiosink);
-  gst_bin_add (GST_BIN (pipeline), audio_bin);
-
-  gst_element_link (src, demux);
-  gst_element_link (decoder, convert);
-  gst_element_link (convert, audiosink);
-
-  pad = gst_element_get_static_pad (decoder, "sink");
-  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, NULL, gst_element_get_static_pad (audio_bin,
-          "sink"), NULL);
-
-  seekable = gst_element_get_static_pad (decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_theora_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *video_bin;
-  GstElement *src, *demux, *decoder, *convert, *videosink;
-  GstPad *pad, *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
-  decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
-  convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "sink");
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  video_bin = gst_bin_new ("v_decoder_bin");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_bin_add (GST_BIN (video_bin), decoder);
-  gst_bin_add (GST_BIN (video_bin), convert);
-  gst_bin_add (GST_BIN (video_bin), videosink);
-  gst_bin_add (GST_BIN (pipeline), video_bin);
-
-  gst_element_link (src, demux);
-  gst_element_link (decoder, convert);
-  gst_element_link (convert, videosink);
-
-  pad = gst_element_get_static_pad (decoder, "sink");
-  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, NULL, gst_element_get_static_pad (video_bin,
-          "sink"), NULL);
-
-  seekable = gst_element_get_static_pad (decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_vorbis_theora_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *audio_bin, *video_bin;
-  GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
-  GstElement *audiosink, *videosink;
-  GstElement *a_queue, *v_queue, *v_scale;
-  GstPad *seekable;
-  GstPad *pad;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_element_link (src, demux);
-
-  audio_bin = gst_bin_new ("a_decoder_bin");
-  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
-  a_decoder = gst_element_factory_make_or_warn ("vorbisdec", "a_dec");
-  a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "a_sink");
-
-  gst_bin_add (GST_BIN (pipeline), audio_bin);
-
-  gst_bin_add (GST_BIN (audio_bin), a_queue);
-  gst_bin_add (GST_BIN (audio_bin), a_decoder);
-  gst_bin_add (GST_BIN (audio_bin), a_convert);
-  gst_bin_add (GST_BIN (audio_bin), audiosink);
-
-  gst_element_link (a_queue, a_decoder);
-  gst_element_link (a_decoder, a_convert);
-  gst_element_link (a_convert, audiosink);
-
-  pad = gst_element_get_static_pad (a_queue, "sink");
-  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, NULL, gst_element_get_static_pad (audio_bin,
-          "sink"), NULL);
-
-  video_bin = gst_bin_new ("v_decoder_bin");
-  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
-  v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
-  v_convert =
-      gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
-  v_scale = gst_element_factory_make_or_warn ("videoscale", "v_scale");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "v_sink");
-
-  gst_bin_add (GST_BIN (pipeline), video_bin);
-
-  gst_bin_add (GST_BIN (video_bin), v_queue);
-  gst_bin_add (GST_BIN (video_bin), v_decoder);
-  gst_bin_add (GST_BIN (video_bin), v_convert);
-  gst_bin_add (GST_BIN (video_bin), v_scale);
-  gst_bin_add (GST_BIN (video_bin), videosink);
-
-  gst_element_link_many (v_queue, v_decoder, v_convert, v_scale, videosink,
-      NULL);
-
-  pad = gst_element_get_static_pad (v_queue, "sink");
-  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, NULL, gst_element_get_static_pad (video_bin,
-          "sink"), NULL);
-
-  seekable = gst_element_get_static_pad (a_decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
-          "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *audio_bin, *video_bin;
-  GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
-  GstElement *audiosink, *videosink;
-  GstElement *a_queue, *v_queue;
-  GstPad *seekable, *pad;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  demux = gst_element_factory_make_or_warn ("avidemux", "demux");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_element_link (src, demux);
-
-  audio_bin = gst_bin_new ("a_decoder_bin");
-  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
-  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
-  a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "a_sink");
-
-  gst_bin_add (GST_BIN (audio_bin), a_queue);
-  gst_bin_add (GST_BIN (audio_bin), a_decoder);
-  gst_bin_add (GST_BIN (audio_bin), a_convert);
-  gst_bin_add (GST_BIN (audio_bin), audiosink);
-
-  gst_element_link (a_queue, a_decoder);
-  gst_element_link (a_decoder, a_convert);
-  gst_element_link (a_convert, audiosink);
-
-  gst_bin_add (GST_BIN (pipeline), audio_bin);
-
-  pad = gst_element_get_static_pad (a_queue, "sink");
-  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, NULL, gst_element_get_static_pad (audio_bin,
-          "sink"), NULL);
-
-  video_bin = gst_bin_new ("v_decoder_bin");
-  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
-  v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
-  v_convert =
-      gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "v_sink");
-
-  gst_bin_add (GST_BIN (video_bin), v_queue);
-  gst_bin_add (GST_BIN (video_bin), v_decoder);
-  gst_bin_add (GST_BIN (video_bin), v_convert);
-  gst_bin_add (GST_BIN (video_bin), videosink);
-
-  gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), video_bin);
-
-  pad = gst_element_get_static_pad (v_queue, "sink");
-  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, NULL, gst_element_get_static_pad (video_bin,
-          "sink"), NULL);
-
-  seekable = gst_element_get_static_pad (a_decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
-          "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_mp3_pipeline (const gchar * location)
-{
-  GstElement *pipeline;
-  GstElement *src, *parser, *decoder, *audiosink, *queue;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  parser = gst_element_factory_make_or_warn ("mp3parse", "parse");
-  decoder = gst_element_factory_make_or_warn ("mad", "dec");
-  queue = gst_element_factory_make_or_warn ("queue", "queue");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "sink");
-
-  seekable_elements = g_list_prepend (seekable_elements, audiosink);
-
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-  //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), parser);
-  gst_bin_add (GST_BIN (pipeline), decoder);
-  gst_bin_add (GST_BIN (pipeline), queue);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-
-  gst_element_link (src, parser);
-  gst_element_link (parser, decoder);
-  gst_element_link (decoder, queue);
-  gst_element_link (queue, audiosink);
-
-  seekable = gst_element_get_static_pad (queue, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_avi_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *audio_bin, *video_bin;
-  GstElement *src, *demux, *a_decoder, *v_decoder, *audiosink, *videosink;
-  GstElement *a_queue = NULL, *v_queue = NULL;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  demux = gst_element_factory_make_or_warn ("avidemux", "demux");
-  seekable_elements = g_list_prepend (seekable_elements, demux);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_element_link (src, demux);
-
-  audio_bin = gst_bin_new ("a_decoder_bin");
-  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "a_sink");
-  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
-  gst_element_link (a_decoder, a_queue);
-  gst_element_link (a_queue, audiosink);
-  gst_bin_add (GST_BIN (audio_bin), a_decoder);
-  gst_bin_add (GST_BIN (audio_bin), a_queue);
-  gst_bin_add (GST_BIN (audio_bin), audiosink);
-  gst_element_set_state (audio_bin, GST_STATE_PAUSED);
-
-  setup_dynamic_link (demux, "audio_00", gst_element_get_static_pad (a_decoder,
-          "sink"), audio_bin);
-
-  seekable = gst_element_get_static_pad (a_queue, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
-          "sink"));
-
-  video_bin = gst_bin_new ("v_decoder_bin");
-  v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "v_sink");
-  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
-  gst_element_link (v_decoder, v_queue);
-  gst_element_link (v_queue, videosink);
-  gst_bin_add (GST_BIN (video_bin), v_decoder);
-  gst_bin_add (GST_BIN (video_bin), v_queue);
-  gst_bin_add (GST_BIN (video_bin), videosink);
-
-  gst_element_set_state (video_bin, GST_STATE_PAUSED);
-
-  setup_dynamic_link (demux, "video_00", gst_element_get_static_pad (v_decoder,
-          "sink"), video_bin);
-
-  seekable = gst_element_get_static_pad (v_queue, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (v_decoder,
-          "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_mpeg_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *audio_bin, *video_bin;
-  GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
-  GstElement *audiosink, *videosink;
-  GstElement *a_queue, *v_queue;
-  GstPad *seekable;
-  GstPad *pad;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  //demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
-  demux = gst_element_factory_make_or_warn ("flupsdemux", "demux");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_element_link (src, demux);
-
-  audio_bin = gst_bin_new ("a_decoder_bin");
-  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
-  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "a_sink");
-  gst_bin_add (GST_BIN (audio_bin), a_decoder);
-  gst_bin_add (GST_BIN (audio_bin), a_queue);
-  gst_bin_add (GST_BIN (audio_bin), audiosink);
-
-  gst_element_link (a_decoder, a_queue);
-  gst_element_link (a_queue, audiosink);
-
-  gst_bin_add (GST_BIN (pipeline), audio_bin);
-
-  pad = gst_element_get_static_pad (a_decoder, "sink");
-  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, "audio_c0", gst_element_get_static_pad (audio_bin,
-          "sink"), NULL);
-
-  video_bin = gst_bin_new ("v_decoder_bin");
-  v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
-  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
-  v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "v_sink");
-
-  gst_bin_add (GST_BIN (video_bin), v_decoder);
-  gst_bin_add (GST_BIN (video_bin), v_queue);
-  gst_bin_add (GST_BIN (video_bin), v_filter);
-  gst_bin_add (GST_BIN (video_bin), videosink);
-
-  gst_element_link (v_decoder, v_queue);
-  gst_element_link (v_queue, v_filter);
-  gst_element_link (v_filter, videosink);
-
-  gst_bin_add (GST_BIN (pipeline), video_bin);
-
-  pad = gst_element_get_static_pad (v_decoder, "sink");
-  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
-  gst_object_unref (pad);
-
-  setup_dynamic_link (demux, "video_e0", gst_element_get_static_pad (video_bin,
-          "sink"), NULL);
-
-  seekable = gst_element_get_static_pad (v_filter, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (v_decoder,
-          "sink"));
-
-  return pipeline;
-}
-
-static GstElement *
-make_mpegnt_pipeline (const gchar * location)
-{
-  GstElement *pipeline, *audio_bin, *video_bin;
-  GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
-  GstElement *audiosink, *videosink;
-  GstElement *a_queue;
-  GstPad *seekable;
-
-  pipeline = gst_pipeline_new ("app");
-
-  src = gst_element_factory_make_or_warn (SOURCE, "src");
-  g_object_set (G_OBJECT (src), "location", location, NULL);
-
-  demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
-  //g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
-
-  seekable_elements = g_list_prepend (seekable_elements, demux);
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-  gst_element_link (src, demux);
-
-  audio_bin = gst_bin_new ("a_decoder_bin");
-  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
-  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
-  audiosink = gst_element_factory_make_or_warn (opt_audiosink_str, "a_sink");
-  //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
-  g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-  gst_element_link (a_decoder, a_queue);
-  gst_element_link (a_queue, audiosink);
-  gst_bin_add (GST_BIN (audio_bin), a_decoder);
-  gst_bin_add (GST_BIN (audio_bin), a_queue);
-  gst_bin_add (GST_BIN (audio_bin), audiosink);
-
-  setup_dynamic_link (demux, "audio_00", gst_element_get_static_pad (a_decoder,
-          "sink"), audio_bin);
-
-  seekable = gst_element_get_static_pad (a_queue, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
-          "sink"));
-
-  video_bin = gst_bin_new ("v_decoder_bin");
-  v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
-  v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
-  videosink = gst_element_factory_make_or_warn (opt_videosink_str, "v_sink");
-  gst_element_link_many (v_decoder, v_filter, videosink, NULL);
-
-  gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL);
-
-  setup_dynamic_link (demux, "video_00", gst_element_get_static_pad (v_decoder,
-          "sink"), video_bin);
-
-  seekable = gst_element_get_static_pad (v_decoder, "src");
-  seekable_pads = g_list_prepend (seekable_pads, seekable);
-  rate_pads = g_list_prepend (rate_pads, seekable);
-  rate_pads =
-      g_list_prepend (rate_pads, gst_element_get_static_pad (v_decoder,
-          "sink"));
-
-  return pipeline;
-}
-
-static void
 playerbin_set_uri (GstElement * player, const gchar * location)
 {
   gchar *uri;
@@ -927,7 +186,7 @@ playerbin_set_uri (GstElement * player, const gchar * location)
 }
 
 static GstElement *
-construct_playerbin (const gchar * name, const gchar * location)
+construct_playbin (const gchar * name, const gchar * location)
 {
   GstElement *player;
   GstElement *avsink;
@@ -939,9 +198,6 @@ construct_playerbin (const gchar * name, const gchar * location)
 
   seekable_elements = g_list_prepend (seekable_elements, player);
 
-  /* force element seeking on this pipeline */
-  elem_seek = TRUE;
-
   avsink = gst_element_factory_make_or_warn (opt_audiosink_str, "a_sink");
   if (avsink)
     g_object_set (player, "audio-sink", avsink, NULL);
@@ -954,17 +210,11 @@ construct_playerbin (const gchar * name, const gchar * location)
 }
 
 static GstElement *
-make_playerbin_pipeline (const gchar * location)
-{
-  return construct_playerbin ("playbin", location);
-}
-
-static GstElement *
-make_playerbin2_pipeline (const gchar * location)
+make_playbin_pipeline (const gchar * location)
 {
-  GstElement *pipeline = construct_playerbin ("playbin2", location);
+  GstElement *pipeline = construct_playbin ("playbin", location);
 
-  /* FIXME: this is not triggered, playbin2 is not forwarding it from the sink */
+  /* FIXME: this is not triggered, playbin is not forwarding it from the sink */
   g_signal_connect (pipeline, "notify::volume", G_CALLBACK (volume_notify_cb),
       NULL);
   return pipeline;
@@ -981,8 +231,6 @@ make_parselaunch_pipeline (const gchar * description)
 
   seekable_elements = g_list_prepend (seekable_elements, pipeline);
 
-  elem_seek = TRUE;
-
   return pipeline;
 }
 #endif
@@ -995,25 +243,10 @@ typedef struct
 Pipeline;
 
 static Pipeline pipelines[] = {
-  {"mp3", make_mp3_pipeline},
-  {"avi", make_avi_pipeline},
-  {"mpeg1", make_mpeg_pipeline},
-  {"mpegparse", make_parse_pipeline},
-  {"vorbis", make_vorbis_pipeline},
-  {"theora", make_theora_pipeline},
-  {"ogg/v/t", make_vorbis_theora_pipeline},
-  {"avi/msmpeg4v3/mp3", make_avi_msmpeg4v3_mp3_pipeline},
-  {"sid", make_sid_pipeline},
-  {"flac", make_flac_pipeline},
-  {"wav", make_wav_pipeline},
-  {"mod", make_mod_pipeline},
-  {"dv", make_dv_pipeline},
-  {"mpeg1nothreads", make_mpegnt_pipeline},
-  {"playerbin", make_playerbin_pipeline},
+  {"playbin", make_playbin_pipeline},
 #ifndef GST_DISABLE_PARSE
   {"parse-launch", make_parselaunch_pipeline},
 #endif
-  {"playerbin2", make_playerbin2_pipeline},
   {NULL, NULL},
 };
 
@@ -1059,37 +292,6 @@ static seek_format seek_formats[] = {
 };
 
 G_GNUC_UNUSED static void
-query_rates (void)
-{
-  GList *walk = rate_pads;
-
-  while (walk) {
-    GstPad *pad = GST_PAD (walk->data);
-    gint i = 0;
-
-    g_print ("rate/sec  %8.8s: ", GST_PAD_NAME (pad));
-    while (seek_formats[i].name) {
-      gint64 value;
-      GstFormat format;
-
-      format = seek_formats[i].format;
-
-      if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format,
-              &value)) {
-        g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
-      } else {
-        g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
-      }
-
-      i++;
-    }
-    g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
-
-    walk = g_list_next (walk);
-  }
-}
-
-G_GNUC_UNUSED static void
 query_positions_elems (void)
 {
   GList *walk = seekable_elements;
@@ -1105,8 +307,8 @@ query_positions_elems (void)
 
       format = seek_formats[i].format;
 
-      if (gst_element_query_position (element, &format, &position) &&
-          gst_element_query_duration (element, &format, &total)) {
+      if (gst_element_query_position (element, format, &position) &&
+          gst_element_query_duration (element, format, &total)) {
         g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
             seek_formats[i].name, position, total);
       } else {
@@ -1121,39 +323,6 @@ query_positions_elems (void)
   }
 }
 
-G_GNUC_UNUSED static void
-query_positions_pads (void)
-{
-  GList *walk = seekable_pads;
-
-  while (walk) {
-    GstPad *pad = GST_PAD (walk->data);
-    gint i = 0;
-
-    g_print ("positions %8.8s: ", GST_PAD_NAME (pad));
-    while (seek_formats[i].name) {
-      GstFormat format;
-      gint64 position, total;
-
-      format = seek_formats[i].format;
-
-      if (gst_pad_query_position (pad, &format, &position) &&
-          gst_pad_query_duration (pad, &format, &total)) {
-        g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
-            seek_formats[i].name, position, total);
-      } else {
-        g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
-            "*NA*");
-      }
-
-      i++;
-    }
-    g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
-
-    walk = g_list_next (walk);
-  }
-}
-
 static gboolean start_seek (GtkWidget * widget, GdkEventButton * event,
     gpointer user_data);
 static gboolean stop_seek (GtkWidget * widget, GdkEventButton * event,
@@ -1181,44 +350,42 @@ set_scale (gdouble value)
 static gboolean
 update_fill (gpointer data)
 {
-  if (elem_seek) {
-    if (seekable_elements) {
-      GstElement *element = GST_ELEMENT (seekable_elements->data);
-      GstQuery *query;
-
-      query = gst_query_new_buffering (GST_FORMAT_PERCENT);
-      if (gst_element_query (element, query)) {
-        gint64 start, stop, buffering_total;
-        GstFormat format;
-        gdouble fill;
-        gboolean busy;
-        gint percent;
-        GstBufferingMode mode;
-        gint avg_in, avg_out;
-        gint64 buffering_left;
-
-        gst_query_parse_buffering_percent (query, &busy, &percent);
-        gst_query_parse_buffering_range (query, &format, &start, &stop,
-            &buffering_total);
-        gst_query_parse_buffering_stats (query, &mode, &avg_in, &avg_out,
-            &buffering_left);
-
-        /* note that we could start the playback when buffering_left < remaining
-         * playback time */
-        GST_DEBUG ("buffering total %" G_GINT64_FORMAT " ms, left %"
-            G_GINT64_FORMAT " ms", buffering_total, buffering_left);
-        GST_DEBUG ("start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT,
-            start, stop);
-
-        if (stop != -1)
-          fill = N_GRAD * stop / GST_FORMAT_PERCENT_MAX;
-        else
-          fill = N_GRAD;
-
-        gtk_range_set_fill_level (GTK_RANGE (hscale), fill);
-      }
-      gst_query_unref (query);
+  if (seekable_elements) {
+    GstElement *element = GST_ELEMENT (seekable_elements->data);
+    GstQuery *query;
+
+    query = gst_query_new_buffering (GST_FORMAT_PERCENT);
+    if (gst_element_query (element, query)) {
+      gint64 start, stop, buffering_total;
+      GstFormat format;
+      gdouble fill;
+      gboolean busy;
+      gint percent;
+      GstBufferingMode mode;
+      gint avg_in, avg_out;
+      gint64 buffering_left;
+
+      gst_query_parse_buffering_percent (query, &busy, &percent);
+      gst_query_parse_buffering_range (query, &format, &start, &stop,
+          &buffering_total);
+      gst_query_parse_buffering_stats (query, &mode, &avg_in, &avg_out,
+          &buffering_left);
+
+      /* note that we could start the playback when buffering_left < remaining
+       * playback time */
+      GST_DEBUG ("buffering total %" G_GINT64_FORMAT " ms, left %"
+          G_GINT64_FORMAT " ms", buffering_total, buffering_left);
+      GST_DEBUG ("start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT,
+          start, stop);
+
+      if (stop != -1)
+        fill = N_GRAD * stop / GST_FORMAT_PERCENT_MAX;
+      else
+        fill = N_GRAD;
+
+      gtk_range_set_fill_level (GTK_RANGE (hscale), fill);
     }
+    gst_query_unref (query);
   }
   return TRUE;
 }
@@ -1226,34 +393,15 @@ update_fill (gpointer data)
 static gboolean
 update_scale (gpointer data)
 {
-  GstFormat format = GST_FORMAT_TIME;
-
-  //position = 0;
-  //duration = 0;
-
-  if (elem_seek) {
-    if (seekable_elements) {
-      GstElement *element = GST_ELEMENT (seekable_elements->data);
+  if (seekable_elements) {
+    GstElement *element = GST_ELEMENT (seekable_elements->data);
 
-      gst_element_query_position (element, &format, &position);
-      gst_element_query_duration (element, &format, &duration);
-    }
-  } else {
-    if (seekable_pads) {
-      GstPad *pad = GST_PAD (seekable_pads->data);
-
-      gst_pad_query_position (pad, &format, &position);
-      gst_pad_query_duration (pad, &format, &duration);
-    }
+    gst_element_query_position (element, GST_FORMAT_TIME, &position);
+    gst_element_query_duration (element, GST_FORMAT_TIME, &duration);
   }
 
   if (stats) {
-    if (elem_seek) {
-      query_positions_elems ();
-    } else {
-      query_positions_pads ();
-    }
-    query_rates ();
+    query_positions_elems ();
   }
 
   if (position >= duration)
@@ -1290,33 +438,17 @@ static gboolean
 send_event (GstEvent * event)
 {
   gboolean res = FALSE;
+  GList *walk = seekable_elements;
 
-  if (!elem_seek) {
-    GList *walk = seekable_pads;
-
-    while (walk) {
-      GstPad *seekable = GST_PAD (walk->data);
-
-      GST_DEBUG ("send event on pad %s:%s", GST_DEBUG_PAD_NAME (seekable));
-
-      gst_event_ref (event);
-      res = gst_pad_send_event (seekable, event);
-
-      walk = g_list_next (walk);
-    }
-  } else {
-    GList *walk = seekable_elements;
-
-    while (walk) {
-      GstElement *seekable = GST_ELEMENT (walk->data);
+  while (walk) {
+    GstElement *seekable = GST_ELEMENT (walk->data);
 
-      GST_DEBUG ("send event on element %s", GST_ELEMENT_NAME (seekable));
+    GST_DEBUG ("send event on element %s", GST_ELEMENT_NAME (seekable));
 
-      gst_event_ref (event);
-      res = gst_element_send_event (seekable, event);
+    gst_event_ref (event);
+    res = gst_element_send_event (seekable, event);
 
-      walk = g_list_next (walk);
-    }
+    walk = g_list_next (walk);
   }
   gst_event_unref (event);
   return res;
@@ -1593,10 +725,6 @@ stop_cb (GtkButton * button, gpointer data)
 
       g_list_free (seekable_elements);
       seekable_elements = NULL;
-      g_list_free (seekable_pads);
-      seekable_pads = NULL;
-      g_list_free (rate_pads);
-      rate_pads = NULL;
 
       pipeline = pipelines[pipeline_type].func (pipeline_spec);
       g_assert (pipeline);
@@ -2002,6 +1130,9 @@ volume_notify_cb (GstElement * pipeline, GParamSpec * arg, gpointer user_dat)
 {
   gdouble cur_volume, new_volume;
 
+  if (volume_spinbutton == NULL)
+    return;
+
   g_object_get (pipeline, "volume", &new_volume, NULL);
   cur_volume = gtk_spin_button_get_value (GTK_SPIN_BUTTON (volume_spinbutton));
   if (fabs (cur_volume - new_volume) > 0.001) {
@@ -2042,12 +1173,18 @@ shot_cb (GtkButton * button, gpointer data)
     gint width, height;
     GdkPixbuf *pixbuf;
     GError *error = NULL;
+    guint8 *data;
+    gsize size;
 
     /* get the snapshot buffer format now. We set the caps on the appsink so
      * that it can only be an rgb buffer. The only thing we have not specified
      * on the caps is the height, which is dependant on the pixel-aspect-ratio
      * of the source material */
+#if 0
     caps = GST_BUFFER_CAPS (buffer);
+#endif
+    /* FIXME, need to get the caps of the buffer somehow */
+    caps = NULL;
     if (!caps) {
       g_warning ("could not get snapshot format\n");
       goto done;
@@ -2064,12 +1201,14 @@ shot_cb (GtkButton * button, gpointer data)
 
     /* create pixmap from buffer and save, gstreamer video buffers have a stride
      * that is rounded up to the nearest multiple of 4 */
-    pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
+    data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+    pixbuf = gdk_pixbuf_new_from_data (data,
         GDK_COLORSPACE_RGB, FALSE, 8, width, height,
         GST_ROUND_UP_4 (width * 3), NULL, NULL);
 
     /* save the pixbuf */
     gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
+    gst_buffer_unmap (buffer, data, size);
 
   done:
     gst_buffer_unref (buffer);
@@ -2436,7 +1575,7 @@ msg_clock_lost (GstBus * bus, GstMessage * message, GstPipeline * data)
 
 static gulong embed_xid = 0;
 
-/* We set the xid here in response to the prepare-xwindow-id message via a
+/* We set the xid here in response to the prepare-window-handle message via a
  * bus sync handler because we don't know the actual videosink used from the
  * start (as we don't know the pipeline, or bin elements such as autovideosink
  * or gconfvideosink may be used which create the actual videosink only once
@@ -2444,26 +1583,28 @@ static gulong embed_xid = 0;
 static GstBusSyncReply
 bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
 {
-  if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) &&
-      gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
-    GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
+  GstElement *element;
 
-    g_print ("got prepare-xwindow-id, setting XID %lu\n", embed_xid);
+  if (!gst_is_video_overlay_prepare_window_handle_message (message))
+    return GST_BUS_PASS;
 
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
-            "force-aspect-ratio")) {
-      g_object_set (element, "force-aspect-ratio", TRUE, NULL);
-    }
+  element = GST_ELEMENT (GST_MESSAGE_SRC (message));
 
-    /* Should have been initialised from main thread before (can't use
-     * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
-     * be called from a streaming thread and GDK_WINDOW_XID maps to more than
-     * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
-     * shouldn't be done from a non-GUI thread without explicit locking).  */
-    g_assert (embed_xid != 0);
+  g_print ("got prepare-window-handle, setting XID %lu\n", embed_xid);
 
-    gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid);
+  if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
+          "force-aspect-ratio")) {
+    g_object_set (element, "force-aspect-ratio", TRUE, NULL);
   }
+
+  /* Should have been initialised from main thread before (can't use
+   * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
+   * be called from a streaming thread and GDK_WINDOW_XID maps to more than
+   * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
+   * shouldn't be done from a non-GUI thread without explicit locking).  */
+  g_assert (embed_xid != 0);
+
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (element), embed_xid);
   return GST_BUS_PASS;
 }
 #endif
@@ -2496,7 +1637,7 @@ realize_cb (GtkWidget * widget, gpointer data)
     /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
      * as well */
     if (!gdk_window_ensure_native (window))
-      g_error ("Couldn't create native window needed for GstXOverlay!");
+      g_error ("Couldn't create native window needed for GstVideoOverlay!");
   }
 #endif
 
@@ -2543,7 +1684,7 @@ connect_bus_signals (GstElement * pipeline)
   GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
 
 #if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32)
-  /* handle prepare-xwindow-id element message synchronously */
+  /* handle prepare-window-handle element message synchronously */
   gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler,
       pipeline);
 #endif
@@ -2653,8 +1794,6 @@ main (int argc, char **argv)
         "audio sink to use (default: " DEFAULT_AUDIOSINK ")", NULL},
     {"stats", 's', 0, G_OPTION_ARG_NONE, &stats,
         "Show pad stats", NULL},
-    {"elem", 'e', 0, G_OPTION_ARG_NONE, &elem_seek,
-        "Seek on elements instead of pads", NULL},
     {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
         "Verbose properties", NULL},
     {"videosink", '\0', 0, G_OPTION_ARG_STRING, &opt_videosink_str,
@@ -2839,7 +1978,7 @@ main (int argc, char **argv)
   g_signal_connect (hscale, "format_value", G_CALLBACK (format_value),
       pipeline);
 
-  if (pipeline_type == 16) {
+  if (pipeline_type == 0) {
     /* the playbin2 panel controls for the video/audio/subtitle tracks */
     panel = gtk_hbox_new (FALSE, 0);
     video_combo = gtk_combo_box_text_new ();
index 14f2809..6f9755e 100644 (file)
@@ -34,9 +34,10 @@ main (int argc, char *argv[])
   GError *error = NULL;
   GdkPixbuf *pixbuf;
   gint64 duration, position;
-  GstFormat format;
   GstStateChangeReturn ret;
   gboolean res;
+  guint8 *data;
+  gsize size;
 
   gst_init (&argc, &argv);
 
@@ -48,7 +49,7 @@ main (int argc, char *argv[])
 
   /* create a new pipeline */
   descr =
-      g_strdup_printf ("uridecodebin uri=%s ! ffmpegcolorspace ! videoscale ! "
+      g_strdup_printf ("uridecodebin uri=%s ! videoconvert ! videoscale ! "
       " appsink name=sink caps=\"" CAPS "\"", argv[1]);
   pipeline = gst_parse_launch (descr, &error);
 
@@ -85,8 +86,7 @@ main (int argc, char *argv[])
   }
 
   /* get the duration */
-  format = GST_FORMAT_TIME;
-  gst_element_query_duration (pipeline, &format, &duration);
+  gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration);
 
   if (duration != -1)
     /* we have a duration, seek to 5% */
@@ -116,7 +116,11 @@ main (int argc, char *argv[])
      * that it can only be an rgb buffer. The only thing we have not specified
      * on the caps is the height, which is dependant on the pixel-aspect-ratio
      * of the source material */
+#if 0
     caps = GST_BUFFER_CAPS (buffer);
+#endif
+    /* FIXME, get buffer caps somehow */
+    caps = NULL;
     if (!caps) {
       g_print ("could not get snapshot format\n");
       exit (-1);
@@ -133,12 +137,17 @@ main (int argc, char *argv[])
 
     /* create pixmap from buffer and save, gstreamer video buffers have a stride
      * that is rounded up to the nearest multiple of 4 */
-    pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
+    data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+    pixbuf = gdk_pixbuf_new_from_data (data,
         GDK_COLORSPACE_RGB, FALSE, 8, width, height,
         GST_ROUND_UP_4 (width * 3), NULL, NULL);
 
     /* save the pixbuf */
     gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
+    gst_buffer_unmap (buffer, data, size);
+
+    /* save the pixbuf */
+    gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
   } else {
     g_print ("could not make snapshot\n");
   }
diff --git a/tests/examples/v4l/.gitignore b/tests/examples/v4l/.gitignore
deleted file mode 100644 (file)
index da0c4eb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-probe
diff --git a/tests/examples/v4l/Makefile.am b/tests/examples/v4l/Makefile.am
deleted file mode 100644 (file)
index 14d6d7d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-noinst_PROGRAMS = probe
-
-probe_SOURCES = probe.c
-probe_CFLAGS  = $(GST_PLUGINS_BASE_CFLAGS) \
-               $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-probe_LDFLAGS = \
-               $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
-               $(GST_BASE_LIBS) $(GST_LIBS)
-
diff --git a/tests/examples/v4l/probe.c b/tests/examples/v4l/probe.c
deleted file mode 100644 (file)
index 435aeac..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* GStreamer
- * Copyright (C) 2009 Filippo Argiolas <filippo.argiolas@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <gst/interfaces/propertyprobe.h>
-
-int
-main (int argc, char *argv[])
-{
-  GstElement *src, *sink;
-  GstElement *bin;
-  GstPropertyProbe *probe = NULL;
-  const GParamSpec *pspec = NULL;
-  GValueArray *array = NULL;
-  gint i, ret;
-  GValue *value;
-  const gchar *device;
-  gchar *name;
-  guint flags;
-
-  gst_init (&argc, &argv);
-
-  bin = gst_pipeline_new ("pipeline");
-  g_assert (bin);
-
-  src = gst_element_factory_make ("v4lsrc", "v4l_source");
-  g_assert (src);
-  sink = gst_element_factory_make ("fakesink", "fake_sink");
-  g_assert (sink);
-
-  /* add objects to the main pipeline */
-  gst_bin_add_many (GST_BIN (bin), src, sink, NULL);
-  /* link the elements */
-  gst_element_link_many (src, sink, NULL);
-
-  /* probe devices */
-  g_print ("Probing devices with propertyprobe...\n");
-  probe = GST_PROPERTY_PROBE (src);
-  pspec = gst_property_probe_get_property (probe, "device");
-  array = gst_property_probe_probe_and_get_values (probe, pspec);
-
-  if (!array) {
-    g_print ("No device found\n");
-    exit (1);
-  }
-
-  for (i = 0; i < array->n_values; i++) {
-    value = g_value_array_get_nth (array, i);
-    device = g_value_get_string (value);
-    g_print ("Device: %s\n", device);
-    g_object_set_property (G_OBJECT (src), "device", value);
-    gst_element_set_state (bin, GST_STATE_READY);
-    ret = gst_element_get_state (bin, NULL, NULL, 10 * GST_SECOND);
-    if (ret != GST_STATE_CHANGE_SUCCESS) {
-      g_print ("Couldn't set STATE_READY\n");
-      continue;
-    }
-    g_object_get (G_OBJECT (src), "device-name", &name, NULL);
-    g_print ("Name: %s\n", name);
-    g_free (name);
-    g_object_get (G_OBJECT (src), "flags", &flags, NULL);
-    g_print ("Flags: 0x%08X\n", flags);
-    gst_element_set_state (bin, GST_STATE_NULL);
-    g_print ("\n");
-  }
-
-  exit (0);
-}
index bd175b1..e633368 100644 (file)
@@ -4,9 +4,9 @@ output-selector-test
 playbin-text
 position-formats
 stress-playbin
-stress-xoverlay
+stress-videooverlay
 test-textoverlay
 test-scale
 test-box
 test-colorkey
-test-xoverlay
+test-videooverlay
index d7a3236..de853c4 100644 (file)
@@ -2,28 +2,31 @@ SUBDIRS = playback
 DIST_SUBDIRS = playback
 
 if USE_X
-X_TESTS = stress-xoverlay
+X_TESTS = stress-videooverlay
 
-stress_xoverlay_SOURCES = stress-xoverlay.c
-stress_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+stress_videooverlay_SOURCES = stress-videooverlay.c
+stress_videooverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
        $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
-stress_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
+stress_videooverlay_LDADD = \
+       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
+       $(GST_LIBS) $(X_LIBS) $(LIBM)
 
 if HAVE_GTK_X11
-X_TESTS += test-colorkey test-xoverlay
+X_TESTS += test-colorkey test-videooverlay
 
 test_colorkey_SOURCES = test-colorkey.c
 test_colorkey_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
        $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
-test_colorkey_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
+test_colorkey_LDADD = \
+       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
+       $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS)
 
-test_xoverlay_SOURCES = test-xoverlay.c
-test_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+test_videooverlay_SOURCES = test-videooverlay.c
+test_videooverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
        $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
-test_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
-       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
+test_videooverlay_LDADD = \
+       $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
+       $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS)
 endif
 
 output_selector_test_SOURCES = output-selector-test.c
index 7da0be4..1deaaff 100644 (file)
@@ -31,12 +31,16 @@ check_position (GstElement * elem, GstQuery * pos, const gchar * info)
   }
 }
 
-static gboolean
-print_buffer_ts (GstPad * pad, GstBuffer * buffer, gpointer user_data)
+static GstProbeReturn
+print_buffer_ts (GstPad * pad, GstProbeType type, gpointer type_data,
+    gpointer user_data)
 {
+  GstBuffer *buffer = type_data;
+
   GST_DEBUG_OBJECT (pad, "  ts: %" GST_TIME_FORMAT,
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
-  return TRUE;
+
+  return GST_PROBE_OK;
 }
 
 gint
@@ -119,7 +123,8 @@ main (gint argc, gchar ** argv)
   }
 
   src_pad = gst_element_get_static_pad (src, "src");
-  gst_pad_add_buffer_probe (src_pad, G_CALLBACK (print_buffer_ts), NULL);
+  gst_pad_add_probe (src_pad, GST_PROBE_TYPE_BUFFER, print_buffer_ts, NULL,
+      NULL);
   gst_object_unref (src_pad);
 
   /* add a controller to the source */
index 24ad283..6d9b94e 100644 (file)
@@ -86,11 +86,11 @@ main (gint argc, gchar * argv[])
   /* create elements */
   pipeline = gst_element_factory_make ("pipeline", "pipeline");
   src = gst_element_factory_make ("videotestsrc", "src");
-  c0 = gst_element_factory_make ("ffmpegcolorspace", NULL);
+  c0 = gst_element_factory_make ("videoconvert", NULL);
   toverlay = gst_element_factory_make ("timeoverlay", "timeoverlay");
   osel = gst_element_factory_make ("output-selector", "osel");
-  c1 = gst_element_factory_make ("ffmpegcolorspace", NULL);
-  c2 = gst_element_factory_make ("ffmpegcolorspace", NULL);
+  c1 = gst_element_factory_make ("videoconvert", NULL);
+  c2 = gst_element_factory_make ("videoconvert", NULL);
   sink1 = gst_element_factory_make ("autovideosink", "sink1");
   sink2 = gst_element_factory_make ("autovideosink", "sink2");
 
index dd81c6b..c50bf9f 100644 (file)
@@ -129,7 +129,7 @@ main (gint argc, gchar * argv[])
   g_signal_connect (bus, "message::state-changed", G_CALLBACK (state_cb),
       pipeline);
 
-  source = gst_element_factory_make ("gnomevfssrc", "source");
+  source = gst_element_factory_make ("giosrc", "source");
   g_assert (source);
 
   if (argv[1] && strstr (argv[1], "://") != NULL) {
index 3c944ec..282302f 100644 (file)
@@ -35,7 +35,7 @@ gen_video_element (void)
   GstPad *pad;
 
   element = gst_bin_new ("vbin");
-  conv = gst_element_factory_make ("ffmpegcolorspace", "conv");
+  conv = gst_element_factory_make ("videoconvert", "conv");
   sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "sink");
 
   gst_bin_add (GST_BIN (element), conv);
@@ -85,7 +85,7 @@ cb_newpad (GstElement * decodebin, GstPad * pad, gboolean last, gpointer data)
   GstPadLinkReturn lret;
 
   /* check media type */
-  caps = gst_pad_get_caps (pad);
+  caps = gst_pad_get_caps (pad, NULL);
   str = gst_caps_get_structure (caps, 0);
 
   name = gst_structure_get_name (str);
index dd08f7c..d55e633 100644 (file)
@@ -25,17 +25,16 @@ update_scale (GstElement * element)
 {
   gint64 duration = -1;
   gint64 position = -1;
-  GstFormat format = GST_FORMAT_TIME;
   gchar dur_str[32], pos_str[32];
 
-  if (gst_element_query_position (element, &format, &position) &&
+  if (gst_element_query_position (element, GST_FORMAT_TIME, &position) &&
       position != -1) {
     g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
   } else {
     g_snprintf (pos_str, 32, "-:--:--.---------");
   }
 
-  if (gst_element_query_duration (element, &format, &duration) &&
+  if (gst_element_query_duration (element, GST_FORMAT_TIME, &duration) &&
       duration != -1) {
     g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
   } else {
index 715b4bb..8badfd3 100644 (file)
@@ -60,18 +60,18 @@ static void
 dump_element_stats (GstElement * element)
 {
   GstIterator *it;
-  gpointer data;
+  GValue data = { 0, };
 
   it = gst_element_iterate_src_pads (element);
   while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
-    GstPad *pad = GST_PAD (data);
+    GstPad *pad = g_value_get_object (&data);
     GstCaps *caps;
     gchar *str;
     GstQuery *query;
 
     g_print ("stream %s:\n", GST_OBJECT_NAME (pad));
 
-    caps = gst_pad_get_caps (pad);
+    caps = gst_pad_get_caps (pad, NULL);
     str = gst_caps_to_string (caps);
     g_print (" caps: %s\n", str);
     g_free (str);
@@ -87,8 +87,9 @@ dump_element_stats (GstElement * element)
     }
     gst_query_unref (query);
 
-    gst_object_unref (pad);
+    g_value_reset (&data);
   }
+  g_value_unset (&data);
   gst_iterator_free (it);
 }
 
index 17e50f9..696767b 100644 (file)
@@ -79,7 +79,7 @@ main (gint argc, gchar * argv[])
   GstStateChangeReturn res;
   GstIterator *it;
   GstBus *bus;
-  gpointer data;
+  GValue data = { 0, };
 
   gst_init (&argc, &argv);
 
@@ -133,14 +133,14 @@ main (gint argc, gchar * argv[])
 
   it = gst_element_iterate_src_pads (decodebin);
   while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
-    GstPad *pad = GST_PAD (data);
+    GstPad *pad = g_value_get_object (&data);
     GstCaps *caps;
     gchar *str;
     GstQuery *query;
 
     g_print ("stream %s:\n", GST_OBJECT_NAME (pad));
 
-    caps = gst_pad_get_caps (pad);
+    caps = gst_pad_get_caps (pad, NULL);
     str = gst_caps_to_string (caps);
     g_print (" caps: %s\n", str);
     g_free (str);
@@ -156,8 +156,9 @@ main (gint argc, gchar * argv[])
     }
     gst_query_unref (query);
 
-    gst_object_unref (pad);
+    g_value_reset (&data);
   }
+  g_value_unset (&data);
   gst_iterator_free (it);
 
   return 0;
index 530229b..6dc984a 100644 (file)
@@ -34,17 +34,16 @@ update_scale (GstElement * element)
 {
   gint64 duration = -1;
   gint64 position = -1;
-  GstFormat format = GST_FORMAT_TIME;
   gchar dur_str[32], pos_str[32];
 
-  if (gst_element_query_position (element, &format, &position) &&
+  if (gst_element_query_position (element, GST_FORMAT_TIME, &position) &&
       position != -1) {
     g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
   } else {
     g_snprintf (pos_str, 32, "-:--:--.---------");
   }
 
-  if (gst_element_query_duration (element, &format, &duration) &&
+  if (gst_element_query_duration (element, GST_FORMAT_TIME, &duration) &&
       duration != -1) {
     g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
   } else {
index 8fc3107..a7c4736 100644 (file)
@@ -94,14 +94,12 @@ have_subtitle (GstElement * appsink, App * app)
 
   if (buffer) {
     guint8 *data;
-    guint size;
-    GstFormat format;
+    gsize size;
     gint64 position;
     GstClock *clock;
     GstClockTime base_time, running_time;
 
-    format = GST_FORMAT_TIME;
-    gst_element_query_position (appsink, &format, &position);
+    gst_element_query_position (appsink, GST_FORMAT_TIME, &position);
 
     clock = gst_element_get_clock (appsink);
     base_time = gst_element_get_base_time (appsink);
@@ -114,10 +112,9 @@ have_subtitle (GstElement * appsink, App * app)
         ", running_time %" GST_TIME_FORMAT, GST_TIME_ARGS (position),
         GST_TIME_ARGS (running_time));
 
-    data = GST_BUFFER_DATA (buffer);
-    size = GST_BUFFER_SIZE (buffer);
-
+    data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
     gst_util_dump_mem (data, size);
+    gst_buffer_unmap (buffer, data, size);
   }
 }
 
index 5ca815e..774d288 100644 (file)
@@ -83,9 +83,9 @@ run_queries (gpointer user_data)
 
   for (i = GST_FORMAT_DEFAULT; i <= GST_FORMAT_PERCENT; i++) {
     fmt = i;
-    pres = gst_element_query_position (bin, &fmt, &pos);
+    pres = gst_element_query_position (bin, fmt, &pos);
     fmt = i;
-    dres = gst_element_query_duration (bin, &fmt, &dur);
+    dres = gst_element_query_duration (bin, fmt, &dur);
     printf ("%-8s : ", gst_format_get_name (i));
     print_value (pres, fmt, pos);
     printf (" / ");
similarity index 91%
rename from tests/icles/stress-xoverlay.c
rename to tests/icles/stress-videooverlay.c
index 9cfb308..bcbe7dc 100644 (file)
@@ -22,7 +22,7 @@
 #endif
 
 #include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -94,11 +94,11 @@ move_window (GstPipeline * pipeline)
 }
 
 static gboolean
-toggle_events (GstXOverlay * ov)
+toggle_events (GstVideoOverlay * ov)
 {
   static gboolean events_toggled;
 
-  gst_x_overlay_handle_events (ov, events_toggled);
+  gst_video_overlay_handle_events (ov, events_toggled);
 
   if (events_toggled) {
     g_print ("Events are handled\n");
@@ -112,7 +112,7 @@ toggle_events (GstXOverlay * ov)
 }
 
 static gboolean
-cycle_window (GstXOverlay * ov)
+cycle_window (GstVideoOverlay * ov)
 {
   XGCValues values;
   Window old_win = win;
@@ -128,7 +128,7 @@ cycle_window (GstXOverlay * ov)
 
   XSync (disp, FALSE);
 
-  gst_x_overlay_set_window_handle (ov, win);
+  gst_video_overlay_set_window_handle (ov, win);
 
   if (old_win) {
     XDestroyWindow (disp, old_win);
@@ -142,15 +142,12 @@ cycle_window (GstXOverlay * ov)
 static GstBusSyncReply
 create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
 {
-  const GstStructure *s;
-  GstXOverlay *ov = NULL;
+  GstVideoOverlay *ov = NULL;
 
-  s = gst_message_get_structure (message);
-  if (s == NULL || !gst_structure_has_name (s, "prepare-xwindow-id")) {
+  if (!gst_is_video_overlay_prepare_window_handle_message (message))
     return GST_BUS_PASS;
-  }
 
-  ov = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
+  ov = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
 
   g_print ("Creating our own window\n");
 
@@ -206,7 +203,8 @@ main (int argc, char **argv)
   if (argc != 2) {
     g_print ("Usage: %s \"pipeline description with launch format\"\n",
         argv[0]);
-    g_print ("The pipeline should contain an element implementing XOverlay.\n");
+    g_print
+        ("The pipeline should contain an element implementing GstVideoOverlay.\n");
     g_print ("Example: %s \"videotestsrc ! ximagesink\"\n", argv[0]);
     return -1;
   }
index 6d04e56..09fd3e7 100644 (file)
@@ -38,7 +38,7 @@ make_pipeline (gint type)
       pstr =
           g_strdup_printf ("videotestsrc ! " CAPS
           " ! videobox name=box ! videoscale ! " CAPS
-          " ! ffmpegcolorspace ! ximagesink");
+          " ! videoconvert ! ximagesink");
       break;
     default:
       return NULL;
index 947363c..ad5db92 100644 (file)
@@ -31,7 +31,7 @@
 #include <gtk/gtk.h>
 
 #include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 #include <gst/interfaces/propertyprobe.h>
 
 #if !GTK_CHECK_VERSION (2, 17, 7)
@@ -105,7 +105,7 @@ realize_cb (GtkWidget * widget, gpointer data)
     /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
      * as well */
     if (!gdk_window_ensure_native (window))
-      g_error ("Couldn't create native window needed for GstXOverlay!");
+      g_error ("Couldn't create native window needed for GstVideoOverlay!");
   }
 #endif
 
@@ -270,10 +270,11 @@ main (int argc, char **argv)
   g_assert (embed_xid != 0);
 
   /* we know what the video sink is in this case (xvimagesink), so we can
-   * just set it directly here now (instead of waiting for a prepare-xwindow-id
-   * element message in a sync bus handler and setting it there) */
+   * just set it directly here now (instead of waiting for a
+   * prepare-window-handle element message in a sync bus handler and setting
+   * it there) */
   g_print ("setting XID %lu\n", embed_xid);
-  gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid);
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
 
   g_idle_add (start_pipeline, pipeline);
   gtk_main ();
index 6d13119..719adee 100644 (file)
@@ -63,7 +63,7 @@ make_pipeline (gint type)
           "capsfilter name=filter ! " "ximagesink");
       break;
     case 7:
-      pstr = g_strdup_printf ("v4l2src ! ffmpegcolorspace ! videoscale ! "
+      pstr = g_strdup_printf ("v4l2src ! videoconvert ! videoscale ! "
           "capsfilter name=filter ! " "ximagesink");
       break;
     default:
index 8d989a8..22119df 100644 (file)
@@ -82,7 +82,7 @@ test_textoverlay (int width, int height)
   pstr = g_strdup_printf ("videotestsrc pattern=blue ! "
       "video/x-raw-yuv,width=%d,height=%d ! t.video_sink "
       "textoverlay name=t font-desc=\"Sans Serif, 20\" ! "
-      " ffmpegcolorspace ! videoscale ! autovideosink", width, height);
+      " videoconvert ! videoscale ! autovideosink", width, height);
 
   pipe = gst_parse_launch_full (pstr, NULL, GST_PARSE_FLAG_NONE, NULL);
   g_assert (pipe);
similarity index 92%
rename from tests/icles/test-xoverlay.c
rename to tests/icles/test-videooverlay.c
index b1b9d92..400d0ac 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) <2008> Stefan Kost <ensonic@users.sf.net>
  *
- * test-xoverlay: test xoverlay custom event handling and subregions
+ * test-videooverlay: test videooverlay custom event handling and subregions
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -32,7 +32,7 @@
 #include <gtk/gtk.h>
 
 #include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
 #include <gst/video/gstvideosink.h>
 
 #if !GTK_CHECK_VERSION (2, 17, 7)
@@ -46,7 +46,7 @@ gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
 static struct
 {
   gint w, h;
-  GstXOverlay *overlay;
+  GstVideoOverlay *overlay;
   GtkWidget *widget;
   gdouble a, p;
   GstVideoRectangle rect;
@@ -72,7 +72,7 @@ animate_render_rect (gpointer user_data)
     r->h = anim_state.h / 2;
     r->y = (r->h - (r->h / 2)) + s * (r->h / 2);
 
-    gst_x_overlay_set_render_rectangle (anim_state.overlay, r->x, r->y,
+    gst_video_overlay_set_render_rectangle (anim_state.overlay, r->x, r->y,
         r->w, r->h);
     gtk_widget_queue_draw (anim_state.widget);
   }
@@ -131,7 +131,7 @@ handle_expose_cb (GtkWidget * widget, GdkEventExpose * event,
   if (verbose) {
     g_print ("expose(%p)\n", widget);
   }
-  gst_x_overlay_expose (anim_state.overlay);
+  gst_video_overlay_expose (anim_state.overlay);
   return FALSE;
 }
 
@@ -214,11 +214,12 @@ main (gint argc, gchar ** argv)
   }
 
   /* we know what the video sink is in this case (xvimagesink), so we can
-   * just set it directly here now (instead of waiting for a prepare-xwindow-id
-   * element message in a sync bus handler and setting it there) */
-  gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid);
+   * just set it directly here now (instead of waiting for a
+   * prepare-window-handle element message in a sync bus handler and setting
+   * it there) */
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
 
-  anim_state.overlay = GST_X_OVERLAY (sink);
+  anim_state.overlay = GST_VIDEO_OVERLAY (sink);
   anim_state.widget = video_window;
   anim_state.w = 320;
   anim_state.h = 240;
diff --git a/tests/old/Makefile.am b/tests/old/Makefile.am
deleted file mode 100644 (file)
index c376eaa..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-if USE_ALSA
-ALSA_DIR=alsa
-else
-ALSA_DIR=
-endif
-
-# if HAVE_GTK
-# EMBED_DIR=embed
-# else
-# EMBED_DIR=
-# endif
-
-SUBDIRS = \
-       $(ALSA_DIR) #seeking
-DIST_SUBDIRS = \
-       alsa
-
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-
-#$(TESTS):
-#      @echo -e '\nrunning gst-register...\n'
-#      $(GST_TOOLS_DIR)/gst-register --gst-plugin-path=$(GST_PLUGIN_PATH)
-
-#TESTS=$(GST_TOOLS_DIR)/gst-compprep
-
-.PHONY: $(TESTS)
diff --git a/tests/old/examples/Makefile.am b/tests/old/examples/Makefile.am
deleted file mode 100644 (file)
index b443119..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-if HAVE_FT2
-FT2_SUBDIRS=seeking
-else
-FT2_SUBDIRS=
-endif
-
-# if HAVE_GTK
-# GTK_SUBDIRS=dynparams $(FT2_SUBDIRS)
-# else
-GTK_SUBDIRS=
-# endif
-
-SUBDIRS=$(GTK_SUBDIRS)
-#DIST_SUBDIRS=capsfilter seeking indexing switch
-DIST_SUBDIRS=seeking
diff --git a/tests/old/examples/capsfilter/Makefile.am b/tests/old/examples/capsfilter/Makefile.am
deleted file mode 100644 (file)
index f8562fe..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = capsfilter1
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
diff --git a/tests/old/examples/capsfilter/capsfilter1.c b/tests/old/examples/capsfilter/capsfilter1.c
deleted file mode 100644 (file)
index a59f728..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <string.h>
-#include <gst/gst.h>
-
-/* This app uses a filter to connect colorspace and videosink
- * so that only RGB data can pass the connection, colorspace will use
- * a converter to convert the I420 data to RGB. Without a filter, this
- * connection would use the I420 format (assuming Xv is enabled) */
-
-static void
-new_pad_func (GstElement * element, GstPad * newpad, gpointer data)
-{
-  GstElement *pipeline = (GstElement *) data;
-  GstElement *queue = gst_bin_get_by_name (GST_BIN (pipeline), "queue");
-
-  if (!strcmp (gst_pad_get_name (newpad), "video_00")) {
-    gst_element_set_state (pipeline, GST_STATE_PAUSED);
-    gst_pad_link (newpad, gst_element_get_pad (queue, "sink"));
-    gst_element_set_state (pipeline, GST_STATE_PLAYING);
-  }
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
-  GstElement *pipeline;
-  GstElement *filesrc;
-  GstElement *demux;
-  GstElement *thread;
-  GstElement *queue;
-  GstElement *mpeg2dec;
-  GstElement *colorspace;
-  GstElement *videosink;
-  gboolean res;
-
-  gst_init (&argc, &argv);
-
-  if (argc < 2) {
-    g_print ("usage: %s <mpeg1 system stream>\n", argv[0]);
-    return (-1);
-  }
-
-  pipeline = gst_pipeline_new ("main_pipeline");
-  filesrc = gst_element_factory_make ("filesrc", "filesrc");
-  g_return_val_if_fail (filesrc, -1);
-  g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
-  demux = gst_element_factory_make ("mpegdemux", "demux");
-  g_return_val_if_fail (demux, -1);
-  g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func),
-      pipeline);
-
-  thread = gst_thread_new ("thread");
-  queue = gst_element_factory_make ("queue", "queue");
-  mpeg2dec = gst_element_factory_make ("mpeg2dec", "mpeg2dec");
-  g_return_val_if_fail (mpeg2dec, -1);
-  colorspace = gst_element_factory_make ("ffmpegcolorspace", "colorspace");
-  g_return_val_if_fail (colorspace, -1);
-  videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink");
-  g_return_val_if_fail (videosink, -1);
-
-  gst_bin_add (GST_BIN (pipeline), filesrc);
-  gst_bin_add (GST_BIN (pipeline), demux);
-
-  gst_bin_add (GST_BIN (thread), queue);
-  gst_bin_add (GST_BIN (thread), mpeg2dec);
-  gst_bin_add (GST_BIN (thread), colorspace);
-  gst_bin_add (GST_BIN (thread), videosink);
-  gst_bin_add (GST_BIN (pipeline), thread);
-
-  gst_element_link_pads (filesrc, "src", demux, "sink");
-  gst_element_link_pads (queue, "src", mpeg2dec, "sink");
-  gst_element_link_pads (mpeg2dec, "src", colorspace, "sink");
-  /* force RGB data passing between colorspace and videosink */
-  res = gst_element_link_pads_filtered (colorspace, "src", videosink, "sink",
-      gst_caps_new_simple ("video/x-raw-rgb", NULL));
-  if (!res) {
-    g_print ("could not connect colorspace and videosink\n");
-    return -1;
-  }
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
-  while (gst_bin_iterate (GST_BIN (pipeline)));
-
-  gst_element_set_state (pipeline, GST_STATE_NULL);
-
-  return 0;
-}
diff --git a/tests/old/examples/gob/Makefile.am b/tests/old/examples/gob/Makefile.am
deleted file mode 100644 (file)
index 7abde4d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-
-plugin_LTLIBRARIES = libgstidentity2.la
-
-GOB_FILES_ID = gst-identity2.c gst-identity2.h gst-identity2-private.h
-
-BUILT_SOURCES =                                         \
-       $(GOB_FILES_ID)
-
-libgstidentity2_la_SOURCES = gst-identity2.gob $(GOB_FILES_ID)
-libgstidentity2_la_CFLAGS = $(GST_CFLAGS)
-libgstidentity2_la_LIBADD =
-
-%.c %.h %-private.h: %.gob
-       gob $<
-
-CLEANFILES = $(GOB_FILES_ID)
-
-dist-hook:
-       cd $(distdir); rm -f $(CLEANFILES)
diff --git a/tests/old/examples/gob/gst-identity2.gob b/tests/old/examples/gob/gst-identity2.gob
deleted file mode 100644 (file)
index 2c58f06..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-
-%header{
-#include <gst/gst.h>
-#include "gst-identity2.h"
-#include "gst-identity2-private.h"
-%}
-
-class Gst:Identity2 from Gst:Element {
-       
-  /* plugin init */
-  private gboolean
-  plugin_init (GModule *module, GstPlugin *plugin)
-  {
-    static GstElementDetails identity2_details =
-    GST_ELEMENT_DETAILS (
-      "GOB Identity",
-      "Filter/Effect",
-      "Does nothing",
-      "Wim Taymans <wim.taymans@chello.be>");
-    GstElementFactory *factory;
-
-    factory = gst_elementfactory_new ("identity2", TYPE_SELF,
-                                      &identity2_details);
-    g_return_val_if_fail (factory != NULL, FALSE);
-
-    gst_plugin_add_feature (plugin, &(factory->feature));
-
-    return TRUE;
-  }
-
-  /* pads FIXME gob oculd be improved here */
-  private GstPad *sinkpad = 
-  {
-    gst_pad_new ("sink", GST_PAD_SINK);
-    gst_element_add_pad (GST_ELEMENT (o), o->_priv->sinkpad);
-    gst_pad_set_chain_function (o->_priv->sinkpad, chain);
-    gst_pad_set_bufferpool_function (o->_priv->sinkpad, get_bufferpool);
-    //gst_pad_set_negotiate_function (o->_priv->sinkpad, negotiate_sink);
-  };
-  private GstPad *srcpad =
-  {
-    gst_pad_new ("src", GST_PAD_SRC);
-    gst_element_add_pad (GST_ELEMENT (o), o->_priv->srcpad);
-    //gst_pad_set_negotiate_function (o->_priv->srcpad, negotiate_src);
-  };
-
-  /* arguments */
-  /*
-  private gboolean loop_based = FALSE; argument BOOL loop_based 
-    get { 
-      ARG = self->_priv->loop_based; 
-    }
-    set { 
-      self->_priv->loop_based = ARG;
-      if (self->_priv->loop_based) {
-        gst_element_set_loop_function (GST_ELEMENT (self), loop);
-        gst_pad_set_chain_function (self->_priv->sinkpad, NULL);
-      }
-      else {
-        gst_pad_set_chain_function (self->_priv->sinkpad, chain);
-        gst_element_set_loop_function (GST_ELEMENT (self), NULL);
-      }
-    };*/
-  private guint sleep_time = 0; argument UINT sleep_time link;
-  private gboolean silent = FALSE; argument BOOL silent link;
-
-  /* signals */
-  private signal last NONE(NONE) void handoff(self);
-
-  /* core code here */
-  private GstBufferPool*
-  get_bufferpool (GstPad *pad (check null))
-  {
-    Self *self = SELF (gst_pad_get_parent (pad));
-    
-    return gst_pad_get_bufferpool (self->_priv->srcpad);
-  }
-
-  /* private GstPadNegotiateReturn
-  negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
-  {
-    Self *self = SELF (gst_pad_get_parent (pad));
-
-    return gst_pad_negotiate_proxy (pad, self->_priv->sinkpad, caps);
-  }
-
-  private GstPadNegotiateReturn
-  negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
-  {
-    Self *self = SELF (gst_pad_get_parent (pad));
-
-    return gst_pad_negotiate_proxy (pad, self->_priv->srcpad, caps);
-  } */
-
-  private void
-  chain (GstPad *pad (check null), GstBuffer *buf (check null))
-  {
-    Self *self;
-
-    self = SELF (gst_pad_get_parent (pad));
-
-    if (!self->_priv->silent)
-      g_print("identity2: chain ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
-
-      handoff (self);
-      gst_pad_push (self->_priv->srcpad, buf);
-
-    if (self->_priv->sleep_time)
-      usleep (self->_priv->sleep_time);
-  }
-
-  /*private void
-  loop (GstElement *element (check null))
-  {
-    Self *self = SELF (element);
-    GstBuffer *buf;
-
-    do {
-      buf = gst_pad_pull (self->_priv->sinkpad);
-      g_print("identity2: loop ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(self->_priv->sinkpad));
-
-      handoff (self);
-      gst_pad_push (self->_priv->srcpad, buf);
-
-      if (self->_priv->sleep_time)
-        usleep (self->_priv->sleep_time);
-
-    } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
-  }*/
-}
-
-%{
-GstPluginDesc plugin_desc = {
-  GST_VERSION_MAJOR,
-  GST_VERSION_MINOR,
-  "identity2",
-  gst_identity2_plugin_init
-};
-%}
diff --git a/tests/old/examples/indexing/.gitignore b/tests/old/examples/indexing/.gitignore
deleted file mode 100644 (file)
index 5ce0947..0000000
+++ /dev/null
@@ -1 +0,0 @@
-indexmpeg
diff --git a/tests/old/examples/indexing/Makefile.am b/tests/old/examples/indexing/Makefile.am
deleted file mode 100644 (file)
index 022bfc8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-examples = indexmpeg
-
-noinst_PROGRAMS = $(examples)
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/old/examples/indexing/indexmpeg.c b/tests/old/examples/indexing/indexmpeg.c
deleted file mode 100644 (file)
index a670ad8..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-#include <gst/gst.h>
-
-static gboolean verbose = FALSE;
-static gboolean quiet = FALSE;
-
-static void
-entry_added (GstIndex * index, GstIndexEntry * entry)
-{
-  switch (entry->type) {
-    case GST_INDEX_ENTRY_ID:
-      g_print ("id %d describes writer %s\n", entry->id,
-          GST_INDEX_ID_DESCRIPTION (entry));
-      break;
-    case GST_INDEX_ENTRY_FORMAT:
-      g_print ("%d: registered format %d for %s\n", entry->id,
-          GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry));
-      break;
-    case GST_INDEX_ENTRY_ASSOCIATION:
-    {
-      gint i;
-
-      g_print ("%p, %d: %08x ", entry, entry->id,
-          GST_INDEX_ASSOC_FLAGS (entry));
-      for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
-        g_print ("%d %" G_GINT64_FORMAT " ", GST_INDEX_ASSOC_FORMAT (entry, i),
-            GST_INDEX_ASSOC_VALUE (entry, i));
-      }
-      g_print ("\n");
-      break;
-    }
-    default:
-      break;
-  }
-}
-
-typedef struct
-{
-  const gchar *padname;
-  GstPad *target;
-  GstElement *bin;
-  GstElement *pipeline;
-  GstIndex *index;
-}
-dyn_link;
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
-  dyn_link *link = (dyn_link *) data;
-
-  if (!strcmp (gst_pad_get_name (newpad), link->padname)) {
-    gst_element_set_state (link->pipeline, GST_STATE_PAUSED);
-    gst_bin_add (GST_BIN (link->pipeline), link->bin);
-    gst_pad_link (newpad, link->target);
-    gst_element_set_index (link->bin, link->index);
-    gst_element_set_state (link->pipeline, GST_STATE_PLAYING);
-  }
-}
-
-static void
-setup_dynamic_linking (GstElement * pipeline,
-    GstElement * element,
-    const gchar * padname, GstPad * target, GstElement * bin, GstIndex * index)
-{
-  dyn_link *link;
-
-  link = g_new0 (dyn_link, 1);
-  link->padname = g_strdup (padname);
-  link->target = target;
-  link->bin = bin;
-  link->pipeline = pipeline;
-  link->index = index;
-
-  g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link),
-      link);
-}
-
-static GstElement *
-make_mpeg_systems_pipeline (const gchar * path, GstIndex * index)
-{
-  GstElement *pipeline;
-  GstElement *src, *demux;
-
-  pipeline = gst_pipeline_new ("pipeline");
-
-  src = gst_element_factory_make ("filesrc", "src");
-  g_object_set (G_OBJECT (src), "location", path, NULL);
-
-  demux = gst_element_factory_make ("mpegdemux", "demux");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-
-  if (index) {
-    gst_element_set_index (pipeline, index);
-  }
-
-  gst_element_link_pads (src, "src", demux, "sink");
-
-  return pipeline;
-}
-
-static GstElement *
-make_mpeg_decoder_pipeline (const gchar * path, GstIndex * index)
-{
-  GstElement *pipeline;
-  GstElement *src, *demux;
-  GstElement *video_bin, *audio_bin;
-  GstElement *video_decoder, *audio_decoder;
-
-  pipeline = gst_pipeline_new ("pipeline");
-
-  src = gst_element_factory_make ("filesrc", "src");
-  g_object_set (G_OBJECT (src), "location", path, NULL);
-
-  demux = gst_element_factory_make ("mpegdemux", "demux");
-
-  gst_bin_add (GST_BIN (pipeline), src);
-  gst_bin_add (GST_BIN (pipeline), demux);
-
-  gst_element_link_pads (src, "src", demux, "sink");
-
-  video_bin = gst_bin_new ("video_bin");
-  video_decoder = gst_element_factory_make ("mpeg2dec", "video_decoder");
-
-  gst_bin_add (GST_BIN (video_bin), video_decoder);
-
-  setup_dynamic_linking (pipeline, demux, "video_00",
-      gst_element_get_pad (video_decoder, "sink"), video_bin, index);
-
-  audio_bin = gst_bin_new ("audio_bin");
-  audio_decoder = gst_element_factory_make ("mad", "audio_decoder");
-
-  setup_dynamic_linking (pipeline, demux, "audio_00",
-      gst_element_get_pad (audio_decoder, "sink"), audio_bin, index);
-
-  gst_bin_add (GST_BIN (audio_bin), audio_decoder);
-
-  if (index) {
-    gst_element_set_index (pipeline, index);
-  }
-
-  return pipeline;
-}
-
-static void
-print_progress (GstPad * pad)
-{
-  gint i = 0;
-  gchar status[53];
-  GstFormat format;
-  gboolean res;
-  gint64 value;
-  gint percent = 0;
-
-  status[0] = '|';
-
-  format = GST_FORMAT_PERCENT;
-  res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
-  if (res) {
-    percent = value / (2 * GST_FORMAT_PERCENT_SCALE);
-  }
-
-  for (i = 0; i < percent; i++) {
-    status[i + 1] = '=';
-  }
-  for (i = percent; i < 50; i++) {
-    status[i + 1] = ' ';
-  }
-  status[51] = '|';
-  status[52] = 0;
-
-  g_print ("%s\r", status);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
-  GstElement *pipeline;
-  GstElement *src;
-  GstPad *pad;
-  GstIndex *index;
-  gint count = 0;
-  GstEvent *event;
-  gboolean res;
-  GstElement *sink;
-  struct poptOption options[] = {
-    {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
-        "Print index entries", NULL},
-    {"quiet", 'q', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &quiet, 0,
-        "don't print progress bar", NULL},
-    POPT_TABLEEND
-  };
-
-  if (!gst_init_check_with_popt_table (&argc, &argv, options) || argc < 3) {
-    g_print ("usage: %s [-v] <type> <filename>  \n"
-        "  type can be: 0 mpeg_systems\n"
-        "               1 mpeg_decoder\n"
-        "  -v : report added index entries\n"
-        "  -q : don't print progress\n", argv[0]);
-    return -1;
-  }
-
-  /* create index that elements can fill */
-  index = gst_index_factory_make ("memindex");
-  if (index) {
-    if (verbose)
-      g_signal_connect (G_OBJECT (index), "entry_added",
-          G_CALLBACK (entry_added), NULL);
-
-    g_object_set (G_OBJECT (index), "resolver", 1, NULL);
-  }
-
-  /* construct pipeline */
-  switch (atoi (argv[1])) {
-    case 0:
-      pipeline = make_mpeg_systems_pipeline (argv[2], index);
-      break;
-    case 1:
-      pipeline = make_mpeg_decoder_pipeline (argv[2], index);
-      break;
-    default:
-      g_print ("unknown type %d\n", atoi (argv[1]));
-      return -1;
-  }
-
-  /* setup some default info/error handlers */
-  g_signal_connect (G_OBJECT (pipeline), "deep_notify",
-      G_CALLBACK (gst_element_default_deep_notify), NULL);
-  g_signal_connect (G_OBJECT (pipeline), "error",
-      G_CALLBACK (gst_element_default_error), NULL);
-
-  /* get a pad to perform progress reporting on */
-  src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
-  pad = gst_element_get_pad (src, "src");
-
-  /* prepare for iteration */
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
-  g_print ("indexing %s...\n", argv[2]);
-  /* run through the complete stream to let it generate an index */
-  while (gst_bin_iterate (GST_BIN (pipeline))) {
-    if (!quiet && (count % 1000 == 0)) {
-      print_progress (pad);
-    }
-    count++;
-  }
-  g_print ("\n");
-
-  /* bring to ready to restart the pipeline */
-  gst_element_set_state (pipeline, GST_STATE_READY);
-  gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
-  if (index)
-    GST_OBJECT_FLAG_UNSET (index, GST_INDEX_WRITABLE);
-
-  src = gst_bin_get_by_name (GST_BIN (pipeline), "video_decoder");
-
-  {
-    gint id;
-    GstIndexEntry *entry;
-    gint64 result;
-    gint total_tm;
-
-    gst_index_get_writer_id (index, GST_OBJECT (src), &id);
-
-    entry = gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_BEFORE, 0,
-        GST_FORMAT_TIME, G_MAXINT64);
-    g_assert (entry);
-    gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &result);
-    total_tm = result * 60 / GST_SECOND;
-    g_print ("total time = %.2fs\n", total_tm / 60.0);
-  }
-
-  pad = gst_element_get_pad (src, "src");
-  sink = gst_element_factory_make ("fakesink", "sink");
-  gst_element_link_pads (src, "src", sink, "sink");
-  gst_bin_add (GST_BIN (pipeline), sink);
-
-  g_print ("seeking %s...\n", argv[2]);
-  event = gst_event_new_seek (GST_FORMAT_TIME |
-      GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
-
-  res = gst_pad_send_event (pad, event);
-  if (!res) {
-    g_warning ("seek failed");
-  }
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-  count = 0;
-  while (gst_bin_iterate (GST_BIN (pipeline))) {
-    if (!quiet && (count % 1000 == 0)) {
-      print_progress (pad);
-    }
-    count++;
-  }
-
-  gst_element_set_state (pipeline, GST_STATE_NULL);
-
-  return 1;
-}
diff --git a/tests/old/examples/seek/.gitignore b/tests/old/examples/seek/.gitignore
deleted file mode 100644 (file)
index fcb1d20..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-cdparanoia
-cdplayer
-seek
-spider_seek
-vorbisfile
-
diff --git a/tests/old/examples/seek/Makefile.am b/tests/old/examples/seek/Makefile.am
deleted file mode 100644 (file)
index b53022b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-examples = seek scrubby #cdplayer cdparanoia 
-
-noinst_PROGRAMS = $(examples)
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/old/examples/seek/cdparanoia.c b/tests/old/examples/seek/cdparanoia.c
deleted file mode 100644 (file)
index f5b8c32..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static void
-get_position_info (GstElement * cdparanoia)
-{
-  GstFormat track_format;
-  const GstFormat *formats;
-  GstPad *pad;
-
-  track_format = gst_format_get_by_nick ("track");
-  g_assert (track_format != 0);
-
-  pad = gst_element_get_pad (cdparanoia, "src");
-  formats = gst_pad_get_formats (pad);
-
-  while (*formats) {
-    const GstFormatDefinition *definition;
-    GstFormat format;
-    gint64 position;
-    gboolean res;
-
-    definition = gst_format_get_details (*formats);
-
-    format = *formats;
-    res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
-
-    if (format == GST_FORMAT_TIME) {
-      position /= GST_SECOND;
-      g_print ("%s: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT,
-          definition->nick, position / 60, position % 60);
-    } else {
-      g_print ("%s: %" G_GINT64_FORMAT, definition->nick, position);
-    }
-
-    formats++;
-    if (*formats) {
-      g_print (", ");
-    }
-  }
-  g_print ("\r");
-}
-
-static void
-get_track_info (GstElement * cdparanoia)
-{
-  GstFormat track_format;
-  gint64 total_tracks = 0, total_time = 0;
-  GstPad *pad;
-  const GstFormat *formats;
-  gint i;
-  gint64 time_count = 0;
-
-  track_format = gst_format_get_by_nick ("track");
-  g_assert (track_format != 0);
-
-  pad = gst_element_get_pad (cdparanoia, "src");
-  formats = gst_pad_get_formats (pad);
-
-  /* we loop over all supported formats and report the total
-   * number of them */
-  while (*formats) {
-    const GstFormatDefinition *definition;
-    gint64 total;
-    GstFormat format;
-    gboolean res;
-
-    definition = gst_format_get_details (*formats);
-
-    format = *formats;
-    res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &total);
-    if (res) {
-      if (format == GST_FORMAT_TIME) {
-        total /= GST_SECOND;
-        g_print ("%s total: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n",
-            definition->nick, total / 60, total % 60);
-      } else
-        g_print ("%s total: %" G_GINT64_FORMAT "\n", definition->nick, total);
-
-      if (format == track_format)
-        total_tracks = total;
-      else if (format == GST_FORMAT_TIME)
-        total_time = total;
-    } else
-      g_print ("failed to get %s total\n", definition->nick);
-
-    formats++;
-  }
-
-  /* then we loop over all the tracks to get more info.
-   * since pad_convert always works from 0, the time from track 1 needs
-   * to be substracted from track 2 */
-  for (i = 0; i <= total_tracks; i++) {
-    gint64 time;
-    gboolean res;
-
-    if (i < total_tracks) {
-      GstFormat format;
-
-      format = GST_FORMAT_TIME;
-      res = gst_pad_convert (pad, track_format, i, &format, &time);
-      time /= GST_SECOND;
-    } else {
-      time = total_time;
-      res = TRUE;
-    }
-
-    if (res) {
-      /* for the first track (i==0) we wait until we have the
-       * time of the next track */
-      if (i > 0) {
-        gint64 length = time - time_count;
-
-        g_print ("track %d: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT
-            " -> %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ", length: %"
-            G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n",
-            i - 1,
-            time_count / 60, time_count % 60,
-            time / 60, time % 60, length / 60, length % 60);
-      }
-    } else {
-      g_print ("could not get time for track %d\n", i);
-    }
-
-    time_count = time;
-  }
-}
-
-int
-main (int argc, char **argv)
-{
-  GstElement *pipeline;
-  GstElement *cdparanoia;
-  GstElement *audiosink;
-  GstPad *pad;
-  GstFormat track_format;
-  GstEvent *event;
-  gint count;
-  gboolean res;
-
-  gst_init (&argc, &argv);
-
-  pipeline = gst_pipeline_new ("pipeline");
-
-  cdparanoia = gst_element_factory_make ("cdparanoia", "cdparanoia");
-  g_assert (cdparanoia);
-  g_object_set (G_OBJECT (cdparanoia), "paranoia_mode", 0, NULL);
-
-  audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
-  g_assert (audiosink);
-
-  gst_bin_add (GST_BIN (pipeline), cdparanoia);
-  gst_bin_add (GST_BIN (pipeline), audiosink);
-
-  gst_element_link_pads (cdparanoia, "src", audiosink, "sink");
-
-  g_signal_connect (G_OBJECT (pipeline), "deep_notify",
-      G_CALLBACK (gst_object_default_deep_notify), NULL);
-
-  gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
-  /* now we go into probe mode */
-  get_track_info (cdparanoia);
-
-  track_format = gst_format_get_by_nick ("track");
-  g_assert (track_format != 0);
-
-  pad = gst_element_get_pad (cdparanoia, "src");
-  g_assert (pad);
-
-  g_print ("playing from track 3\n");
-  /* seek to track3 */
-  event = gst_event_new_seek (track_format |
-      GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 3);
-
-  res = gst_pad_send_event (pad, event);
-  if (!res)
-    g_warning ("seek failed");
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
-  count = 0;
-  while (count++ < 500) {
-    get_position_info (cdparanoia);
-    g_usleep (G_USEC_PER_SEC / 2);
-  }
-  gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
-  g_print ("\nplaying from second 25 to second 29\n");
-  /* seek to some seconds */
-  event = gst_event_new_segment_seek (GST_FORMAT_TIME |
-      GST_SEEK_METHOD_SET |
-      GST_SEEK_FLAG_FLUSH, 25 * GST_SECOND, 29 * GST_SECOND);
-  res = gst_pad_send_event (pad, event);
-  if (!res)
-    g_warning ("seek failed");
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
-  count = 0;
-  while (count++ < 500) {
-    get_position_info (cdparanoia);
-    g_usleep (G_USEC_PER_SEC / 2);
-  }
-  g_print ("\n");
-
-  /* shutdown everything again */
-  gst_element_set_state (pipeline, GST_STATE_NULL);
-
-  return 0;
-}
diff --git a/tests/old/examples/seek/cdplayer.c b/tests/old/examples/seek/cdplayer.c
deleted file mode 100644 (file)
index 6305d50..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static GList *seekable_elements = NULL;
-
-static GstElement *pipeline;
-static GtkAdjustment *adjustment;
-static gboolean stats = FALSE;
-static guint64 duration;
-
-static guint update_id;
-
-#define UPDATE_INTERVAL 500
-
-static GstElement *
-make_cdaudio_pipeline (void)
-{
-  GstElement *cdaudio;
-
-  cdaudio = gst_element_factory_make ("cdaudio", "cdaudio");
-  g_assert (cdaudio != NULL);
-
-  seekable_elements = g_list_prepend (seekable_elements, cdaudio);
-
-  return cdaudio;
-}
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
-  gint64 real;
-  gint64 seconds;
-  gint64 subseconds;
-
-  real = value * duration / 100;
-  seconds = (gint64) real / GST_SECOND;
-  subseconds = (gint64) real / (GST_SECOND / 100);
-
-  return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
-      G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-typedef struct
-{
-  const gchar *name;
-  const GstFormat format;
-}
-seek_format;
-
-static seek_format seek_formats[] = {
-  {"tim", GST_FORMAT_TIME},
-  {"byt", GST_FORMAT_BYTES},
-  {"buf", GST_FORMAT_BUFFERS},
-  {"def", GST_FORMAT_DEFAULT},
-  {NULL, 0},
-};
-
-
-G_GNUC_UNUSED static void
-query_durations ()
-{
-  GList *walk = seekable_elements;
-
-  while (walk) {
-    GstElement *element = GST_ELEMENT (walk->data);
-    gint i = 0;
-
-    g_print ("durations %8.8s: ", GST_ELEMENT_NAME (element));
-    while (seek_formats[i].name) {
-      gboolean res;
-      gint64 value;
-      GstFormat format;
-
-      format = seek_formats[i].format;
-      res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
-      if (res) {
-        g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
-      } else {
-        g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
-      }
-      i++;
-    }
-    g_print (" %s\n", GST_ELEMENT_NAME (element));
-    walk = g_list_next (walk);
-  }
-}
-
-G_GNUC_UNUSED static void
-query_positions ()
-{
-  GList *walk = seekable_elements;
-
-  while (walk) {
-    GstElement *element = GST_ELEMENT (walk->data);
-    gint i = 0;
-
-    g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
-    while (seek_formats[i].name) {
-      gboolean res;
-      gint64 value;
-      GstFormat format;
-
-      format = seek_formats[i].format;
-      res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
-      if (res) {
-        g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
-      } else {
-        g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
-      }
-      i++;
-    }
-    g_print (" %s\n", GST_ELEMENT_NAME (element));
-    walk = g_list_next (walk);
-  }
-}
-
-static gboolean
-update_scale (gpointer data)
-{
-  GstClock *clock;
-  guint64 position = 0;
-  GstFormat format = GST_FORMAT_TIME;
-
-  duration = 0;
-  clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline));
-
-  if (seekable_elements) {
-    GstElement *element = GST_ELEMENT (seekable_elements->data);
-
-    gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
-    gst_element_query (element, GST_QUERY_POSITION, &format, &position);
-  }
-
-  if (stats) {
-    if (clock)
-      g_print ("clock:                  %13" G_GUINT64_FORMAT "  (%s)\n",
-          position, gst_object_get_name (GST_OBJECT (clock)));
-    query_durations ();
-    query_positions ();
-  }
-  if (duration > 0) {
-    gtk_adjustment_set_value (adjustment, position * 100.0 / duration);
-  }
-
-  return TRUE;
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
-  gst_element_set_state (pipeline, GST_STATE_PAUSED);
-  g_timeout_remove (update_id);
-
-  return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
-  gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
-  gboolean res;
-  GstEvent *s_event;
-  GList *walk = seekable_elements;
-
-  while (walk) {
-    GstElement *seekable = GST_ELEMENT (walk->data);
-
-    g_print ("seek to %" G_GINT64_FORMAT " on element %s\n", real,
-        GST_ELEMENT_NAME (seekable));
-    s_event =
-        gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
-        GST_SEEK_FLAG_FLUSH, real);
-
-    res = gst_element_send_event (seekable, s_event);
-
-    walk = g_list_next (walk);
-  }
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-  update_id =
-      g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
-
-  return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
-  GstState state;
-
-  gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
-  if (state != GST_STATE_PLAYING) {
-    gst_element_set_state (pipeline, GST_STATE_PLAYING);
-    update_id =
-        g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
-  }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
-  GstState state;
-
-  gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
-  if (state != GST_STATE_PAUSED) {
-    gst_element_set_state (pipeline, GST_STATE_PAUSED);
-    g_timeout_remove (update_id);
-  }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
-  GstState state;
-
-  gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
-  if (state != GST_STATE_READY) {
-    gst_element_set_state (pipeline, GST_STATE_READY);
-    g_timeout_remove (update_id);
-  }
-}
-
-int
-main (int argc, char **argv)
-{
-  GtkWidget *window, *hbox, *vbox,
-      *play_button, *pause_button, *stop_button, *hscale;
-  struct poptOption options[] = {
-    {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
-        "Show element stats", NULL},
-    POPT_TABLEEND
-  };
-
-  gst_init_with_popt_table (&argc, &argv, options);
-  gtk_init (&argc, &argv);
-
-  pipeline = make_cdaudio_pipeline ();
-
-  g_signal_connect (pipeline, "deep_notify",
-      G_CALLBACK (gst_object_default_deep_notify), NULL);
-
-  /* initialize gui elements ... */
-  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  hbox = gtk_hbox_new (FALSE, 0);
-  vbox = gtk_vbox_new (FALSE, 0);
-  play_button = gtk_button_new_with_label ("play");
-  pause_button = gtk_button_new_with_label ("pause");
-  stop_button = gtk_button_new_with_label ("stop");
-
-  adjustment =
-      GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
-  hscale = gtk_hscale_new (adjustment);
-  gtk_scale_set_digits (GTK_SCALE (hscale), 2);
-  gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
-  g_signal_connect (GTK_OBJECT (hscale),
-      "button_press_event", G_CALLBACK (start_seek), pipeline);
-  g_signal_connect (GTK_OBJECT (hscale),
-      "button_release_event", G_CALLBACK (stop_seek), pipeline);
-  g_signal_connect (GTK_OBJECT (hscale),
-      "format_value", G_CALLBACK (format_value), pipeline);
-
-  /* do the packing stuff ... */
-  gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
-  gtk_container_add (GTK_CONTAINER (vbox), hbox);
-  gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
-  gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
-  gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
-  gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
-
-  /* connect things ... */
-  g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
-      pipeline);
-  g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
-      pipeline);
-  g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
-      pipeline);
-  g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
-
-  /* show the gui. */
-  gtk_widget_show_all (window);
-
-  gtk_main ();
-
-  gst_element_set_state (pipeline, GST_STATE_NULL);
-
-  return 0;
-}
diff --git a/tests/old/examples/seek/chained.c b/tests/old/examples/seek/chained.c
deleted file mode 100644 (file)
index bf23e05..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static GstElement *bin;
-
-static void
-unlinked (GstPad * pad, GstPad * peerpad, GstElement * pipeline)
-{
-  gst_element_set_state (pipeline, GST_STATE_PAUSED);
-  gst_bin_remove (GST_BIN (pipeline), bin);
-  gst_element_set_state (bin, GST_STATE_READY);
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-static void
-new_pad (GstElement * elem, GstPad * newpad, GstElement * pipeline)
-{
-  GstScheduler *sched;
-  GstClock *clock;
-
-  g_print ("new pad %s\n", gst_pad_get_name (newpad));
-
-  gst_element_set_state (pipeline, GST_STATE_PAUSED);
-  gst_bin_add (GST_BIN (pipeline), bin);
-
-  sched = gst_element_get_scheduler (GST_ELEMENT (pipeline));
-  clock = gst_scheduler_get_clock (sched);
-  gst_scheduler_set_clock (sched, clock);
-
-  gst_pad_link (newpad, gst_element_get_pad (bin, "sink"));
-
-  g_signal_connect (G_OBJECT (newpad), "unlinked", G_CALLBACK (unlinked),
-      pipeline);
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-int
-main (int argc, char **argv)
-{
-  GstElement *pipeline;
-  GstElement *filesrc;
-  GstElement *oggdemux;
-  GstElement *vorbisdec;
-  GstElement *audioconvert;
-  GstElement *audiosink;
-
-  gst_init (&argc, &argv);
-
-  if (argc < 2) {
-    g_print ("usage: %s <oggfile>\n", argv[0]);
-    return (-1);
-  }
-
-  pipeline = gst_pipeline_new ("pipeline");
-
-  filesrc = gst_element_factory_make ("filesrc", "filesrc");
-  g_assert (filesrc);
-  g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
-
-  oggdemux = gst_element_factory_make ("oggdemux", "oggdemux");
-  g_assert (oggdemux);
-
-  gst_bin_add (GST_BIN (pipeline), filesrc);
-  gst_bin_add (GST_BIN (pipeline), oggdemux);
-
-  gst_element_link_pads (filesrc, "src", oggdemux, "sink");
-
-  g_signal_connect (G_OBJECT (oggdemux), "new_pad", G_CALLBACK (new_pad),
-      pipeline);
-
-  bin = gst_bin_new ("bin");
-  vorbisdec = gst_element_factory_make ("vorbisdec", "vorbisdec");
-  g_assert (vorbisdec);
-  audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
-  g_assert (audioconvert);
-  audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
-  g_assert (audiosink);
-  gst_bin_add (GST_BIN (bin), vorbisdec);
-  gst_bin_add (GST_BIN (bin), audioconvert);
-  gst_bin_add (GST_BIN (bin), audiosink);
-
-  gst_element_link_pads (vorbisdec, "src", audioconvert, "sink");
-  gst_element_link_pads (audioconvert, "src", audiosink, "sink");
-
-  gst_element_add_ghost_pad (bin, gst_element_get_pad (vorbisdec, "sink"),
-      "sink");
-
-  g_object_ref (G_OBJECT (bin));
-
-  g_signal_connect (pipeline, "deep_notify",
-      G_CALLBACK (gst_element_default_deep_notify), NULL);
-
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
-  while (gst_bin_iterate (GST_BIN (pipeline)))
-    /* nop */ ;
-
-  /* stop probe */
-  gst_element_set_state (pipeline, GST_STATE_NULL);
-
-  return 0;
-}
diff --git a/tests/old/examples/stats/Makefile.am b/tests/old/examples/stats/Makefile.am
deleted file mode 100644 (file)
index 0f7d81c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = mp2ogg
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
diff --git a/tests/old/examples/stats/mp2ogg.c b/tests/old/examples/stats/mp2ogg.c
deleted file mode 100644 (file)
index fc56d5b..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/gst.h>
-
-/* This example app demonstartes the use of pad query and convert to
- * get useful statistics about a plugin. In this case we monitor the
- * compression status of mpeg audio to ogg vorbis transcoding.
- */
-
-gint
-main (gint argc, gchar * argv[])
-{
-  GstElement *pipeline;
-  GError *error = NULL;
-  gchar *description;
-  GstElement *encoder, *decoder;
-  GstPad *dec_sink, *enc_src;
-
-  gst_init (&argc, &argv);
-
-  if (argc < 3) {
-    g_print ("usage: %s <inputfile> <outputfile>\n", argv[0]);
-    return -1;
-  }
-
-  description = g_strdup_printf ("filesrc location=\"%s\" ! mad name=decoder ! "
-      "vorbisenc name=encoder ! filesink location=\"%s\"", argv[1], argv[2]);
-
-  pipeline = GST_ELEMENT (gst_parse_launch (description, &error));
-  if (!pipeline) {
-    if (error)
-      g_print ("ERROR: pipeline could not be constructed: %s\n",
-          error->message);
-    else
-      g_print ("ERROR: pipeline could not be constructed\n");
-    return -1;
-  }
-
-  decoder = gst_bin_get_by_name (GST_BIN (pipeline), "decoder");
-  encoder = gst_bin_get_by_name (GST_BIN (pipeline), "encoder");
-
-  dec_sink = gst_element_get_pad (decoder, "sink");
-  enc_src = gst_element_get_pad (encoder, "src");
-
-  if (gst_element_set_state (pipeline,
-          GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) {
-    g_print ("pipeline doesn't want to play\n");
-    return -1;
-  }
-
-  while (gst_bin_iterate (GST_BIN (pipeline))) {
-    gint64 position;
-    gint64 duration;
-    gint64 bitrate_enc, bitrate_dec;
-    GstFormat format;
-
-    format = GST_FORMAT_TIME;
-    /* get the position */
-    gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position);
-
-    /* get the total duration */
-    gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration);
-
-    format = GST_FORMAT_BYTES;
-    /* see how many bytes are genereated per 8 seconds (== bitrate) */
-    gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND,
-        &format, &bitrate_enc);
-
-    gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND,
-        &format, &bitrate_dec);
-
-    g_print ("[%2dm %.2ds] of [%2dm %.2ds], "
-        "src avg bitrate: %" G_GINT64_FORMAT ", dest avg birate: %"
-        G_GINT64_FORMAT ", ratio [%02.2f]    \r",
-        (gint) (position / (GST_SECOND * 60)),
-        (gint) (position / (GST_SECOND)) % 60,
-        (gint) (duration / (GST_SECOND * 60)),
-        (gint) (duration / (GST_SECOND)) % 60, bitrate_dec, bitrate_enc,
-        (gfloat) bitrate_dec / bitrate_enc);
-  }
-
-  g_print ("\n");
-
-  return 0;
-}
diff --git a/tests/old/examples/switch/.gitignore b/tests/old/examples/switch/.gitignore
deleted file mode 100644 (file)
index 7893c43..0000000
+++ /dev/null
@@ -1 +0,0 @@
-switcher
diff --git a/tests/old/examples/switch/Makefile.am b/tests/old/examples/switch/Makefile.am
deleted file mode 100644 (file)
index bd7aaf6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-noinst_PROGRAMS = switcher
-
-switcher_SOURCES = switcher.c
-switcher_CFLAGS = $(GST_CFLAGS)
-switcher_LDADD = $(GST_LIBS)
-
diff --git a/tests/old/examples/switch/switcher.c b/tests/old/examples/switch/switcher.c
deleted file mode 100644 (file)
index 8d463c2..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static GMainLoop *loop = NULL;
-
-
-
-static void
-got_eos (GstElement * pipeline)
-{
-  g_main_loop_quit (loop);
-}
-
-static gboolean
-idle_iterate (GstElement * pipeline)
-{
-  gst_bin_iterate (GST_BIN (pipeline));
-  return (GST_STATE (GST_ELEMENT (pipeline)) == GST_STATE_PLAYING);
-}
-
-static gboolean
-switch_timer (GstElement * video_switch)
-{
-  gint nb_sources, active_source;
-
-  g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL);
-  g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL);
-
-  active_source++;
-
-  if (active_source > nb_sources - 1)
-    active_source = 0;
-
-  g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL);
-
-  g_message ("current number of sources : %d, active source %d",
-      nb_sources, active_source);
-
-  return (GST_STATE (GST_ELEMENT (video_switch)) == GST_STATE_PLAYING);
-}
-
-int
-main (int argc, char *argv[])
-{
-  GstElement *pipeline, *src1, *src2, *video_switch, *video_sink;
-
-  /* Initing GStreamer library */
-  gst_init (&argc, &argv);
-
-  loop = g_main_loop_new (NULL, FALSE);
-
-  pipeline = gst_pipeline_new ("pipeline");
-  src1 = gst_element_factory_make ("videotestsrc", "src1");
-  g_object_set (G_OBJECT (src1), "pattern", 0, NULL);
-  src2 = gst_element_factory_make ("videotestsrc", "src2");
-  g_object_set (G_OBJECT (src2), "pattern", 1, NULL);
-  video_switch = gst_element_factory_make ("switch", "video_switch");
-  video_sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "video_sink");
-
-  gst_bin_add_many (GST_BIN (pipeline), src1, src2, video_switch,
-      video_sink, NULL);
-
-  gst_element_link (src1, video_switch);
-  gst_element_link (src2, video_switch);
-  gst_element_link (video_switch, video_sink);
-
-  g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL);
-
-  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
-  g_idle_add ((GSourceFunc) idle_iterate, pipeline);
-  g_timeout_add (2000, (GSourceFunc) switch_timer, video_switch);
-
-  g_main_loop_run (loop);
-
-  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
-
-  /* unref */
-  gst_object_unref (pipeline);
-
-  exit (0);
-}
diff --git a/tests/old/testsuite/alsa/.gitignore b/tests/old/testsuite/alsa/.gitignore
deleted file mode 100644 (file)
index abf7b41..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-formats
-srcstate
-state
diff --git a/tests/old/testsuite/alsa/Makefile.am b/tests/old/testsuite/alsa/Makefile.am
deleted file mode 100644 (file)
index 6557bc5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-testprogs = formats state srcstate
-
-noinst_PROGRAMS = $(testprogs)
-
-formats_SOURCES = formats.c sinesrc.c sinesrc.h
-state_SOURCES = state.c sinesrc.c sinesrc.h
-srcstate_SOURCES =srcstate.c
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-noinst_HEADERS = sinesrc.h
diff --git a/tests/old/testsuite/alsa/formats.c b/tests/old/testsuite/alsa/formats.c
deleted file mode 100644 (file)
index e6ca8f1..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * formats.c: Tests the different formats on alsasink
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "sinesrc.h"
-
-GstElement *pipeline;
-gint channels = 1;
-gboolean sign = FALSE;
-gint endianness = G_LITTLE_ENDIAN;
-gint depth = 8;
-gint width = 8;
-
-#define NUMBER_OF_INT_TESTS 28
-#define NUMBER_OF_FLOAT_TESTS 2
-#define NUMBER_OF_LAW_TESTS 2
-
-gint last = 0;
-gint counter = 0;
-
-static void create_pipeline (void);
-
-
-static void
-pre_get_func (SineSrc * src)
-{
-  counter++;
-};
-
-static void
-create_pipeline (void)
-{
-  GstElement *src;
-  SineSrc *sinesrc;
-  GstElement *alsasink;
-
-  pipeline = gst_pipeline_new ("pipeline");
-  src = sinesrc_new ();
-  alsasink = gst_element_factory_make ("alsasink", "alsasink");
-
-  gst_bin_add_many (GST_BIN (pipeline), src, alsasink, NULL);
-  gst_element_link (src, alsasink);
-
-  /* prepare our sinesrc */
-  sinesrc = (SineSrc *) src;
-  sinesrc->pre_get_func = pre_get_func;
-  sinesrc->newcaps = TRUE;
-  /* int tests */
-  if (last < NUMBER_OF_INT_TESTS) {
-    sinesrc->type = SINE_SRC_INT;
-    sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE;
-    sinesrc->endianness =
-        ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
-    switch ((last / 4) % 8) {
-      case 0:
-        sinesrc->depth = 8;
-        sinesrc->width = 8;
-        break;
-      case 1:
-        sinesrc->depth = 16;
-        sinesrc->width = 16;
-        break;
-      case 2:
-        sinesrc->depth = 24;
-        sinesrc->width = 32;
-        break;
-      case 3:
-        sinesrc->depth = 32;
-        sinesrc->width = 32;
-        break;
-        /* nomore tests below until i know what 24bit width means to alsa wrt endianness */
-      case 4:
-        sinesrc->depth = 24;
-        sinesrc->width = 24;
-        break;
-      case 5:
-        sinesrc->depth = 20;
-        sinesrc->width = 24;
-        break;
-      case 6:
-        sinesrc->depth = 18;
-        sinesrc->width = 24;
-        break;
-      case 7:
-        /* not used yet */
-        sinesrc->depth = 8;
-        sinesrc->width = 8;
-        break;
-      default:
-        g_assert_not_reached ();
-    }
-
-    g_print ("Setting format to: format:     \"int\"\n"
-        "                   sign:       %s\n"
-        "                   endianness: %d\n"
-        "                   width:      %d\n"
-        "                   depth:      %d\n",
-        sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness,
-        sinesrc->width, sinesrc->depth);
-  } else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) {
-    gint temp = last - NUMBER_OF_INT_TESTS;
-
-    sinesrc->type = SINE_SRC_FLOAT;
-    switch (temp) {
-      case 0:
-        sinesrc->width = 32;
-        break;
-      case 1:
-        sinesrc->width = 64;
-        break;
-      default:
-        g_assert_not_reached ();
-    }
-    g_print ("Setting format to float width %d\n", sinesrc->width);
-  } else if (last <
-      NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) {
-    gint temp = last - NUMBER_OF_INT_TESTS - NUMBER_OF_FLOAT_TESTS;
-    GstElement *law;
-
-    sinesrc->type = SINE_SRC_INT;
-    sinesrc->sign = TRUE;
-    sinesrc->endianness = G_BYTE_ORDER;
-    sinesrc->depth = 16;
-    sinesrc->width = 16;
-
-    if (temp == 0) {
-      law = gst_element_factory_make ("mulawenc", "mulaw");
-    } else {
-      law = gst_element_factory_make ("alawenc", "alaw");
-    }
-    g_assert (law);
-    gst_element_unlink (src, alsasink);
-    gst_bin_add (GST_BIN (pipeline), law);
-    gst_element_link_many (src, law, alsasink, NULL);
-    if (temp == 0) {
-      g_print ("Setting format to: format:     \"MU law\"\n");
-    } else {
-      g_print ("Setting format to: format:     \"A law\"\n");
-    }
-  } else {
-    g_print ("All formats work like a charm.\n");
-    exit (0);
-  }
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
-  gst_init (&argc, &argv);
-
-  g_print ("\n"
-      "This test will test the various formats ALSA and GStreamer support.\n"
-      "You will hear a short sine tone on your default ALSA soundcard for every\n"
-      "format tested. They should all sound the same (incl. volume).\n" "\n");
-  create_pipeline ();
-
-  while (pipeline) {
-    gst_bin_iterate (GST_BIN (pipeline));
-    if ((counter / 200) > last) {
-      last = counter / 200;
-      gst_object_unref (pipeline);
-      create_pipeline ();
-    }
-  }
-
-  return 0;
-}
diff --git a/tests/old/testsuite/alsa/sinesrc.c b/tests/old/testsuite/alsa/sinesrc.c
deleted file mode 100644 (file)
index a42db71..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * sinesrc.c: An elemnt emitting a sine src in lots of different formats
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "sinesrc.h"
-#include <math.h>
-#include <string.h>             /* memcpy */
-
-#define SAMPLES_PER_WAVE 200
-
-static GstStaticPadTemplate sinesrc_src_factory =
-    GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
-        "signed = (boolean) { FALSE, TRUE }, "
-        "width = (int) [8, 32], "
-        "depth = (int) [8, 32], "
-        "rate = (int) [8000, 192000], "
-        "channels = (int) [1, 16];"
-        "audio/x-raw-float, "
-        "endianness = (int) BYTE_ORDER, "
-        "width = (int) {32, 64}, "
-        "rate = (int) [8000, 192000], " "channels = (int) [1, 16]")
-    );
-
-static GstElementClass *parent_class = NULL;
-
-static void sinesrc_init (SineSrc * src);
-static void sinesrc_class_init (SineSrcClass * klass);
-
-static GstData *sinesrc_get (GstPad * pad);
-static GstStateChangeReturn sinesrc_change_state (GstElement * element,
-    GstStateChange transition);
-
-
-GType
-sinesrc_get_type (void)
-{
-  static GType sinesrc_type = 0;
-
-  if (!sinesrc_type) {
-    static const GTypeInfo sinesrc_info = {
-      sizeof (SineSrcClass), NULL, NULL,
-      (GClassInitFunc) sinesrc_class_init, NULL, NULL,
-      sizeof (SineSrc), 0,
-      (GInstanceInitFunc) sinesrc_init,
-    };
-
-    sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "SineSrc",
-        &sinesrc_info, 0);
-  }
-  return sinesrc_type;
-}
-
-static void
-sinesrc_class_init (SineSrcClass * klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  element_class->change_state = sinesrc_change_state;
-
-  parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-sinesrc_init (SineSrc * src)
-{
-  src->src =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&sinesrc_src_factory), "src");
-  gst_element_add_pad (GST_ELEMENT (src), src->src);
-  gst_pad_set_get_function (src->src, sinesrc_get);
-
-  src->width = 16;
-  src->depth = 16;
-  src->sign = TRUE;
-  src->endianness = G_BYTE_ORDER;
-  src->rate = 44100;
-  src->channels = 1;
-  src->type = SINE_SRC_INT;
-  src->newcaps = TRUE;
-
-  src->pre_get_func = NULL;
-
-  GST_OBJECT (src)->name = "sinesrc";
-}
-
-static void
-sinesrc_force_caps (SineSrc * src)
-{
-  GstCaps *caps;
-
-  if (!src->newcaps)
-    return;
-
-  src->newcaps = FALSE;
-
-  switch (src->type) {
-    case SINE_SRC_INT:
-      caps = gst_caps_new_simple ("audio/x-raw-int",
-          "signed", G_TYPE_BOOLEAN, src->sign,
-          "depth", G_TYPE_INT, src->depth, NULL);
-      if (src->width > 8)
-        gst_caps_set_simple (caps,
-            "endianness", G_TYPE_INT, src->endianness, NULL);
-      break;
-    case SINE_SRC_FLOAT:
-      g_assert (src->width == 32 || src->width == 64);
-      caps = gst_caps_new_simple ("audio/x-raw-float",
-          "endianness", G_TYPE_INT, src->endianness, NULL);
-      break;
-    default:
-      caps = NULL;
-      g_assert_not_reached ();
-  }
-  gst_caps_set_simple (caps,
-      "width", G_TYPE_INT, src->width,
-      "rate", G_TYPE_INT, src->rate,
-      "channels", G_TYPE_INT, src->channels, NULL);
-
-  if (gst_pad_try_set_caps (src->src, caps) != GST_PAD_LINK_OK)
-    g_assert_not_reached ();
-}
-
-/* always return 1 wave 
- * there are 200 waves in 1 second, so the frequency is samplerate/200
- */
-static guint8
-UIDENTITY (guint8 x)
-{
-  return x;
-};
-
-static gint8
-IDENTITY (gint8 x)
-{
-  return x;
-};
-
-#define POPULATE(format, be_func, le_func) G_STMT_START {\
-  format val = (format) int_value;\
-  format *p = data;\
-  switch (src->endianness) {\
-    case G_LITTLE_ENDIAN:\
-      val = le_func (val);\
-      break;\
-    case G_BIG_ENDIAN:\
-      val = be_func (val);\
-      break;\
-    default: \
-      g_assert_not_reached ();\
-  };\
-  for (j = 0; j < src->channels; j++) {\
-    *p = val;\
-    p ++;\
-  }\
-  data = p;\
-} G_STMT_END
-
-static GstData *
-sinesrc_get (GstPad * pad)
-{
-  GstBuffer *buf;
-  SineSrc *src;
-
-  void *data;
-  gint i, j;
-  gdouble value;
-
-  g_return_val_if_fail (pad != NULL, NULL);
-  src = SINESRC (gst_pad_get_parent (pad));
-
-  if (src->pre_get_func)
-    src->pre_get_func (src);
-
-  buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
-      SAMPLES_PER_WAVE);
-  g_assert (buf);
-  data = GST_BUFFER_DATA (buf);
-  g_assert (data);
-
-  for (i = 0; i < SAMPLES_PER_WAVE; i++) {
-    value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE);
-    switch (src->type) {
-      case SINE_SRC_INT:{
-        gint64 int_value =
-            (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1));
-        if (int_value ==
-            (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)))
-          int_value--;
-        switch (src->width) {
-          case 8:
-            if (src->sign)
-              POPULATE (gint8, IDENTITY, IDENTITY);
-            else
-              POPULATE (guint8, UIDENTITY, UIDENTITY);
-            break;
-          case 16:
-            if (src->sign)
-              POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE);
-            else
-              POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE);
-            break;
-          case 24:
-            if (src->sign) {
-              gpointer p;
-              gint32 val = (gint32) int_value;
-
-              switch (src->endianness) {
-                case G_LITTLE_ENDIAN:
-                  val = GINT32_TO_LE (val);
-                  break;
-                case G_BIG_ENDIAN:
-                  val = GINT32_TO_BE (val);
-                  break;
-                default:
-                  g_assert_not_reached ();
-              };
-              p = &val;
-              if (src->endianness == G_BIG_ENDIAN)
-                p++;
-              for (j = 0; j < src->channels; j++) {
-                memcpy (data, p, 3);
-                data += 3;
-              }
-            } else {
-              gpointer p;
-              guint32 val = (guint32) int_value;
-
-              switch (src->endianness) {
-                case G_LITTLE_ENDIAN:
-                  val = GUINT32_TO_LE (val);
-                  break;
-                case G_BIG_ENDIAN:
-                  val = GUINT32_TO_BE (val);
-                  break;
-                default:
-                  g_assert_not_reached ();
-              };
-              p = &val;
-              if (src->endianness == G_BIG_ENDIAN)
-                p++;
-              for (j = 0; j < src->channels; j++) {
-                memcpy (data, p, 3);
-                data += 3;
-              }
-            }
-            break;
-          case 32:
-            if (src->sign)
-              POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE);
-            else
-              POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE);
-            break;
-          default:
-            g_assert_not_reached ();
-        }
-        break;
-      }
-      case SINE_SRC_FLOAT:
-        if (src->width == 32) {
-          gfloat *p = (gfloat *) data;
-          gfloat fval = (gfloat) value;
-
-          for (j = 0; j < src->channels; j++) {
-            *p = fval;
-            p++;
-          }
-          data = p;
-          break;
-        }
-        if (src->width == 64) {
-          gdouble *p = (gdouble *) data;
-
-          for (j = 0; j < src->channels; j++) {
-            *p = value;
-            p++;
-          }
-          data = p;
-          break;
-        }
-        g_assert_not_reached ();
-      default:
-        g_assert_not_reached ();
-    }
-  }
-
-  if (src->newcaps) {
-    sinesrc_force_caps (src);
-  }
-  return GST_DATA (buf);
-}
-
-GstElement *
-sinesrc_new (void)
-{
-  return GST_ELEMENT (g_object_new (TYPE_SINESRC, NULL));
-}
-
-void
-sinesrc_set_pre_get_func (SineSrc * src, PreGetFunc func)
-{
-  src->pre_get_func = func;
-}
-
-static GstStateChangeReturn
-sinesrc_change_state (GstElement * element, GstStateChange transition)
-{
-  SineSrc *sinesrc;
-
-  g_return_val_if_fail (element != NULL, FALSE);
-  sinesrc = SINESRC (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      sinesrc->newcaps = TRUE;
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      break;
-    default:
-      g_assert_not_reached ();
-  }
-
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  return GST_STATE_CHANGE_SUCCESS;
-}
diff --git a/tests/old/testsuite/alsa/sinesrc.h b/tests/old/testsuite/alsa/sinesrc.h
deleted file mode 100644 (file)
index 057428d..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * sinesrc.h: Header file for sinesrc.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __SINESRC_H__
-#define __SINESRC_H__
-
-
-#include <gst/gst.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-  
-
-#define TYPE_SINESRC \
-  (sinesrc_get_type())
-#define SINESRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),TYPE_SINESRC,SineSrc))
-#define SINESRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),TYPE_SINESRC,SineSrcClass))
-#define IS_SINESRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),TYPE_SINESRC))
-#define IS_SINESRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),TYPE_SINESRC))
-
-typedef struct _SineSrc SineSrc;
-typedef struct _SineSrcClass SineSrcClass;
-
-typedef void (*PreGetFunc) (SineSrc *src);
-
-typedef enum {
-  SINE_SRC_INT,
-  SINE_SRC_FLOAT
-} SineSrcAudio;
-
-struct _SineSrc {
-  GstElement element;
-
-  /* pads */
-  GstPad *src;
-
-  /* audio parameters */
-  SineSrcAudio type;
-  gint width; /* int + float */
-  gint depth; /* int */
-  gboolean sign; /* int */
-  gint endianness; /* int */
-  
-  gint rate;
-  gint channels; /* interleaved */
-  
-  gboolean newcaps;
-  
-  /* freaky stuff for testing */
-  PreGetFunc pre_get_func;
-};
-
-struct _SineSrcClass {
-  GstElementClass parent_class;
-};
-
-GType           sinesrc_get_type                (void);
-GstElement *    sinesrc_new                     (void);
-
-void            sinesrc_set_pre_get_func        (SineSrc *src, PreGetFunc func);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_SINESRC_H__ */
diff --git a/tests/old/testsuite/alsa/srcstate.c b/tests/old/testsuite/alsa/srcstate.c
deleted file mode 100644 (file)
index 4ae536d..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * srcstate.c: Tests alsasrc for state changes
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <gst/gst.h>
-
-GstElement *pipeline;
-
-static void
-set_state (GstState state)
-{
-  GstState old_state = gst_element_get_state (pipeline);
-
-  g_print ("Setting state from %s to %s...",
-      gst_element_state_get_name (old_state),
-      gst_element_state_get_name (state));
-
-  if (!gst_element_set_state (pipeline, state)) {
-    g_print (" ERROR\n");
-    exit (-1);
-  }
-
-  if (state == GST_STATE_PLAYING) {
-    gint i;
-
-    g_print (" DONE - iterating a bit...");
-    for (i = 0; i < 5; i++) {
-      if (!gst_bin_iterate (GST_BIN (pipeline))) {
-        g_print (" ERROR in iteration %d\n", i);
-        exit (-2);
-      }
-    }
-  }
-  g_print (" DONE\n");
-}
-
-static void
-create_pipeline (void)
-{
-  GstElement *alsasrc;
-  GstElement *fakesink;
-
-  pipeline = gst_pipeline_new ("pipeline");
-  alsasrc = gst_element_factory_make ("alsasrc", "alsasrc");
-  fakesink = gst_element_factory_make ("fakesink", "fakesink");
-
-  gst_bin_add_many (GST_BIN (pipeline), alsasrc, fakesink, NULL);
-  gst_element_link (alsasrc, fakesink);
-
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
-  gst_init (&argc, &argv);
-
-  g_print ("\n" "This test will check if state changes work on the alsasrc.\n");
-  create_pipeline ();
-
-  /* simulate some state changes here */
-  set_state (GST_STATE_READY);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_READY);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_PAUSED);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_PLAYING);
-  set_state (GST_STATE_PAUSED);
-  set_state (GST_STATE_PLAYING);
-  set_state (GST_STATE_READY);
-  set_state (GST_STATE_PLAYING);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_PLAYING);
-
-  g_print ("The alsa plugin mastered another test.\n");
-
-  gst_object_unref (pipeline);
-
-  return 0;
-}
diff --git a/tests/old/testsuite/alsa/state.c b/tests/old/testsuite/alsa/state.c
deleted file mode 100644 (file)
index 9cbd8ac..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * state.c: Tests alsasink for state changes
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "sinesrc.h"
-
-GstElement *pipeline;
-
-static void
-set_state (GstState state)
-{
-  GstState old_state = gst_element_get_state (pipeline);
-
-  g_print ("Setting state from %s to %s...",
-      gst_element_state_get_name (old_state),
-      gst_element_state_get_name (state));
-
-  if (!gst_element_set_state (pipeline, state)) {
-    g_print (" ERROR\n");
-    exit (-1);
-  }
-
-  if (state == GST_STATE_PLAYING) {
-    gint i;
-
-    g_print (" DONE - iterating a bit...");
-    for (i = 0; i < 400; i++) {
-      if (!gst_bin_iterate (GST_BIN (pipeline))) {
-        g_print (" ERROR in iteration %d\n", i);
-        exit (-2);
-      }
-    }
-  }
-  g_print (" DONE\n");
-}
-
-static void
-create_pipeline (void)
-{
-  GstElement *src;
-  SineSrc *sinesrc;
-  GstElement *alsasink;
-
-  pipeline = gst_pipeline_new ("pipeline");
-  src = sinesrc_new ();
-  alsasink = gst_element_factory_make ("alsasink", "alsasink");
-
-  gst_bin_add_many (GST_BIN (pipeline), src, alsasink, NULL);
-  gst_element_link (src, alsasink);
-
-  /* prepare our sinesrc */
-  sinesrc = (SineSrc *) src;
-  sinesrc->newcaps = TRUE;
-  sinesrc->type = SINE_SRC_INT;
-  sinesrc->sign = TRUE;
-  sinesrc->endianness = G_BYTE_ORDER;
-  sinesrc->depth = 16;
-  sinesrc->width = 16;
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
-  gst_init (&argc, &argv);
-
-  g_print ("\n"
-      "This test will check if state changes work on the alsasink.\n"
-      "You will hear some short sine tones on your default ALSA soundcard,\n"
-      "but they are not important in this test.\n" "\n");
-  create_pipeline ();
-
-  /* simulate some state changes here */
-  set_state (GST_STATE_READY);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_READY);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_PAUSED);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_PLAYING);
-  set_state (GST_STATE_PAUSED);
-  set_state (GST_STATE_PLAYING);
-  set_state (GST_STATE_READY);
-  set_state (GST_STATE_PLAYING);
-  set_state (GST_STATE_NULL);
-  set_state (GST_STATE_PLAYING);
-
-  g_print ("The alsa plugin mastered another test.\n");
-
-  gst_object_unref (pipeline);
-
-  return 0;
-}
diff --git a/tests/old/testsuite/embed/Makefile.am b/tests/old/testsuite/embed/Makefile.am
deleted file mode 100644 (file)
index 2ffdc76..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-noinst_PROGRAMS = embed
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS) \
-       $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/old/testsuite/embed/embed.c b/tests/old/testsuite/embed/embed.c
deleted file mode 100644 (file)
index ed4a93c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Sample app for element embedding.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst.h>
-#include <gst/xoverlay/xoverlay.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
-static void
-cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e)
-{
-  if (GST_IS_X_OVERLAY (e) &&
-      !GTK_WIDGET_NO_WINDOW (w) && GTK_WIDGET_REALIZED (w)) {
-    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e),
-        GDK_WINDOW_XWINDOW (w->window));
-  }
-}
-
-int
-main (int argc, char *argv[])
-{
-  GtkWidget *window, *content;
-  GstElement *testsrc, *csp, *videosink, *pipeline;
-
-  gtk_init (&argc, &argv);
-  gst_init (&argc, &argv);
-
-  pipeline = gst_element_factory_make ("pipeline", NULL);
-  testsrc = gst_element_factory_make ("videotestsrc", NULL);
-  csp = gst_element_factory_make ("ffmpegcolorspace", NULL);
-  videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL);
-
-  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
-  gtk_window_set_title (GTK_WINDOW (window), "My application");
-  content = gtk_event_box_new ();
-  gtk_container_add (GTK_CONTAINER (window), content);
-  g_signal_connect (content, "expose-event", G_CALLBACK (cb_expose), videosink);
-  gtk_widget_show_all (window);
-
-  gst_bin_add_many (GST_BIN (pipeline), testsrc, csp, videosink, NULL);
-  gst_element_link_many (testsrc, csp, videosink, NULL);
-
-  g_idle_add ((GSourceFunc) gst_bin_iterate, pipeline);
-  gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
-  gtk_main ();
-
-  return 0;
-}
diff --git a/tests/old/testsuite/gst-lint b/tests/old/testsuite/gst-lint
deleted file mode 100755 (executable)
index a924f05..0000000
+++ /dev/null
@@ -1,571 +0,0 @@
-#!/usr/bin/perl -w 
-# vi: set ts=4:
-#
-
-#
-# GStreamer developers:  please add comments on any tests you think
-# are dumb or have too many false positives.
-#
-
-#
-# Future ideas:
-# - spell check comments
-# - check each function for at least one assertion (?)
-# - check parameters that init/set/get have consistent types
-# - check for gst_caps_set() without check for writeability
-# - check .so files for stray symbols
-#
-
-#
-# Random "other" testing ideas
-# - load each plugin individually
-#
-
-sub check_copyright();
-sub check_license();
-sub check_buffer_alloc();
-sub check_bad_includes();
-sub check_begin_decls();
-sub check_c99_comments();
-sub check_carriage_returns();
-sub check_printf_lld();
-sub check_glibisms();
-sub check_indentation();
-sub check_no_ignore();
-sub check_deprecated();
-sub check_config_h();
-sub check_varargs_functions();
-sub check_debugging();
-sub check_old_typefind();
-sub check_bad_casts();
-sub check_old_plugin();
-sub check_signal_new();
-sub check_gnuc_const();
-sub check_caps();
-sub check_lib_deprecated();
-sub check_typo();
-sub check_explicit_caps();
-sub check_signals();
-sub check_gettext();
-sub check_padtemplate();
-sub check_parent_class();
-
-sub m_check_plugindir();
-sub m_check_interfaces();
-
-open FIND, "find . -name \"*.[ch]\" -print|";
-
-foreach $filename (<FIND>) {
-       chomp $filename;
-       open FILE, "$filename";
-       @lines = <FILE>;
-       close FILE;
-
-       print "I: $filename\n";
-
-       # important stuff
-       check_bad_includes();
-       check_printf_lld();
-       check_no_ignore();
-       check_deprecated();
-       check_config_h();
-       check_old_typefind();
-       check_old_plugin();
-       check_caps();
-       check_lib_deprecated();
-       check_typo();
-       check_glibisms();
-       check_explicit_caps();
-       check_signals();
-       check_gettext();
-       check_padtemplate();
-       check_parent_class();
-
-       # less important stuff
-       check_license();
-
-if (0) {
-       check_copyright();
-
-    check_gnuc_const();
-       check_begin_decls();
-       check_buffer_alloc();
-       check_c99_comments();
-       check_carriage_returns();
-       #check_indentation();
-       check_varargs_functions();
-       check_debugging();
-       check_bad_casts();
-       check_signal_new();
-}
-}
-
-open FIND, "find . -name \"Makefile.am\" -print|";
-
-foreach $filename (<FIND>) {
-       chomp $filename;
-       open FILE, "$filename";
-       @lines = <FILE>;
-       close FILE;
-
-       print "I: $filename\n";
-
-       m_check_plugindir();
-       m_check_interfaces();
-}
-
-#
-# Every source file must have a copyright block
-#
-sub check_copyright()
-{
-       if (! grep { /copyright/i; } @lines) {
-               print "E: no copyright block\n";
-       }
-}
-
-#
-# Every source file should have a license statement
-#
-sub check_license()
-{
-       if (grep { /Lesser General Public License/; } @lines) {
-               print "I: license is LGPL\n";
-       } elsif (grep { /Library General Public License/; } @lines) {
-               print "I: license is LGPL\n";
-               print "W: copyright header uses \"Library\" LGPL\n";
-       } elsif (grep { /General Public License/; } @lines) {
-               print "I: license is GPL\n";
-       } else {
-               print "E: unknown license or no copyright block\n";
-       }
-}
-
-#
-# Suggest usage of gst_buffer_new_and_alloc()
-#
-sub check_buffer_alloc()
-{
-       my $n = 0;
-       my $lineno = 1;
-
-       foreach $line (@lines){
-               if($line =~ /gst_buffer_new/){
-                       $n=5;
-               }
-               if($n>0 && $line =~ /malloc/){
-                       print "W: ($lineno) gst_buffer_new() followed by malloc(), suggest gst_buffer_new_and_alloc()\n";
-                       return;
-               }
-               $n--;
-               $lineno++;
-       }
-}
-
-sub check_bad_includes()
-{
-       #
-       # malloc.h is non-standard (and probably not what is indended)
-       #
-       if (grep { /^#include\s+<malloc.h>/; } @lines) {
-               print "E: bad header: malloc.h\n"
-       }
-}
-
-sub check_begin_decls()
-{
-       #
-       # Prefer "G_BEGIN_DECLS" to 'extern "C" {'
-       #
-       if($filename =~ /\.h$/){
-               if (grep { /extern\s*\"C\"\s*/; } @lines) {
-                       print "W: extern \"C\" { should be changed to G_BEGIN_DECLS,G_END_DECLS\n";
-               }elsif (!grep { /G_BEGIN_DECLS/; } @lines) {
-                       print "E: header doesn't use G_BEGIN_DECLS\n";
-               }
-       }
-}
-
-#
-# Prefer c89-style comments
-#
-sub check_c99_comments()
-{
-       if (grep { /\/\//; } @lines) {
-               print "W: //-style comments should be converted to /* */\n"
-       }
-}
-
-#
-# DOS end-of-line characters are just wrong
-#
-sub check_carriage_returns()
-{
-       if (grep { /\r/; } @lines) {
-               print "E: source has carriage returns (DOS-style files)\n"
-       }
-}
-
-#
-# Many uses of %lld are wrong.  This could have a lot of false-positives
-#
-sub check_printf_lld()
-{
-       if (grep { /\".*\%\d*ll[du].*\"/; } @lines) {
-               print "W: Possible \%lld or \%llu in printf format\n"
-       }
-}
-
-#
-# Glib functions are preferred
-#
-sub check_glibisms()
-{
-       if (grep { /\bcalloc\s*\(/; } @lines) {
-               print "E: use g_malloc0() instead of calloc()\n"
-       }
-       if (grep { /\bfree\s*\(/; } @lines) {
-               print "E: use g_free() instead of free()\n"
-       }
-       if (grep { /\bmalloc\s*\(/; } @lines) {
-               print "E: use g_malloc() instead of malloc()\n"
-       }
-       if (grep { /\bprintf\s*\(/; } @lines) {
-               print "E: use g_print() instead of printf()\n"
-       }
-       if (grep { /\brealloc\s*\(/; } @lines) {
-               print "E: use g_realloc() instead of realloc()\n"
-       }
-       if (grep { /^#include\s+<ctype.h>/; } @lines) {
-               print "E: ctype.h functions are not locale-independent and don't work in UTF-8 locales.  Use g_ascii_is*()\n"
-       }
-}
-
-#
-# I don't think that indentation necessarily needs to be fixed, since
-# it causes problems with patching and cvs annotate.
-#
-# This takes forever and isn't very useful
-#
-sub check_indentation()
-{
-       my $changed_lines;
-       my $percent;
-
-       `indent -br -bad -cbi0 -cli2 -bls -l80 -ut -ce $filename -o .check_plugin.tmp`;
-       $changed_lines = `diff $filename .check_plugin.tmp | grep '^>' | wc -l`;
-       `rm -f .check_plugin.tmp`;
-
-       $percent = int(100 * $changed_lines / $#lines);
-
-       if($percent < 10){
-               print "I: indent changed $percent % of the lines\n";
-       }elsif($percent <20){
-               print "W: indent changed $percent % of the lines\n";
-       }else{
-               print "E: indent changed $percent % of the lines\n";
-       }
-}
-
-
-#
-# Check (roughly) for functions whose value should not be ignored
-#
-sub check_no_ignore()
-{
-       if (grep { /^\s+gst_buffer_merge\s*\(/; } @lines) {
-               print "E: return value of gst_buffer_merge () possibly ignored\n";
-       }
-       if (grep { /^\s+malloc\s*\(/; } @lines) {
-               print "E: return value of malloc() possibly ignored\n";
-       }
-       if (grep { /^\s+gst_buffer_new\s*\(/; } @lines) {
-               print "E: return value of gst_buffer_new() possibly ignored\n";
-       }
-}
-
-#
-# Check for some deprecated stuff (that _shouldn't_ be around anymore)
-#
-sub check_deprecated()
-{
-       #
-       # Check for old GST_DEBUG() usage
-       # (none found)
-       #
-       if (grep { /GST_DEBUG\s*\(\s+\d/; } @lines) {
-               print "E: old-style GST_DEBUG()\n";
-       }
-       if (grep { /GST_INFO\s*\(\s+\d/; } @lines) {
-               print "E: old-style GST_DEBUG()\n";
-       }
-       if (grep { /GstEventFlags/; } @lines) {
-               print "W: who uses GstEventFlags\n";
-       }
-       if (grep { /g_type_class_ref/ } @lines) {
-               print "W: g_type_class_ref should be changed to g_type_class_peek_parent\n";
-       }
-
-}
-
-#
-# Every .c file should include config.h before any other headers
-# No .h file should include config.h
-#
-sub check_config_h()
-{
-       if($filename =~ /\.c$/){
-               #
-               # config.h should be wrapped
-               #
-               my @includes = grep { /^#include/; } @lines;
-       
-               if (!grep { /^#include\s+["<]config.h[">]/; } @includes) {
-                       print "E: #include <config.h> missing\n";
-               }else{
-                       if (!($includes[0] =~ /^#include\s+["<]config.h[">]/)){
-                               print "E: #include <config.h> is not first include\n";
-                       }
-                       if(!grep { /^#ifdef HAVE_CONFIG_H/; } @lines) {
-                               print "E: #include <config.h> not surrounded by #ifdef HAVE_CONFIG_H\n";
-                       }
-               }
-       }
-
-       if($filename =~ /\.h$/){
-               if (grep { /^#include\s+["<]config.h[">]/; } @lines) {
-                       print "E: headers should not #include <config.h>\n";
-               }
-       }
-
-}
-  
-#
-# Check for functions that take varargs to make sure they are
-# named correctly
-#
-sub check_varargs_functions()
-{
-       if($filename =~ /\.h$/){
-               if (grep { /varargs/; } @lines) {
-                       print "I: has varargs\n";
-               }
-       }
-}
-
-#
-# Debugging checks
-#
-sub check_debugging()
-{
-       if (grep { /\Wg_print\W/ || /\Wprintf\W/ && /\Wfprintf\W/; } @lines) {
-               print "W: friendly libraries don't print to stdio or stderr\n";
-       }
-
-       if (grep { /GST_DEBUG.*\\n"/; } @lines) {
-               print "W: possible newline in GST_DEBUG()\n";
-       }
-
-}
-
-#
-# check for plugindir=
-#
-sub m_check_plugindir()
-{
-       if (grep { /plugindir\s*=/; } @lines) {
-               print "E: plugindir= is no longer necessary\n";
-       }
-}
-
-#
-# check for old typefinding code
-#
-sub check_old_typefind()
-{
-       if (grep { /GstTypeDefinition/ || /GstTypeFactory/ } @lines) {
-               print "E: old typefind interface has been removed\n";
-       }
-}
-
-#
-# check for casts that we've deemed incorrect (fix the prototype)
-#
-sub check_bad_casts()
-{
-       if (grep { /GBaseInitFunc/ || /GBaseFinalizeFunc/ ||
-                       /GClassInitFunc/ || /GClassFinalizeFunc/ ||
-                       /GInstanceInitFunc/ || /GInterfaceInitFunc/ ||
-                       /GInterfaceFinalizeFunc/ } @lines) {
-               print "W: bad casts (fix prototype)\n";
-       }
-       if (grep { /\(\s*Gst[A-Z][A-Za-z]*\s*\*\s*\)/ } @lines ) {
-               print "W: use GST_XXX() instead of (GstXxx *)\n";
-       }
-
-}
-
-#
-# check for old plugin code
-#
-sub check_old_plugin()
-{
-       if (grep { /plugin_init.*GModule.*GstPlugin/ } @lines) {
-               print "E: old plugin interface detected\n";
-       }
-       if (grep { /GstPluginDesc.*plugin_desc/ } @lines) {
-               print "W: should use GST_PLUGIN_DEFINE() instead of GstPluginDesc\n";
-       }
-}
-
-#
-# Check for calls to g_signal_new() with a callback type of G_TYPE_POINTER
-#
-sub check_signal_new()
-{
-       my $n = 0;
-       my $lineno = 1;
-
-       foreach $line (@lines){
-               if($line =~ /g_signal_new/){
-                       $n=5;
-               }
-               if($n>0 && $line =~ /G_TYPE_POINTER/){
-                       print "W: ($lineno) g_signal_new() with callback type of G_TYPE_POINTER.  Register and use a boxed type instead.\n";
-                       return;
-               }
-               $n--;
-               $lineno++;
-       }
-}
-
-#
-# Check that libgstinterfaces is in LDADD
-#
-sub m_check_interfaces()
-{
-       if (grep { /libgstinterfaces.la/ } @lines) {
-               if (! grep { /libgstinterfaces_la/ } @lines) {
-                       if (! grep { /_LDADD.*libgstinterfaces.la/ } @lines) {
-                               print "E: libgstinterfaces.la not in LDADD\n";
-                       }
-               }
-       }
-}
-
-#
-# Check that get_type() functions return G_CONST_RETURN GType
-#
-sub check_gnuc_const()
-{
-       my $n = 0;
-       my $lineno = 1;
-
-       foreach $line (@lines){
-           if($line =~ /GType.*get_type.*/ &&
-               !($line =~ /GType.*get_type.*G_GNUC_CONST/)) {
-
-                       print "E: get_type function does not have G_GNUC_CONST attribute\n";
-               }
-       }
-}
-
-#
-# Check caps usage
-#
-sub check_caps()
-{
-       if (grep { /gst_pad_get_caps/ } @lines) {
-               print "E: elements should not call gst_pad_get_caps(), use gst_pad_get_allowed_caps()\n";
-       }
-}
-
-#
-# Check for use of deprecated functions
-#
-sub check_lib_deprecated()
-{
-       if (grep { /bzero/ } @lines) {
-               print "E: change bzero() to memset()\n";
-       }
-}
-
-#
-# Check for typos
-#
-sub check_typo()
-{
-       if (grep { /;\s*;\s*$/ } @lines) {
-               print "W: typo? \";;\"\n";
-       }
-}
-
-#
-# set_explicit_caps() should preceed pad_add()
-#
-sub check_explicit_caps()
-{
-       my $n = 0;
-       my $lineno = 1;
-
-       foreach $line (@lines){
-               if($line =~ /gst_element_add_pad/){
-                       $n=10;
-               }
-               if($n>0 && $line =~ /gst_pad_set_explicit_caps/){
-                       print "W: ($lineno) explicit caps should be set before adding pad\n";
-                       return;
-               }
-               $n--;
-               $lineno++;
-       }
-}
-
-#
-# Check for - in signal names
-#
-sub check_signals()
-{
-       if (grep { /g_signal_new.*\".*-.*\"/; } @lines) {
-               print "E: g_signal_new() with a signal name with a - in it (we prefer _)\n"
-       }
-}
-
-#
-# Check for things that gettext gets wrong
-#
-sub check_gettext()
-{
-       if (grep { /\b_\(.*G_GU?INT64_FORMAT/ ||
-                  /\b_\(.*GST_TIME_FORMAT/ ||
-                  /\b_\(.*GST_FOURCC_FORMAT/ } @lines) {
-               print "E: gettext doesn't handle format strings that are defines\n"
-       }
-}
-
-#
-# Check that pad templates are statically scoped
-#
-sub check_padtemplate()
-{
-       foreach $line (@lines){
-               if ($line =~ /GstStaticPadTemplate/ && !($line =~ /static/)) {
-                       print "W: pad template definitions should be static\n";
-                       return;
-               }
-       }
-}
-
-#
-# Check that parent_class is statically scoped
-#
-sub check_parent_class()
-{
-       foreach $line (@lines){
-               if ($line =~ /Gst.*\*\s*parent_class/ && !($line =~ /static/)) {
-                       print "E: parent_class definitions should be static\n";
-                       return;
-               }
-       }
-}
-
index 00d2d0f..bcadc1b 100644 (file)
@@ -249,7 +249,9 @@ print_tag_each (GQuark field_id, const GValue * value, gpointer user_data)
     ser = g_value_dup_string (value);
   else if (GST_VALUE_HOLDS_BUFFER (value)) {
     GstBuffer *buf = gst_value_get_buffer (value);
-    ser = g_strdup_printf ("<GstBuffer [%d bytes]>", GST_BUFFER_SIZE (buf));
+    ser =
+        g_strdup_printf ("<GstBuffer [%" G_GSIZE_FORMAT " bytes]>",
+        gst_buffer_get_size (buf));
   } else
     ser = gst_value_serialize (value);
 
index ada7380..90ee34c 100644 (file)
@@ -27,7 +27,7 @@ Here is an example .gst file that implements the same defaults as hard-coded
 in the script :
 
 AUDIOSINK = osssink
-VIDEOSINK = ffmpegcolorspace ! xvimagesink
+VIDEOSINK = videoconvert ! xvimagesink
 
 You can change osssink to esdsink or alsasink (if you have
 the plug-in), and you can change xvimagesink to ximagesink, aasink
index 293209a..798929b 100644 (file)
@@ -52,7 +52,7 @@ sub visualise(@)
     my $pipe;
     $pipe = $vis unless $pipe = $pipes{$vis};
 
-    $command = "gst-launch-@GST_MAJORMINOR@ $cfg{AUDIOSRC} ! $pipe ! { queue ! ffmpegcolorspace ! $cfg{VIDEOSINK} }";
+    $command = "gst-launch-@GST_MAJORMINOR@ $cfg{AUDIOSRC} ! $pipe ! { queue ! videoconvert ! $cfg{VIDEOSINK} }";
     print "Running $command\n";
     system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools $command");
 }
index f075b82..6785c88 100644 (file)
@@ -35,7 +35,6 @@ win32/vs6/libgstaudiotestsrc.dsp
 win32/vs6/libgstcdda.dsp
 win32/vs6/libgstdecodebin2.dsp
 win32/vs6/libgstdecodebin.dsp
-win32/vs6/libgstffmpegcolorspace.dsp
 win32/vs6/libgstfft.dsp
 win32/vs6/libgstgdp.dsp
 win32/vs6/libgstinterfaces.dsp
@@ -66,7 +65,6 @@ win32/vs8/libgstaudiorate.vcproj
 win32/vs8/libgstaudioresample.vcproj
 win32/vs8/libgstaudiotestsrc.vcproj
 win32/vs8/libgstdecodebin.vcproj
-win32/vs8/libgstffmpegcolorspace.vcproj
 win32/vs8/libgstinterfaces.vcproj
 win32/vs8/libgstogg.vcproj
 win32/vs8/libgstplaybin.vcproj
index f5905f1..21ec7c9 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef _GST_PLUGINS_BASE__STDINT_H
 #define _GST_PLUGINS_BASE__STDINT_H 1
 #ifndef _GENERATED_STDINT_H
-#define _GENERATED_STDINT_H "gst-plugins-base 0.10.35.1"
-/* generated using gnu compiler gcc (Debian 4.6.0-13) 4.6.1 20110611 (prerelease) */
+#define _GENERATED_STDINT_H "gst-plugins-base 0.11.0.2"
+/* generated using gnu compiler gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 */
 #define _STDINT_HAVE_STDINT_H 1
 #include <stdint.h>
 #endif
index 61af357..6dfd85d 100644 (file)
@@ -109,6 +109,8 @@ gst_buffer_format_type_get_type (void)
       {GST_BUFTYPE_AC3, "GST_BUFTYPE_AC3", "ac3"},
       {GST_BUFTYPE_EAC3, "GST_BUFTYPE_EAC3", "eac3"},
       {GST_BUFTYPE_DTS, "GST_BUFTYPE_DTS", "dts"},
+      {GST_BUFTYPE_MPEG2_AAC, "GST_BUFTYPE_MPEG2_AAC", "mpeg2-aac"},
+      {GST_BUFTYPE_MPEG4_AAC, "GST_BUFTYPE_MPEG4_AAC", "mpeg4-aac"},
       {0, NULL, NULL}
     };
     GType g_define_type_id =
@@ -164,6 +166,8 @@ gst_buffer_format_get_type (void)
       {GST_AC3, "GST_AC3", "ac3"},
       {GST_EAC3, "GST_EAC3", "eac3"},
       {GST_DTS, "GST_DTS", "dts"},
+      {GST_MPEG2_AAC, "GST_MPEG2_AAC", "mpeg2-aac"},
+      {GST_MPEG4_AAC, "GST_MPEG4_AAC", "mpeg4-aac"},
       {0, NULL, NULL}
     };
     GType g_define_type_id = g_enum_register_static ("GstBufferFormat", values);
index 9386b20..88edf0e 100644 (file)
@@ -42,7 +42,7 @@
 #undef ENABLE_NLS
 
 /* gettext package name */
-#define GETTEXT_PACKAGE "gst-plugins-base-0.10"
+#define GETTEXT_PACKAGE "gst-plugins-base-0.11"
 
 /* The GIO library directory. */
 #undef GIO_LIBDIR
 /* The GIO modules directory. */
 #undef GIO_MODULE_DIR
 
-/* The GnomeVFS modules directory. */
-#undef GNOME_VFS_MODULES_DIR
-
 /* system wide data directory */
 #define GST_DATADIR PREFIX "\\share"
 
+/* set to disable libxml2-dependent code in subparse */
+#undef GST_DISABLE_XML
+
 /* macro to use to show function name */
 #undef GST_FUNCTION
 
 #define GST_LICENSE "LGPL"
 
 /* major/minor version */
-#define GST_MAJORMINOR "0.10"
+#define GST_MAJORMINOR "0.11"
 
 /* package name in plugins */
-#define GST_PACKAGE_NAME "GStreamer Base Plug-ins git"
+#define GST_PACKAGE_NAME "GStreamer Base Plug-ins prerelease"
 
 /* package origin */
 #define GST_PACKAGE_ORIGIN "Unknown package origin"
 
 /* GStreamer package release date/time for plugins as YYYY-MM-DD */
-#define GST_PACKAGE_RELEASE_DATETIME "2011-05-18T13:30Z"
-
-/* I know the API is subject to change. */
-#undef G_UDEV_API_IS_SUBJECT_TO_CHANGE
+#define GST_PACKAGE_RELEASE_DATETIME "2011-08-03T09:53Z"
 
 /* Define to enable ALSA (used by alsa). */
 #undef HAVE_ALSA
 /* Define to 1 if you have the `gmtime_r' function. */
 #undef HAVE_GMTIME_R
 
-/* Define to enable GNOME VFS (used by gnomevfs). */
-#undef HAVE_GNOME_VFS
-
-/* Define to enable Video 4 Linux (used by video4linux). */
-#undef HAVE_GST_V4L
-
-/* Whether gudev is available for device detection */
-#undef HAVE_GUDEV
-
 /* Define if you have the iconv() function and it works. */
 #undef HAVE_ICONV
 
 /* Define if you have C99's lrintf function. */
 #undef HAVE_LRINTF
 
-/* Define to 1 if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
 #define PACKAGE_NAME "GStreamer Base Plug-ins"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GStreamer Base Plug-ins 0.10.35.1"
+#define PACKAGE_STRING "GStreamer Base Plug-ins 0.11.0.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "gst-plugins-base"
 #undef PACKAGE_URL
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.10.35.1"
+#define PACKAGE_VERSION "0.11.0.2"
 
 /* directory where plugins are located */
 #ifdef _DEBUG
-#  define PLUGINDIR PREFIX "\\debug\\lib\\gstreamer-0.10"
+#  define PLUGINDIR PREFIX "\\debug\\lib\\gstreamer-0.11"
 #else
-#  define PLUGINDIR PREFIX "\\lib\\gstreamer-0.10"
+#  define PLUGINDIR PREFIX "\\lib\\gstreamer-0.11"
 #endif
 
 /* The size of `char', as computed by sizeof. */
 #undef USE_TREMOLO
 
 /* Version number of package */
-#define VERSION "0.10.35.1"
+#define VERSION "0.11.0.2"
 
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    significant byte first (like Motorola and SPARC, unlike Intel). */
index 892d680..596a576 100644 (file)
@@ -1,6 +1,4 @@
 EXPORTS
-       gst_app_buffer_get_type
-       gst_app_buffer_new
        gst_app_sink_get_caps
        gst_app_sink_get_drop
        gst_app_sink_get_emit_signals
index bd6f8c7..4a191d4 100644 (file)
@@ -1,4 +1,5 @@
 EXPORTS
+       gst_meta_net_address_get_info
        gst_netaddress_equal
        gst_netaddress_get_address_bytes
        gst_netaddress_get_ip4_address
@@ -8,5 +9,3 @@ EXPORTS
        gst_netaddress_set_ip4_address
        gst_netaddress_set_ip6_address
        gst_netaddress_to_string
-       gst_netbuffer_get_type
-       gst_netbuffer_new
index 41c9660..54d855b 100644 (file)
@@ -19,12 +19,13 @@ EXPORTS
        gst_basertppayload_set_options
        gst_basertppayload_set_outcaps
        gst_rtcp_buffer_add_packet
-       gst_rtcp_buffer_end
        gst_rtcp_buffer_get_first_packet
        gst_rtcp_buffer_get_packet_count
+       gst_rtcp_buffer_map
        gst_rtcp_buffer_new
        gst_rtcp_buffer_new_copy_data
        gst_rtcp_buffer_new_take_data
+       gst_rtcp_buffer_unmap
        gst_rtcp_buffer_validate
        gst_rtcp_buffer_validate_data
        gst_rtcp_ntp_to_unix
@@ -99,21 +100,7 @@ EXPORTS
        gst_rtp_buffer_get_ssrc
        gst_rtp_buffer_get_timestamp
        gst_rtp_buffer_get_version
-       gst_rtp_buffer_list_add_extension_onebyte_header
-       gst_rtp_buffer_list_add_extension_twobytes_header
-       gst_rtp_buffer_list_from_buffer
-       gst_rtp_buffer_list_get_extension_onebyte_header
-       gst_rtp_buffer_list_get_extension_twobytes_header
-       gst_rtp_buffer_list_get_payload_len
-       gst_rtp_buffer_list_get_payload_type
-       gst_rtp_buffer_list_get_seq
-       gst_rtp_buffer_list_get_ssrc
-       gst_rtp_buffer_list_get_timestamp
-       gst_rtp_buffer_list_set_payload_type
-       gst_rtp_buffer_list_set_seq
-       gst_rtp_buffer_list_set_ssrc
-       gst_rtp_buffer_list_set_timestamp
-       gst_rtp_buffer_list_validate
+       gst_rtp_buffer_map
        gst_rtp_buffer_new_allocate
        gst_rtp_buffer_new_allocate_len
        gst_rtp_buffer_new_copy_data
@@ -130,6 +117,7 @@ EXPORTS
        gst_rtp_buffer_set_ssrc
        gst_rtp_buffer_set_timestamp
        gst_rtp_buffer_set_version
+       gst_rtp_buffer_unmap
        gst_rtp_buffer_validate
        gst_rtp_buffer_validate_data
        gst_rtp_payload_info_for_name
index 8fa522c..c68335a 100644 (file)
@@ -26,6 +26,7 @@ EXPORTS
        gst_tag_list_add_id3_image
        gst_tag_list_from_exif_buffer
        gst_tag_list_from_exif_buffer_with_tiff_header
+       gst_tag_list_from_vorbiscomment
        gst_tag_list_from_id3v2_tag
        gst_tag_list_from_vorbiscomment_buffer
        gst_tag_list_from_xmp_buffer
index 9f9fad3..5c6f11e 100644 (file)
@@ -1,37 +1,36 @@
 EXPORTS
+       gst_buffer_add_meta_video
+       gst_buffer_add_meta_video_full
+       gst_buffer_pool_config_get_video_alignment
+       gst_buffer_pool_config_set_video_alignment
+       gst_meta_video_crop_get_info
+       gst_meta_video_get_info
+       gst_meta_video_map
+       gst_meta_video_unmap
        gst_video_calculate_display_ratio
        gst_video_convert_frame
        gst_video_convert_frame_async
        gst_video_event_new_still_frame
        gst_video_event_parse_still_frame
        gst_video_filter_get_type
-       gst_video_format_convert
+       gst_video_flags_get_type
+       gst_video_format_flags_get_type
        gst_video_format_from_fourcc
-       gst_video_format_get_component_depth
-       gst_video_format_get_component_height
-       gst_video_format_get_component_offset
-       gst_video_format_get_component_width
-       gst_video_format_get_pixel_stride
-       gst_video_format_get_row_stride
-       gst_video_format_get_size
+       gst_video_format_from_masks
+       gst_video_format_from_string
+       gst_video_format_get_info
        gst_video_format_get_type
-       gst_video_format_has_alpha
-       gst_video_format_is_gray
-       gst_video_format_is_rgb
-       gst_video_format_is_yuv
-       gst_video_format_new_caps
-       gst_video_format_new_caps_interlaced
-       gst_video_format_new_template_caps
-       gst_video_format_parse_caps
-       gst_video_format_parse_caps_interlaced
        gst_video_format_to_fourcc
-       gst_video_frame_rate
-       gst_video_get_size
-       gst_video_get_size_from_caps
-       gst_video_parse_caps_chroma_site
-       gst_video_parse_caps_color_matrix
+       gst_video_format_to_string
+       gst_video_frame_copy
+       gst_video_frame_map
+       gst_video_frame_unmap
+       gst_video_info_convert
+       gst_video_info_from_caps
+       gst_video_info_init
+       gst_video_info_set_format
+       gst_video_info_to_caps
        gst_video_parse_caps_framerate
        gst_video_parse_caps_palette
-       gst_video_parse_caps_pixel_aspect_ratio
        gst_video_sink_center_rect
        gst_video_sink_get_type
index d8a64d6..789a1be 100644 (file)
@@ -4,14 +4,14 @@
 #include "multichannel-enumtypes.h"
 
 #include "multichannel.h"
+#include "gstringbuffer.h"
 
 /* enumerations from "multichannel.h" */
 GType
 gst_audio_channel_position_get_type (void)
 {
-  static GType etype = 0;
-
-  if (etype == 0) {
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
     static const GEnumValue values[] = {
       {GST_AUDIO_CHANNEL_POSITION_INVALID, "GST_AUDIO_CHANNEL_POSITION_INVALID",
           "invalid"},
@@ -45,9 +45,131 @@ gst_audio_channel_position_get_type (void)
       {GST_AUDIO_CHANNEL_POSITION_NUM, "GST_AUDIO_CHANNEL_POSITION_NUM", "num"},
       {0, NULL, NULL}
     };
-    etype = g_enum_register_static ("GstAudioChannelPosition", values);
+    GType g_define_type_id =
+        g_enum_register_static ("GstAudioChannelPosition", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+  return g_define_type_id__volatile;
+}
+
+/* enumerations from "gstringbuffer.h" */
+GType
+gst_ring_buffer_state_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      {GST_RING_BUFFER_STATE_STOPPED, "GST_RING_BUFFER_STATE_STOPPED",
+          "stopped"},
+      {GST_RING_BUFFER_STATE_PAUSED, "GST_RING_BUFFER_STATE_PAUSED", "paused"},
+      {GST_RING_BUFFER_STATE_STARTED, "GST_RING_BUFFER_STATE_STARTED",
+          "started"},
+      {0, NULL, NULL}
+    };
+    GType g_define_type_id =
+        g_enum_register_static ("GstRingBufferState", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+  return g_define_type_id__volatile;
+}
+
+GType
+gst_ring_buffer_seg_state_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      {GST_SEGSTATE_INVALID, "GST_SEGSTATE_INVALID", "invalid"},
+      {GST_SEGSTATE_EMPTY, "GST_SEGSTATE_EMPTY", "empty"},
+      {GST_SEGSTATE_FILLED, "GST_SEGSTATE_FILLED", "filled"},
+      {GST_SEGSTATE_PARTIAL, "GST_SEGSTATE_PARTIAL", "partial"},
+      {0, NULL, NULL}
+    };
+    GType g_define_type_id =
+        g_enum_register_static ("GstRingBufferSegState", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+  return g_define_type_id__volatile;
+}
+
+GType
+gst_buffer_format_type_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      {GST_BUFTYPE_LINEAR, "GST_BUFTYPE_LINEAR", "linear"},
+      {GST_BUFTYPE_FLOAT, "GST_BUFTYPE_FLOAT", "float"},
+      {GST_BUFTYPE_MU_LAW, "GST_BUFTYPE_MU_LAW", "mu-law"},
+      {GST_BUFTYPE_A_LAW, "GST_BUFTYPE_A_LAW", "a-law"},
+      {GST_BUFTYPE_IMA_ADPCM, "GST_BUFTYPE_IMA_ADPCM", "ima-adpcm"},
+      {GST_BUFTYPE_MPEG, "GST_BUFTYPE_MPEG", "mpeg"},
+      {GST_BUFTYPE_GSM, "GST_BUFTYPE_GSM", "gsm"},
+      {GST_BUFTYPE_IEC958, "GST_BUFTYPE_IEC958", "iec958"},
+      {GST_BUFTYPE_AC3, "GST_BUFTYPE_AC3", "ac3"},
+      {GST_BUFTYPE_EAC3, "GST_BUFTYPE_EAC3", "eac3"},
+      {GST_BUFTYPE_DTS, "GST_BUFTYPE_DTS", "dts"},
+      {0, NULL, NULL}
+    };
+    GType g_define_type_id =
+        g_enum_register_static ("GstBufferFormatType", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+  return g_define_type_id__volatile;
+}
+
+GType
+gst_buffer_format_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      {GST_UNKNOWN, "GST_UNKNOWN", "unknown"},
+      {GST_S8, "GST_S8", "s8"},
+      {GST_U8, "GST_U8", "u8"},
+      {GST_S16_LE, "GST_S16_LE", "s16-le"},
+      {GST_S16_BE, "GST_S16_BE", "s16-be"},
+      {GST_U16_LE, "GST_U16_LE", "u16-le"},
+      {GST_U16_BE, "GST_U16_BE", "u16-be"},
+      {GST_S24_LE, "GST_S24_LE", "s24-le"},
+      {GST_S24_BE, "GST_S24_BE", "s24-be"},
+      {GST_U24_LE, "GST_U24_LE", "u24-le"},
+      {GST_U24_BE, "GST_U24_BE", "u24-be"},
+      {GST_S32_LE, "GST_S32_LE", "s32-le"},
+      {GST_S32_BE, "GST_S32_BE", "s32-be"},
+      {GST_U32_LE, "GST_U32_LE", "u32-le"},
+      {GST_U32_BE, "GST_U32_BE", "u32-be"},
+      {GST_S24_3LE, "GST_S24_3LE", "s24-3le"},
+      {GST_S24_3BE, "GST_S24_3BE", "s24-3be"},
+      {GST_U24_3LE, "GST_U24_3LE", "u24-3le"},
+      {GST_U24_3BE, "GST_U24_3BE", "u24-3be"},
+      {GST_S20_3LE, "GST_S20_3LE", "s20-3le"},
+      {GST_S20_3BE, "GST_S20_3BE", "s20-3be"},
+      {GST_U20_3LE, "GST_U20_3LE", "u20-3le"},
+      {GST_U20_3BE, "GST_U20_3BE", "u20-3be"},
+      {GST_S18_3LE, "GST_S18_3LE", "s18-3le"},
+      {GST_S18_3BE, "GST_S18_3BE", "s18-3be"},
+      {GST_U18_3LE, "GST_U18_3LE", "u18-3le"},
+      {GST_U18_3BE, "GST_U18_3BE", "u18-3be"},
+      {GST_FLOAT32_LE, "GST_FLOAT32_LE", "float32-le"},
+      {GST_FLOAT32_BE, "GST_FLOAT32_BE", "float32-be"},
+      {GST_FLOAT64_LE, "GST_FLOAT64_LE", "float64-le"},
+      {GST_FLOAT64_BE, "GST_FLOAT64_BE", "float64-be"},
+      {GST_MU_LAW, "GST_MU_LAW", "mu-law"},
+      {GST_A_LAW, "GST_A_LAW", "a-law"},
+      {GST_IMA_ADPCM, "GST_IMA_ADPCM", "ima-adpcm"},
+      {GST_MPEG, "GST_MPEG", "mpeg"},
+      {GST_GSM, "GST_GSM", "gsm"},
+      {GST_IEC958, "GST_IEC958", "iec958"},
+      {GST_AC3, "GST_AC3", "ac3"},
+      {GST_EAC3, "GST_EAC3", "eac3"},
+      {GST_DTS, "GST_DTS", "dts"},
+      {0, NULL, NULL}
+    };
+    GType g_define_type_id = g_enum_register_static ("GstBufferFormat", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
   }
-  return etype;
+  return g_define_type_id__volatile;
 }
 
 /* Generated data ends here */
index f3cc6bd..b3d1558 100644 (file)
@@ -11,6 +11,16 @@ G_BEGIN_DECLS
 /* enumerations from "multichannel.h" */
 GType gst_audio_channel_position_get_type (void);
 #define GST_TYPE_AUDIO_CHANNEL_POSITION (gst_audio_channel_position_get_type())
+
+/* enumerations from "gstringbuffer.h" */
+GType gst_ring_buffer_state_get_type (void);
+#define GST_TYPE_RING_BUFFER_STATE (gst_ring_buffer_state_get_type())
+GType gst_ring_buffer_seg_state_get_type (void);
+#define GST_TYPE_RING_BUFFER_SEG_STATE (gst_ring_buffer_seg_state_get_type())
+GType gst_buffer_format_type_get_type (void);
+#define GST_TYPE_BUFFER_FORMAT_TYPE (gst_buffer_format_type_get_type())
+GType gst_buffer_format_get_type (void);
+#define GST_TYPE_BUFFER_FORMAT (gst_buffer_format_get_type())
 G_END_DECLS
 
 #endif /* __GST_AUDIO_ENUM_TYPES_H__ */
index caa2aef..11d716a 100644 (file)
@@ -63,3 +63,48 @@ gst_video_format_get_type (void)
   }
   return g_define_type_id__volatile;
 }
+
+GType
+gst_video_format_flags_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GFlagsValue values[] = {
+      {GST_VIDEO_FORMAT_FLAG_YUV, "GST_VIDEO_FORMAT_FLAG_YUV", "yuv"},
+      {GST_VIDEO_FORMAT_FLAG_RGB, "GST_VIDEO_FORMAT_FLAG_RGB", "rgb"},
+      {GST_VIDEO_FORMAT_FLAG_GRAY, "GST_VIDEO_FORMAT_FLAG_GRAY", "gray"},
+      {GST_VIDEO_FORMAT_FLAG_ALPHA, "GST_VIDEO_FORMAT_FLAG_ALPHA", "alpha"},
+      {GST_VIDEO_FORMAT_FLAG_LE, "GST_VIDEO_FORMAT_FLAG_LE", "le"},
+      {GST_VIDEO_FORMAT_FLAG_PALETTE, "GST_VIDEO_FORMAT_FLAG_PALETTE",
+          "palette"},
+      {GST_VIDEO_FORMAT_FLAG_COMPLEX, "GST_VIDEO_FORMAT_FLAG_COMPLEX",
+          "complex"},
+      {0, NULL, NULL}
+    };
+    GType g_define_type_id =
+        g_flags_register_static ("GstVideoFormatFlags", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+  return g_define_type_id__volatile;
+}
+
+GType
+gst_video_flags_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GFlagsValue values[] = {
+      {GST_VIDEO_FLAG_NONE, "GST_VIDEO_FLAG_NONE", "none"},
+      {GST_VIDEO_FLAG_INTERLACED, "GST_VIDEO_FLAG_INTERLACED", "interlaced"},
+      {GST_VIDEO_FLAG_TTF, "GST_VIDEO_FLAG_TTF", "ttf"},
+      {GST_VIDEO_FLAG_RFF, "GST_VIDEO_FLAG_RFF", "rff"},
+      {GST_VIDEO_FLAG_ONEFIELD, "GST_VIDEO_FLAG_ONEFIELD", "onefield"},
+      {GST_VIDEO_FLAG_TELECINE, "GST_VIDEO_FLAG_TELECINE", "telecine"},
+      {GST_VIDEO_FLAG_PROGRESSIVE, "GST_VIDEO_FLAG_PROGRESSIVE", "progressive"},
+      {0, NULL, NULL}
+    };
+    GType g_define_type_id = g_flags_register_static ("GstVideoFlags", values);
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+  return g_define_type_id__volatile;
+}
index a247abc..eae444d 100644 (file)
@@ -11,6 +11,10 @@ G_BEGIN_DECLS
 /* enumerations from "video.h" */
 GType gst_video_format_get_type (void);
 #define GST_TYPE_VIDEO_FORMAT (gst_video_format_get_type())
+GType gst_video_format_flags_get_type (void);
+#define GST_TYPE_VIDEO_FORMAT_FLAGS (gst_video_format_flags_get_type())
+GType gst_video_flags_get_type (void);
+#define GST_TYPE_VIDEO_FLAGS (gst_video_flags_get_type())
 G_END_DECLS
 
 #endif /* __GST_VIDEO_ENUM_TYPES_H__ */
index ab6bfad..a651927 100644 (file)
@@ -138,18 +138,6 @@ Package=<4>
 \r
 ###############################################################################\r
 \r
-Project: "libgstffmpegcolorspace"=".\libgstffmpegcolorspace.dsp" - Package Owner=<4>\r
-\r
-Package=<5>\r
-{{{\r
-}}}\r
-\r
-Package=<4>\r
-{{{\r
-}}}\r
-\r
-###############################################################################\r
-\r
 Project: "libgstfft"=".\libgstfft.dsp" - Package Owner=<4>\r
 \r
 Package=<5>\r
diff --git a/win32/vs6/libgstffmpegcolorspace.dsp b/win32/vs6/libgstffmpegcolorspace.dsp
deleted file mode 100644 (file)
index ad7cd40..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstffmpegcolorspace" - Package Owner=<4>\r
-# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** DO NOT EDIT **\r
-\r
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
-\r
-CFG=libgstffmpegcolorspace - Win32 Debug\r
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
-!MESSAGE use the Export Makefile command and run\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "libgstffmpegcolorspace.mak".\r
-!MESSAGE \r
-!MESSAGE You can specify a configuration when running NMAKE\r
-!MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "libgstffmpegcolorspace.mak" CFG="libgstffmpegcolorspace - Win32 Debug"\r
-!MESSAGE \r
-!MESSAGE Possible choices for configuration are:\r
-!MESSAGE \r
-!MESSAGE "libgstffmpegcolorspace - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE "libgstffmpegcolorspace - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE \r
-\r
-# Begin Project\r
-# PROP AllowPerConfigDependencies 0\r
-# PROP Scc_ProjName ""\r
-# PROP Scc_LocalPath ""\r
-CPP=cl.exe\r
-MTL=midl.exe\r
-RSC=rc.exe\r
-\r
-!IF  "$(CFG)" == "libgstffmpegcolorspace - Win32 Release"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 0\r
-# PROP BASE Output_Dir "Release"\r
-# PROP BASE Intermediate_Dir "Release"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 0\r
-# PROP Output_Dir "Release"\r
-# PROP Intermediate_Dir "Release"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /YX /FD /c\r
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst/ffmpegcolorspace" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c\r
-# SUBTRACT CPP /YX\r
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x40c /d "NDEBUG"\r
-# ADD RSC /l 0x40c /d "NDEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"\r
-# Begin Special Build Tool\r
-TargetPath=.\Release\libgstffmpegcolorspace.dll\r
-SOURCE="$(InputPath)"\r
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10\r
-# End Special Build Tool\r
-\r
-!ELSEIF  "$(CFG)" == "libgstffmpegcolorspace - Win32 Debug"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 1\r
-# PROP BASE Output_Dir "Debug"\r
-# PROP BASE Intermediate_Dir "Debug"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 1\r
-# PROP Output_Dir "Debug"\r
-# PROP Intermediate_Dir "Debug"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst/ffmpegcolorspace" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c\r
-# SUBTRACT CPP /YX\r
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x40c /d "_DEBUG"\r
-# ADD RSC /l 0x40c /d "_DEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"\r
-# Begin Special Build Tool\r
-TargetPath=.\Debug\libgstffmpegcolorspace.dll\r
-SOURCE="$(InputPath)"\r
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10\r
-# End Special Build Tool\r
-\r
-!ENDIF \r
-\r
-# Begin Target\r
-\r
-# Name "libgstffmpegcolorspace - Win32 Release"\r
-# Name "libgstffmpegcolorspace - Win32 Debug"\r
-# Begin Group "Source Files"\r
-\r
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\dsputil.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpeg.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\imgconvert.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\mem.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\utils.c\r
-# End Source File\r
-# End Group\r
-# Begin Group "Header Files"\r
-\r
-# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\avcodec.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\dsputil.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\imgconvert_template.h\r
-# End Source File\r
-# End Group\r
-# Begin Group "Resource Files"\r
-\r
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-# End Group\r
-# End Target\r
-# End Project\r
index 7e68ec6..07bb70d 100644 (file)
@@ -131,9 +131,5 @@ SOURCE="..\..\gst-libs\gst\tag\tags.c"
 \r
 # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
 # End Group\r
-# Begin Source File\r
-\r
-SOURCE=..\..\gst\ffmpegcolorspace\avcodec.h\r
-# End Source File\r
 # End Target\r
 # End Project\r
index cd048c2..b486e89 100644 (file)
@@ -28,10 +28,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudiotestsrc", "libgs
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstffmpegcolorspace", "libgstffmpegcolorspace.vcproj", "{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
-       ProjectSection(ProjectDependencies) = postProject
-       EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstplaybin", "libgstplaybin.vcproj", "{7B296C12-D728-4CD8-8CF7-B8D7A433F85C}"
        ProjectSection(ProjectDependencies) = postProject
                {F7558C2A-C1BC-453C-8FDE-84F33DB73915} = {F7558C2A-C1BC-453C-8FDE-84F33DB73915}
diff --git a/win32/vs7/libgstffmpegcolorspace.vcproj b/win32/vs7/libgstffmpegcolorspace.vcproj
deleted file mode 100644 (file)
index 5b53b22..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="7.10"
-       Name="libgstffmpegcolorspace"
-       ProjectGUID="{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
-       Keyword="Win32Proj">
-       <Platforms>
-               <Platform
-                       Name="Win32"/>
-       </Platforms>
-       <Configurations>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory="Debug"
-                       IntermediateDirectory="Debug"
-                       ConfigurationType="2"
-                       CharacterSet="2">
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common,../../gst/ffmpegcolorspace"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
-                               MinimalRebuild="TRUE"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="TRUE"
-                               DebugInformationFormat="4"/>
-                       <Tool
-                               Name="VCCustomBuildTool"/>
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
-                               OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
-                               LinkIncremental="2"
-                               AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
-                               GenerateDebugInformation="TRUE"
-                               ProgramDatabaseFile="$(OutDir)/libgstffmpegcolorspace.pdb"
-                               SubSystem="2"
-                               ImportLibrary="$(OutDir)/libgstffmpegcolorspace.lib"
-                               TargetMachine="1"/>
-                       <Tool
-                               Name="VCMIDLTool"/>
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                               CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
-                       <Tool
-                               Name="VCPreBuildEventTool"/>
-                       <Tool
-                               Name="VCPreLinkEventTool"/>
-                       <Tool
-                               Name="VCResourceCompilerTool"/>
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"/>
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"/>
-                       <Tool
-                               Name="VCWebDeploymentTool"/>
-                       <Tool
-                               Name="VCManagedWrapperGeneratorTool"/>
-                       <Tool
-                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-               </Configuration>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory="Release"
-                       IntermediateDirectory="Release"
-                       ConfigurationType="2"
-                       CharacterSet="2">
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common,../../gst/ffmpegcolorspace"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
-                               RuntimeLibrary="2"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="TRUE"
-                               DebugInformationFormat="3"/>
-                       <Tool
-                               Name="VCCustomBuildTool"/>
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
-                               OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
-                               LinkIncremental="1"
-                               AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
-                               GenerateDebugInformation="TRUE"
-                               SubSystem="2"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               ImportLibrary="$(OutDir)/libgstffmpegcolorspace.lib"
-                               TargetMachine="1"/>
-                       <Tool
-                               Name="VCMIDLTool"/>
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                               CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
-                       <Tool
-                               Name="VCPreBuildEventTool"/>
-                       <Tool
-                               Name="VCPreLinkEventTool"/>
-                       <Tool
-                               Name="VCResourceCompilerTool"/>
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"/>
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"/>
-                       <Tool
-                               Name="VCWebDeploymentTool"/>
-                       <Tool
-                               Name="VCManagedWrapperGeneratorTool"/>
-                       <Tool
-                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <Filter
-                       Name="Source Files"
-                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\dsputil.c">
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\gstffmpeg.c">
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.c">
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.c">
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\imgconvert.c">
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\mem.c">
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\utils.c">
-                       </File>
-               </Filter>
-               <Filter
-                       Name="Header Files"
-                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
-                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-               </Filter>
-               <Filter
-                       Name="Resource Files"
-                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-               </Filter>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
index e7a593d..d8a85f1 100644 (file)
@@ -21,8 +21,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudioresample", "libg
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudiotestsrc", "libgstaudiotestsrc.vcproj", "{B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstffmpegcolorspace", "libgstffmpegcolorspace.vcproj", "{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstplaybin", "libgstplaybin.vcproj", "{7B296C12-D728-4CD8-8CF7-B8D7A433F85C}"
        ProjectSection(ProjectDependencies) = postProject
                {F7558C2A-C1BC-453C-8FDE-84F33DB73915} = {F7558C2A-C1BC-453C-8FDE-84F33DB73915}
diff --git a/win32/vs8/libgstffmpegcolorspace.vcproj b/win32/vs8/libgstffmpegcolorspace.vcproj
deleted file mode 100644 (file)
index add0dc7..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="8,00"
-       Name="libgstffmpegcolorspace"
-       ProjectGUID="{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
-       Keyword="Win32Proj"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-                       IntermediateDirectory="$(ConfigurationName)"
-                       ConfigurationType="2"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common;../../gst/ffmpegcolorspace"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="true"
-                               DebugInformationFormat="4"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
-                               OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
-                               LinkIncremental="2"
-                               AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
-                               GenerateDebugInformation="true"
-                               SubSystem="2"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                               CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-                       IntermediateDirectory="$(ConfigurationName)"
-                       ConfigurationType="2"
-                       CharacterSet="2"
-                       WholeProgramOptimization="1"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common;../../gst/ffmpegcolorspace"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
-                               RuntimeLibrary="2"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="true"
-                               DebugInformationFormat="3"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
-                               OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
-                               LinkIncremental="1"
-                               AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
-                               GenerateDebugInformation="true"
-                               SubSystem="2"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                               CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <Filter
-                       Name="Source Files"
-                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-                       >
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\dsputil.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\gstffmpeg.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\imgconvert.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\mem.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\gst\ffmpegcolorspace\utils.c"
-                               >
-                       </File>
-               </Filter>
-               <Filter
-                       Name="Header Files"
-                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
-                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-                       >
-               </Filter>
-               <Filter
-                       Name="Resource Files"
-                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-                       >
-               </Filter>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>